/* ==========================================================
   City Selector — v3.0
   ========================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --cs-indigo:      #5553F0;
  --cs-teal:        #22D3C8;
  --cs-teal-dim:    rgba(34, 211, 200, 0.16);
  --cs-teal-ring:   rgba(34, 211, 200, 0.22);
  --cs-ink:         rgba(255, 255, 255, 0.96);
  --cs-ink-muted:   rgba(255, 255, 255, 0.72);
  --cs-surface:     rgba(255, 255, 255, 0.10);
  --cs-surface-dk:  rgba(0, 0, 40, 0.28);
  --cs-border:      rgba(255, 255, 255, 0.22);
  --cs-border-teal: rgba(34, 211, 200, 0.60);
  --cs-radius-sm:   8px;
  --cs-radius:      12px;
  --cs-font:        'Onest', system-ui, sans-serif;
}

/* ── Página ──────────────────────────────────────────────────── */
.cs-page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 70% 50% at 50% -5%, rgba(120,118,255,0.55) 0%, transparent 70%),
    radial-gradient(ellipse 80% 60% at 100% 110%, rgba(28,26,110,0.55) 0%, transparent 60%),
    var(--cs-indigo);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px 64px;
  font-family: var(--cs-font);
  -webkit-font-smoothing: antialiased;
}

.cs-page::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(ellipse 55% 45% at 50% 30%, rgba(255,255,255,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

#city-selector {
  position: relative;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* ── Logo sem fundo — mix-blend-mode elimina o preto ────────── */
.cs-logo {
  width: 180px;
  height: auto;
  display: block;
  mix-blend-mode: screen;
  margin-bottom: 16px;
}

/* ── Divisor ─────────────────────────────────────────────────── */
.cs-divider {
  width: 100%;
  max-width: 400px;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--cs-teal) 35%,
    var(--cs-teal) 65%,
    transparent 100%
  );
  border: none;
  margin-bottom: 44px;
  opacity: 0.65;
}

/* ── Estados ─────────────────────────────────────────────────── */
.cs-state {
  display: none;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.cs-state--active {
  display: flex;
  animation: cs-appear 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cs-appear {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ── Pin ─────────────────────────────────────────────────────── */
.cs-pin-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
}

.cs-pin-ripple {
  position: absolute;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--cs-teal-ring);
  animation: cs-ripple 2.6s ease-out infinite;
}

.cs-pin-ripple--2 { animation-delay: 1.3s; }

@keyframes cs-ripple {
  0%   { transform: scale(1);   opacity: 0.55; }
  100% { transform: scale(2.7); opacity: 0;    }
}

.cs-pin-inner {
  position: relative;
  z-index: 1;
  width: 56px;
  height: 56px;
  background: var(--cs-teal);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 6px rgba(34,211,200,0.14), 0 8px 28px rgba(34,211,200,0.35);
  animation: cs-pin-pulse 2.2s ease-in-out infinite;
}

@keyframes cs-pin-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 6px rgba(34,211,200,0.14), 0 8px 28px rgba(34,211,200,0.35);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 0 9px rgba(34,211,200,0.07), 0 12px 36px rgba(34,211,200,0.45);
  }
}

/* ── Texto estado geo ────────────────────────────────────────── */
.cs-title {
  color: var(--cs-ink);
  font-family: var(--cs-font);
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  letter-spacing: -0.02em;
  line-height: 1.3;
  text-wrap: balance;
  margin-bottom: 10px;
}

.cs-subtitle {
  color: var(--cs-ink-muted);
  font-size: 0.875rem;
  line-height: 1.65;
  text-align: center;
  max-width: 280px;
  margin-bottom: 28px;
}

.cs-manual-link {
  color: var(--cs-ink);
  font-family: var(--cs-font);
  font-size: 0.8125rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255,255,255,0.30);
  cursor: pointer;
  background: none;
  border: none;
  padding: 6px 4px;
  transition: text-decoration-color 0.15s ease;
}

.cs-manual-link:hover         { text-decoration-color: rgba(255,255,255,0.75); }
.cs-manual-link:focus-visible { outline: 2px solid var(--cs-teal); outline-offset: 4px; border-radius: 4px; }

