/* ============================================================
   BMW SparePartHub - Custom CSS (extends Tailwind via CDN)
   ============================================================ */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Barlow+Condensed:wght@600;700;800&display=swap');

:root {
  --primary: #1c69d4;
  --primary-dark: #0d4fa8;
  --primary-light: #5b9ef8;
  --accent: #f59e0b;
  --text-dark: #1e293b;
  --text-muted: #64748b;
  --bg-light: #f8fafc;
  --border: #e2e8f0;
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 40px rgba(0,0,0,.12);
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  color: var(--text-dark);
  background: #ffffff;
  line-height: 1.6;
}

/* ---- Typography ---- */
.font-display { font-family: 'Barlow Condensed', sans-serif; }

/* ---- Top Bar ---- */
.topbar {
  background: var(--primary); color: #fff;
  font-size: .8125rem; padding: .45rem 0;
}
.topbar a { color: #fff; text-decoration: none; opacity: .9; transition: opacity .2s; }
.topbar a:hover { opacity: 1; text-decoration: underline; }

/* ---- Buttons ---- */
.btn-primary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--primary); color: #fff;
  padding: .75rem 1.75rem; border-radius: 8px;
  font-weight: 600; font-size: .9375rem;
  transition: all .2s ease;
  border: none; cursor: pointer; text-decoration: none;
}
.btn-primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(28,105,212,.35);
}

.btn-secondary {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: #fff; color: var(--primary);
  padding: .75rem 1.75rem; border-radius: 8px;
  font-weight: 600; font-size: .9375rem;
  border: 2px solid var(--primary);
  transition: all .2s ease; cursor: pointer; text-decoration: none;
}
.btn-secondary:hover {
  background: var(--primary); color: #fff;
  transform: translateY(-1px);
}

