/* ===== RESET & BASE ===== */
* { margin: 0; padding: 0; box-sizing: border-box; }
:root {
  --primary: #e63946;
  --primary-dark: #c1121f;
  --dark: #1d3557;
  --darker: #14213d;
  --light: #f1faee;
  --gray: #6c757d;
  --border: #e0e0e0;
  --success: #2a9d8f;
  --warning: #f4a261;
}
html { scroll-behavior: smooth; }
body {
  font-family: 'Poppins', sans-serif;
  color: #333;
  background: #fafafa;
  line-height: 1.6;
}
.container { max-width: 1200px; margin: 0 auto; padding: 0 20px; }
img { max-width: 100%; display: block; }
a { text-decoration: none; color: inherit; }

/* ===== NAVBAR ===== */
.navbar {
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
  position: sticky; top: 0; z-index: 1000;
}
.nav-container {
  display: flex; justify-content: space-between; align-items: center;
  padding: 15px 20px;
}
.logo { font-size: 1.4rem; font-weight: 700; color: var(--dark); }
.logo span { color: var(--primary); }
.nav-links { display: flex; gap: 30px; list-style: none; align-items: center; }
.nav-links a { font-weight: 500; transition: color 0.3s; }
.nav-links a:hover, .nav-links a.active { color: var(--primary); }
.btn-nav {
  background: var(--primary); color: #fff !important;
  padding: 8px 20px; border-radius: 25px; transition: 0.3s;
}
.btn-nav:hover { background: var(--primary-dark); transform: translateY(-2px); }
.hamburger { display: none; font-size: 1.6rem; cursor: pointer; }

/* ===== HERO ===== */
.hero {
  background: linear-gradient(135deg, var(--darker) 0%, var(--dark) 100%);
  color: #fff; padding: 100px 0; text-align: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: ''; position: absolute; top: -50%; right: -20%;
  width: 600px; height: 600px; border-radius: 50%;
  background: rgba(230,57,70,0.15);
}
.hero-content { position: relative; z-index: 1; }
.hero h1 { font-size: 3rem; margin-bottom: 15px; line-height: 1.2; }
.hero h1 span { color: var(--primary); }
.hero p { font-size: 1.2rem; opacity: 0.9; max-width: 600px; margin: 0 auto 30px; }
.hero-btns { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 50px; justify-content: center; margin-top: 50px; flex-wrap: wrap; }
.hero-stats h3 { font-size: 2rem; color: var(--primary); }
.hero-stats p { font-size: 0.9rem; opacity: 0.8; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-block; padding: 12px 30px; border-radius: 30px;
  font-weight: 600; cursor: pointer; border: none; font-size: 1rem;
  transition: 0.3s; text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-2px); box-shadow: 0 5px 15px rgba(230,57,70,0.3); }
.btn-outline { background: transparent; color: #fff; border: 2px solid #fff; }
.btn-outline:hover { background: #fff; color: var(--dark); }
.full-width { width: 100%; }

/* ===== SECTIONS ===== */
.section { padding: 70px 0; }
.section-title { text-align: center; font-size: 2.2rem; color: var(--dark); margin-bottom: 10px; }
.section-sub { text-align: center; color: var(--gray); margin-bottom: 40px; }
.center-btn { text-align: center; margin-top: 40px; }

/* ===== CAR GRID ===== */
.car-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 25px;
}
.car-card {
  background: #fff; border-radius: 15px; overflow: hidden;
  box-shadow: 0 3px 15px rgba(0,0,0,0.08); transition: 0.3s;
}
.car-card:hover { transform: translateY(-8px); box-shadow: 0 10px 30px rgba(0,0,0,0.15); }
.car-card img { width: 100%; height: 200px; object-fit: cover; }
.car-card-body { padding: 20px; }
.car-card-body h3 { color: var(--dark); font-size: 1.2rem; margin-bottom: 5px; }
.car-year { color: var(--gray); font-size: 0.9rem; margin-bottom: 10px; }
.car-price { color: var(--primary); font-size: 1.4rem; font-weight: 700; margin-bottom: 15px; }
.car-card-actions { display: flex; gap: 10px; }
.car-card-actions .btn { padding: 8px 15px; font-size: 0.85rem; flex: 1; }

/* ===== FEATURES ===== */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 25px; }
.feature-card {
  background: #fff; padding: 30px 20px; border-radius: 15px; text-align: center;
  box-shadow: 0 3px 15px rgba(0,0,0,0.06); transition: 0.3s;
}
.feature-card:hover { transform: translateY(-5px); }
.feature-icon { font-size: 2.5rem; margin-bottom: 15px; }
.feature-card h3 { color: var(--dark); margin-bottom: 10px; }
.feature-card p { color: var(--gray); font-size: 0.9rem; }

