:root {
  --bg: #1c1c1f;
  --bg-soft: #232326;
  --surface: #27272b;
  --surface-hover: #303034;
  --border: #3a3a3f;
  --border-hover: #56565c;
  --text: #f1f1f2;
  --text-muted: #9a9aa1;
  --primary: #22c55e;
  --primary-hover: #4ade80;
  --accent: #22c55e;
  --accent-rgb: 34, 197, 94;
  --danger: #f87171;
  --danger-rgb: 248, 113, 113;
  --warning: #d69e2e;
  --warning-rgb: 214, 158, 46;
  --header-bg: rgba(28, 28, 31, 0.9);
  --radius: 14px;
  --font-body: 'Inter', system-ui, sans-serif;
  --font-heading: 'Space Grotesk', system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  transition: background 0.2s, color 0.2s;
}

h1, h2, h3, .logo {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---- Header ---- */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--header-bg);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}
.logo {
  font-size: 1.3rem;
  color: var(--text);
}
.logo span { color: var(--primary); }
.site-header .logo { display: inline-flex; align-items: center; gap: 10px; white-space: nowrap; }
.main-nav a { white-space: nowrap; }
.site-header .logo .logo-text { color: var(--text); }
.logo-icon { width: 36px; height: 36px; flex-shrink: 0; color: var(--primary); }
.main-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-weight: 500;
}
.main-nav a { color: var(--text-muted); transition: color 0.15s; }
.main-nav a:hover { color: var(--text); }

/* ---- Flash ---- */
.flash {
  margin-top: 16px;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-weight: 500;
}
.flash-success { background: rgba(var(--accent-rgb), 0.12); color: var(--accent); border: 1px solid rgba(var(--accent-rgb), 0.3); }
.flash-error { background: rgba(var(--danger-rgb), 0.12); color: var(--danger); border: 1px solid rgba(var(--danger-rgb), 0.3); }

/* ---- Hero ---- */
.hero {
  padding: 72px 0 48px;
  background:
    radial-gradient(circle at 85% 0%, rgba(var(--accent-rgb), 0.06), transparent 40%);
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  margin: 0 0 12px;
}
.hero h1 span { color: var(--primary); }
.hero p { color: var(--text-muted); font-size: 1.1rem; margin: 0; }

