/* ============================================================
   KAATO PWA — Estilos principais
   Paleta: #1BAF88 (primário), #4DD9B0 (claro), #0D8C6E (escuro)
   ============================================================ */

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

:root {
  --verde:       #1BAF88;
  --verde-claro: #4DD9B0;
  --verde-bebe:  #7AE3CC;
  --verde-bg:    #E8FAF6;
  --verde-dark:  #0D8C6E;
  --texto:       #1e293b;
  --texto-muted: #64748b;
  --borda:       #e2e8f0;
  --fundo:       #f8fafc;
  --branco:      #ffffff;
  --erro:        #ef4444;
  --erro-bg:     #fef2f2;
  --radius:      12px;
  --radius-lg:   16px;
  --shadow:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md:   0 4px 6px rgba(0,0,0,0.07), 0 2px 4px rgba(0,0,0,0.05);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  color: var(--texto);
  background: var(--fundo);
  -webkit-font-smoothing: antialiased;
}

/* ============================================================
   AUTH PAGES (login / cadastro)
   ============================================================ */

.auth-page {
  background: var(--branco);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  padding: 0;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  padding: 48px 28px 32px;
}

.logo-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 40px;
}

.logo-icon {
  width: 48px;
  height: 48px;
  background: var(--verde);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-text {
  font-size: 30px;
  font-weight: 800;
  color: var(--verde);
  letter-spacing: -1px;
}

.auth-container h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--texto);
  margin-bottom: 6px;
}

.subtitle {
  color: var(--texto-muted);
  font-size: 15px;
  margin-bottom: 32px;
}

/* ============================================================
   FORMULÁRIOS
   ============================================================ */

.form { display: flex; flex-direction: column; gap: 16px; }

.field { display: flex; flex-direction: column; gap: 6px; }

.field label {
  font-size: 14px;
  font-weight: 500;
  color: var(--texto);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--borda);
  border-radius: var(--radius);
  font-size: 15px;
  color: var(--texto);
  background: var(--branco);
  outline: none;
  transition: border-color 0.15s;
  -webkit-appearance: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--verde);
}

.field textarea {
  resize: vertical;
  min-height: 80px;
}

/* ============================================================
   BOTÕES
   ============================================================ */

.btn-primary {
  width: 100%;
  padding: 14px;
  background: var(--verde);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn-primary:hover { background: var(--verde-dark); }
.btn-primary:active { transform: scale(0.98); }
.btn-primary:disabled { background: var(--verde-bebe); cursor: not-allowed; }

.btn-secondary {
  width: 100%;
  padding: 13px;
  background: var(--verde-bg);
  color: var(--verde-dark);
  border: 1.5px solid var(--verde-claro);
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover { background: #d1f5ec; }

.btn-outline {
  padding: 10px 20px;
  background: transparent;
  color: var(--verde);
  border: 1.5px solid var(--verde);
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* ============================================================
   ALERTAS
   ============================================================ */

.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-erro {
  background: var(--erro-bg);
  color: var(--erro);
  border: 1px solid #fecaca;
}

.alert-sucesso {
  background: var(--verde-bg);
  color: var(--verde-dark);
  border: 1px solid var(--verde-claro);
}

/* ============================================================
   AUTH FOOTER
   ============================================================ */

.auth-footer {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--texto-muted);
}

.auth-footer a {
  color: var(--verde);
  font-weight: 600;
  text-decoration: none;
}

/* ============================================================
   APP LAYOUT (telas internas)
   ============================================================ */

.app-page {
  background: var(--fundo);
  min-height: 100vh;
  padding-bottom: 160px;
}

/* Header */
.app-header {
  background: var(--branco);
  border-bottom: 1px solid var(--borda);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header .logo-text { font-size: 22px; }

.header-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--texto-muted);
}

.avatar {
  width: 36px;
  height: 36px;
  background: var(--verde-bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--verde-dark);
  font-size: 14px;
}

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--branco);
  border-top: 1px solid var(--borda);
  display: flex;
  z-index: 100;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 12px;
  text-decoration: none;
  color: var(--texto-muted);
  font-size: 11px;
  gap: 4px;
  transition: color 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.nav-item.ativo { color: var(--verde); }

.nav-item svg { width: 22px; height: 22px; }

/* Conteúdo principal */
.app-content { padding: 20px; }

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--branco);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 16px;
}

.card-titulo {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--texto);
}

/* ============================================================
   VEÍCULOS (seleção de tipo)
   ============================================================ */

.veiculos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}

.veiculo-btn {
  padding: 14px 10px;
  border: 2px solid var(--borda);
  border-radius: var(--radius);
  background: var(--branco);
  cursor: pointer;
  text-align: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--texto-muted);
  transition: all 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.veiculo-btn.selecionado {
  border-color: var(--verde);
  background: var(--verde-bg);
  color: var(--verde-dark);
}

.veiculo-btn .veiculo-icon { font-size: 24px; display: block; margin-bottom: 6px; }
.veiculo-preco { font-size: 11px; color: var(--texto-muted); margin-top: 2px; }

/* ============================================================
   PEDIDOS (lista e status)
   ============================================================ */

.pedido-card {
  background: var(--branco);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 12px;
  border-left: 4px solid var(--borda);
}

.pedido-card.aguardando { border-left-color: #f59e0b; }
.pedido-card.aceito     { border-left-color: #3b82f6; }
.pedido-card.coletado   { border-left-color: #8b5cf6; }
.pedido-card.em_rota    { border-left-color: var(--verde-claro); }
.pedido-card.entregue   { border-left-color: var(--verde); }
.pedido-card.cancelado  { border-left-color: var(--erro); }

.pedido-rota {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.pedido-origem, .pedido-destino {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
}

.pedido-origem::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--verde-claro);
  flex-shrink: 0;
}

.pedido-destino::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--verde);
  flex-shrink: 0;
}

.pedido-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--texto-muted);
}

.pedido-valor {
  font-weight: 700;
  font-size: 16px;
  color: var(--verde-dark);
}

.status-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}

.status-aguardando { background: #fef3c7; color: #92400e; }
.status-aceito     { background: #dbeafe; color: #1e40af; }
.status-coletado   { background: #ede9fe; color: #5b21b6; }
.status-em_rota    { background: var(--verde-bg); color: var(--verde-dark); }
.status-entregue   { background: #dcfce7; color: #166534; }
.status-cancelado  { background: #fee2e2; color: #991b1b; }

/* ============================================================
   VALOR ESTIMADO
   ============================================================ */

.valor-estimado {
  background: var(--verde-bg);
  border: 1.5px solid var(--verde-claro);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  margin-bottom: 16px;
}

.valor-estimado .label { font-size: 13px; color: var(--verde-dark); margin-bottom: 4px; }
.valor-estimado .valor { font-size: 28px; font-weight: 800; color: var(--verde); }
.valor-estimado .distancia { font-size: 12px; color: var(--texto-muted); margin-top: 2px; }

/* ============================================================
   EMPTY STATE
   ============================================================ */

.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--texto-muted);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; color: var(--texto); }
.empty-state p { font-size: 14px; line-height: 1.6; }

/* ============================================================
   LOADING
   ============================================================ */

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--verde-bg);
  border-top-color: var(--verde);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   UTILIDADES
   ============================================================ */

.mt-8  { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-8  { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.text-center { text-align: center; }
.text-muted { color: var(--texto-muted); font-size: 14px; }
.font-bold { font-weight: 700; }
.w-full { width: 100%; }