/* ============================================================
   Chapman Auto — Professional UI Refresh (v2)
   Presentation-only layer. All IDs, classes, handlers & logic
   from styles.css + app.js remain fully intact.
   ============================================================ */

:root {
  /* Refined professional palette */
  --primary-dark: #0b1628;
  --accent-red: #c41e2a;
  --accent-hover: #9e1822;
  --accent-soft: rgba(196, 30, 42, 0.08);
  --silver-accent: #94a3b8;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --bg-light: #f1f5f9;
  --bg-white: #ffffff;
  --border-color: #e2e8f0;
  --card-bg: #ffffff;
  --nav-bg: rgba(255, 255, 255, 0.92);
  --logo-pad-bg: #ffffff;
  --shadow-xs: 0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-soft: 0 4px 20px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 30px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 16px 40px rgba(15, 23, 42, 0.12);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, 0.16);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-card: 16px;
  --radius-btn: 10px;
  --radius-pill: 999px;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  --font-heading: 'Poppins', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, sans-serif;
}

[data-theme="dark"] {
  --primary-dark: #f1f5f9;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --bg-light: #1e293b;
  --bg-white: #0f172a;
  --border-color: #334155;
  --card-bg: #1e293b;
  --nav-bg: rgba(15, 23, 42, 0.92);
  --logo-pad-bg: #ffffff;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 8px 30px rgba(0, 0, 0, 0.3);
  --shadow-hover: 0 16px 40px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.5);
  --accent-soft: rgba(196, 30, 42, 0.15);
}

/* ---------- Base ---------- */
html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
}

body {
  font-size: 15px;
  line-height: 1.65;
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body, input, select, textarea, button {
  font-family: var(--font-body);
}

::selection {
  background: rgba(196, 30, 42, 0.15);
  color: var(--text-main);
}

.container {
  width: min(100% - 48px, 1280px);
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 0;
  padding-right: 0;
}

/* ---------- Navigation ---------- */
.navbar {
  min-height: 76px;
  border-bottom: 1px solid var(--border-color);
  background: var(--nav-bg);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  box-shadow: var(--shadow-xs);
  transition: background var(--transition), border-color var(--transition);
}

.nav-container {
  min-height: 76px;
  gap: 20px;
  align-items: center;
}

.logo {
  min-width: 0;
  display: flex;
  align-items: center;
}

.logo img,
.logo-img {
  display: block;
  width: auto;
  max-width: 200px;
  height: 48px;
  object-fit: contain;
}

.nav-links {
  gap: 2px;
}

.nav-links a {
  position: relative;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 0.84rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-main);
  transition: color var(--transition), background var(--transition);
}

.nav-links a:hover,
.nav-links a.active-nav {
  background: var(--accent-soft);
  color: var(--accent-red);
}

.nav-links a::after {
  content: "";
  position: absolute;
  height: 2px;
  left: 14px;
  right: 14px;
  bottom: 5px;
  background: var(--accent-red);
  border-radius: 1px;
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--transition);
}

.nav-links a:hover::after,
.nav-links a.active-nav::after {
  transform: scaleX(1);
}

.nav-menu-btn,
.theme-toggle {
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-main);
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition), transform var(--transition);
}

.nav-menu-btn:hover,
.theme-toggle:hover {
  background: var(--bg-light);
  border-color: var(--silver-accent);
}

.nav-drawer {
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  border-radius: 0 0 var(--radius-card) var(--radius-card);
  padding: 12px;
  background: var(--card-bg);
}

.nav-drawer a {
  border-radius: var(--radius-md);
  padding: 13px 16px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background var(--transition), color var(--transition);
}

.nav-drawer a:hover,
.nav-drawer a.active-nav {
  background: var(--accent-soft);
  color: var(--accent-red);
}

/* ---------- Hero ---------- */
.hero {
  min-height: clamp(480px, 58vw, 640px);
  overflow: hidden;
  isolation: isolate;
  position: relative;
}

.hero-overlay {
  background:
    linear-gradient(105deg, rgba(11, 22, 40, 0.88) 0%, rgba(11, 22, 40, 0.55) 45%, rgba(11, 22, 40, 0.2) 100%),
    linear-gradient(0deg, rgba(11, 22, 40, 0.4) 0%, transparent 50%);
}

.hero-content {
  max-width: 900px;
  padding-top: 72px;
  padding-bottom: 72px;
}

.hero h1 {
  max-width: 820px;
  margin-inline: auto;
  font-size: clamp(2.4rem, 5.2vw, 4.2rem);
  line-height: 1.08;
  letter-spacing: -0.04em;
  font-weight: 800;
  text-wrap: balance;
  color: #fff;
}

.hero p {
  max-width: 640px;
  margin: 20px auto 28px;
  color: rgba(255, 255, 255, 0.88);
  font-size: clamp(1rem, 1.4vw, 1.15rem);
  line-height: 1.6;
}

/* ---------- Buttons ---------- */
.btn {
  min-height: 44px;
  padding: 11px 20px;
  border-radius: var(--radius-btn);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 0.88rem;
  letter-spacing: -0.01em;
  box-shadow: none;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
}

