/* ======================
   RESET & VARIÁVEIS (Identidade SisDesp)
====================== */
* {
  box-sizing: border-box;
}

:root {
  --primary: #30325e;        /* Azul-marinho oficial SisDesp */
  --primary-dark: #1e2047;
  --primary-light: #6668a0;
  --accent: #c9a227;         /* Dourado - remete a selo/documento oficial */
  --accent-soft: rgba(201, 162, 39, 0.12);
  --primary-soft: rgba(48, 50, 94, 0.08);
  --success: #10b981;
  --danger: #ef4444;
  --bg: #1a1c3d;
  --bg-page: #f7f7fb;
  --card-bg: #ffffff;
  --text: #1a1b2e;
  --text-muted: #666a8c;
  --border: #e4e4f0;
  --radius: 20px;
  --shadow-sm: 0 4px 12px rgba(26, 27, 46, 0.04);
  --shadow-md: 0 10px 25px rgba(26, 27, 46, 0.09);
  --shadow-lg: 0 20px 40px rgba(26, 27, 46, 0.14);
}

body {
  margin: 0;
  font-family: 'Plus Jakarta Sans', 'Inter', system-ui, sans-serif;
  background-color: var(--bg-page);
  color: var(--text);
  padding-bottom: 90px;
  min-height: 100vh;
}

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 10% 0%, rgba(48, 50, 94, 0.10), transparent 40%),
    radial-gradient(circle at 90% 10%, rgba(201, 162, 39, 0.08), transparent 40%),
    var(--bg-page);
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

/* ======================
   HEADER
====================== */
.page-header {
  text-align: center;
  padding: 50px 0 35px;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: contain;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  background: #fff;
  padding: 6px;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(48, 50, 94, 0.15);
  margin-bottom: 16px;
}

.badge-live::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}

.titulo {
  font-weight: 800;
  margin: 0;
  font-size: clamp(2rem, 4vw, 2.8rem);
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, var(--primary-dark), var(--primary), var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subtitulo {
  color: var(--text-muted);
  margin: 10px auto 0;
  max-width: 520px;
  font-size: 0.98rem;
  line-height: 1.6;
}

/* ======================
   INPUTS & CARDS
====================== */
.comparacao {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 40px;
}

.card {
  position: relative;
  overflow: hidden;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow-sm);
  transition: all 0.25s ease;
  border: 1px solid var(--border);
}

.card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(48, 50, 94, 0.25);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #f1f5f9;
  padding-bottom: 16px;
  margin-bottom: 20px;
}

.card-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
}

.form-group {
  margin-bottom: 16px;
}

label {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
  display: block;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

select {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background-color: #f8fafc;
  font-size: 0.93rem;
  font-family: inherit;
  color: var(--text);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23666a8c'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 10.94l3.71-3.71a.75.75 0 111.06 1.06l-4.24 4.24a.75.75 0 01-1.06 0L5.21 8.29a.75.75 0 01.02-1.08z' clip-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 18px;
  transition: all 0.2s ease;
}

select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(48, 50, 94, 0.12);
  background-color: #fff;
}

select:disabled {
  background-color: #f1f5f9;
  color: #94a3b8;
  cursor: not-allowed;
  opacity: 0.7;
}

/* Indicadores de Status */
.status-indicator {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-block;
  position: relative;
}

.status-indicator.status-loading {
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  animation: girar 0.7s linear infinite;
}

.status-indicator.status-ok {
  background: var(--success);
}
.status-indicator.status-ok::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 900;
}

.status-indicator.status-erro {
  background: var(--danger);
  cursor: pointer;
}
.status-indicator.status-erro::after {
  content: "!";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 900;
}

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

/* ======================
   RESULTADO / RELATÓRIO
====================== */
.resultado {
  scroll-margin-top: 30px;
}

.resultado:empty {
  display: none;
}

.relatorio-card {
  position: relative;
  overflow: hidden;
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 36px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  animation: aparecer 0.4s ease-out both;
}

.relatorio-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

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

.relatorio-header {
  text-align: center;
  margin-bottom: 28px;
}
.relatorio-header h3 { margin: 0; font-size: 1.5rem; font-weight: 800; }
.relatorio-header p { margin: 6px 0 0; color: var(--text-muted); font-size: 0.92rem; }

.relatorio-grid {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 20px;
}

