/* ============================================================
   360Drive — Componentes (header, botões, spinner, badges)
   ============================================================ */

/* ── App shell ───────────────────────────────────────────── */
#app {
  width: 100%;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* ── Header ──────────────────────────────────────────────── */
#app-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: var(--space-3);
  padding: 13px clamp(16px, 4vw, 44px);
  background: var(--header-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border-gold-soft);
}

/* ── Logo ─────────────────────────────────────────────────── */
.brand {
  grid-column: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo-img {
  height: 46px;
  width: auto;
  display: block;
  object-fit: contain;
}

.brand-name {
  font-size: clamp(19px, 4.6vw, 25px);
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1;
  color: var(--gold-lighter);
}

.brand-name-alt {
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--text-strong);
}

.header-side { min-width: 0; }

.header-meta {
  grid-column: 3;
  display: none;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
  text-align: right;
}

.header-meta-kicker {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--gold-light);
}

.header-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}

@media (min-width: 640px) {
  .header-meta { display: flex; }
}

/* ── Botões ──────────────────────────────────────────────── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 700;
  transition: background var(--duration-md), border-color var(--duration-md),
              color var(--duration-md), box-shadow var(--duration-md),
              transform var(--duration-md);
  white-space: nowrap;
  width: 100%;
  cursor: pointer;
}

/* CTA dourado */
.btn-primary {
  border: none;
  color: var(--text-ink);
  background: var(--gold-grad);
  box-shadow: var(--shadow-gold);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-gold-hover);
}

.btn-primary:active:not(:disabled) {
  transform: translateY(0);
  box-shadow: var(--shadow-gold);
}

.btn-primary:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  box-shadow: none;
}

/* Ghost (Editar consulta) */
.btn-ghost {
  width: auto;
  padding: 11px 18px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 700;
}

.btn-ghost:hover {
  border-color: rgba(226, 184, 92, 0.50);
  color: var(--gold-lighter);
  background: rgba(226, 184, 92, 0.10);
}

/* ── Spinner ─────────────────────────────────────────────── */
.spinner {
  width: 18px;
  height: 18px;
  border: 2.5px solid rgba(36, 25, 6, 0.35);
  border-top-color: var(--text-ink);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}

/* Spinner claro (sobre fundo escuro dos campos) */
.spinner-light {
  border-color: rgba(226, 184, 92, 0.25);
  border-top-color: var(--gold-light);
}

/* ── Card genérico ───────────────────────────────────────── */
.card {
  background: var(--panel-grad);
  border: 1px solid var(--border-gold-soft);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-card);
}

/* ── Error box ───────────────────────────────────────────── */
.error-box {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 13px 15px;
  background: rgba(255, 122, 138, 0.10);
  border: 1px solid rgba(255, 122, 138, 0.28);
  border-radius: var(--radius-md);
  color: var(--danger-soft);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
}

.error-box-icon { flex-shrink: 0; }

/* ── Loading overlay ─────────────────────────────────────── */
.loading-overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-10) 0;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── Busca por placa ─────────────────────────────────────── */
.plate-search {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

/* ── Alternador de modo (placa × manual) ─────────────────── */
.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-2);
  padding: 5px;
  margin-bottom: var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.mode-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 11px var(--space-3);
  border: 1px solid transparent;
  border-radius: calc(var(--radius-md) - 4px);
  background: transparent;
  color: var(--text-dim);
  font-size: 13.5px;
  font-weight: 700;
  transition: background var(--duration-fast) ease,
              color var(--duration-fast) ease,
              border-color var(--duration-fast) ease;
}

.mode-tab svg { width: 17px; height: 17px; flex-shrink: 0; }

.mode-tab:not(.active):hover { color: var(--text); }

.mode-tab.active {
  background: var(--surface-3);
  border-color: var(--border-gold);
  color: var(--gold-light);
}

.mode-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  animation: fadeUp var(--duration-fast) ease both;
}

.plate-field {
  position: relative;
  width: 100%;
}

.plate-field-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-dim);
  pointer-events: none;
}

.plate-input {
  padding-left: 42px;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.plate-input::placeholder {
  letter-spacing: 0.14em;
  font-weight: 600;
  color: var(--text-dim);
}

.btn-plate {
  width: 100%;
  gap: var(--space-2);
}

.btn-plate:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-plate-spinner { display: inline-flex; }

.plate-hint {
  margin: 0;
  font-size: 12.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

/* ── Histórico de placas ─────────────────────────────────── */
.plate-history {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.plate-history-label {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.plate-history-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.plate-chip {
  padding: 5px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  transition: border-color var(--duration-fast) ease, color var(--duration-fast) ease;
}

.plate-chip:hover {
  border-color: var(--border-gold);
  color: var(--gold-light);
}

/* ── Skeleton de carregamento ────────────────────────────── */
.plate-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.skeleton-line {
  height: 11px;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.05) 25%,
    rgba(255, 255, 255, 0.11) 50%,
    rgba(255, 255, 255, 0.05) 75%);
  background-size: 200% 100%;
  animation: skeleton-sweep 1.4s ease-in-out infinite;
}

.skeleton-line--lg { height: 15px; width: 62%; }
.skeleton-line--sm { width: 38%; }

@keyframes skeleton-sweep {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-line { animation: none; }
}

/* ── Resultado da placa ──────────────────────────────────── */
.plate-result {
  padding: var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border-gold-soft);
  border-radius: var(--radius-md);
}

.plate-result-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.plate-tag {
  padding: 4px 10px;
  background: var(--gold-grad);
  border-radius: var(--radius-sm);
  color: var(--text-ink);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.plate-result-name {
  flex: 1;
  min-width: 0;
  color: var(--text-strong);
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.4;
}

.plate-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: var(--space-3);
  margin: 0;
}

.plate-fact dt {
  margin-bottom: 2px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.plate-fact dd {
  margin: 0;
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
}

/* ── Mensagem (não encontrada / indisponível) ────────────── */
.plate-message {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 13px 15px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  color: var(--text-soft);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.5;
}

.plate-message-icon { flex-shrink: 0; color: var(--text-muted); }

.plate-message.is-error {
  background: rgba(255, 122, 138, 0.10);
  border-color: rgba(255, 122, 138, 0.28);
  color: var(--danger-soft);
}

.plate-message.is-error .plate-message-icon { color: var(--danger-soft); }

/* ── Versões FIPE candidatas da placa ────────────────────── */
.plate-versions {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.plate-versions-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  line-height: 1.5;
}

.plate-versions-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.plate-version {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  padding: 11px 14px;
  text-align: left;
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  transition: border-color var(--duration-fast) ease,
              background var(--duration-fast) ease;
}

.plate-version:hover { border-color: var(--border-gold); }

.plate-version.is-selected {
  background: var(--surface-3);
  border-color: var(--gold);
  color: var(--text-strong);
}

.plate-version-name { min-width: 0; line-height: 1.4; }

.plate-version-price {
  flex-shrink: 0;
  font-weight: 800;
  color: var(--gold-light);
}

/* ── Divisor "ou selecione manualmente" ──────────────────── */
.plate-divider {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-1);
  color: var(--text-dim);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.plate-divider::before,
.plate-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

@media (max-width: 480px) {
  .plate-row { flex-wrap: wrap; }
  .plate-field { flex-basis: 100%; }
  .btn-plate { width: 100%; padding: 13px var(--space-5); }
}
