/* ==========================================================================
   PlacasBR — Design System Premium
   ========================================================================== */

/* ---- Variables ---- */
:root {
  --bg-primary:    #0f0f23;
  --bg-secondary:  #1a1a35;
  --bg-card:       #1e1e3a;
  --bg-card-hover: #252545;
  --bg-input:      #13132b;
  --border:        rgba(255,255,255,.08);
  --border-focus:  rgba(124,58,237,.6);

  --text-primary:   #f0f0ff;
  --text-secondary: #a0a0c0;
  --text-muted:     #666680;

  --accent:        #7c3aed;
  --accent-hover:  #6d28d9;
  --accent-light:  rgba(124,58,237,.15);
  --blue:          #3b82f6;
  --yellow:        #e8b400;
  --green:         #22c55e;
  --red:           #ef4444;
  --orange:        #f59e0b;

  --radius-sm:  6px;
  --radius:     10px;
  --radius-lg:  16px;
  --radius-xl:  24px;
  --shadow:     0 4px 24px rgba(0,0,0,.4);
  --shadow-lg:  0 8px 48px rgba(0,0,0,.6);

  --nav-height: 68px;
  --sidebar-w:  220px;

  --transition: 0.2s ease;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

[data-theme="light"] {
  --bg-primary:    #f4f4ff;
  --bg-secondary:  #eeeeff;
  --bg-card:       #ffffff;
  --bg-card-hover: #f8f8ff;
  --bg-input:      #ffffff;
  --border:        rgba(0,0,0,.1);
  --border-focus:  rgba(124,58,237,.5);
  --text-primary:  #1a1a35;
  --text-secondary:#4a4a6a;
  --text-muted:    #888;
  --shadow:        0 4px 24px rgba(0,0,0,.1);
}

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

html { scroll-behavior: smooth; font-size: 16px; }

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: #a78bfa; }

img { max-width: 100%; display: block; }
code { font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace; }

/* ---- Container ---- */
.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all var(--transition);
  white-space: nowrap;
  line-height: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6366f1);
  color: #fff;
  box-shadow: 0 0 20px rgba(124,58,237,.3);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 30px rgba(124,58,237,.5);
  color: #fff;
}

.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border);
}
.btn-ghost:hover {
  background: var(--bg-card);
  border-color: var(--border-focus);
  color: var(--text-primary);
}