.btn-accent {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--accent); color: #fff;
  padding: .75rem 1.75rem; border-radius: 8px;
  font-weight: 700; font-size: .9375rem;
  transition: all .2s ease; border: none; cursor: pointer; text-decoration: none;
}
.btn-accent:hover { background: #d97706; transform: translateY(-1px); }

/* ---- Cards ---- */
.card {
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

/* Product Card */
.product-card { position: relative; }
.product-card .card-img {
  width: 100%; height: 200px; object-fit: cover;
  transition: transform .4s ease;
}
.product-card:hover .card-img { transform: scale(1.04); }
.product-card .badge {
  position: absolute; top: 10px; left: 10px;
  background: var(--primary); color: #fff;
  font-size: .68rem; font-weight: 700; padding: .22rem .65rem;
  border-radius: 4px; letter-spacing: .04em; text-transform: uppercase;
}
.product-card .deal-badge {
  position: absolute; top: 10px; right: 10px;
  background: #16a34a; color: #fff;
  font-size: .68rem; font-weight: 700; padding: .22rem .65rem;
  border-radius: 4px; letter-spacing: .04em; text-transform: uppercase;
}
.product-card .price { color: var(--text-dark); font-weight: 800; font-size: 1.15rem; }
.product-card .down-payment { color: var(--primary); font-size: .8125rem; font-weight: 600; }

/* ---- Carousel ---- */
.carousel-wrap { position: relative; }
.carousel-track-outer { overflow: hidden; }
.carousel-track {
  display: flex; gap: 1.25rem;
  transition: transform .4s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}
.carousel-track .product-card { flex: 0 0 calc(25% - 1rem); min-width: 240px; }
.carousel-btn {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  background: #fff; border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; z-index: 10; box-shadow: var(--shadow-md);
  transition: all .2s; color: var(--text-dark);
}
.carousel-btn:hover { background: var(--primary); color: #fff; border-color: var(--primary); }
.carousel-btn.prev { left: -20px; }
.carousel-btn.next { right: -20px; }
@media (max-width: 1024px) { .carousel-track .product-card { flex: 0 0 calc(33.33% - 1rem); } }
@media (max-width: 768px)  { .carousel-track .product-card { flex: 0 0 calc(50% - 1rem); } }
@media (max-width: 480px)  { .carousel-track .product-card { flex: 0 0 90%; } }

/* ---- Search Hero ---- */
.hero-search { background: linear-gradient(135deg, #05193d 0%, #0d3378 40%, #1c69d4 100%); }
.search-bar {
  background: #fff; border-radius: 10px;
  padding: .9rem 1rem; display: flex; gap: .75rem; align-items: center;
  flex-wrap: nowrap;
  box-shadow: 0 8px 40px rgba(0,0,0,.35);
}
.search-bar select, .search-bar input {
  flex: 1 1 0; min-width: 0; padding: .7rem .9rem;
  border: 1.5px solid var(--border); border-radius: 6px;
  font-size: .88rem; color: var(--text-dark); outline: none;
  transition: border-color .2s; height: 46px;
  background-color: #fff;
  appearance: auto;
}
.search-bar select:focus, .search-bar input:focus { border-color: var(--primary); }
#hero-search-btn {
  flex-shrink: 0; white-space: nowrap; height: 46px;
  display: inline-flex; align-items: center; gap: .4rem;
  padding: 0 1.5rem; font-size: .88rem;
}

/* ---- Section labels ---- */
.section-label {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .1em; color: var(--primary); margin-bottom: .25rem;
}

/* ---- Newsletter ---- */
.newsletter-section { background: linear-gradient(135deg, #05193d, #0d3378); }
.newsletter-input {
  padding: .75rem 1rem; border-radius: 6px 0 0 6px;
  border: none; font-size: .9375rem; flex: 1; outline: none;
}
.newsletter-btn {
  background: #1c69d4; color: #fff; padding: .75rem 1.5rem;
  border: none; border-radius: 0 6px 6px 0; font-weight: 700;
  cursor: pointer; white-space: nowrap; font-size: .9375rem;
  transition: background .2s;
}
.newsletter-btn:hover { background: #0d4fa8; }

/* ---- Model Tabs ---- */
.model-tab {
  padding: .45rem 1.1rem; border-radius: 100px;
  font-size: .875rem; font-weight: 600; cursor: pointer;
  border: 1.5px solid var(--border); background: #fff;
  transition: all .2s; white-space: nowrap;
}
.model-tab.active, .model-tab:hover {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* ---- Navbar ---- */
.navbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  box-shadow: var(--shadow-sm);
}

.nav-link {
  color: var(--text-dark); font-weight: 500;
  padding: .5rem .875rem; border-radius: 6px;
  transition: all .2s; text-decoration: none; font-size: .9375rem;
}
.nav-link:hover, .nav-link.active {
  color: var(--primary); background: rgba(28,105,212,.06);
}

/* ---- Hero ---- */
.hero {
  background: linear-gradient(135deg, #05193d 0%, #0d3378 50%, #1c69d4 100%);
  min-height: 480px;
  position: relative; overflow: hidden;
  display: flex; align-items: center;
}
.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='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content { position: relative; z-index: 1; }

/* ---- Section Headings ---- */
.section-title {
  font-family: 'Barlow Condensed', sans-serif;
  font-size: 2rem; font-weight: 800; color: var(--text-dark);
  letter-spacing: -.01em; line-height: 1.2;
}
.section-subtitle {
  color: var(--text-muted); font-size: 1rem; margin-top: .5rem;
}
.section-divider {
  width: 60px; height: 4px; border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  margin: .75rem 0;
}

/* ---- Category Cards ---- */
.cat-card {
  display: flex; flex-direction: column; align-items: center;
  padding: 1.5rem 1.25rem; text-align: center;
  background: #fff; border-radius: var(--radius);
  border: 2px solid var(--border);
  text-decoration: none; color: var(--text-dark);
  transition: all .25s ease; overflow: hidden; position: relative;
}
.cat-card:hover {
  border-color: var(--primary);
  background: rgba(28,105,212,.04);
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.cat-card .cat-icon {
  width: 64px; height: 64px; border-radius: 50%;
  background: linear-gradient(135deg, rgba(28,105,212,.08), rgba(91,158,248,.12));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem; color: var(--primary); margin-bottom: .875rem;
  transition: all .25s;
}
.cat-card:hover .cat-icon {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: #fff; transform: scale(1.1);
}
/* Image-mode category card */
.cat-card-img {
  width: calc(100% + 2.5rem); margin: -1.5rem -1.25rem .875rem;
  height: 130px;
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  background-color: #f8f9fb;
  position: relative; flex-shrink: 0;
  transition: transform .35s ease;
}
.cat-card:hover .cat-card-img { transform: scale(1.03); }
.cat-card-img-overlay { display: none; }
.cat-card-img-title { color: var(--text-dark); }
.cat-card:has(.cat-card-img) { background: #fff; border-color: var(--border); }
.cat-card:has(.cat-card-img) p { color: var(--text-dark); }

/* ---- Grid ---- */
.products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

/* ---- Shipping Option Cards ---- */
.shipping-opt {
  user-select: none;
}
.shipping-opt input[type="radio"] { flex-shrink: 0; }

/* ---- Forms ---- */
.form-label { font-weight: 600; font-size: .875rem; color: var(--text-dark); margin-bottom: .375rem; display: block; }
.form-input {
  width: 100%;
  padding: .75rem 1rem; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .9375rem; color: var(--text-dark);
  background: #fff; transition: border-color .2s, box-shadow .2s;
  outline: none;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(28,105,212,.12);
}
.form-input.error { border-color: #ef4444; }
.form-error { color: #ef4444; font-size: .8125rem; margin-top: .25rem; }
.form-select {
  width: 100%; padding: .75rem 1rem; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: .9375rem; background: #fff;
  appearance: none; cursor: pointer; outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right .875rem center;
  padding-right: 2.5rem;
}
.form-select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(28,105,212,.12); }

/* ---- Cart Sidebar ---- */
.cart-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.5);
  z-index: 200; opacity: 0; pointer-events: none; transition: opacity .3s;
}
.cart-overlay.open { opacity: 1; pointer-events: auto; }
.cart-drawer {
  position: fixed; top: 0; right: 0; height: 100vh; width: 420px; max-width: 95vw;
  background: #fff; z-index: 201;
  transform: translateX(100%); transition: transform .35s cubic-bezier(.4,0,.2,1);
  display: flex; flex-direction: column; box-shadow: -10px 0 40px rgba(0,0,0,.15);
}
.cart-drawer.open { transform: translateX(0); }

/* ---- Order Modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 300;
  display: none; align-items: center; justify-content: center; padding: 1rem;
}
.modal-backdrop.open { display: flex; }
.modal-box {
  background: #fff; border-radius: 16px; padding: 2.5rem;
  max-width: 480px; width: 100%; text-align: center;
  box-shadow: var(--shadow-lg); animation: modalIn .3s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(.92) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---- Alerts ---- */
.alert { padding: .875rem 1.25rem; border-radius: 8px; font-size: .9375rem; margin-bottom: 1rem; }
.alert-success { background: #f0fdf4; color: #15803d; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-info    { background: #fff5f5; color: #b91c1c; border: 1px solid #fecaca; }
.alert-warning { background: #fffbeb; color: #b45309; border: 1px solid #fde68a; }

/* ---- Breadcrumb ---- */
.breadcrumb { display: flex; gap: .5rem; align-items: center; font-size: .875rem; color: var(--text-muted); }
.breadcrumb a { color: var(--primary); text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

/* ---- Image Gallery ---- */
.gallery-main {
  width: 100%; border-radius: var(--radius); overflow: hidden;
  aspect-ratio: 4/3; background: var(--bg-light);
}
.gallery-main img { width: 100%; height: 100%; object-fit: cover; }
.gallery-thumbs { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .75rem; }
.gallery-thumb {
  width: 70px; height: 70px; border-radius: 8px; overflow: hidden;
  border: 2px solid var(--border); cursor: pointer; transition: border-color .2s;
}
.gallery-thumb:hover, .gallery-thumb.active { border-color: var(--primary); }

/* ---- Brand Card ---- */
.brand-card {
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
  padding: 1rem; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: #fff;
  text-decoration: none; color: var(--text-dark);
  font-weight: 600; font-size: .875rem;
  transition: all .2s; text-align: center;
}
.brand-card:hover {
  border-color: var(--primary); color: var(--primary);
  box-shadow: var(--shadow-md); transform: translateY(-2px);
}
.gallery-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---- Price Box ---- */
.price-box {
  background: linear-gradient(135deg, #eff6ff, #dbeafe);
  border: 2px solid rgba(28,105,212,.2);
  border-radius: var(--radius); padding: 1.5rem;
}
.total-price { font-size: 2.25rem; font-weight: 800; color: var(--primary); }
.down-payment-label { font-size: 1rem; font-weight: 700; color: #15803d; }
.down-payment-amount { font-size: 1.5rem; font-weight: 800; color: #15803d; }

/* ---- Pagination ---- */
.pagination { display: flex; gap: .375rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.page-btn {
  min-width: 40px; height: 40px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: .875rem; cursor: pointer;
  border: 1.5px solid var(--border); color: var(--text-dark);
  background: #fff; text-decoration: none; transition: all .2s;
}
.page-btn:hover { border-color: var(--primary); color: var(--primary); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---- Alert colors for info ---- */
.page-btn.disabled { opacity: .4; pointer-events: none; }

/* ---- Footer ---- */
.footer { background: #111; color: #9ca3af; }
.footer a { color: #9ca3af; text-decoration: none; transition: color .2s; }
.footer a:hover { color: #fff; }
.footer-heading { color: #fff; font-weight: 700; font-size: 1rem; margin-bottom: 1.25rem; }

/* ---- Admin Sidebar ---- */
.admin-sidebar {
  background: #0a1628; color: #94a3b8;
  width: 260px; min-height: 100vh;
  position: fixed; left: 0; top: 0; z-index: 50;
  transition: transform .3s;
}
.admin-sidebar .brand {
  padding: 1.5rem; border-bottom: 1px solid rgba(255,255,255,.08);
  color: #fff; font-weight: 800; font-size: 1.125rem;
}
.sidebar-link {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1.5rem; color: #94a3b8; font-size: .9rem;
  text-decoration: none; transition: all .2s;
  border-left: 3px solid transparent;
}
.sidebar-link:hover { color: #fff; background: rgba(255,255,255,.06); border-left-color: var(--primary); }
.sidebar-link.active { color: #fff; background: rgba(28,105,212,.2); border-left-color: var(--primary); font-weight: 600; }
.admin-main { margin-left: 260px; min-height: 100vh; background: #f8fafc; }
.admin-topbar {
  background: #fff; border-bottom: 1px solid var(--border);
  padding: 1rem 1.5rem; display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 40;
}
.admin-card {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}

/* ---- Stat Card ---- */
.stat-card {
  background: #fff; border-radius: var(--radius);
  padding: 1.5rem; border: 1px solid var(--border);
  display: flex; align-items: center; gap: 1rem;
}
.stat-icon {
  width: 56px; height: 56px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem; flex-shrink: 0;
}

/* ---- WhatsApp Float Button ---- */
.whatsapp-btn {
  position: fixed; bottom: 24px;
  width: 58px; height: 58px; border-radius: 50%;
  background: #25d366; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.75rem; box-shadow: 0 6px 24px rgba(37,211,102,.45);
  text-decoration: none; z-index: 150;
  transition: transform .2s, box-shadow .2s;
  animation: pulse-whatsapp 2.5s infinite;
}
.whatsapp-btn:hover { transform: scale(1.1); box-shadow: 0 8px 30px rgba(37,211,102,.55); }
@keyframes pulse-whatsapp {
  0%, 100% { box-shadow: 0 6px 24px rgba(37,211,102,.45); }
  50% { box-shadow: 0 6px 36px rgba(37,211,102,.7); }
}

/* ---- Table ---- */
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th { background: #f1f5f9; padding: .875rem 1rem; text-align: left; font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); border-bottom: 1px solid var(--border); }
.data-table td { padding: .875rem 1rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: #f8fafc; }

/* Status Badges */
.status-badge { display: inline-flex; align-items: center; gap: .35rem; padding: .25rem .75rem; border-radius: 100px; font-size: .75rem; font-weight: 700; text-transform: capitalize; }
.status-pending    { background: #fffbeb; color: #b45309; }
.status-confirmed  { background: #eff6ff; color: #1d4ed8; }
.status-processing { background: #f0f9ff; color: #0369a1; }
.status-shipped    { background: #f0fdf4; color: #15803d; }
.status-delivered  { background: #dcfce7; color: #166534; }
.status-cancelled  { background: #fef2f2; color: #b91c1c; }

/* ---- Trust Bar ---- */
.trust-bar {
  background: #05193d; color: #fff;
  display: flex; justify-content: center; align-items: center;
  flex-wrap: wrap; gap: 0; overflow: hidden;
}
.trust-bar-item {
  display: flex; align-items: center; gap: .55rem;
  padding: .85rem 1.75rem; font-size: .8rem; font-weight: 600;
  letter-spacing: .02em; border-right: 1px solid rgba(255,255,255,.12);
  white-space: nowrap;
}
.trust-bar-item:last-child { border-right: none; }
.trust-bar-item i { color: #5b9ef8; font-size: .95rem; }

/* ---- How It Works Steps ---- */
.how-step {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 2rem 1.5rem; position: relative;
}
.how-step-num {
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.375rem; font-weight: 900;
  margin-bottom: 1rem; flex-shrink: 0;
  box-shadow: 0 4px 20px rgba(28,105,212,.4);
}
.how-step-arrow {
  position: absolute; right: -1.5rem; top: 2.75rem;
  color: var(--primary); font-size: 1.5rem; z-index: 1;
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .admin-sidebar { transform: translateX(-100%); }
  .admin-sidebar.mobile-open { transform: translateX(0); }
  .admin-main { margin-left: 0; }
  .section-title { font-size: 1.625rem; }
  .cart-drawer { width: 100vw; }
  .hero { min-height: 420px; }
  /* ---- Mobile Search Bar Fix ---- */
  .search-bar {
    flex-direction: column;
    padding: .875rem 1rem;
    gap: .5rem;
    border-radius: 8px;
  }
  .search-bar select,
  .search-bar input {
    flex: none !important;
    width: 100% !important;
    min-height: 48px;
    font-size: .9rem;
    padding: .7rem 1rem;
  }
  #hero-search-btn {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    display: flex !important;
    align-items: center;
    min-height: 48px;
    padding: .75rem 1rem !important;
    border-radius: 6px !important;
    gap: .5rem;
  }
  .trust-bar-item { padding: .65rem .9rem; font-size: .72rem; }
  .how-step-arrow { display: none; }
  .carousel-btn { display: none; }
  .topbar .topbar-right { display: none; }
}

