/* ═══════════════════════════════════════════════════════
   Candiota Mobilidade — Folha de estilos principal
   Mobile-first · Alto contraste · Acessível
═══════════════════════════════════════════════════════ */

/* ── Variáveis ─────────────────────────────────────── */
:root {
  --primary:        #0f3460;
  --primary-light:  #1a5fa8;
  --primary-mid:    #16457a;
  --accent:         #f59e0b;
  --accent-dark:    #d97706;
  --whatsapp:       #25d366;
  --whatsapp-dark:  #1da851;

  --bg:             #f0f4f8;
  --surface:        #ffffff;
  --border:         #dde3ec;
  --text:           #1a2434;
  --text-muted:     #5e6e85;
  --error:          #dc2626;
  --error-bg:       #fef2f2;
  --success:        #16a34a;

  --radius-sm:  8px;
  --radius:     14px;
  --radius-lg:  20px;
  --radius-xl:  28px;

  --shadow-sm:  0 1px 3px rgba(0,0,0,.08);
  --shadow:     0 4px 14px rgba(0,0,0,.10);
  --shadow-lg:  0 8px 28px rgba(0,0,0,.14);

  --font: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont,
          'Helvetica Neue', Arial, sans-serif;

  --ease: 0.2s ease;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Wrapper (centraliza no desktop) ──────────────── */
#app {
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  position: relative;
}

/* ── Sistema de telas ──────────────────────────────── */
.screen {
  display: none;
  flex-direction: column;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
}

.screen.active {
  display: flex;
}

/* ══════════════════════════════════════════════════════
   TELA 1 — HOME
══════════════════════════════════════════════════════ */

/* Cabeçalho hero com gradiente */
.home-hero {
  background: linear-gradient(160deg, var(--primary) 0%, var(--primary-mid) 55%, var(--primary-light) 100%);
  color: #fff;
  text-align: center;
  padding: 52px 24px 52px;
  position: relative;
  overflow: hidden;
}

/* Onda curva embaixo do hero */
.home-hero::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: -5%;
  right: -5%;
  height: 36px;
  background: var(--bg);
  border-radius: 60% 60% 0 0 / 100% 100% 0 0;
}

/* Reflexo decorativo no hero */
.home-hero::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 200px;
  height: 200px;
  background: rgba(255,255,255,0.04);
  border-radius: 50%;
  pointer-events: none;
}

.brand-logo {
  font-size: 72px;
  display: block;
  margin-bottom: 14px;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,.3));
  line-height: 1;
}

.brand-name {
  font-size: 1.65rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin-bottom: 8px;
  text-shadow: 0 2px 6px rgba(0,0,0,.25);
}

.brand-tagline {
  font-size: 1rem;
  font-weight: 400;
  opacity: 0.88;
}

/* Área de ações na home */
.home-actions {
  flex: 1;
  padding: 28px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Cards de serviço */
.service-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  background: var(--surface);
  border: none;
  border-radius: var(--radius-lg);
  padding: 20px 16px 20px 18px;
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow);
  transition: transform var(--ease), box-shadow var(--ease);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* Borda colorida lateral */
.service-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 5px;
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
}

.card-corrida::before   { background: var(--primary-light); }
.card-encomenda::before { background: var(--accent); }

.service-card:active {
  transform: scale(0.975);
  box-shadow: var(--shadow-sm);
}

.service-card-icon {
  font-size: 44px;
  flex-shrink: 0;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.1));
}

.service-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.service-card-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  display: block;
}

.service-card-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: block;
}

.service-card-arrow {
  font-size: 2rem;
  color: #c8d1dc;
  font-weight: 300;
  flex-shrink: 0;
  line-height: 1;
}