.btn-danger {
  background: var(--red);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-block { display: flex; width: 100%; justify-content: center; }
.btn-sm  { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg  { padding: 14px 28px; font-size: 1rem; }
.btn-icon { background: transparent; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px; cursor: pointer; color: var(--text-primary); display: flex; align-items: center; }
.btn-icon svg { width: 18px; height: 18px; }
.btn-icon:hover { background: var(--bg-card); }

/* ---- Navbar ---- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(15,15,35,.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  height: var(--nav-height);
}

.navbar-inner {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-icon { width: 36px; height: 36px; flex-shrink: 0; }
.brand-name { font-size: 1.25rem; font-weight: 800; color: var(--text-primary); }
.brand-name span { color: var(--accent); }

.nav-links { display: flex; gap: 4px; margin-left: 20px; }
.nav-link {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all var(--transition);
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-card); }
.nav-admin { color: var(--orange) !important; }

.nav-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.user-menu { position: relative; }
.user-menu-toggle {
  display: flex; align-items: center; gap: 8px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px;
  cursor: pointer; color: var(--text-primary); font-size: 0.875rem; font-weight: 500;
  transition: all var(--transition);
}
.user-menu-toggle:hover { border-color: var(--border-focus); }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--blue)); display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 700; color: #fff; }

.user-dropdown {
  display: none;
  position: absolute;
  right: 0; top: calc(100% + 8px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 200px;
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  overflow: hidden;
}
.user-dropdown.active { display: block; }

.dropdown-header { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.dropdown-header strong { display: block; font-size: 0.875rem; }
.dropdown-header small { color: var(--text-muted); font-size: 0.75rem; }

.dropdown-item {
  display: block; padding: 10px 16px; color: var(--text-secondary);
  font-size: 0.875rem; transition: all var(--transition);
}
.dropdown-item:hover { background: var(--bg-card-hover); color: var(--text-primary); }
.dropdown-danger:hover { color: var(--red); }

.dropdown-divider { height: 1px; background: var(--border); }

/* Mobile Menu */
.mobile-menu {
  display: none;
  flex-direction: column;
  padding: 12px 24px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}
.mobile-menu.active { display: flex; }
.mobile-menu a { padding: 10px 0; color: var(--text-secondary); font-size: 0.95rem; border-bottom: 1px solid var(--border); }
.mobile-menu a:last-child { border: none; }
.nav-mobile-toggle { display: none; }

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-mobile-toggle { display: flex; }
  .user-name { display: none; }
}

/* ---- Flash Messages ---- */
.flash-container { position: fixed; top: calc(var(--nav-height) + 12px); right: 16px; z-index: 9999; }
.flash {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; border-radius: var(--radius);
  font-size: 0.875rem; font-weight: 500;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow);
  min-width: 280px; max-width: 480px;
  animation: slideIn .3s ease;
}
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }
.flash-success { background: rgba(34,197,94,.15); border: 1px solid rgba(34,197,94,.4); color: #86efac; }
.flash-error   { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.4);  color: #fca5a5; }
.flash-info    { background: rgba(59,130,246,.15); border: 1px solid rgba(59,130,246,.4); color: #93c5fd; }
.flash-warning { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.4); color: #fcd34d; }
.flash-close { margin-left: auto; background: none; border: none; cursor: pointer; color: inherit; font-size: 1rem; padding: 0; line-height: 1; }

/* ---- Main Content ---- */
.main-content { min-height: calc(100vh - var(--nav-height)); }

/* ---- HERO ---- */
.hero {
  position: relative;
  padding: 100px 0 80px;
  overflow: hidden;
  text-align: center;
}

.hero-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(124,58,237,.3) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 80% 80%, rgba(59,130,246,.15) 0%, transparent 60%);
}

.hero-inner { position: relative; z-index: 1; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(124,58,237,.15); border: 1px solid rgba(124,58,237,.3);
  border-radius: 100px; padding: 6px 16px;
  font-size: 0.8rem; font-weight: 500; color: #a78bfa;
  margin-bottom: 28px;
}
.pulse-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(34,197,94,.4); } 50% { box-shadow: 0 0 0 6px rgba(34,197,94,0); } }

.hero-title {
  font-size: clamp(2.5rem, 6vw, 4.5rem);
  font-weight: 900;
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin-bottom: 20px;
}

.gradient-text {
  background: linear-gradient(135deg, #7c3aed, #3b82f6, #818cf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.15rem;
  color: var(--text-secondary);
  max-width: 580px;
  margin: 0 auto 40px;
  line-height: 1.7;
}

/* ---- Search Box ---- */
.hero-search-box { max-width: 640px; margin: 0 auto 40px; }

.search-form { width: 100%; }

.plate-input-wrapper {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.plate-input-wrapper:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(124,58,237,.15);
}

.plate-prefix {
  padding: 0 16px;
  font-size: 1.4rem;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
}

.plate-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 1.3rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  letter-spacing: 4px;
  text-transform: uppercase;
  padding: 16px 20px;
}

.plate-input::placeholder { color: var(--text-muted); letter-spacing: 2px; font-weight: 400; }

.btn-search {
  flex-shrink: 0;
  margin: 6px;
  border-radius: var(--radius);
  gap: 8px;
  padding: 12px 20px;
}
.btn-search svg { width: 18px; height: 18px; }

.search-hint { font-size: 0.8rem; color: var(--text-muted); margin-top: 12px; }
.search-hint a { color: var(--accent); }

/* ---- Hero Stats ---- */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  flex-wrap: wrap;
}
.stat-item { text-align: center; }
.stat-item strong { display: block; font-size: 1.6rem; font-weight: 800; color: var(--text-primary); }
.stat-item span { font-size: 0.8rem; color: var(--text-muted); }
.stat-divider { width: 1px; height: 40px; background: var(--border); }

/* ---- Sections ---- */
.section { padding: 80px 0; }
.section-alt { background: var(--bg-secondary); }

