/* ==========================================================================
   CONSULTA AUTOKEY (VEÍCULOS) — AUTOKEY DESIGN SYSTEM
   Harmonização total com a Nova Home (Autokey):
   - Tipografia Manrope
   - Fundo atmosférico com iluminação sutil e grid overlay
   - Header flutuante em pílula com badge de status
   - Card Bento moderno com sombras refinadas
   - Botão de busca esportivo com animação de pulso
   - Showroom de resultados com chips e numerais tabulares
   - Logo centralizada no card superior no mobile
   ========================================================================== */

:root {
  /* Marca e Neutros Autokey */
  --brand-red: #d9040a;
  --brand-red-hover: #b80309;
  --brand-red-press: #9c0208;
  --brand-red-subtle: rgba(217, 4, 10, 0.08);

  --brand-dark: #191d20;
  --brand-dark-hover: #2b3136;
  --brand-black: #101214;
  --brand-white: #ffffff;

  /* Superfícies */
  --surface: #f5f5f3;
  --surface-alt: #eaeae7;
  --surface-card: #ffffff;

  /* Tipografia */
  --text-primary: #191d20;
  --text-secondary: #5f6368;
  --text-muted: #8c8f94;

  /* Bordas */
  --border: rgba(25, 29, 32, 0.09);
  --border-strong: rgba(25, 29, 32, 0.22);
  --border-subtle: rgba(25, 29, 32, 0.05);

  /* Sombras */
  --shadow-nav: 0 1px 2px rgba(25, 29, 32, 0.04), 0 10px 30px -12px rgba(25, 29, 32, 0.16);
  --shadow-float: 0 2px 4px rgba(25, 29, 32, 0.04), 0 20px 44px -18px rgba(25, 29, 32, 0.16);
  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.04), 0 12px 24px -10px rgba(25, 29, 32, 0.1);
  --shadow-btn-red: 0 4px 14px rgba(217, 4, 10, 0.32);

  /* Raios */
  --radius-xs: 6px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 24px;
  --radius-pill: 9999px;

  /* Transições e Curvas */
  --ease-soft: cubic-bezier(0.33, 1, 0.68, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 0.18s;
  --dur-base: 0.28s;
}

/* ==========================================================================
   RESET & ESTRUTURA GLOBAL
   ========================================================================== */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

[hidden] {
  display: none !important;
}

html {
  font-family: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--text-primary);
  background-color: var(--surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-color: var(--surface);
  color: var(--text-primary);
  overflow-x: clip;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

/* ==========================================================================
   BACKGROUND ATMOSFÉRICO (AUTOKEY CANVAS)
   ========================================================================== */

.autokey-bg-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.38;
}

.bg-glow-1 {
  top: -10vw;
  right: -5vw;
  width: 45vw;
  height: 45vw;
  background: radial-gradient(circle, rgba(217, 4, 10, 0.12) 0%, transparent 70%);
}

.bg-glow-2 {
  top: 35vh;
  left: -15vw;
  width: 50vw;
  height: 50vw;
  background: radial-gradient(circle, rgba(25, 29, 32, 0.05) 0%, transparent 70%);
}

.bg-grid-overlay {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(25, 29, 32, 0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(25, 29, 32, 0.025) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: linear-gradient(to bottom, black 25%, transparent 95%);
  -webkit-mask-image: linear-gradient(to bottom, black 25%, transparent 95%);
}

/* ==========================================================================
   HEADER FLUTUANTE EM PÍLULA (AUTOKEY DESIGN)
   ========================================================================== */

.autokey-nav-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0.85rem 1rem 0.5rem;
}

.nav-container {
  max-width: 1200px;
  margin: 0 auto;
}

.nav-pill-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 72px;
  padding: 0 1.5rem;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-nav);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  -webkit-user-select: none;
}

.nav-brand-logo {
  height: 48px;
  width: auto;
  object-fit: contain;
}

.nav-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--brand-dark);
}

.live-dot {
  width: 6px;
  height: 6px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 6px #10b981;
  animation: pulse-dot 2s infinite ease-in-out;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.nav-links-menu {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.5rem 0.95rem;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: var(--radius-pill);
  transition: all var(--dur-fast) var(--ease-soft);
}

.nav-link:hover {
  color: var(--brand-dark);
  background-color: var(--surface);
}

.nav-link.active {
  color: var(--brand-dark);
  background-color: var(--surface-alt);
  font-weight: 700;
}

.nav-link-suporte {
  color: var(--brand-red);
  background: var(--brand-red-subtle);
}

.nav-link-suporte:hover {
  color: #ffffff;
  background: var(--brand-red);
}

/* ==========================================================================
   PAGE LAYOUT & BENTO CARD
   ========================================================================== */

.page {
  min-height: calc(100vh - 90px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1.5rem 1rem 6rem;
  position: relative;
  z-index: 1;
}

.card {
  width: 100%;
  max-width: 680px;
  padding: clamp(24px, 4vw, 36px);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-float);
  transition: box-shadow 0.3s var(--ease-soft), border-color 0.3s var(--ease-soft);
}

.card-largo {
  max-width: 680px;
}

/* ==========================================================================
   CARD HEADER
   ========================================================================== */

.card-header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.autokey-logo {
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.06));
}