/* ===== CTA ===== */
.cta { background: var(--primary); color: #fff; padding: 60px 0; text-align: center; }
.cta h2 { font-size: 2rem; margin-bottom: 10px; }
.cta p { margin-bottom: 25px; opacity: 0.95; }
.cta .btn-primary { background: #fff; color: var(--primary); }
.cta .btn-primary:hover { background: var(--dark); color: #fff; }

/* ===== PAGE HEADER ===== */
.page-header {
  background: linear-gradient(135deg, var(--dark), var(--darker));
  color: #fff; padding: 60px 0; text-align: center;
}
.page-header h1 { font-size: 2.5rem; margin-bottom: 10px; }
.page-header p { opacity: 0.9; }

/* ===== FILTER BAR ===== */
.filter-bar {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 15px;
  background: #fff; padding: 20px; border-radius: 15px;
  box-shadow: 0 3px 15px rgba(0,0,0,0.06); margin-bottom: 25px;
}
.filter-bar input, .filter-bar select {
  padding: 12px 15px; border: 2px solid var(--border); border-radius: 10px;
  font-family: inherit; font-size: 0.95rem; outline: none; transition: 0.3s;
}
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--primary); }
.car-count { color: var(--gray); margin-bottom: 20px; font-size: 0.95rem; }
.no-results { text-align: center; padding: 50px; color: var(--gray); }

/* ===== CAR DETAIL ===== */
.back-link { color: var(--primary); font-weight: 500; display: inline-block; margin-bottom: 25px; }
.car-detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.car-detail-img img { width: 100%; border-radius: 15px; box-shadow: 0 5px 20px rgba(0,0,0,0.1); }
.car-detail-info h1 { color: var(--dark); font-size: 2rem; margin-bottom: 10px; }
.car-year { color: var(--gray); margin-bottom: 15px; }
.car-price { color: var(--primary); font-size: 2rem; margin-bottom: 25px; }
.car-specs { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 25px; }
.car-specs div { background: #fff; padding: 15px; border-radius: 10px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.car-specs strong { display: block; color: var(--gray); font-size: 0.85rem; margin-bottom: 3px; }
.car-desc { color: #555; margin-bottom: 25px; }
.car-actions { display: flex; gap: 15px; flex-wrap: wrap; }
.car-actions .btn-outline { color: var(--primary); border-color: var(--primary); }
.car-actions .btn-outline:hover { background: var(--primary); color: #fff; }

/* ===== AUTH PAGES ===== */
.auth-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--dark), var(--darker));
}
.admin-auth { background: linear-gradient(135deg, #2b2d42, #1a1a2e); }
.auth-container { width: 100%; max-width: 450px; padding: 20px; }
.auth-card {
  background: #fff; padding: 40px; border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.auth-logo { display: block; text-align: center; font-size: 1.5rem; font-weight: 700; color: var(--dark); margin-bottom: 20px; }
.auth-card h2 { text-align: center; color: var(--dark); margin-bottom: 5px; }
.auth-sub { text-align: center; color: var(--gray); font-size: 0.9rem; margin-bottom: 30px; }
.auth-card label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 0.9rem; color: #444; }
.auth-card input {
  width: 100%; padding: 12px 15px; border: 2px solid var(--border);
  border-radius: 10px; margin-bottom: 18px; font-family: inherit; outline: none; transition: 0.3s;
}
.auth-card input:focus { border-color: var(--primary); }
.auth-switch { text-align: center; margin-top: 18px; font-size: 0.9rem; color: var(--gray); }
.auth-switch a { color: var(--primary); font-weight: 600; }
.hint { text-align: center; margin-top: 15px; font-size: 0.85rem; color: var(--gray); background: #f8f9fa; padding: 8px; border-radius: 8px; }
.form-msg { margin-top: 15px; padding: 10px; border-radius: 8px; text-align: center; font-size: 0.9rem; }
.form-msg.success { background: #d4edda; color: #155724; }
.form-msg.error { background: #f8d7da; color: #721c24; }

/* ===== MODAL ===== */
.modal {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 2000; align-items: center; justify-content: center; padding: 20px;
}
.modal.active { display: flex; }
.modal-content {
  background: #fff; padding: 35px; border-radius: 20px;
  width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; position: relative;
}
.modal-lg { max-width: 750px; }
.close { position: absolute; top: 15px; right: 20px; font-size: 2rem; cursor: pointer; color: var(--gray); }
.close:hover { color: var(--primary); }
.modal-content h2 { color: var(--dark); margin-bottom: 20px; }
.modal-content label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 0.9rem; }
.modal-content input, .modal-content textarea, .modal-content select {
  width: 100%; padding: 11px 14px; border: 2px solid var(--border);
  border-radius: 10px; margin-bottom: 15px; font-family: inherit; outline: none;
}
.modal-content input:focus, .modal-content textarea:focus { border-color: var(--primary); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 15px; }

/* ===== ADMIN ===== */
.admin-body { background: #f4f6f9; }
.admin-navbar { background: var(--darker); }
.admin-navbar .logo, .admin-navbar .nav-links a { color: #fff; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; flex-wrap: wrap; gap: 15px; }
.admin-header h1 { color: var(--dark); }
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 30px; }
.stat-card { background: #fff; padding: 20px; border-radius: 15px; box-shadow: 0 3px 12px rgba(0,0,0,0.06); }
.stat-card h3 { font-size: 2rem; color: var(--primary); }
.stat-card p { color: var(--gray); font-size: 0.9rem; }
.table-wrap { background: #fff; border-radius: 15px; overflow-x: auto; box-shadow: 0 3px 15px rgba(0,0,0,0.06); }
.admin-table { width: 100%; border-collapse: collapse; min-width: 700px; }
.admin-table th, .admin-table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border); }
.admin-table th { background: #f8f9fa; color: var(--dark); font-size: 0.85rem; text-transform: uppercase; }
.admin-table img { width: 60px; height: 40px; object-fit: cover; border-radius: 6px; }
.admin-table .btn-sm { padding: 6px 12px; font-size: 0.8rem; border-radius: 6px; margin-right: 5px; cursor: pointer; border: none; font-weight: 600; }
.btn-edit { background: var(--warning); color: #fff; }
.btn-delete { background: var(--primary); color: #fff; }
.empty-row { text-align: center; color: var(--gray); padding: 40px !important; }

/* ===== ENQUIRY / CONTACT ===== */
.enquiry-form-wrap, .contact-form {
  max-width: 600px; margin: 0 auto; background: #fff; padding: 35px;
  border-radius: 20px; box-shadow: 0 5px 25px rgba(0,0,0,0.08);
}
.enquiry-form-wrap label, .contact-form label { display: block; font-weight: 500; margin-bottom: 6px; font-size: 0.9rem; }
.enquiry-form-wrap input, .enquiry-form-wrap select, .enquiry-form-wrap textarea,
.contact-form input, .contact-form textarea {
  width: 100%; padding: 12px 15px; border: 2px solid var(--border);
  border-radius: 10px; margin-bottom: 18px; font-family: inherit; outline: none;
}
.enquiry-form-wrap input:focus, .contact-form input:focus { border-color: var(--primary); }
.contact-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; }
.contact-info h2 { color: var(--dark); margin-bottom: 25px; }
.contact-item { display: flex; gap: 15px; margin-bottom: 25px; align-items: flex-start; }
.contact-item span { font-size: 1.5rem; }
.contact-item strong { display: block; color: var(--dark); margin-bottom: 3px; }
.contact-item p { color: var(--gray); }
.about-content { max-width: 800px; margin: 0 auto; }
.about-content h2 { color: var(--dark); margin: 25px 0 10px; }
.about-content p, .about-content li { color: #555; margin-bottom: 10px; }
.about-content ul { padding-left: 25px; }

/* ===== FOOTER ===== */
footer { background: var(--darker); color: #fff; padding: 50px 0 0; margin-top: 60px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 40px; padding-bottom: 40px; }
.footer-grid h3, .footer-grid h4 { margin-bottom: 15px; color: #fff; }
.footer-grid p, .footer-grid li { color: rgba(255,255,255,0.7); font-size: 0.9rem; margin-bottom: 8px; }
.footer-grid ul { list-style: none; }
.footer-grid a:hover { color: var(--primary); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,0.1); padding: 20px 0; text-align: center; color: rgba(255,255,255,0.5); font-size: 0.85rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .car-detail-grid, .contact-grid, .footer-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .nav-links {
    position: absolute; top: 65px; left: 0; right: 0; background: #fff;
    flex-direction: column; padding: 20px; gap: 15px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.1); display: none;
  }
  .nav-links.active { display: flex; }
  .hamburger { display: block; }
  .hero h1 { font-size: 2rem; }
  .hero-stats { gap: 25px; }
  .section { padding: 45px 0; }
  .section-title { font-size: 1.7rem; }
  .form-grid { grid-template-columns: 1fr; }
  .filter-bar { grid-template-columns: 1fr; }
  .car-specs { grid-template-columns: 1fr; }
}
.badge {
  background: #e63946; color: #fff; font-size: 0.7rem;
  padding: 1px 7px; border-radius: 10px; margin-left: 4px;
}

/* ===== SOLD CAR STYLES ===== */
.car-img-wrap { position: relative; overflow: hidden; }
.car-img-wrap img { width: 100%; height: 200px; object-fit: cover; display: block; }
.sold-card { opacity: 0.95; }
.sold-card .blurred {
  filter: blur(4px) grayscale(0.5);
  transform: scale(1.05);
}
.sold-badge {
  position: absolute; top: 15px; left: 50%; transform: translateX(-50%);
  background: #e63946; color: #fff; font-weight: 700;
  padding: 8px 28px; border-radius: 30px; letter-spacing: 3px;
  font-size: 1rem; box-shadow: 0 4px 15px rgba(230,57,70,0.5);
  animation: pulseSold 1.8s infinite;
}
@keyframes pulseSold {
  0%,100% { transform: translateX(-50%) scale(1); }
  50% { transform: translateX(-50%) scale(1.08); }
}

/* ===== IMAGE GALLERY (car-details) ===== */
.gallery-main {
  width: 100%; aspect-ratio: 16/9; border-radius: 15px;
  overflow: hidden; background: #000; margin-bottom: 12px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.15);
}
.gallery-main img { width: 100%; height: 100%; object-fit: contain; background: #f0f0f0; }
.gallery-thumbs {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px;
}
.gallery-thumbs img {
  width: 100%; aspect-ratio: 1; object-fit: cover;
  border-radius: 8px; cursor: pointer; border: 3px solid transparent;
  transition: 0.2s; opacity: 0.7;
}
.gallery-thumbs img:hover { opacity: 1; }
.gallery-thumbs img.active { border-color: #e63946; opacity: 1; }
.gallery-sold-overlay {
  position: absolute; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2.5rem; font-weight: 800; letter-spacing: 6px;
  border-radius: 15px; pointer-events: none;
}
.gallery-wrap { position: relative; }

/* ===== STATUS PILLS (admin) ===== */
.status-pill {
  display: inline-block; padding: 4px 12px; border-radius: 15px;
  font-size: 0.75rem; font-weight: 600;
}
.status-available { background: #d4edda; color: #155724; }
.status-sold { background: #f8d7da; color: #721c24; }

/* ===== IMAGE UPLOAD GRID (admin form) ===== */
.img-upload-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px; margin-top: 12px;
}
.img-slot {
  position: relative; aspect-ratio: 1; border: 2px dashed #c0c0c0;
  border-radius: 10px; overflow: hidden; background: #fafafa;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: 0.3s;
}
.img-slot:hover { border-color: #e63946; background: #fff5f5; }
.img-slot img { width: 100%; height: 100%; object-fit: cover; }
.img-slot .slot-num {
  font-size: 1.5rem; color: #bbb; font-weight: 300;
}
.img-slot .rm-img {
  position: absolute; top: 4px; right: 4px; background: #e63946;
  color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px;
  cursor: pointer; font-size: 0.75rem; line-height: 1;
}

/* ===== SALES DETAILS CARD ===== */
.sale-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sale-info-item {
  background: #f8f9fa; padding: 10px 12px; border-radius: 8px;
  border-left: 3px solid #2a9d8f;
}
.sale-info-item strong {
  display: block; color: #6c757d; font-size: 0.72rem;
  text-transform: uppercase; margin-bottom: 3px;
}
.sale-info-item span { color: #1d3557; font-weight: 600; font-size: 0.9rem; }

/* ===== REPORTS ===== */
.report-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px; margin-bottom: 30px;
}
.report-card {
  background: #fff; padding: 25px; border-radius: 15px;
  box-shadow: 0 3px 15px rgba(0,0,0,0.06);
  border-top: 4px solid #e63946;
}
.report-card.green { border-top-color: #2a9d8f; }
.report-card.blue { border-top-color: #457b9d; }
.report-card.orange { border-top-color: #f4a261; }
.report-card h3 { font-size: 1.8rem; color: #1d3557; margin-bottom: 5px; }
.report-card p { color: #6c757d; font-size: 0.85rem; }
.profit-positive { color: #2a9d8f !important; }
.profit-negative { color: #e63946 !important; }

.img-upload-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px; margin-top: 12px;
}
.img-slot {
  position: relative; aspect-ratio: 1; border: 2px dashed #c0c0c0;
  border-radius: 10px; overflow: hidden; background: #fafafa;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: 0.3s;
}
.img-slot:hover { border-color: #e63946; background: #fff5f5; }
.img-slot img { width: 100%; height: 100%; object-fit: cover; }
.img-slot .slot-num { font-size: 1.5rem; color: #bbb; }
.img-slot .rm-img {
  position: absolute; top: 4px; right: 4px; background: #e63946;
  color: #fff; border: none; border-radius: 50%; width: 22px; height: 22px;
  cursor: pointer; font-size: 0.75rem; line-height: 1;
}

.new-badge {
  position: absolute; top: 12px; right: 12px;
  background: #2a9d8f; color: #fff;
  font-size: 0.7rem; font-weight: 700;
  padding: 4px 10px; border-radius: 12px;
  letter-spacing: 1px;
  box-shadow: 0 2px 8px rgba(42,157,143,0.4);
  animation: pulseNew 2s infinite;
}
@keyframes pulseNew {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@media print {
  .navbar, .footer, .back-link, .car-actions, footer { display: none !important; }
  body { background: #fff; }
  .detail-section { break-inside: avoid; box-shadow: none; border: 1px solid #ddd; }
  .detail-section h3 { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .car-detail-info { border-top: 6px solid #e63946; }
}