.section-header {
  text-align: center;
  margin-bottom: 56px;
}
.section-header h2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  margin-bottom: 12px;
}
.section-header p { color: var(--text-secondary); font-size: 1.1rem; }

/* ---- Features Grid ---- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  transition: all var(--transition);
}
.feature-card:hover {
  transform: translateY(-4px);
  border-color: rgba(124,58,237,.4);
  box-shadow: 0 8px 32px rgba(124,58,237,.15);
}
.feature-icon { font-size: 2rem; margin-bottom: 14px; }
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.feature-card p { font-size: 0.875rem; color: var(--text-secondary); line-height: 1.6; }

/* ---- How It Works ---- */
.steps { display: flex; align-items: center; justify-content: center; gap: 16px; flex-wrap: wrap; }
.step { text-align: center; max-width: 220px; }
.step-number {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--blue));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; font-weight: 800; margin: 0 auto 16px;
  box-shadow: 0 0 24px rgba(124,58,237,.4);
}
.step h3 { font-size: 1rem; font-weight: 700; margin-bottom: 8px; }
.step p { font-size: 0.875rem; color: var(--text-secondary); }
.step-arrow { font-size: 1.5rem; color: var(--text-muted); }

/* ---- CTA ---- */
.cta-card {
  background: linear-gradient(135deg, rgba(124,58,237,.2), rgba(59,130,246,.15));
  border: 1px solid rgba(124,58,237,.3);
  border-radius: var(--radius-xl);
  padding: 60px 40px;
  text-align: center;
}
.cta-card h2 { font-size: 2rem; font-weight: 800; margin-bottom: 12px; }
.cta-card p { color: var(--text-secondary); margin-bottom: 32px; font-size: 1.1rem; }
.cta-actions { display: flex; gap: 16px; justify-content: center; flex-wrap: wrap; }

/* ---- Auth ---- */
.auth-container {
  display: flex; align-items: center; justify-content: center;
  min-height: calc(100vh - var(--nav-height));
  padding: 40px 16px;
}
.auth-card {
  width: 100%; max-width: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  box-shadow: var(--shadow-lg);
}
.auth-header { text-align: center; margin-bottom: 32px; }
.auth-brand { display: inline-block; margin-bottom: 20px; }
.auth-header h1 { font-size: 1.6rem; font-weight: 800; margin-bottom: 8px; }
.auth-header p { color: var(--text-secondary); font-size: 0.9rem; }
.auth-form { display: flex; flex-direction: column; gap: 20px; }
.auth-footer { text-align: center; margin-top: 24px; font-size: 0.875rem; color: var(--text-secondary); }
.auth-benefits { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; padding: 16px; background: var(--bg-input); border-radius: var(--radius); }
.benefit-item { font-size: 0.8rem; color: var(--green); }

/* ---- Forms ---- */
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 0.875rem; font-weight: 600; color: var(--text-secondary); display: flex; align-items: center; justify-content: space-between; }
.form-label-link { font-weight: 400; color: var(--accent); font-size: 0.8rem; }

.form-control {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 0.9rem;
  padding: 11px 14px;
  width: 100%;
  outline: none;
  transition: all var(--transition);
  font-family: var(--font);
}
.form-control:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(124,58,237,.15);
}
.form-control:disabled { opacity: 0.5; cursor: not-allowed; }
.form-control-sm { padding: 7px 10px; font-size: 0.8rem; }

.input-with-toggle { position: relative; }
.input-with-toggle .form-control { padding-right: 48px; }
.password-toggle { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; font-size: 1rem; padding: 4px; }

.form-check { display: flex; align-items: flex-start; gap: 10px; }
.form-check input { width: 18px; height: 18px; margin-top: 2px; cursor: pointer; accent-color: var(--accent); }
.form-check label { font-size: 0.8rem; color: var(--text-secondary); cursor: pointer; }

.password-strength { font-size: 0.75rem; margin-top: 4px; height: 16px; }

