/* frontend/css/modules/segmentos.css */

.nextlist-units {
  width: 100%;
  padding: 24px 32px;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

/* ─── Header ─────────────────────────────────────────────── */

.nextlist-units .page-header {
  margin-bottom: 1.5rem;
}

.nextlist-units .header-content {
  display: flex;
  align-items: center;
  position: relative;
  height: 44px;
}

.nextlist-units .header-left {
  display: flex;
  align-items: center;
  z-index: 1;
}

.nextlist-units .btn-voltar {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0;
}

.nextlist-units .btn-voltar-circle {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-color);
  font-size: 0.85rem;
  transition: background-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.nextlist-units .btn-voltar:hover .btn-voltar-circle {
  background-color: var(--primary-color);
  color: #ffffff;
}

.nextlist-units .btn-voltar-label {
  color: var(--primary-color);
  font-size: 1rem;
  font-weight: 500;
}

.nextlist-units .page-title {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary-color);
  margin: 0;
  white-space: nowrap;
}

/* ─── Tabs Navigation ────────────────────────────────────── */

.nextlist-units .tabs-navigation {
  display: flex;
  justify-content: center;
  gap: 0;
  border-bottom: 2px solid var(--border, #e5e7eb);
  margin-bottom: 2rem;
}

.nextlist-units .tab-button {
  background: none;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
}

.nextlist-units .tab-button:hover {
  color: var(--primary-color);
}

.nextlist-units .tab-button.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
  font-weight: 600;
}

/* ─── Tab Content ────────────────────────────────────────── */

.nextlist-units .tab-content {
  display: none;
}

.nextlist-units .tab-content.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  animation: seg-fadeIn 0.25s ease-out;
}

@keyframes seg-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Form Container ─────────────────────────────────────── */

.nextlist-units .form-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  width: 100%;
}

.nextlist-units .form-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.nextlist-units .form-row-full {
  width: 100%;
}

.nextlist-units .form-row-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

/* ─── Floating Label Inputs ──────────────────────────────── */

.nextlist-units .floating-input-wrapper {
  position: relative;
  width: 100%;
}