/* Botão direto WhatsApp */
.btn-direct-wa {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 15px 24px;
  background: transparent;
  border: 2px solid var(--whatsapp);
  border-radius: 50px;
  color: var(--whatsapp);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  text-decoration: none;
  transition: background var(--ease), color var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-direct-wa:active {
  background: var(--whatsapp);
  color: #fff;
}

/* Rodapé da home */
.home-footer {
  padding: 12px 20px 28px;
  text-align: center;
}

.home-footer p {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════
   TELAS DE FORMULÁRIO (CORRIDA & ENCOMENDA)
══════════════════════════════════════════════════════ */

/* Header das telas de formulário */
.screen-header {
  background: var(--primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  box-shadow: 0 2px 10px rgba(0,0,0,.2);
  position: sticky;
  top: 0;
  z-index: 20;
}

.btn-back {
  display: flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,.15);
  border: none;
  border-radius: 50px;
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: var(--font);
  padding: 9px 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-back:active {
  background: rgba(255,255,255,.28);
}

.screen-header h2 {
  font-size: 1.05rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Área scrollável do formulário */
.form-container {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 0;
}

/* Seções do formulário */
.form-section {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 14px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

.form-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--text-muted);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.badge-opt {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: #e8edf3;
  color: var(--text-muted);
  padding: 2px 7px;
  border-radius: 50px;
}

/* Grupos de campo */
.form-group {
  margin-bottom: 14px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
}

.required {
  color: var(--error);
  margin-left: 1px;
}

/* Inputs */
.form-input {
  display: block;
  width: 100%;
  padding: 13px 14px;
  font-size: 1rem; /* >= 16px evita zoom no iOS */
  font-family: var(--font);
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  outline: none;
  transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
  -webkit-appearance: none;
  appearance: none;
}

.form-input::placeholder {
  color: #9aaabb;
}

.form-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(26, 95, 168, .14);
  background: #fff;
}

.form-input.error {
  border-color: var(--error);
  background: var(--error-bg);
}

.form-input.error:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .12);
}

/* Select customizado */
.form-select {
  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 d='M1 1l5 5 5-5' stroke='%235e6e85' stroke-width='1.8' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 42px;
  cursor: pointer;
}

/* Textarea */
.form-textarea {
  resize: none;
  line-height: 1.55;
}

/* Mensagens de erro */
.form-error-msg {
  display: none;
  font-size: 0.8rem;
  color: var(--error);
  font-weight: 500;
  margin-top: 5px;
  padding-left: 2px;
}

.form-error-msg.visible {
  display: block;
}

/* Dica de campo */
.form-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.4;
}

/* ── Seletor de tamanho ─────────────────────────────── */
.size-selector {
  display: flex;
  gap: 8px;
}

.size-option {
  flex: 1;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.size-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.size-option > span {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 12px 6px 10px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--ease);
  text-align: center;
  min-height: 76px;
  user-select: none;
}

.size-option input[type="radio"]:checked + span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(15, 52, 96, .28);
}

.size-option:active > span {
  transform: scale(0.97);
}

.size-icon {
  font-size: 1.4rem;
  display: block;
  margin-bottom: 4px;
}

.size-label {
  font-size: 0.875rem;
  font-weight: 700;
  display: block;
  line-height: 1.2;
}

.size-hint {
  font-size: 0.7rem;
  opacity: 0.72;
  display: block;
  line-height: 1.2;
  margin-top: 2px;
}

/* ── Botão de localização ───────────────────────────── */
.btn-location {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 13px 18px;
  background: var(--surface);
  border: 2px solid var(--primary-light);
  border-radius: var(--radius-sm);
  color: var(--primary-light);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-location:active:not(:disabled) {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.btn-location:disabled {
  opacity: 0.6;
  cursor: default;
}

.location-status {
  margin-top: 10px;
  font-size: 0.85rem;
  font-weight: 500;
  min-height: 22px;
  line-height: 1.4;
}

.location-status.success { color: var(--success); }
.location-status.error   { color: var(--error); }
.location-status.loading { color: var(--text-muted); }

/* ── Rodapé com botão de envio ──────────────────────── */
.screen-footer {
  flex-shrink: 0;
  padding: 12px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom, 16px));
  background: linear-gradient(to top, #fff 82%, transparent);
}

.btn-submit {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 17px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  font-family: var(--font);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  transition: transform var(--ease), box-shadow var(--ease), background var(--ease);
  letter-spacing: 0.2px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-whatsapp {
  background: var(--whatsapp);
  color: #fff;
  box-shadow: 0 4px 18px rgba(37, 211, 102, .40);
}

.btn-whatsapp:active {
  transform: scale(0.975);
  box-shadow: 0 2px 8px rgba(37, 211, 102, .25);
  background: var(--whatsapp-dark);
}

/* ═══════════════════════════════════════════════════
   TOAST DE NOTIFICAÇÃO
═══════════════════════════════════════════════════ */
.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--text);
  color: #fff;
  padding: 12px 22px;
  border-radius: 50px;
  font-size: 0.875rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.28s ease;
  white-space: nowrap;
  max-width: 88vw;
  text-align: center;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast.error   { background: var(--error); }
.toast.success { background: var(--success); }

/* ═══════════════════════════════════════════════════
   DESKTOP — centraliza como "frame de celular"
═══════════════════════════════════════════════════ */
@media (min-width: 520px) {
  body {
    background: #c9d4e0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding: 24px 16px;
  }

  #app {
    width: 100%;
    max-width: 430px;
    min-height: calc(100vh - 48px);
    min-height: calc(100dvh - 48px);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 24px 64px rgba(0,0,0,.24);
  }

  .screen {
    min-height: calc(100vh - 48px);
    min-height: calc(100dvh - 48px);
  }

  /* Mostra frame visual no desktop */
  #app::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 28px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.15);
    pointer-events: none;
    z-index: 9998;
  }
}

/* ═══════════════════════════════════════════════════
   ACESSIBILIDADE — foco visível
═══════════════════════════════════════════════════ */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

/* Remove outline padrão só para mouse, mantém teclado */
:focus:not(:focus-visible) {
  outline: none;
}