/* ---- Alerts ---- */
.alert {
  padding: 12px 16px; border-radius: var(--radius); font-size: 0.875rem; margin-bottom: 20px;
}
.alert-error   { background: rgba(239,68,68,.15);  border: 1px solid rgba(239,68,68,.4);  color: #fca5a5; }
.alert-success { background: rgba(34,197,94,.15);  border: 1px solid rgba(34,197,94,.4);  color: #86efac; }
.alert-info    { background: rgba(59,130,246,.15); border: 1px solid rgba(59,130,246,.4); color: #93c5fd; }
.alert-warning { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.4); color: #fcd34d; }

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 100px; font-size: 0.75rem; font-weight: 600;
}
.badge-ok      { background: rgba(34,197,94,.15);  color: #4ade80; }
.badge-alert   { background: rgba(239,68,68,.15);  color: #f87171; }
.badge-neutral { background: rgba(148,163,184,.1); color: #94a3b8; }
.badge-secure  { background: rgba(34,197,94,.1);   color: #4ade80; border: 1px solid rgba(34,197,94,.2); font-size: 0.7rem; }
.badge-fast    { background: rgba(124,58,237,.1);  color: #a78bfa; border: 1px solid rgba(124,58,237,.2); font-size: 0.7rem; }

/* ---- Search Page ---- */
.search-page-header { text-align: center; margin-bottom: 32px; }
.search-page-header h1 { font-size: 2rem; font-weight: 800; }
.search-page-header p { color: var(--text-secondary); margin-top: 8px; }

.search-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
}

.search-label { display: block; font-size: 0.875rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; }

.plate-input-wrapper--large { border-radius: var(--radius-xl); }
.plate-input--large { font-size: 1.6rem; letter-spacing: 6px; padding: 18px 24px; }
.plate-prefix--flag { padding: 0 20px; font-size: 1.6rem; }
.btn-search-main { padding: 14px 24px; margin: 8px; }

.placa-validation { min-height: 24px; font-size: 0.8rem; margin-top: 8px; padding-left: 4px; }

.search-tips { font-size: 0.8rem; color: var(--text-muted); margin-top: 16px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.search-tips code { background: var(--bg-input); padding: 2px 8px; border-radius: 4px; }

.info-banner {
  display: flex; align-items: center; gap: 12px;
  background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.25);
  border-radius: var(--radius); padding: 12px 16px; margin-bottom: 20px;
  font-size: 0.875rem; color: var(--text-secondary);
}

.usage-bar-wrap { margin-bottom: 20px; }
.usage-labels { display: flex; justify-content: space-between; font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.usage-bar { background: var(--bg-input); border-radius: 100px; height: 6px; overflow: hidden; }
.usage-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--blue)); border-radius: 100px; transition: width .5s ease; }

/* Loading Card */
.search-loading { margin-top: 24px; }
.loading-card {
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-xl);
  padding: 40px 32px; text-align: center;
}
.loading-card h3 { font-size: 1.1rem; font-weight: 700; margin: 20px 0 24px; }
.loading-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-top: 20px; }

.sources-progress { display: flex; flex-direction: column; gap: 12px; text-align: left; max-width: 280px; margin: 0 auto; }
.source-row { display: flex; align-items: center; justify-content: space-between; padding: 8px 16px; background: var(--bg-input); border-radius: var(--radius); font-size: 0.875rem; }
.source-status { display: flex; align-items: center; }

/* Spinners */
.loading-spinner, .loading-spinner-sm {
  display: inline-block; border-radius: 50%;
  border: 2px solid rgba(124,58,237,.2);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
.loading-spinner { width: 20px; height: 20px; }
.loading-spinner-sm { width: 16px; height: 16px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Recent Searches */
.recent-searches { margin-top: 32px; }
.recent-searches h3 { font-size: 0.95rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 12px; }
.recent-list { display: flex; flex-wrap: wrap; gap: 8px; }
.recent-item { display: flex; align-items: center; gap: 10px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; font-size: 0.8rem; color: var(--text-secondary); transition: all var(--transition); }
.recent-item:hover { border-color: var(--border-focus); color: var(--text-primary); }

/* ---- Result Page ---- */
.result-container { padding-top: 32px; padding-bottom: 60px; }

.breadcrumb { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 24px; }
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--accent); }

.result-header { margin-bottom: 32px; }
.result-plate-section { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 20px; flex-wrap: wrap; }

.plate-display {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border: 3px solid #e8b400;
  border-radius: var(--radius);
  padding: 12px 24px;
  text-align: center;
  min-width: 180px;
  box-shadow: 0 0 30px rgba(232,180,0,.2);
}
.plate-country { font-size: 0.6rem; font-weight: 700; color: #e8b400; letter-spacing: 4px; margin-bottom: 4px; }
.plate-number { font-size: 2rem; font-weight: 900; font-family: 'JetBrains Mono', monospace; color: #fff; letter-spacing: 4px; }
.plate-city { font-size: 0.65rem; color: rgba(255,255,255,.5); margin-top: 4px; }

.result-meta { flex: 1; display: flex; flex-direction: column; gap: 12px; }

.confidence-badge {
  display: inline-flex; align-items: center; gap: 14px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px;
}
.confidence-high   { border-color: rgba(34,197,94,.3); }
.confidence-medium { border-color: rgba(245,158,11,.3); }
.confidence-low    { border-color: rgba(239,68,68,.3); }
.confidence-high .confidence-ring   { color: var(--green); }
.confidence-medium .confidence-ring { color: var(--orange); }
.confidence-low .confidence-ring    { color: var(--red); }

.confidence-ring { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
.confidence-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.confidence-ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.7rem; font-weight: 800; color: var(--text-primary); transform: rotate(90deg); /* cancel parent rotation */ }

.confidence-badge > div:last-child { font-size: 0.85rem; }
.confidence-badge > div:last-child strong { display: block; }
.confidence-badge > div:last-child small { color: var(--text-muted); font-size: 0.75rem; }

.result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.result-vehicle-title { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.vehicle-brand { font-size: 1.1rem; font-weight: 700; color: var(--accent); }
.vehicle-model { font-size: 1.4rem; font-weight: 800; }
.vehicle-year  { font-size: 1rem; color: var(--text-muted); }

.cache-notice { display: flex; align-items: center; gap: 8px; font-size: 0.8rem; color: var(--text-muted); margin-top: 8px; }

/* Tabs */
.result-tabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}
.tab-btn {
  padding: 10px 18px; background: transparent; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 0.875rem; font-weight: 500; cursor: pointer; transition: all var(--transition);
  margin-bottom: -1px; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.tab-btn:hover { color: var(--text-primary); background: var(--bg-card); }
.tab-btn.active { color: var(--accent); border-bottom-color: var(--accent); background: var(--bg-card); }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }

/* Data Cards */
.data-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.data-card-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px; font-size: 0.875rem; font-weight: 700;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
.data-card-header svg { width: 18px; height: 18px; }
.data-rows { padding: 4px 0; }
.data-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 20px; border-bottom: 1px solid rgba(255,255,255,.03); }
.data-row:last-child { border: none; }
.data-label { font-size: 0.8rem; color: var(--text-muted); }
.data-value { font-size: 0.875rem; font-weight: 600; text-align: right; max-width: 60%; }

/* Restrictions */
.restriction-card {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
}
.restriction-ok    { border-color: rgba(34,197,94,.2); }
.restriction-alert { border-color: rgba(239,68,68,.3); background: rgba(239,68,68,.05); }
.restriction-icon { font-size: 1.8rem; flex-shrink: 0; }
.restriction-content { flex: 1; }
.restriction-content h4 { font-size: 0.875rem; font-weight: 700; margin-bottom: 4px; }
.restriction-content p { font-size: 0.8rem; color: var(--text-secondary); }
.restriction-empty { color: var(--text-muted) !important; }
.restriction-status { flex-shrink: 0; }

/* FIPE */
.fipe-section { display: flex; flex-direction: column; align-items: center; gap: 24px; }
.fipe-hero { text-align: center; padding: 40px; background: var(--bg-card); border: 1px solid rgba(124,58,237,.3); border-radius: var(--radius-xl); width: 100%; max-width: 480px; }
.fipe-valor-main { display: flex; align-items: baseline; gap: 8px; justify-content: center; margin-bottom: 8px; }
.fipe-currency { font-size: 1.5rem; font-weight: 700; color: var(--text-muted); }
.fipe-number { font-size: 3rem; font-weight: 900; color: var(--green); }
.fipe-hero p { color: var(--text-secondary); font-size: 0.9rem; }
.fipe-hero small { display: block; color: var(--text-muted); font-size: 0.75rem; margin-top: 4px; }
.fipe-empty { text-align: center; padding: 40px; color: var(--text-muted); }

.market-price { text-align: center; padding: 24px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.market-price h4 { font-size: 1rem; margin-bottom: 12px; }
.market-value { font-size: 2rem; font-weight: 800; color: var(--blue); }

/* Débitos */
.debito-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; }
.debito-icon { font-size: 2rem; margin-bottom: 12px; }
.debito-card h4 { font-size: 0.95rem; font-weight: 700; margin-bottom: 8px; }
.debito-card p { font-size: 0.875rem; color: var(--text-secondary); }
.no-data { color: var(--text-muted) !important; font-style: italic; }
.upgrade-prompt { background: rgba(124,58,237,.1); border: 1px solid rgba(124,58,237,.25); border-radius: var(--radius); padding: 16px; text-align: center; margin-top: 16px; font-size: 0.875rem; }

/* Ads */
.ads-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.ad-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: all var(--transition); }
.ad-card:hover { transform: translateY(-3px); border-color: rgba(124,58,237,.3); color: inherit; }
.ad-image { height: 140px; overflow: hidden; }
.ad-image img { width: 100%; height: 100%; object-fit: cover; }
.ad-image--placeholder { background: var(--bg-secondary); display: flex; align-items: center; justify-content: center; font-size: 3rem; }
.ad-content { padding: 14px; }
.ad-content h4 { font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; line-height: 1.4; }
.ad-price { font-size: 1rem; font-weight: 800; color: var(--green); margin-bottom: 4px; }
.ad-source { display: inline-block; background: rgba(124,58,237,.15); color: #a78bfa; font-size: 0.7rem; border-radius: 4px; padding: 2px 6px; margin-top: 6px; }

/* Sources */
.sources-section { margin-top: 32px; padding: 16px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius); }
.sources-section h4 { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); margin-bottom: 10px; }
.sources-list { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.source-tag { padding: 4px 12px; border-radius: 100px; font-size: 0.75rem; font-weight: 600; }
.source-tag--ok { background: rgba(34,197,94,.1); color: #4ade80; border: 1px solid rgba(34,197,94,.2); }
.source-tag--neutral { background: var(--bg-input); color: var(--text-muted); }
.sources-section small { color: var(--text-muted); font-size: 0.75rem; }

.new-search-bar { margin-top: 24px; padding: 20px; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); }

/* ---- Plans ---- */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; margin-top: 40px; }
.plan-card {
  position: relative;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 32px 28px;
  display: flex; flex-direction: column; gap: 20px;
  transition: all var(--transition);
}
.plan-card:hover { transform: translateY(-4px); }
.plan-featured { border-color: rgba(124,58,237,.5); box-shadow: 0 0 40px rgba(124,58,237,.2); }
.plan-badge { position: absolute; top: -12px; left: 50%; transform: translateX(-50%); background: var(--accent); color: #fff; font-size: 0.75rem; font-weight: 700; padding: 4px 16px; border-radius: 100px; white-space: nowrap; }
.plan-name { font-size: 1.1rem; font-weight: 700; }
.plan-price { display: flex; align-items: baseline; gap: 4px; }
.plan-currency { font-size: 1rem; color: var(--text-muted); }
.plan-amount { font-size: 2.5rem; font-weight: 900; }
.plan-period { font-size: 0.8rem; color: var(--text-muted); }
.plan-desc { font-size: 0.875rem; color: var(--text-secondary); }
.plan-features { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 0.875rem; flex: 1; }
.plan-features li { color: var(--text-secondary); }

/* ---- Dashboard ---- */
.dashboard-welcome { display: flex; justify-content: space-between; align-items: center; margin-bottom: 32px; flex-wrap: wrap; gap: 16px; }
.dashboard-welcome h1 { font-size: 1.8rem; font-weight: 800; }
.dashboard-welcome p { color: var(--text-secondary); }

.dash-stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.dash-stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.dash-stat-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 8px; }
.dash-stat-value { font-size: 1.8rem; font-weight: 800; }
.dash-stat-value span { font-size: 1rem; color: var(--text-muted); }
.api-key-preview { font-size: 0.75rem; background: var(--bg-input); padding: 4px 8px; border-radius: 4px; display: block; }

.dashboard-section { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 24px; }
.section-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.section-row h2 { font-size: 1rem; font-weight: 700; }

.empty-state { text-align: center; padding: 40px; color: var(--text-muted); }
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { margin-bottom: 16px; }

.history-list { display: flex; flex-direction: column; gap: 8px; }
.history-item { display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius); transition: all var(--transition); color: var(--text-primary); }
.history-item:hover { border-color: rgba(124,58,237,.3); background: var(--bg-card-hover); color: var(--text-primary); }
.plate-badge { background: var(--bg-input); font-family: monospace; padding: 4px 12px; border-radius: 4px; font-weight: 700; font-size: 0.9rem; letter-spacing: 2px; border: 1px solid var(--border); }
.history-info { flex: 1; display: flex; gap: 8px; }
.history-time { font-size: 0.8rem; color: var(--text-muted); margin-left: auto; }
.history-status { font-size: 0.75rem; font-weight: 600; padding: 2px 8px; border-radius: 4px; }
.status-completed, .status-cached { background: rgba(34,197,94,.1); color: #4ade80; }
.status-failed  { background: rgba(239,68,68,.1); color: #f87171; }
.status-pending { background: rgba(245,158,11,.1); color: #fbbf24; }

/* ---- Admin ---- */
.admin-layout { display: flex; min-height: calc(100vh - var(--nav-height)); }

.admin-sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  padding: 24px 12px;
}
.admin-sidebar-title { font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 2px; color: var(--text-muted); padding: 0 12px; margin-bottom: 12px; }

.admin-nav { display: flex; flex-direction: column; gap: 2px; }
.admin-nav-item { padding: 9px 14px; border-radius: var(--radius); font-size: 0.875rem; color: var(--text-secondary); transition: all var(--transition); }
.admin-nav-item:hover { background: var(--bg-card); color: var(--text-primary); }
.admin-nav-item.active { background: rgba(124,58,237,.15); color: var(--accent); }
.admin-nav-divider { height: 1px; background: var(--border); margin: 8px 12px; }

.admin-main { flex: 1; padding: 32px; overflow: auto; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 28px; flex-wrap: wrap; gap: 12px; }
.admin-topbar h1 { font-size: 1.5rem; font-weight: 800; }
.admin-date { font-size: 0.85rem; color: var(--text-muted); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 28px; }
.kpi-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; display: flex; align-items: flex-start; gap: 14px; }
.kpi-icon { font-size: 2rem; flex-shrink: 0; }
.kpi-data { flex: 1; }
.kpi-value { font-size: 1.6rem; font-weight: 900; line-height: 1; }
.kpi-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; }
.kpi-sub { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; }
.kpi-mini { display: flex; gap: 20px; font-size: 0.875rem; color: var(--text-secondary); }

