/* Modern overrides: consistent header/main/footer, modal dialog, nav active */

/* Layout spacing */
main { max-width: 1100px; margin: 0 auto; padding: 24px; background: rgba(255,255,255,.60); border-radius: 10px; }
footer { margin-top: 24px; }
/* Make footer stick to bottom edge when it enters viewport */
footer { position: sticky; bottom: 0; z-index: 900; box-shadow: 0 -6px 18px rgba(0,0,0,.12); }

/* Sticky footer on short pages */
body { display:flex; min-height:100vh; flex-direction:column; }
main { flex: 1 0 auto; }

/* Header banner height, balanced across pages */
.hero-header { min-height: var(--hdr-h); position: sticky; top: 0; z-index: 1000; transition: none; }
.hero-content { padding: 10px 3vw; }
/* Stuck state: only visual (no reflow) */
.hero-header.is-stuck { box-shadow: 0 6px 18px rgba(0,0,0,.12); backdrop-filter: saturate(1.1) blur(2px); }
.hero-header.is-stuck .hero-logo { filter: none; }
.hero-header.is-stuck .hero-title { opacity: .98; }

/* Nav active state */
.hero-topbar nav a.active { color: #12ff2e; }
.hero-topbar nav a.active::after { width: 100%; }

/* Smaller centered modal dialog with overlay */
body.ac-no-scroll { overflow: hidden; }
.ac-hero-modal { position: fixed; inset: 0; display: none; z-index: 100000; align-items: center; justify-content: center; padding: 16px; }
.ac-hero-modal[aria-hidden="false"] { display: flex; }
.ac-hero-modal__bg { display: none; }
.ac-hero-modal__shade { position: absolute; inset: 0; background: rgba(0,0,0,.45); backdrop-filter: blur(1px); }
.ac-hero-modal__content {
  position: relative; text-align: center; color: #0f172a; background: #ffffff;
  width: min(92vw, 640px); max-width: 640px; margin: 0; padding: clamp(16px, 3vw, 28px);
  border-radius: 16px; box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.ac-hero-modal__title { color: #10b981; text-shadow: none; }
.ac-hero-modal__subtitle { color: #475569; }
.ac-hero-modal__logo span { color: #0f172a; font-weight: 700; }
.ac-hero-modal__close {
  position: absolute; top: 10px; right: 12px; background: transparent; border: 0; cursor: pointer;
  font-size: 24px; line-height: 1; color: #64748b; padding: 4px; border-radius: 8px;
}
.ac-hero-modal__close:hover { background: #f1f5f9; color: #0f172a; }
.ac-hero-modal .btn--secondary { color: #0f172a; border-color: #cbd5e1; }

/* Gallery basics (no external lightbox) */
.gallery { display: grid; gap: 12px; }
.gallery .main-img { width: 100%; max-height: 60vh; object-fit: cover; border-radius: 10px; box-shadow: 0 2px 16px rgba(0,0,0,.15); }
.gallery-thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px,1fr)); gap: 10px; }
.gallery-thumbs .thumb { cursor: pointer; border-radius: 8px; border: 2px solid transparent; transition: transform .12s, border-color .12s; }
.gallery-thumbs .thumb:hover { transform: translateY(-2px); border-color: #10b981; }

/* Search page: sticky filters and responsive grid */
.filters {
  position: sticky;
  top: var(--hdr-h); /* keep below sticky header */
  z-index: 50;
  background: rgba(255,255,255,.9);
  backdrop-filter: blur(3px);
  padding: 10px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.08);
}
.filters input, .filters select { padding: 8px 10px; border: 1px solid #cbd5e1; border-radius: 8px; }
.filters button { margin-left: 6px; }

.cars-grid { 
  display: grid; gap: 16px; 
  /* slightly smaller cards so more fit per row */
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  margin-top: 16px;
}
.car-card { border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; }
/* Ensure image always fills the media area (no dark band) */
.car-card .car-media { aspect-ratio: 16/10; }
.car-card .car-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.car-card .car-body { padding: 10px 12px; }
.car-card .car-actions { padding: 0 12px 12px; }

/* Cars page: transparent cards and grid distribution */
.cars-grid .car-card { background: rgba(255,255,255,.75); border: 1px solid #cbd5e1; box-shadow: 0 2px 10px rgba(0,0,0,.06); width:auto; }
/* keep a subtle separator below the image; looks like a light border */
.cars-grid .car-media{ background: rgba(15,23,42,.85); border-bottom:1px solid #e5e7eb; }
.cars-grid .car-title { color: #0f172a; }
.cars-grid .car-specs { color:#334155; }
.cars-grid .car-price { color:#0f172a; }
.cars-grid { grid-auto-rows: 1fr; }

/* Admin helpers */
.form-card {
  background: #ffffff; padding: 2px; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.08);
  margin: 1px auto; display: flex; flex-direction: column; gap: 10px;
}
.form-card input, .form-card textarea, .form-card select { padding: 10px 12px; border:1px solid #cbd5e1; border-radius: 10px; margin:8px 0 12px; }
.auth-center{ min-height: calc(100vh - 90px); display:grid; place-items:center; }
.auth-center.nofull{ min-height: initial; display:flex; justify-content:center; }
.form-card.auth{ max-width: 420px; background:#f7f9fc; border:1px solid #e9eef7; box-shadow: 0 10px 30px rgba(0,0,0,.08); padding: 28px 24px; }
.admin-subnav { display:flex; gap:12px; align-items:center; padding:10px; background:#f8fafc; border-radius:10px; box-shadow:0 1px 8px rgba(0,0,0,.06); }
.admin-subnav a { color:#0f172a; font-weight:600; }
.alert { background:#ecfeff; border:1px solid #a5f3fc; color:#164e63; padding:8px 12px; border-radius:8px; }
.alert.error { background:#fee2e2; border-color:#fecaca; color:#991b1b; }

/* Drag list for gallery ordering */
.drag-list { list-style:none; margin:8px 0; padding:0; display:flex; gap:8px; flex-wrap:wrap; }
.drag-item { display:flex; align-items:center; gap:6px; padding:6px; border:1px dashed #cbd5e1; border-radius:8px; background:#fff; cursor:grab; }
.drag-item.dragging { opacity:.6; }
.drag-item img { width:72px; height:54px; object-fit:cover; border-radius:6px; display:block; }
.drag-item .del { color:#991b1b; }
.comments-section{ background: rgba(241,245,249,.7); border-radius:10px; padding:12px; box-shadow: 0 1px 6px rgba(0,0,0,.06); max-width: none; width: calc(100% - 96px); margin-left:auto; margin-right:auto; }
.comments-section h2{ margin: 6px 0 8px; }
.rating-summary{ display:flex; align-items:center; gap:8px; margin-bottom:6px; color:#111827; }
.rating-summary .avg{ font-size: 1.2rem; font-weight: 800; }
.rating-summary .count{ color:#475569; font-size:.95em; }
.comment.compact{ background:transparent; padding:6px 0 6px 8px; border-bottom:1px dashed #cbd5e1; }
.comment.compact .row{ display:flex; align-items:center; gap:8px; font-size:.92em; color:#0f172a; }
.comment.compact .text{ font-size:.92em; color:#475569; margin-top:2px; }
.comments-title{ font-size:1.1rem; margin-bottom:8px; }
.no-reviews{ color:#475569; font-size:.95em; }
.rating-summary .star-lg{ color:#f59e0b; font-size:20px; }
.rating-summary .avg{ font-weight:800; }
.rating-summary .count{ font-size:.9em; color:#475569; margin-left:6px; }
.rating-row{ display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.name-field{ flex:1 1 160px; }
.captcha-field{ width:120px; }
.comment-field{ width:100%; margin-top:6px; }
.mt-6{ margin-top:6px; }
.mt-10{ margin-top:10px; }
.hidden{ display:none; }
.stars{ color:#f59e0b; }
.stars-input{ display:inline-flex; flex-direction: row-reverse; }
.stars-input input{ display:none; }
.stars-input label{ cursor:pointer; color:#cbd5e1; font-size:20px; padding:0 2px; }
.stars-input input:checked ~ label, .stars-input label:hover, .stars-input label:hover ~ label{ color:#f59e0b; }
.admin-body { background:#e9eef7; }
.admin-shell { min-height: 100vh; display:flex; flex-direction:column; background:#e9eef7; }
.admin-topbar { position:sticky; top:0; z-index:1000; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 18px; background:linear-gradient(180deg,#ffffff 0%, #eef2f9 100%); color:#0f172a; border-bottom:1px solid #d9e0eb; box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.admin-topbar { flex-wrap: wrap; }
.admin-topbar .site-nav ul{ display:flex; gap:12px; flex-wrap:wrap; }
.admin-topbar .site-nav{ margin-left:auto; }
@media (max-width: 900px){
  .admin-topbar .site-nav{ width:100%; order: 2; }
}
.admin-topbar .logo-wrap{ display:flex; align-items:center; gap:12px; }
.admin-topbar .admin-brand { display:flex; align-items:center; gap:12px; font-weight:800; letter-spacing:.4px; }
.admin-topbar .admin-brand img { height: 56px; width:auto; display:block; background:#fff; padding:6px; border:1px solid #e5e7eb; border-radius:12px; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.admin-topbar .admin-brand span { color:#0f172a; }
.admin-main { flex:1; padding: 16px; width: min(1500px, calc(100vw - 48px)); max-width: none; margin: 0 auto; }
.admin-subnav { background: transparent; box-shadow:none; }
.admin-subnav a { color:#0f172a; }
.admin-subnav a:hover { color:#1450a3; }

.admin-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(260px,1fr)); gap: 16px; margin-top: 10px; width:100%; }
@media (min-width: 1200px){ .admin-grid { grid-template-columns: repeat(3, minmax(260px,1fr)); } }
@media (min-width: 1600px){ .admin-grid { grid-template-columns: repeat(4, minmax(260px,1fr)); } }
.card-btn { display:block; background:#fff; border-radius:12px; padding:14px; box-shadow: 0 2px 10px rgba(0,0,0,.08); color:#0f172a; text-decoration:none; }
.card-btn .card-ico { font-size: 26px; }
.card-btn .card-title { font-weight:800; margin: 4px 0; }
.card-btn .card-sub { color:#475569; font-size:.9em; }

/* Homepage strip: keep horizontal scroll with 3+ cards visible */
/* Use defaults from css/style.css (flex row, snap). No override here. */

/* ---- Admin modal for Add/Edit car ---- */
.modal{ position: fixed; inset: 0; display:none; z-index:100000; }
.modal[aria-hidden="false"], .modal.is-open{ display:flex; align-items:center; justify-content:center; }
.modal__backdrop{ position:absolute; inset:0; background: rgba(0,0,0,.55); }
.modal__dialog{ position:relative; max-width: 760px; width: min(94vw, 760px); margin: 0 auto; background:#fff; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.35); padding: 16px 16px 8px; }
.modal__close{ position:absolute; top:8px; right:10px; background:transparent; border:0; font-size:26px; cursor:pointer; color:#334155; }

/* Admin widths + mobile cards */
.admin-main .page-head{ width:100%; }
.admin-main .cars-table-wrap{ width:98%; }
@media (max-width: 700px){
  .cars-table-wrap{ overflow:visible; }
  .cars-table{ min-width: initial; width:100%; border-collapse: separate; border-spacing: 0 10px; }
  .cars-table thead{ display:none; }
  .cars-table tr{ display:block; background:#fff; border:1px solid #e5e7eb; border-radius:12px; box-shadow:0 2px 10px rgba(0,0,0,.06); padding:10px; }
  .cars-table td{ display:flex; align-items:center; justify-content:space-between; padding:6px 6px; border-bottom:0; }
  .cars-table td:first-child{ justify-content:flex-start; gap:10px; }
  .cars-table td:last-child{ justify-content:flex-start; gap:10px; flex-wrap:wrap; }
  .cars-table a.btn, .cars-table a{ display:inline-block; }
}

/* Match gallery width on small screens (cars-strip-wrap uses 12px padding) */
@media (max-width: 650px){
  .comments-section{ width: calc(100% - 24px); }
}
/* Responsive navigation */
.nav-toggle{ display:none; background:transparent; color:#fff; border:1px solid rgba(255,255,255,.35); border-radius:8px; padding:6px 10px; }
.site-nav{ position:relative; }
@media (max-width: 900px){
  .hero-topbar{ align-items: center; }
  .nav-toggle{ display:inline-block; }
  .hero-topbar{ gap:10px 16px; }
  .site-nav{ position: fixed; top: var(--hdr-h); left: -100vw; height: calc(100vh - var(--hdr-h)); width: 74vw; max-width: 360px; background:#0f172a; color:#fff; box-shadow: 8px 0 24px rgba(0,0,0,.35); transition: left .25s ease; padding:16px; }
  .site-nav ul{ flex-direction: column; gap:10px; }
  body.nav-open .site-nav{ left:0; }
}
@media (max-width: 650px){
  .hero-topbar{ flex-direction: column; align-items: flex-start; }
  .site-nav{ width: 100vw; max-width: none; left: -100vw; }
  body.nav-open .site-nav{ left:0; }
}

/* Breadcrumbs */
.breadcrumbs{ display:flex; flex-wrap:wrap; gap:8px; font-size:.92em; color:#475569; padding:8px 0 4px; }
.breadcrumbs a{ color:#1450a3; }
.breadcrumbs .sep{ opacity:.5; }

/* Styled checkboxes for admin toggles */
.chk{ display:inline-flex; align-items:center; gap:6px; background:#f8fafc; border:1px solid #e5e7eb; padding:4px 8px; border-radius:8px; margin-right:6px; }
.chk input{ width:16px; height:16px; }

/* Toast */
.toast{ position: fixed; top:16px; right:16px; z-index:200000; background:#0f172a; color:#e5e7eb; padding:10px 14px; border-radius:10px; box-shadow:0 8px 24px rgba(0,0,0,.25); opacity:0; transform: translateY(-10px); transition: opacity .2s, transform .2s; }
.toast.show{ opacity:1; transform:none; }