.brand-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.type-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

.tick {
  display: inline-block;
  width: 1.25rem;
  height: 2.5px;
  background-color: var(--brand-red);
  border-radius: 2px;
  flex-shrink: 0;
}

.app-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--brand-dark);
  letter-spacing: -0.02em;
}

/* ==========================================================================
   CAMPOS & SELECTS
   ========================================================================== */

.consulta-flow {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.field label {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
}

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

.input {
  width: 100%;
  height: 52px;
  padding: 0 44px 0 16px;
  border-radius: var(--radius-md);
  background: #ffffff;
  border: 1.5px solid var(--border);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%236b6b68' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
  transition: all 0.22s var(--ease-soft);
}

.input:hover:not(:disabled) {
  border-color: var(--border-strong);
}

.input:focus {
  border-color: var(--brand-red);
  box-shadow: 0 0 0 3.5px var(--brand-red-subtle);
}

.input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background-color: var(--surface);
  color: var(--text-muted);
  border-color: rgba(25, 29, 32, 0.06);
}

/* ==========================================================================
   BOTÃO CONSULTAR
   ========================================================================== */

.actions {
  margin-top: 10px;
}

#buscar {
  width: 100%;
  height: 54px;
  border-radius: var(--radius-pill);
  background: var(--brand-red);
  border: none;
  color: #ffffff;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  box-shadow: var(--shadow-btn-red);
  transition: all 0.25s var(--ease-soft);
  user-select: none;
}

#buscar .btn-arrow {
  transition: transform 0.25s var(--ease-soft);
}

#buscar:hover:not(:disabled) {
  background: var(--brand-red-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(217, 4, 10, 0.4);
}

#buscar:hover:not(:disabled) .btn-arrow {
  transform: translateX(4px);
}

#buscar:active:not(:disabled) {
  background: var(--brand-red-press);
  transform: scale(0.98);
}

#buscar:focus-visible {
  outline: 3px solid var(--brand-dark);
  outline-offset: 3px;
}

#buscar:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
  background: #94a3b8;
}

#buscar[aria-busy="true"] {
  background: linear-gradient(110deg, var(--brand-red) 20%, color-mix(in srgb, var(--brand-red) 65%, #fff) 50%, var(--brand-red) 80%);
  background-size: 200% 100%;
  animation: botao-pulso 1.2s ease-in-out infinite;
  cursor: progress;
}

@keyframes botao-pulso {
  from { background-position: 120% 0; }
  to { background-position: -80% 0; }
}

/* ==========================================================================
   AUTH NOTICE
   ========================================================================== */

.auth-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  gap: 12px;
}

.auth-icon {
  font-size: 36px;
  margin-bottom: 4px;
}

.auth-title {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand-dark);
}

.auth-desc {
  font-size: 0.875rem;
  color: var(--text-secondary);
  max-width: 320px;
  line-height: 1.5;
}

.auth-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
  width: 100%;
  justify-content: center;
}

.auth-btn-primary {
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  background: var(--brand-red);
  color: white;
  text-decoration: none;
  font-weight: 700;
  font-size: 0.875rem;
  transition: all 0.2s;
}

.auth-btn-primary:hover {
  background: var(--brand-red-hover);
  transform: translateY(-1px);
}

.auth-btn-secondary {
  padding: 12px 24px;
  border-radius: var(--radius-pill);
  background: #ffffff;
  border: 1px solid var(--border);
  color: var(--text-primary);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.875rem;
  transition: all 0.2s;
}

/* ==========================================================================
   RESULTADO / SHOWROOM
   ========================================================================== */

.resultado {
  margin-top: 32px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #ffffff;
  box-shadow: var(--shadow-card);
  animation: enterRise 0.45s var(--ease-soft) forwards;
}

@keyframes enterRise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.resultado-titulo {
  margin-bottom: 22px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.resultado-titulo h2 {
  color: var(--brand-dark);
  font-size: clamp(1.35rem, 3.5vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.resultado-titulo span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 600;
}

.smart-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--brand-red-subtle);
  color: var(--brand-red);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1px solid rgba(217, 4, 10, 0.2);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 36px 20px;
  text-align: center;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1.5px dashed var(--border);
}