/* ---- Filters ---- */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 24px 0;
}
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}
.filter-group label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input, select, textarea, button {
  font-family: inherit;
  font-size: 0.95rem;
}
input, select, textarea {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 10px 12px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 9px;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-danger { background: rgba(var(--danger-rgb), 0.12); color: var(--danger); border-color: rgba(var(--danger-rgb), 0.3); }
.btn-danger:hover { background: rgba(var(--danger-rgb), 0.22); }
.btn-large { padding: 14px 28px; font-size: 1rem; }
.btn-sm { padding: 6px 12px; font-size: 0.82rem; }

/* ---- Vehicle grid ---- */
.section-title { margin: 32px 0 20px; font-size: 1.4rem; }
.vehicle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 22px;
  padding-bottom: 60px;
}
.vehicle-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.15s, border-color 0.15s;
  display: block;
  box-shadow: 0 1px 3px rgba(16, 32, 26, 0.04);
}
.vehicle-card:hover {
  transform: translateY(-4px);
  border-color: var(--border-hover);
}
.vehicle-card-img { position: relative; aspect-ratio: 4 / 3; background: var(--bg-soft); }
.vehicle-card-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.no-image {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.85rem;
}
.badge {
  position: absolute;
  top: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.badge-type { left: 10px; background: rgba(10, 15, 12, 0.72); color: #fff; backdrop-filter: blur(4px); }
.badge-sold { right: 10px; background: var(--danger); color: #fff; }
.badge-reserve { right: 10px; background: var(--warning); color: #1c1c1f; }
.vehicle-card-body { padding: 16px; }
.vehicle-card-body h3 { margin: 0 0 4px; font-size: 1.1rem; }
.vehicle-meta { color: var(--text-muted); font-size: 0.85rem; margin: 0 0 8px; }
.vehicle-price { color: var(--primary); font-weight: 700; font-size: 1.15rem; margin: 0; }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  margin: 24px 0 60px;
}
.not-found { padding: 80px 20px; margin-top: 40px; }

/* ---- Vehicle detail ---- */
.vehicle-detail { padding-top: 32px; padding-bottom: 80px; }
.back-link { display: inline-block; color: var(--text-muted); margin-bottom: 20px; }
.back-link:hover { color: var(--text); }
.vehicle-detail-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 40px;
}
@media (max-width: 860px) { .vehicle-detail-grid { grid-template-columns: minmax(0, 1fr); } }

.gallery-main { border-radius: var(--radius); overflow: hidden; aspect-ratio: 4/3; background: var(--surface); border: 1px solid var(--border); }
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.gallery-thumb { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; cursor: pointer; border: 2px solid transparent; opacity: 0.7; }
.gallery-thumb:hover { opacity: 1; border-color: var(--border-hover); }

.vehicle-info h1 { font-size: 1.9rem; margin: 10px 0 4px; }
.vehicle-price-big { color: var(--primary); font-size: 1.6rem; font-weight: 700; margin: 0 0 20px; }
.spec-list { list-style: none; padding: 0; margin: 0 0 24px; border-top: 1px solid var(--border); }
.spec-list li { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); }
.spec-list li span { color: var(--text-muted); }
.vehicle-description { margin-bottom: 28px; }
.vehicle-description h2 { font-size: 1.1rem; margin-bottom: 8px; }
.vehicle-description p { color: var(--text-muted); white-space: pre-line; }

.vehicle-actions { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.vehicle-actions form { width: 100%; }
.vehicle-actions .btn-large { width: 100%; white-space: normal; text-align: center; }
.payment-note { color: var(--text-muted); font-size: 0.82rem; margin: 0; }

/* ---- Contact ---- */
.contact-page { padding-top: 40px; padding-bottom: 80px; max-width: 640px; }
.contact-page h1 { margin-bottom: 8px; }
.lead { color: var(--text-muted); margin-bottom: 24px; }
.contact-vehicle-ref {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 24px;
}
.contact-vehicle-ref img { width: 80px; height: 60px; object-fit: cover; border-radius: 8px; }
.contact-vehicle-ref span { display: block; color: var(--text-muted); font-size: 0.85rem; }
.contact-form, .vehicle-form, .auth-form { display: flex; flex-direction: column; gap: 18px; }
.form-row { display: flex; flex-direction: column; gap: 6px; }
.form-row label { font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* ---- Auth ---- */
.auth-page { padding-top: 60px; padding-bottom: 60px; display: flex; justify-content: center; }
.auth-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px; width: 100%; max-width: 400px;
}
.auth-box h1 { margin: 0 0 6px; }

/* ---- Admin ---- */
.admin-page { padding-top: 32px; padding-bottom: 80px; }
.admin-toolbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.admin-toolbar-actions { display: flex; align-items: center; gap: 10px; }
.pill { background: var(--primary); color: #fff; border-radius: 999px; padding: 2px 8px; font-size: 0.72rem; font-weight: 700; margin-left: 6px; }
.admin-table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 800px; }
.admin-table th, .admin-table td { padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { color: var(--text-muted); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.admin-thumb { width: 60px; height: 44px; object-fit: cover; border-radius: 6px; }
.admin-thumb.no-image { display: flex; align-items: center; justify-content: center; background: var(--bg-soft); color: var(--text-muted); }
.admin-actions { display: flex; gap: 8px; }
.status-tag { padding: 4px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; }
.status-disponible { background: rgba(var(--accent-rgb), 0.14); color: var(--accent); }
.status-vendu { background: rgba(var(--danger-rgb), 0.14); color: var(--danger); }
.status-reserve { background: rgba(var(--warning-rgb), 0.16); color: var(--warning); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 18px; margin-bottom: 18px; }
.existing-images { display: flex; flex-wrap: wrap; gap: 14px; }
.existing-image { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted); }
.existing-image img { width: 100px; height: 75px; object-fit: cover; border-radius: 8px; }

/* ---- Messages ---- */
.message-list { display: flex; flex-direction: column; gap: 16px; }
.message-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.message-unread { border-color: var(--primary); }
.message-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.message-date { color: var(--text-muted); font-size: 0.8rem; margin-left: 10px; }
.message-contact-info { display: flex; gap: 18px; color: var(--text-muted); font-size: 0.88rem; margin-bottom: 8px; }
.message-contact-info a { color: var(--accent); }
.message-vehicle-ref { display: inline-block; background: var(--bg-soft); padding: 4px 10px; border-radius: 999px; font-size: 0.8rem; margin-bottom: 10px; color: var(--text-muted); }
.message-content { white-space: pre-line; margin: 0 0 12px; }
.message-actions { display: flex; gap: 8px; }

/* ---- Footer ---- */
.site-footer { border-top: 1px solid var(--border); margin-top: 40px; padding: 40px 0 20px; color: var(--text-muted); }
.footer-inner { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 24px; }
.footer-logo { font-size: 1.1rem; margin-bottom: 8px; }
.footer-links { display: flex; flex-direction: column; gap: 8px; }
.footer-bottom { margin-top: 24px; font-size: 0.8rem; text-align: center; opacity: 0.7; }

@media (max-width: 640px) {
  .main-nav { gap: 14px; font-size: 0.85rem; }
  .header-inner { height: 60px; }
  .logo-icon { width: 28px; height: 28px; }
  .site-header .logo { font-size: 1.1rem; gap: 8px; }
}

@media (max-width: 480px) {
  .nav-long { display: none; }
}