/* ── Estado manual ───────────────────────────────────────────── */
.cs-label {
  color: var(--cs-ink-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  margin-bottom: 20px;
}

.cs-form {
  width: 100%;
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── Select de estado ────────────────────────────────────────── */
.cs-select {
  width: 100%;
  padding: 14px 44px 14px 16px;
  border-radius: var(--cs-radius);
  border: 1.5px solid var(--cs-border);
  background-color: var(--cs-surface);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='rgba(255,255,255,0.55)' stroke-width='1.5' stroke-linecap='round' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  color: var(--cs-ink);
  font-family: var(--cs-font);
  font-size: 0.9375rem;
  font-weight: 500;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.cs-select:hover        { border-color: rgba(255,255,255,0.38); background-color: rgba(255,255,255,0.13); }
.cs-select:focus-visible { border-color: var(--cs-teal); outline: 2px solid rgba(34,211,200,0.28); outline-offset: 2px; }
.cs-select option       { color: #1a1a2e; background: #fff; font-family: system-ui, sans-serif; }

/* ── Combobox de cidade ──────────────────────────────────────── */
.cs-combo {
  position: relative;
  width: 100%;
}

.cs-combo-trigger {
  width: 100%;
  padding: 14px 44px 14px 16px;
  border-radius: var(--cs-radius);
  border: 1.5px solid var(--cs-border);
  background-color: var(--cs-surface);
  color: var(--cs-ink);
  font-family: var(--cs-font);
  font-size: 0.9375rem;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  outline: none;
  transition: border-color 0.18s ease, background-color 0.18s ease;
}

.cs-combo-trigger:hover:not(:disabled) {
  border-color: rgba(255,255,255,0.38);
  background-color: rgba(255,255,255,0.13);
}

.cs-combo-trigger:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}

.cs-combo-trigger:focus-visible {
  outline: 2px solid rgba(34,211,200,0.28);
  outline-offset: 2px;
}

/* Aberto: borda inferior reta */
.cs-combo[data-open] .cs-combo-trigger {
  border-color: var(--cs-teal);
  border-radius: var(--cs-radius) var(--cs-radius) 0 0;
  border-bottom-color: transparent;
  background-color: rgba(255,255,255,0.13);
}

.cs-combo-placeholder {
  color: rgba(255, 255, 255, 0.42);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-combo-selected-val {
  color: var(--cs-ink);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cs-combo-arrow {
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.cs-combo[data-open] .cs-combo-arrow {
  transform: rotate(180deg);
}

/* ── Painel dropdown ─────────────────────────────────────────── */
.cs-combo-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: color-mix(in srgb, var(--cs-indigo) 80%, black 20%);
  border: 1.5px solid var(--cs-teal);
  border-top: none;
  border-radius: 0 0 var(--cs-radius) var(--cs-radius);
  z-index: 50;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  animation: cs-panel-open 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes cs-panel-open {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0);    }
}

/* ── Linha de busca dentro do dropdown ───────────────────────── */
.cs-combo-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.cs-combo-search {
  flex: 1;
  background: none;
  border: none;
  color: var(--cs-ink);
  font-family: var(--cs-font);
  font-size: 0.875rem;
  font-weight: 400;
  outline: none;
  padding: 2px 0;
}

.cs-combo-search::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

/* ── Lista de opções ─────────────────────────────────────────── */
.cs-combo-list {
  max-height: 228px;
  overflow-y: auto;
  padding: 6px;
}

.cs-combo-opt {
  padding: 10px 12px;
  color: var(--cs-ink);
  font-family: var(--cs-font);
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: var(--cs-radius-sm);
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
}

.cs-combo-opt:hover,
.cs-combo-opt[aria-selected="true"] {
  background: var(--cs-teal-dim);
}

.cs-combo-empty {
  padding: 14px 12px;
  color: var(--cs-ink-muted);
  font-size: 0.875rem;
  text-align: center;
  font-style: italic;
}

/* Scrollbar do dropdown */
.cs-combo-list::-webkit-scrollbar       { width: 3px; }
.cs-combo-list::-webkit-scrollbar-track { background: transparent; }
.cs-combo-list::-webkit-scrollbar-thumb { background: rgba(34,211,200,0.35); border-radius: 2px; }

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .cs-pin-inner,
  .cs-pin-ripple,
  .cs-state--active,
  .cs-combo-panel,
  .cs-combo-trigger,
  .cs-combo-arrow,
  .cs-select {
    animation: none !important;
    transition: none !important;
  }
}
