/* ============================================================
   UAEAutomall – Shared Stylesheet
   Used by: index.php, details.php
   ============================================================ */


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

:root {
  --brand:      #0057ff;
  --brand-dark: #0040c8;
  --brand-light:#e8efff;
  --surface:    #ffffff;
  --bg:         #f0f4f9;
  --bg2:        #e4eaf3;
  --text:       #0d1b2a;
  --text2:      #4a5568;
  --text3:      #8898aa;
  --border:     #dce3ee;
  --radius:     16px;
  --radius-sm:  10px;
  --shadow:     0 4px 24px rgba(13,27,42,0.08);
  --shadow-lg:  0 12px 48px rgba(13,27,42,0.14);
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}


/* ── Navigation
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  align-items: center;
}
.nav-inner {
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-logo {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--brand);
  text-decoration: none;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-logo svg { width: 28px; height: 28px; }

.nav-links { display: flex; gap: 4px; }
.nav-links a {
  color: var(--text2);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.nav-links a:hover { background: var(--brand-light); color: var(--brand); }

/* Back button (details page) */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 9px;
  color: var(--text2);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.btn-back:hover { border-color: var(--brand); color: var(--brand); }


/* ── Page layout
   ============================================================ */
.page-body {
  max-width: 1280px;
  margin: 0 auto;
  padding: 40px 24px;
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 32px;
  align-items: start;
}

/* Details page has different top padding */
.page-body--details { padding-top: 0; padding-bottom: 48px; }

/* Breadcrumb (details page) */
.breadcrumb {
  max-width: 1280px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text3);
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--brand); text-decoration: none; font-weight: 500; }
.breadcrumb a:hover { text-decoration: underline; }


/* ── Sidebar & Side Cards
   ============================================================ */
.sidebar { display: flex; flex-direction: column; gap: 20px; }

.side-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.side-card h3,
.side-card h5 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1.5px solid var(--border);
}
.ad-block { text-align: center; }

/* Feature list (index sidebar) */
.feature-list { list-style: none; }
.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text2);
  font-size: 0.845rem;
  line-height: 1.55;
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}
.feature-list li:last-child { border-bottom: none; }
.feature-list li .ico { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

/* Popular brands (index sidebar) */
.popular-list { display: flex; flex-direction: column; gap: 2px; }
.popular-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.84rem;
  color: var(--text2);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
}
.popular-item:hover { background: var(--brand-light); color: var(--brand); }
.popular-item .rank {
  width: 20px;
  height: 20px;
  background: var(--bg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text3);
}

