@import url("https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap");

:root {
  --navy: #155e95;
  --navy-dark: #0f4670;
  --navy-soft: #eff6fc;
  --ink: #111827;
  --ink-secondary: #4b5563;
  --ink-muted: #6b7280;
  --bg-page: #e5ebf1;
  --bg-app: #f8fafc;
  --surface: #ffffff;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --green: #15803d;
  --green-soft: #dcfce7;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --highlight: #fef08a;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
}

body.high-contrast {
  --navy: #ffffff;
  --navy-dark: #e5e5e5;
  --navy-soft: #1f2937;
  --ink: #ffffff;
  --ink-secondary: #e5e7eb;
  --ink-muted: #d1d5db;
  --bg-page: #000000;
  --bg-app: #000000;
  --surface: #111111;
  --border: #ffffff;
  --border-strong: #ffffff;
  --green: #4ade80;
  --green-soft: #052e16;
  --amber: #facc15;
  --amber-soft: #422006;
  --highlight: #fde047;
}

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

body {
  font-family: "Outfit", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-page);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 12px;
  -webkit-font-smoothing: antialiased;
}

/* Moldura Minimalista do Smartphone */
.phone-frame {
  width: 390px;
  max-width: 100%;
  min-height: 780px;
  background: var(--bg-app);
  border-radius: 32px;
  border: 6px solid #1e293b;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.14);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* Cabeçalho Limpo SEMOB-DF */
.app-header {
  background: var(--surface);
  color: var(--ink);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}

.brand-title {
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--navy);
}

.contrast-btn {
  min-height: 38px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: transparent;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.contrast-btn:hover {
  border-color: var(--navy);
  color: var(--navy);
}

/* Container de Telas */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 20px;
  gap: 20px;
  overflow-y: auto;
}

.screen.active {
  display: flex;
}

/* Card de Localização Atual (Tela 01) */
.location-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.pin-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--navy-soft);
  color: var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.location-label {
  font-size: 0.78rem;
  color: var(--ink-muted);
  font-weight: 500;
}

.location-value {
  font-size: 0.96rem;
  font-weight: 600;
  color: var(--ink);
  margin-top: 2px;
}

/* Busca de Destino (Tela 01) */
.search-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
}

.field-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.search-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.search-svg {
  position: absolute;
  left: 14px;
  color: var(--ink-muted);
  pointer-events: none;
}

.search-input {
  width: 100%;
  min-height: 50px;
  padding: 12px 38px 12px 42px;
  font-family: inherit;
  font-size: 0.96rem;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(21, 94, 149, 0.12);
}

.clear-btn {
  position: absolute;
  right: 10px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--ink-muted);
  font-size: 1rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
}

.clear-btn.visible {
  display: flex;
}

/* W01 — Autocompletar Limpo */
.autocomplete-list {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
  overflow: hidden;
  display: none;
}

.autocomplete-list.open {
  display: block;
}

.autocomplete-item {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  transition: background 0.12s ease;
}

.autocomplete-item:last-child {
  border-bottom: none;
}

.autocomplete-item:hover {
  background: var(--navy-soft);
}

.ac-main {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
}

.ac-sub {
  font-size: 0.78rem;
  color: var(--ink-muted);
}

/* Atalhos Rápidos */
.shortcuts-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.Shortcuts-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-muted);
}