.btn-primary {
  background: var(--accent-red);
  box-shadow: 0 4px 14px rgba(196, 30, 42, 0.25);
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(196, 30, 42, 0.32);
}

.btn-secondary {
  border-width: 1.5px;
  border-color: var(--border-color);
  background: var(--card-bg);
  color: var(--text-main);
}

.btn-secondary:hover {
  border-color: var(--primary-dark);
  background: var(--primary-dark);
  color: var(--bg-white);
}

.btn-whatsapp {
  box-shadow: 0 4px 14px rgba(37, 211, 102, 0.22);
}

.btn-whatsapp:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(37, 211, 102, 0.3);
}

.btn:focus-visible,
.btn-history:focus-visible,
.btn-dl:focus-visible,
.form-control:focus-visible,
select:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 3px solid rgba(196, 30, 42, 0.35);
  outline-offset: 2px;
}

/* ---------- Sections ---------- */
.page-section {
  padding-top: 48px;
  padding-bottom: 72px;
}

.section-title {
  font-size: clamp(1.65rem, 2.8vw, 2.35rem);
  line-height: 1.2;
  letter-spacing: -0.035em;
  margin-bottom: 12px;
  font-weight: 700;
}

.section-subtitle {
  max-width: 720px;
  margin: 0 auto 36px;
  color: var(--text-muted);
  line-height: 1.7;
  font-size: 1.02rem;
}

/* ---------- Cards & Search ---------- */
.search-card,
.calculator-card,
.quotation-card,
.brands-strip,
.admin-container,
.admin-login-box {
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background: var(--card-bg);
  box-shadow: var(--shadow-soft);
}

.search-card {
  padding: clamp(22px, 3vw, 32px);
}

.search-header {
  margin-bottom: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.search-header h3 {
  font-size: 1.12rem;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.search-grid,
.calc-grid,
.quote-grid {
  gap: 16px;
}

.filter-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-main);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.form-control {
  min-height: 46px;
  width: 100%;
  border: 1.5px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  background: var(--bg-white);
  color: var(--text-main);
  font: inherit;
  font-size: 0.9rem;
  transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.form-control:hover {
  border-color: #cbd5e1;
}

.form-control:focus {
  outline: 0;
  border-color: var(--accent-red);
  box-shadow: 0 0 0 4px rgba(196, 30, 42, 0.1);
}

textarea.form-control {
  min-height: 120px;
  resize: vertical;
}

/* ---------- Vehicle cards ---------- */
.vehicle-grid {
  gap: 22px;
}

.vehicle-card {
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  background: var(--card-bg);
  box-shadow: var(--shadow-xs);
  transition: transform var(--transition-slow), box-shadow var(--transition-slow), border-color var(--transition);
}

.vehicle-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(196, 30, 42, 0.2);
}

.card-img-wrap {
  overflow: hidden;
  background: var(--bg-light);
  aspect-ratio: 16 / 10;
}

.card-img {
  transition: transform 0.5s cubic-bezier(0.2, 0.7, 0.2, 1);
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vehicle-card:hover .card-img {
  transform: scale(1.05);
}

.card-body {
  padding: 18px 18px 20px;
}

.card-title {
  font-size: 1.05rem;
  line-height: 1.35;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.card-trim {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.card-price {
  margin: 10px 0;
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--accent-red);
}

.card-specs {
  gap: 8px 12px;
}

.spec-item {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.card-actions {
  gap: 8px;
  margin-top: 16px;
}

.card-actions .btn {
  flex: 1 1 auto;
  padding: 9px 12px;
  font-size: 0.8rem;
  min-height: 40px;
}

.card-badge,
.verified-badge,
.sold-badge,
.status-available,
.status-sold {
  border-radius: var(--radius-pill);
  font-weight: 700;
  letter-spacing: 0.02em;
  font-size: 0.7rem;
  text-transform: uppercase;
}

/* ---------- Brands & Features ---------- */
.brand-grid {
  gap: 14px;
}

.brand-card {
  min-height: 110px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: none;
  background: var(--card-bg);
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
}

.brand-card:hover {
  transform: translateY(-3px);
  border-color: rgba(196, 30, 42, 0.25);
  box-shadow: var(--shadow-soft);
}

.features-grid,
.job-grid {
  gap: 20px;
}

.feature-card,
.service-card,
.job-card {
  overflow: hidden;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  background: var(--card-bg);
  box-shadow: var(--shadow-soft);
}

.feature-card,
.service-card {
  transition: transform var(--transition), box-shadow var(--transition);
}

.feature-card:hover,
.service-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
}

.feature-card h3,
.service-card h3,
.job-card h3 {
  letter-spacing: -0.02em;
  font-weight: 700;
}

/* ---------- Calculator & Quotation ---------- */
.quotation-card,
.calculator-card {
  padding: clamp(22px, 3vw, 36px);
}

/* ---------- Modals ---------- */
.modal-overlay {
  padding: 20px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  background: rgba(11, 22, 40, 0.7);
}

.modal-card {
  border: 1px solid var(--border-color);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  background: var(--card-bg);
}

/* ---------- Admin ---------- */
.admin-container {
  padding: clamp(20px, 3vw, 32px);
}

.admin-tabs {
  gap: 6px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.admin-tab-btn {
  border-radius: var(--radius-md);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background var(--transition), color var(--transition), box-shadow var(--transition);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
}

.admin-tab-btn:hover {
  background: var(--bg-light);
  color: var(--text-main);
}

.admin-tab-btn.active {
  background: var(--accent-soft);
  color: var(--accent-red);
  box-shadow: 0 2px 8px rgba(196, 30, 42, 0.1);
  border-color: rgba(196, 30, 42, 0.15);
}

.admin-content-pane {
  padding-top: 24px;
}

.table-responsive {
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--card-bg);
}

.admin-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--card-bg);
  font-size: 0.85rem;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--bg-light);
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
  white-space: nowrap;
}