.empty-icone {
  font-size: 38px;
  opacity: 0.85;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
}

.empty-state-erro {
  border-color: rgba(217, 4, 10, 0.28);
  background: rgba(217, 4, 10, 0.04);
}

.empty-state-erro p {
  color: var(--brand-red);
}

.empty-state-aviso {
  border-color: rgba(255, 149, 0, 0.35);
  background: rgba(255, 149, 0, 0.04);
}

.empty-state-aviso p {
  color: #b35900;
}

/* ==========================================================================
   SEÇÕES & BENTO GRID
   ========================================================================== */

.secao {
  margin-bottom: 24px;
}

.secao-titulo {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.secao-titulo::before {
  content: '';
  display: inline-block;
  width: 1.25rem;
  height: 2.5px;
  background-color: var(--brand-red);
  border-radius: 2px;
  flex-shrink: 0;
}

.secao-titulo strong {
  color: var(--brand-dark);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.dados-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dado {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  transition: all 0.2s var(--ease-soft);
}

.dado:hover {
  background: #ffffff;
  border-color: var(--brand-red);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.04);
}

.dado span {
  display: block;
  margin-bottom: 3px;
  color: var(--text-secondary);
  font-size: 0.6875rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.dado strong {
  display: block;
  overflow-wrap: anywhere;
  color: var(--text-primary);
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
  font-variant-numeric: tabular-nums;
}

.dado-span-inteiro {
  grid-column: 1 / -1;
}

/* ==========================================================================
   PASSOS & PROCEDIMENTOS
   ========================================================================== */

.passos {
  margin: 8px 0 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.passos li {
  color: var(--text-primary);
  font-size: 0.88rem;
  line-height: 1.55;
  font-weight: 500;
}

.passos li::marker {
  color: var(--brand-red);
  font-weight: 800;
}

.aviso {
  padding: 14px 16px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-primary);
  font-size: 0.85rem;
  line-height: 1.6;
}

/* ==========================================================================
   EQUIPAMENTOS / CHIPS
   ========================================================================== */

.equipamentos {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.equipamento-chip {
  background: var(--surface);
  color: var(--brand-dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 5px 14px;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: all 0.2s var(--ease-soft);
}

.equipamento-chip:hover {
  background: var(--brand-red);
  border-color: var(--brand-red);
  color: white;
  transform: translateY(-1px);
}

/* ==========================================================================
   IMAGENS DO VEÍCULO
   ========================================================================== */

.imagens-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.imagem-item {
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #ffffff;
  box-shadow: var(--shadow-card);
  transition: transform 0.25s var(--ease-soft), box-shadow 0.25s var(--ease-soft);
}

.imagem-item:hover {
  transform: scale(1.03);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.imagem-item img {
  display: block;
  width: 100%;
  height: 140px;
  object-fit: contain;
  padding: 8px;
  background: white;
}

/* ==========================================================================
   RESPONSIVO
   ========================================================================== */

@media (max-width: 1024px) {
  .nav-links-menu {
    display: none;
  }

  .nav-pill-wrapper {
    justify-content: center;
  }

  .nav-brand {
    justify-content: center;
    margin: 0 auto;
  }
}

@media (max-width: 768px) {
  .autokey-nav-header {
    padding: 0.5rem 0.75rem 0.25rem;
  }

  /* Centraliza a logo no card flutuante superior da Autokey */
  .nav-pill-wrapper {
    height: 64px;
    padding: 0 1rem;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .nav-brand {
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    width: 100%;
    text-align: center;
  }

  .nav-brand-logo {
    height: 56px;
    width: auto;
    max-width: 180px;
    object-fit: contain;
    margin: 0 auto;
    display: block;
  }

  .nav-brand-logo[src$="/images/logos/Logo-Autokey-Preto.png"] {
    width: 116px;
    object-fit: cover;
    object-position: center 54%;
  }

  .nav-brand-badge {
    display: none;
  }

  .page {
    padding: 0.85rem 0.75rem calc(95px + env(safe-area-inset-bottom, 20px));
  }

  .card {
    padding: 20px 16px;
    border-radius: var(--radius-md);
  }

  .card-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    justify-content: flex-start;
  }

  .brand-group {
    gap: 12px;
  }

  .app-title {
    font-size: 1rem;
  }

  .dados-grid {
    grid-template-columns: 1fr;
  }

  .imagens-grid {
    grid-template-columns: 1fr;
  }
}