.admin-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; margin-bottom: 20px; }
.admin-card-header { padding: 14px 20px; font-size: 0.875rem; font-weight: 700; border-bottom: 1px solid var(--border); color: var(--text-secondary); }

.table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.admin-table th { padding: 10px 16px; text-align: left; font-size: 0.75rem; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.admin-table td { padding: 10px 16px; border-bottom: 1px solid rgba(255,255,255,.03); vertical-align: middle; }
.admin-table tr:last-child td { border: none; }
.admin-table tr:hover td { background: rgba(255,255,255,.02); }
.admin-table-sm td, .admin-table-sm th { padding: 7px 12px; }

.admin-pagination { display: flex; gap: 6px; padding: 16px 20px; }
.page-btn { padding: 6px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: transparent; color: var(--text-secondary); font-size: 0.8rem; cursor: pointer; transition: all var(--transition); }
.page-btn.active, .page-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; cursor: pointer; inset: 0; background: var(--bg-input); border-radius: 100px; transition: var(--transition); border: 1px solid var(--border); }
.toggle-slider:before { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: var(--text-muted); border-radius: 50%; transition: var(--transition); }
.toggle-switch input:checked + .toggle-slider { background: rgba(34,197,94,.2); border-color: var(--green); }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(18px); background: var(--green); }