.shortcuts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.shortcut-btn {
  min-height: 56px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.shortcut-btn:hover {
  border-color: var(--navy);
  background: var(--navy-soft);
}

.shortcut-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.shortcut-detail {
  font-size: 0.76rem;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* Botões Primários e Secundários (Mínimo 48px) */
.btn-primary {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  background: var(--navy);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.btn-primary:active {
  transform: scale(0.98);
}

body.high-contrast .btn-primary {
  color: #000000;
}

.btn-primary:hover {
  background: var(--navy-dark);
}

.btn-outline {
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  background: transparent;
  color: var(--ink);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.btn-outline:hover {
  border-color: var(--navy);
  background: var(--navy-soft);
}

/* Navegação interna (Voltar) */
.nav-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.back-link {
  min-height: 40px;
  padding: 6px 10px 6px 0;
  background: transparent;
  border: none;
  color: var(--navy);
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.screen-subtitle {
  font-size: 0.8rem;
  color: var(--ink-muted);
  font-weight: 500;
}

/* TELA 02: Cartões de Rota Limpos (Lâmina 2) */
.routes-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.route-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.route-card.recommended {
  border: 2px solid var(--navy);
}

.route-tag {
  display: inline-block;
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 4px 8px;
  border-radius: 6px;
}

.route-tag.fast {
  background: var(--highlight);
  color: #111827;
}

.route-tag.normal {
  background: var(--bg-app);
  color: var(--ink-muted);
  border: 1px solid var(--border);
}

.route-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--ink);
}

.route-subtitle {
  font-size: 0.84rem;
  color: var(--ink-secondary);
  margin-top: 2px;
}

.route-details {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.86rem;
}

.detail-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.detail-label {
  color: var(--ink-muted);
}

.detail-val {
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}

.eta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 2px;
}

.eta-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-secondary);
}

.eta-badge {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--highlight);
  color: #111827;
}

/* TELA 03: Mapa e Passo a Passo (Lâmina 3) */
.status-pill {
  font-size: 0.76rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--green-soft);
  color: var(--green);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill.offline {
  background: var(--border);
  color: var(--ink-secondary);
}

/* Cards de Contingência W03 e W04 */
.contingency-card {
  border-radius: var(--radius-md);
  padding: 14px;
  display: none;
  flex-direction: column;
  gap: 10px;
  font-size: 0.84rem;
}

.contingency-card.visible {
  display: flex;
}

.contingency-card.warn {
  background: var(--amber-soft);
  border: 1.5px solid #f59e0b;
  color: #78350f;
}

.contingency-card.offline {
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  color: var(--ink);
}

.contingency-title {
  font-size: 0.9rem;
  font-weight: 700;
}

/* Mapa Vetorial Limpo */
.map-box {
  position: relative;
  width: 100%;
  height: 250px;
  background: #edf2f7;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.map-svg {
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease;
  transform-origin: 45% 68%;
}

.map-svg.zoomed {
  transform: scale(1.42);
}

.map-zoom-bar {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}

.zoom-btn {
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.zoom-btn.active {
  background: var(--navy);
  color: #ffffff;
}

body.high-contrast .zoom-btn.active {
  color: #000000;
}

/* Passo a Passo Inferior */
.steps-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.step-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.step-row:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: var(--highlight);
  color: #111827;
  font-weight: 700;
  font-size: 0.84rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.step-desc {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
}

/* Rodapé Discreto de Simulação para os Testes (W03 e W04) */
.sim-bar {
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.sim-btn {
  flex: 1;
  min-height: 36px;
  padding: 6px 8px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--ink-secondary);
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
}

.sim-btn:hover {
  border-color: var(--navy);
  color: var(--navy);
}

/* Modal Limpo */
.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 40;
}

.modal-overlay.open {
  display: flex;
}

.modal-box {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
}

.times-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.time-chip {
  padding: 8px;
  text-align: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 600;
}

.time-chip.active {
  border-color: var(--navy);
  background: var(--navy-soft);
  color: var(--navy);
}

/* Toast Minimalista */
.toast {
  position: absolute;
  bottom: 18px;
  left: 20px;
  right: 20px;
  background: #1e293b;
  color: #ffffff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 500;
  text-align: center;
  display: none;
  z-index: 50;
}

.toast.show {
  display: block;
}

@media (max-width: 440px) {
  body {
    padding: 0;
  }
  .phone-frame {
    width: 100%;
    min-height: 100vh;
    border: none;
    border-radius: 0;
  }
}