.nextlist-units .floating-input {
  width: 100%;
  padding: 22px 16px 8px 16px;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  font-size: 1rem;
  background-color: var(--surface-hover, #f9fafb);
  color: var(--text-primary, #1f2937);
  transition: border-color 0.2s, background-color 0.2s;
  font-family: inherit;
  box-sizing: border-box;
  height: 62px;
  outline: none;
}

.nextlist-units .floating-input:focus {
  background-color: var(--surface-hover, #f0f0f0);
  border: 2px solid var(--primary-color);
}

.nextlist-units .floating-input[readonly] {
  background-color: var(--surface-hover, #f9fafb);
  cursor: default;
  color: var(--text-secondary, #6b7280);
}

/* Label flutuante */
.nextlist-units .floating-label {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  color: var(--text-secondary, #9ca3af);
  pointer-events: none;
  transition: top 0.18s ease, font-size 0.18s ease, color 0.18s ease, transform 0.18s ease;
  line-height: 1;
}

.nextlist-units .floating-input:focus ~ .floating-label,
.nextlist-units .floating-input:not(:placeholder-shown) ~ .floating-label {
  top: 12px;
  transform: translateY(0);
  font-size: 0.75rem;
  color: var(--primary-color);
}

.nextlist-units .floating-input[readonly] ~ .floating-label {
  top: 12px;
  transform: translateY(0);
  font-size: 0.75rem;
  color: var(--text-secondary, #9ca3af);
}

.nextlist-units .floating-label .required {
  color: #ef4444;
}

/* ─── CEP hint & spinner ─────────────────────────────────── */

.nextlist-units .cep-hint {
  display: block;
  margin-top: 4px;
  font-size: 0.65rem;
  color: #9ca3af;
}

.nextlist-units .cep-loading {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--primary-color);
  font-size: 0.9rem;
}

/* ─── Custom Select (mesma linha dos inputs) ─────────────── */

.nextlist-units .custom-select-wrapper {
  position: relative;
}

.nextlist-units .custom-select {
  width: 100%;
  height: 62px;
  padding: 22px 40px 8px 16px;
  border: 1px solid var(--border, #e0e0e0);
  border-radius: 8px;
  font-size: 1rem;
  background-color: var(--surface-hover, #f9fafb);
  color: var(--text-primary, #1f2937);
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  transition: border-color 0.2s, background-color 0.2s;
  box-sizing: border-box;
  user-select: none;
  outline: none;
}

.nextlist-units .custom-select:focus,
.nextlist-units .custom-select.open {
  background-color: var(--surface-hover, #f0f0f0);
  border: 2px solid var(--primary-color);
}

.nextlist-units .custom-select-value {
  flex: 1;
  font-size: 1rem;
  color: var(--text-primary, #1f2937);
  line-height: 1;
}

.nextlist-units .custom-select-arrow {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-secondary, #9ca3af);
  font-size: 0.8rem;
  pointer-events: none;
  transition: transform 0.2s;
}

.nextlist-units .custom-select.open .custom-select-arrow {
  transform: translateY(-50%) rotate(180deg);
}

.nextlist-units .floating-label-select {
  top: 12px;
  transform: translateY(0);
  font-size: 0.75rem;
  color: var(--text-secondary, #9ca3af);
}

.nextlist-units .custom-select:focus ~ .floating-label-select,
.nextlist-units .custom-select.open ~ .floating-label-select,
.nextlist-units .custom-select.selected ~ .floating-label-select {
  color: var(--primary-color);
}

.nextlist-units .custom-select-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background-color: var(--input-bg, #ffffff);
  border: 1px solid var(--border, #e0e0e0);
  border-top: none;
  z-index: 100;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 6px 20px rgba(0,0,0,0.1);
}

.nextlist-units .custom-select-dropdown.open {
  display: block;
}

.nextlist-units .custom-select-option {
  padding: 14px 16px;
  font-size: 0.95rem;
  color: var(--text-primary, #1f2937);
  cursor: pointer;
  border-bottom: 1px solid var(--border, #f0f0f0);
  transition: background-color 0.15s;
}

.nextlist-units .custom-select-option:last-child {
  border-bottom: none;
}

.nextlist-units .custom-select-option:hover {
  background-color: var(--surface-hover, #f5f5f5);
}

.nextlist-units .custom-select-option.selected {
  color: var(--primary-color);
  font-weight: 600;
}

/* ─── Buttons ────────────────────────────────────────────── */

.nextlist-units .form-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 2rem;
  padding-bottom: 0.5rem;
}

.nextlist-units .btn {
  padding: 11px 32px;
  border-radius: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  border: none;
  font-family: inherit;
}

.nextlist-units .btn-primary {
  background-color: var(--primary-color);
  color: #ffffff;
}

.nextlist-units .btn-primary:hover {
  opacity: 0.88;
  transform: translateY(-1px);
}

.nextlist-units .btn-secondary {
  background-color: #f1f3f5;
  color: var(--text-primary, #1f2937);
  border: 1px solid var(--border, #e5e7eb);
}

.nextlist-units .btn-secondary:hover {
  opacity: 0.8;
}

/* ─── Toggle Switch ──────────────────────────────────────── */

.nextlist-units .toggle-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
}

.nextlist-units .toggle-switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.nextlist-units .toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.nextlist-units .toggle-slider {
  position: absolute;
  inset: 0;
  background-color: #d1d5db;
  border-radius: 28px;
  cursor: pointer;
  transition: background-color 0.25s;
}

.nextlist-units .toggle-slider::before {
  content: '';
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  background-color: #ffffff;
  border-radius: 50%;
  transition: transform 0.25s;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.nextlist-units .toggle-switch input:checked + .toggle-slider {
  background-color: var(--primary-color);
}

.nextlist-units .toggle-switch input:checked + .toggle-slider::before {
  transform: translateX(24px);
}

.nextlist-units .toggle-label {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-primary, #1f2937);
}

/* ─── Dark Theme ─────────────────────────────────────────── */

html.dark-theme .nextlist-units .floating-input,
html.dark-theme .nextlist-units .custom-select {
  background-color: #1e1e1e;
  color: #f0f0f0;
  border-bottom-color: #444;
}

html.dark-theme .nextlist-units .floating-input:focus,
html.dark-theme .nextlist-units .custom-select:focus,
html.dark-theme .nextlist-units .custom-select.open {
  background-color: #252525;
}

html.dark-theme .nextlist-units .floating-input[readonly] {
  background-color: #1a1a1a;
  color: #888;
}

html.dark-theme .nextlist-units .custom-select-dropdown {
  background-color: #1e1e1e;
  border-color: #444;
}

html.dark-theme .nextlist-units .custom-select-option {
  color: #f0f0f0;
  border-bottom-color: #333;
}

html.dark-theme .nextlist-units .custom-select-option:hover {
  background-color: #2c2c2c;
}

html.dark-theme .nextlist-units .tab-button:hover {
  color: var(--primary-color);
}

html.dark-theme .nextlist-units .tabs-navigation {
  border-bottom-color: #444;
}

html.dark-theme .nextlist-units .floating-label {
  color: #777;
}

html.dark-theme .nextlist-units .btn-secondary {
  background-color: #2c2c2c;
  color: #f0f0f0;
  border-color: #555;
}

/* ─── Responsive ─────────────────────────────────────────── */

@media (max-width: 768px) {
  .nextlist-units {
    padding: 16px;
  }

  .nextlist-units .form-row-cols {
    grid-template-columns: 1fr;
  }

  .nextlist-units .tab-button {
    font-size: 0.9rem;
    padding: 0.75rem 1.25rem;
  }

  .nextlist-units .form-actions {
    flex-direction: column-reverse;
  }

  .nextlist-units .btn {
    width: 100%;
    text-align: center;
  }

  .nextlist-units .page-title {
    font-size: 1.2rem;
  }
}