/* Scrapers */
.scrapers-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
.scraper-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px; }
.scraper-online  { border-color: rgba(34,197,94,.3); }
.scraper-degraded{ border-color: rgba(245,158,11,.3); }
.scraper-offline { border-color: rgba(239,68,68,.3); opacity: .7; }
.scraper-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.scraper-header h3 { font-size: 0.95rem; font-weight: 700; }
.scraper-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.scraper-online .scraper-dot { background: var(--green); box-shadow: 0 0 8px rgba(34,197,94,.6); }
.scraper-degraded .scraper-dot { background: var(--orange); }
.scraper-offline .scraper-dot { background: var(--red); }
.scraper-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.scraper-stat { background: var(--bg-input); border-radius: var(--radius-sm); padding: 8px; }
.scraper-stat span { display: block; font-size: 0.7rem; color: var(--text-muted); }
.scraper-stat strong { font-size: 0.9rem; font-weight: 700; }
.scraper-error { background: rgba(239,68,68,.08); border-radius: var(--radius-sm); padding: 8px; margin-bottom: 12px; }
.scraper-error small { font-size: 0.75rem; color: #f87171; }
.scraper-footer { font-size: 0.75rem; color: var(--text-muted); }

/* Logs */
.log-terminal { background: #0a0a18; border-radius: 0; padding: 16px; max-height: 600px; overflow-y: auto; font-family: 'JetBrains Mono', 'Courier New', monospace; font-size: 0.75rem; }
.log-line { padding: 2px 0; line-height: 1.6; white-space: pre-wrap; word-break: break-all; }
.log-info    { color: #94a3b8; }
.log-error   { color: #f87171; }
.log-warning { color: #fbbf24; }
.log-debug   { color: #666; }

/* API docs */
.api-docs { display: flex; flex-direction: column; gap: 16px; }
.api-docs h4 { font-size: 0.875rem; font-weight: 700; margin-bottom: 8px; }
.code-block { background: #0a0a18; color: #e2e8f0; padding: 16px; border-radius: var(--radius); font-size: 0.8rem; font-family: monospace; overflow-x: auto; white-space: pre; border: 1px solid var(--border); }
.api-key-display { display: flex; align-items: center; gap: 12px; background: var(--bg-input); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 16px; margin-top: 8px; }
.api-key-display code { flex: 1; font-size: 0.85rem; color: var(--green); word-break: break-all; }

/* Footer */
.footer { background: var(--bg-secondary); border-top: 1px solid var(--border); padding: 60px 0 32px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 40px; margin-bottom: 40px; }
.footer-brand p { color: var(--text-muted); font-size: 0.875rem; margin-top: 12px; line-height: 1.6; }
.footer-badges { display: flex; gap: 8px; margin-top: 16px; }
.footer-links h4 { font-size: 0.875rem; font-weight: 700; margin-bottom: 16px; }
.footer-links ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.footer-links a { color: var(--text-muted); font-size: 0.875rem; transition: color var(--transition); }
.footer-links a:hover { color: var(--text-primary); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 24px; text-align: center; }
.footer-bottom p { color: var(--text-muted); font-size: 0.8rem; }
.footer-disclaimer { margin-top: 6px; font-size: 0.7rem; }

@media (max-width: 768px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
  .admin-layout { flex-direction: column; }
  .admin-sidebar { width: 100%; padding: 12px; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; }
  .admin-main { padding: 16px; }
  .result-plate-section { flex-direction: column; }
  .cards-grid { grid-template-columns: 1fr; }
  .plans-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .footer-grid { grid-template-columns: 1fr; }
  .hero-stats { flex-direction: column; gap: 12px; }
  .stat-divider { display: none; }
}