.admin-table th,
.admin-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

.admin-table tr:last-child td {
  border-bottom: 0;
}

.admin-table tbody tr {
  transition: background var(--transition);
}

.admin-table tbody tr:hover {
  background: rgba(148, 163, 184, 0.08);
}

.stats-grid {
  gap: 16px;
}

.stat-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 22px;
  background: var(--card-bg);
  transition: transform var(--transition), box-shadow var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.stat-number {
  letter-spacing: -0.04em;
  font-weight: 800;
  font-size: 1.75rem;
  color: var(--primary-dark);
}

/* ---------- Image previews ---------- */
.image-preview-grid .preview-item,
.image-preview-item {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

/* ---------- Footer ---------- */
footer {
  margin-top: 40px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-light);
  padding-top: 48px;
  padding-bottom: 32px;
}

.footer-grid {
  gap: 32px;
}

.footer-col h4 {
  letter-spacing: -0.02em;
  font-weight: 700;
  margin-bottom: 14px;
  font-size: 0.95rem;
}

.footer-links a {
  transition: color var(--transition), transform var(--transition);
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-links a:hover {
  color: var(--accent-red);
  transform: translateX(3px);
}

.social-links a {
  border-radius: var(--radius-md);
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.social-links a:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-soft);
  background: var(--accent-red);
  color: #fff;
  border-color: var(--accent-red);
}

/* ---------- Utilities ---------- */
#apiStatusBar:empty {
  display: none;
}

#toastStack {
  z-index: 10050;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent-red);
}

img {
  max-width: 100%;
  height: auto;
}

/* Blog polish */
.blog-card {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-card);
  background: var(--card-bg);
  box-shadow: var(--shadow-xs);
  padding: 24px;
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.blog-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-hover);
  border-color: rgba(196, 30, 42, 0.15);
}

.blog-card h3 {
  letter-spacing: -0.02em;
  font-weight: 700;
}

/* Price slider polish */
.price-slider-wrap {
  padding: 8px 0;
}

.price-slider-values {
  display: flex;
  justify-content: space-between;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.price-slider-values strong {
  color: var(--text-main);
  font-weight: 700;
}

/* Toasts */
.toast {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

/* ---------- Responsive ---------- */
@media (min-width: 1200px) {
  .vehicle-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .container {
    width: min(100% - 36px, 1280px);
  }
  .nav-container {
    gap: 12px;
  }
  .nav-links a {
    padding: 8px 10px;
    font-size: 0.8rem;
  }
}

@media (max-width: 800px) {
  body {
    padding-top: 72px;
  }
  .navbar,
  .nav-container {
    min-height: 68px;
  }
  .logo img,
  .logo-img {
    height: 42px;
    max-width: 160px;
  }
  .container {
    width: min(100% - 28px, 1280px);
  }
  .hero {
    min-height: 480px;
  }
  .hero-content {
    padding-top: 56px;
    padding-bottom: 56px;
  }
  .hero h1 {
    font-size: clamp(2.1rem, 8vw, 3.2rem);
  }
  .page-section {
    padding-top: 32px;
    padding-bottom: 52px;
  }
  .search-grid,
  .calc-grid,
  .quote-grid {
    gap: 14px;
  }
  .vehicle-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
    gap: 16px;
  }
  .admin-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
  }
  .admin-tab-btn {
    flex: 0 0 auto;
  }
  footer {
    padding-top: 36px;
  }
}

@media (max-width: 480px) {
  .container {
    width: calc(100% - 24px);
  }
  .hero {
    min-height: 440px;
  }
  .hero h1 {
    font-size: 2rem;
  }
  .hero p {
    font-size: 0.95rem;
  }
  .btn {
    padding: 10px 14px;
    font-size: 0.82rem;
  }
  .search-card,
  .quotation-card,
  .calculator-card {
    padding: 16px;
    border-radius: 14px;
  }
  .section-title {
    font-size: 1.6rem;
  }
  .vehicle-grid {
    grid-template-columns: 1fr;
  }
  .card-body {
    padding: 15px;
  }
  .modal-overlay {
    padding: 12px;
  }
  .modal-card {
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    border-radius: 16px;
  }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