/* ═══════════════════════════════════════════════════
   FLUXO ASSISTENTE — CORRIDA EM PASSOS
═══════════════════════════════════════════════════ */

/* Barra de progresso sob o header */
.step-progress-track {
  height: 4px;
  background: #dde3ec;
  flex-shrink: 0;
  position: sticky;
  top: 49px; /* logo abaixo do header sticky */
  z-index: 19;
}

.step-progress-fill {
  height: 100%;
  background: var(--whatsapp);
  border-radius: 0 2px 2px 0;
  transition: width 0.38s cubic-bezier(.4,0,.2,1);
}

/* Label "Passo X de 5" no header */
.corrida-step-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: rgba(255,255,255,.70);
  margin-left: auto;
  white-space: nowrap;
}

/* ── Conteúdo dos passos ─────────────────────────── */
.step-content {
  display: none;
  flex-direction: column;
  flex: 1;
}

.step-content.active {
  display: flex;
}

.step-body {
  flex: 1;
  padding: 26px 18px 40px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Títulos e subtítulos */
.step-title {
  font-size: 1.45rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.step-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: -6px;
}

/* Badge verde de confirmação (exibido no passo 2) */
.step-badge {
  background: #e8f5e9;
  border: 1.5px solid #a5d6a7;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 0.85rem;
  color: #2e7d32;
  font-weight: 600;
  line-height: 1.4;
}

.step-badge:empty { display: none; }

/* ── Botão GPS — opção principal ─────────────────── */
.btn-step-primary {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 18px 16px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius);
  color: #fff;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  box-shadow: 0 4px 18px rgba(15, 52, 96, .28);
  transition: transform var(--ease), box-shadow var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-step-primary:active {
  transform: scale(0.975);
  box-shadow: 0 2px 8px rgba(15, 52, 96, .16);
}

.btn-step-primary:disabled {
  opacity: 0.6;
  cursor: default;
  transform: none;
}

.btn-step-primary strong {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.btn-step-primary small {
  display: block;
  font-size: 0.76rem;
  opacity: 0.78;
  margin-top: 2px;
}

/* Divisor "ou" */
.step-divider {
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  position: relative;
  line-height: 1;
}

.step-divider::before,
.step-divider::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--border);
}

.step-divider::before { left: 0; }
.step-divider::after  { right: 0; }

/* ── Botões de opção secundária ──────────────────── */
.btn-step-secondary {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--ease), background var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-step-secondary:active {
  border-color: var(--primary-light);
  background: #f0f4fa;
}

/* ── Grupo de input expandível ───────────────────── */
.step-input-group {
  background: var(--surface);
  border: 2px solid var(--primary-light);
  border-radius: var(--radius);
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 0 0 4px rgba(26, 95, 168, .09);
}

/* ── Botão confirmar (dentro do grupo de input) ──── */
.btn-step-confirm {
  align-self: flex-end;
  padding: 10px 20px;
  background: var(--primary);
  border: none;
  border-radius: 50px;
  color: #fff;
  font-size: 0.875rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: background var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-step-confirm:active { background: var(--primary-light); }

/* ── Botão "Continuar →" / "Ver resumo →" ────────── */
.btn-step-next {
  width: 100%;
  padding: 16px 24px;
  background: var(--primary);
  border: none;
  border-radius: 50px;
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(15, 52, 96, .24);
  transition: transform var(--ease), box-shadow var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  margin-top: 4px;
}

.btn-step-next:active {
  transform: scale(0.975);
  box-shadow: 0 2px 6px rgba(15, 52, 96, .14);
}

/* ── Grade de destinos rápidos ───────────────────── */
.quick-destinations {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.btn-dest {
  padding: 18px 10px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  text-align: center;
  box-shadow: var(--shadow-sm);
  transition: all var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  line-height: 1.35;
}

.btn-dest:active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  transform: scale(0.97);
}

/* "Outro destino" ocupa largura total */
.btn-dest-other {
  grid-column: 1 / -1;
  background: #f8fafc;
  border-style: dashed;
  color: var(--primary-light);
}

/* ── Seletor de quantidade de passageiros ─────────── */
.qty-selector {
  display: flex;
  gap: 10px;
}

.btn-qty {
  flex: 1;
  padding: 14px 6px;
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--ease);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.btn-qty.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 3px 10px rgba(15, 52, 96, .24);
}

.btn-qty:active:not(.active) {
  transform: scale(0.95);
}

/* ── Card de resumo (passo 5) ─────────────────────── */
.summary-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 6px 14px;
  box-shadow: var(--shadow-sm);
}

.summary-row {
  display: flex;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

.summary-row:last-child { border-bottom: none; }

.summary-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
  margin-top: 2px;
  line-height: 1;
}

.summary-content { flex: 1; }

.summary-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.summary-value {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.summary-link {
  display: block;
  font-size: 0.82rem;
  color: var(--primary-light);
  text-decoration: none;
  margin-top: 3px;
  font-weight: 500;
}

.summary-link:active { text-decoration: underline; }