/* Buyer checklist (details sidebar) */
.checklist { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.checklist li {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.845rem;
  color: var(--text2);
  line-height: 1.5;
}
.check-ico { color: #16a34a; flex-shrink: 0; font-weight: 700; font-size: 0.85rem; margin-top: 1px; }

/* Similar listings (details sidebar) */
.similar-list { display: flex; flex-direction: column; gap: 10px; }
.similar-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.12s;
  text-decoration: none;
  color: inherit;
}
.similar-item:hover { background: var(--bg); }
.similar-img {
  width: 56px;
  height: 42px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--bg2);
  flex-shrink: 0;
}
.similar-info { flex: 1; min-width: 0; }
.similar-name {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.similar-price { font-size: 0.75rem; font-weight: 700; color: var(--brand); }


/* ── Footer
   ============================================================ */
footer {
  background: #060f1e;
  color: rgba(255,255,255,0.5);
  text-align: center;
  padding: 32px 24px;
  font-size: 0.84rem;
}
.footer-inner { max-width: 1280px; margin: 0 auto; }
.footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.footer-links a { color: rgba(255,255,255,0.65); text-decoration: none; }
.footer-links a:hover { color: #fff; }


/* ── Shared Utilities
   ============================================================ */

/* Spinner */
.spinner {
  width: 44px;
  height: 44px;
  border: 3.5px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  margin: 0 auto 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Ad row (details page between sections) */
.ad-row {
  margin: 20px 0;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 16px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}


/* ── Hero (index page)
   ============================================================ */
.hero {
  background: linear-gradient(135deg, #001e6e 0%, #0057ff 60%, #0099ff 100%);
  position: relative;
  overflow: hidden;
  padding: 72px 24px 80px;
}
.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner {
  max-width: 1280px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 420px;
  gap: 48px;
  align-items: center;
  position: relative;
}
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 20px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.hero h1 {
  font-size: clamp(1.9rem, 3.5vw, 3.2rem);
  font-weight: 800;
  color: #fff;
  line-height: 1.1;
  letter-spacing: -1px;
  margin-bottom: 18px;
}
.hero h1 span { color: #7dd3fc; }
.hero-sub {
  color: rgba(255,255,255,0.82);
  font-size: 1.05rem;
  line-height: 1.65;
  max-width: 500px;
}
.hero-stats { display: flex; gap: 32px; margin-top: 36px; }
.hero-stat-val { font-size: 1.6rem; font-weight: 800; color: #fff; line-height: 1; }
.hero-stat-lbl { font-size: 0.78rem; color: rgba(255,255,255,0.65); font-weight: 500; margin-top: 3px; }


/* ── Search Form (index page)
   ============================================================ */
.search-card {
  background: #fff;
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow-lg);
}
.search-card h3 { font-size: 1rem; font-weight: 700; color: var(--text); margin-bottom: 20px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text2);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-group select,
.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-family: inherit;
  color: var(--text);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
  appearance: none;
}
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238898aa' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}
.form-group select:focus,
.form-group input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(0,87,255,0.12);
  background: #fff;
}
.btn-search {
  width: 100%;
  padding: 13px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 4px;
}
.btn-search:hover { background: var(--brand-dark); }
.btn-search:active { transform: scale(0.98); }


/* ── Listings (index page)
   ============================================================ */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-title { font-size: 1.3rem; font-weight: 800; color: var(--text); letter-spacing: -0.4px; }
.section-count { font-size: 0.82rem; color: var(--text3); font-weight: 500; }

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

/* Car card */
.car-card {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
  border: 1.5px solid transparent;
  display: flex;
  flex-direction: column;
}
.car-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: #c7d9ff;
}
.car-card-img {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16/10;
  background: var(--bg2);
  display: block;
}
.car-card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
  display: block;
}
.car-card:hover .car-card-img img { transform: scale(1.04); }

.car-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(0,87,255,0.88);
  color: #fff;
  font-size: 0.69rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}
.source-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0,0,0,0.55);
  color: rgba(255,255,255,0.85);
  font-size: 0.62rem;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 5px;
  letter-spacing: 0.2px;
}
.car-card-body { padding: 16px; flex: 1; display: flex; flex-direction: column; }
.car-title {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.car-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
.car-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg);
  color: var(--text2);
  font-size: 0.71rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
}
.car-price { font-size: 1.15rem; font-weight: 800; color: var(--brand); margin-top: auto; margin-bottom: 12px; }
.car-actions { display: flex; gap: 8px; }
.btn-details {
  flex: 1;
  padding: 9px 12px;
  background: var(--brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.15s;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}
.btn-details:hover { background: var(--brand-dark); }
.btn-ext {
  padding: 9px 12px;
  background: var(--bg);
  color: var(--text2);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: border-color 0.15s, color 0.15s;
}
.btn-ext:hover { border-color: var(--brand); color: var(--brand); }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, var(--bg2) 25%, #d8e0ec 50%, var(--bg2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-card { background: var(--surface); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.skeleton-img { aspect-ratio: 16/10; }
.skeleton-body { padding: 16px; }
.skeleton-line { height: 13px; margin-bottom: 10px; }

/* Empty / error state */
.empty-state {
  text-align: center;
  padding: 56px 24px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  grid-column: 1 / -1;
}
.empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state h3 { font-size: 1.1rem; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 0.875rem; color: var(--text3); }

/* Results bar */
.results-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  font-size: 0.875rem;
}
.results-bar strong { color: var(--brand); }
.btn-clear {
  background: none;
  border: 1.5px solid var(--border);
  color: var(--text2);
  font-size: 0.8rem;
  font-weight: 600;
  font-family: inherit;
  padding: 5px 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.btn-clear:hover { border-color: var(--brand); color: var(--brand); }


/* ── Car Detail (details page)
   ============================================================ */
.car-image-wrap {
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  aspect-ratio: 16/9;
  position: relative;
}
.car-image-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  color: var(--text3);
  gap: 10px;
  font-size: 0.85rem;
  font-weight: 500;
}