.veiculo-result {
  flex: 1;
  background: #f8fafc;
  border-radius: 16px;
  padding: 24px;
  border: 1px solid var(--border);
  text-align: center;
  transition: transform 0.2s ease;
}
.veiculo-result:hover { transform: translateY(-2px); }

.tag-id {
  background: var(--primary-soft);
  color: var(--primary);
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.modelo-titulo {
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 700;
  margin: 0 0 16px 0;
  min-height: 48px;
  line-height: 1.4;
}

.detalhes-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 18px;
  background: #fff;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.detalhe-item span { display: block; font-size: 0.72rem; color: var(--text-muted); font-weight: 600; }
.detalhe-item strong { display: block; font-size: 0.88rem; color: var(--text); font-weight: 700; }

.preco-display {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--primary-dark);
  background: #fff;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.versus-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  flex-shrink: 0;
}
.versus-divider span {
  background: linear-gradient(135deg, var(--primary), var(--accent));
  color: #fff;
  font-weight: 800;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 0.8rem;
  box-shadow: 0 4px 12px rgba(48, 50, 94, 0.35);
}

.footer-result {
  margin-top: 30px;
  text-align: center;
  padding-top: 24px;
  border-top: 2px dashed var(--border);
}

.diff-container {
  display: inline-block;
  background: var(--accent-soft);
  border: 1.5px solid rgba(201, 162, 39, 0.4);
  padding: 14px 28px;
  border-radius: 50px;
  box-shadow: var(--shadow-sm);
}

.label-diff { font-weight: 600; color: var(--text-muted); margin-right: 8px; }
.valor-diff { font-weight: 800; font-size: 1.25rem; }
.valor-diff.v1-win, .valor-diff.v2-win { color: var(--danger); }

.diff-container small {
  display: block;
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Estilo do Botão de Impressão */
.btn-imprimir {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  background-color: #ffffff;
  color: #2d3748 !important; /* Força cor do texto escura */
  border: 1px solid #cbd5e0;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-top: 12px;
}

.btn-imprimir:hover {
  background-color: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-dark) !important;
}

/* ==========================================
   CONFIGURAÇÃO DE PÁGINA DE IMPRESSÃO
========================================== */
@page {
  size: auto;
  margin: 12mm;
}

/* ======================
   STICKY BAR (FLUTUANTE)
====================== */
.sticky-bar {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  width: calc(100% - 40px);
  max-width: 600px;
  background: linear-gradient(135deg, rgba(30, 32, 71, 0.95), rgba(48, 50, 94, 0.95));
  backdrop-filter: blur(12px);
  color: #fff;
  border-radius: 50px;
  padding: 12px 24px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.sticky-bar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 20px);
}

.sticky-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  font-size: 0.88rem;
  font-weight: 600;
}

.sticky-bar button {
  background: var(--accent);
  color: var(--primary-dark);
  border: none;
  padding: 8px 18px;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: filter 0.2s;
}

.sticky-bar button:hover {
  filter: brightness(1.08);
}

/* ======================
   RESPONSIVO
====================== */
@media (max-width: 768px) {
  .comparacao, .relatorio-grid {
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .versus-divider {
    width: 100%;
    margin: 8px 0;
  }

  .page-header { padding: 35px 0 25px; }

  .sticky-content {
    flex-direction: column;
    text-align: center;
    gap: 8px;
  }
}

/* ==========================================
   ÁREA EXCLUSIVA DE IMPRESSÃO (PÁGINA ÚNICA)
========================================== */
#print-area {
  display: none;
}

@media print {
  @page {
    size: A4 portrait;
    margin: 12mm;
  }

  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
    opacity: 1 !important;
    transform: none !important;
  }

  body {
    background: #ffffff !important;
    color: #000000 !important;
    min-height: auto !important;
    padding: 0 !important;
  }

  body > *:not(#print-area) {
    display: none !important;
  }

  #print-area {
    display: block !important;
    width: 100% !important;
    margin: 0 auto !important;
    padding: 0 !important;
    background: #ffffff !important;
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  #print-area .relatorio-card {
    box-shadow: none !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 12px !important;
    padding: 24px !important;
    margin: 0 !important;
    max-width: 100% !important;
    background: #ffffff !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }

  #print-area div {
    page-break-inside: avoid !important;
    break-inside: avoid !important;
  }
}