.car-header {
  padding: 24px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 20px;
}
.car-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.car-brand-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-light);
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.car-name { font-size: 1.6rem; font-weight: 800; color: var(--text); line-height: 1.2; letter-spacing: -0.5px; }
.car-subtitle { font-size: 0.9rem; color: var(--text3); margin-top: 6px; line-height: 1.5; }
.car-price-block { text-align: right; flex-shrink: 0; }
.car-price { font-size: 2rem; font-weight: 800; color: var(--brand); line-height: 1; }
.car-price-note { font-size: 0.75rem; color: var(--text3); margin-top: 4px; }

/* Specs */
.specs-section {
  margin-top: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.specs-header { padding: 18px 24px; border-bottom: 1.5px solid var(--border); }
.specs-header h2 { font-size: 1rem; font-weight: 700; color: var(--text); }
.specs-grid { display: grid; grid-template-columns: 1fr 1fr; }
.spec-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.spec-item:nth-child(even) { border-right: none; }
.spec-item:nth-last-child(-n+2) { border-bottom: none; }
.spec-icon {
  width: 36px;
  height: 36px;
  background: var(--brand-light);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 1rem;
}
.spec-label { font-size: 0.72rem; color: var(--text3); font-weight: 500; text-transform: uppercase; letter-spacing: 0.4px; }
.spec-value { font-size: 0.9rem; font-weight: 700; color: var(--text); margin-top: 2px; }

/* Description */
.desc-section {
  margin-top: 20px;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}
.desc-section h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1.5px solid var(--border);
}
.desc-text { font-size: 0.9rem; color: var(--text2); line-height: 1.7; }

/* Dealer card */
.dealer-card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.dealer-header {
  background: linear-gradient(135deg, #001e6e, #0057ff);
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.dealer-logo {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: rgba(255,255,255,0.15);
  border: 2px solid rgba(255,255,255,0.3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dealer-logo img { width: 100%; height: 100%; object-fit: cover; }
.dealer-logo-ph { font-size: 1.4rem; }
.dealer-name { font-size: 1rem; font-weight: 700; color: #fff; line-height: 1.3; }
.dealer-tag { font-size: 0.72rem; color: rgba(255,255,255,0.7); margin-top: 3px; font-weight: 500; }
.dealer-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 10px; }

.btn-wa {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px; background: #16a34a; color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 700;
  font-family: inherit; text-decoration: none; cursor: pointer; transition: background 0.15s;
}
.btn-wa:hover { background: #15803d; }

.btn-call {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 13px; background: var(--brand); color: #fff; border: none;
  border-radius: var(--radius-sm); font-size: 0.9rem; font-weight: 700;
  font-family: inherit; text-decoration: none; cursor: pointer; transition: background 0.15s;
}
.btn-call:hover { background: var(--brand-dark); }

.btn-listing {
  display: flex; align-items: center; justify-content: center; gap: 9px;
  padding: 11px; background: var(--bg); color: var(--text2);
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.85rem; font-weight: 600; font-family: inherit;
  text-decoration: none; cursor: pointer; transition: border-color 0.15s, color 0.15s;
}
.btn-listing:hover { border-color: var(--brand); color: var(--brand); }


/* ── Responsive
   ============================================================ */

/* Index page breakpoints */
@media (max-width: 1024px) {
  .page-body { grid-template-columns: 1fr; }
  .sidebar { display: grid; grid-template-columns: 1fr 1fr; }
}
@media (max-width: 768px) {
  .hero-inner { grid-template-columns: 1fr; }
  .hero { padding: 44px 20px 52px; }
  .hero-stats { gap: 20px; }
  .form-grid { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .page-body { padding: 24px 16px; }
}
@media (max-width: 480px) {
  .car-grid { grid-template-columns: 1fr; }
}

/* Details page breakpoints */
@media (max-width: 960px) {
  .dealer-card { grid-column: 1 / -1; }
}
@media (max-width: 640px) {
  .specs-grid { grid-template-columns: 1fr; }
  .spec-item { border-right: none; }
  .spec-item:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }
  .spec-item:last-child { border-bottom: none; }
  .car-name { font-size: 1.3rem; }
  .car-price { font-size: 1.5rem; }
  .page-body--details { padding: 0 16px 40px; }
}
