/* ═══════════════════════════════════════════════════════════
   FRONTEND — Bootstrap 5 Override + Site Components
   ═══════════════════════════════════════════════════════════ */

/* ── Variables (set dynamically by PHP via inline :root) ── */
:root {
  --primary: #0f172a;
  --accent:  #3b82f6;
  --border:  #e2e8f0;
  --surface: #f8fafc;
  --text:    #1e293b;
  --bs-body-font-family: 'DM Sans', sans-serif;
  --bs-body-color: #1e293b;
  --bs-border-color: #e2e8f0;
  --bs-border-radius: 0.5rem;
  --bs-primary: var(--primary);
}

*, *::before, *::after { box-sizing: border-box; }
body { font-family: 'DM Sans', sans-serif; color: var(--text); }

/* ── Bootstrap Form Overrides ───────────────────────────── */
.form-control,
.form-select {
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  font-family: inherit;
  font-size: 15px;
  padding: 0.6rem 0.9rem;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.form-control:focus,
.form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, .07);
  outline: none;
}
.form-control::placeholder { color: #94a3b8; }
.form-label {
  font-weight: 600;
  font-size: 13.5px;
  color: #374151;
  margin-bottom: 0.4rem;
}
.form-check-input:checked {
  background-color: var(--primary);
  border-color: var(--primary);
}
.form-check-input:focus { box-shadow: 0 0 0 3px rgba(15, 23, 42, .1); }
.form-check-label { font-size: 13.5px; }

/* ── Bootstrap Button Overrides ─────────────────────────── */
.btn {
  font-family: inherit;
  font-weight: 700;
  border-radius: 0.5rem;
  transition: all .15s;
}
.btn-primary {
  background-color: var(--primary);
  border-color: var(--primary);
}
.btn-primary:hover {
  background-color: #1e293b;
  border-color: #1e293b;
}
.btn-outline-primary {
  color: var(--primary);
  border-color: var(--primary);
}
.btn-outline-primary:hover {
  background-color: var(--primary);
  border-color: var(--primary);
}
.btn-lg { padding: 0.75rem 1.75rem; font-size: 16px; border-radius: 50px; }

/* ── Bootstrap Alert ────────────────────────────────────── */
.alert { border: none; border-radius: 0.75rem; font-size: 14px; }
.alert-success { background: #dcfce7; color: #15803d; }
.alert-danger  { background: #fee2e2; color: #dc2626; }
.alert-warning { background: #fef3c7; color: #92400e; }

/* ── Bootstrap Badge ────────────────────────────────────── */
.badge { font-weight: 700; border-radius: 20px; }

/* ── Topbar ─────────────────────────────────────────────── */
.site-topbar {
  background: var(--primary);
  color: rgba(255,255,255,.9);
  padding: 7px 0;
  font-size: 13px;
  text-align: center;
}

/* ── Header ─────────────────────────────────────────────── */
.site-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.header-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px;
  height: 64px;
  max-width: 1400px;
  margin: 0 auto;
}
.site-logo img  { height: 40px; object-fit: contain; }
.site-logo span {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  text-decoration: none;
}

/* ── Header Search ──────────────────────────────────────── */
.header-search { flex: 1; max-width: 480px; position: relative; }
.header-search .form-control {
  padding-left: 40px;
  border-radius: 50px;
  background: var(--surface);
  border-color: var(--border);
  font-size: 14px;
}
.header-search .form-control:focus { background: #fff; }
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: #94a3b8;
  font-size: 15px;
  pointer-events: none;
}
.search-suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(0,0,0,.12);
  z-index: 999;
  display: none;
  overflow: hidden;
}
.search-suggestion-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text);
  transition: background .15s;
  font-size: 14px;
}
.search-suggestion-item:hover { background: var(--surface); }
.search-suggestion-item img {
  width: 40px; height: 40px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* ── Header Actions ─────────────────────────────────────── */
.header-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.header-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 8px;
  color: #374151;
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  transition: background .15s, color .15s;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}
.header-btn:hover { background: var(--surface); color: var(--primary); }
.header-btn .bi  { font-size: 20px; }
.cart-badge {
  position: absolute;
  top: 2px; right: 4px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  width: 18px; height: 18px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Navigation ─────────────────────────────────────────── */
.site-nav { background: #fff; border-bottom: 1px solid var(--border); }
.site-nav-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}
.site-nav-inner::-webkit-scrollbar { display: none; }
.site-nav a {
  white-space: nowrap;
  padding: 10px 14px;
  font-size: 13.5px;
  font-weight: 600;
  color: #374151;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  display: inline-block;
  transition: color .15s, border-color .15s;
}
.site-nav a:hover { color: var(--primary); border-bottom-color: var(--primary); }
.site-nav a.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb { font-size: 12.5px; }
.breadcrumb-item + .breadcrumb-item::before { color: #94a3b8; }
.breadcrumb-item a { color: #64748b; text-decoration: none; }
.breadcrumb-item a:hover { color: var(--primary); }

/* ── Product Card ───────────────────────────────────────── */
.product-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow .2s, transform .2s;
  height: 100%;
  display: flex;
  flex-direction: column;
}
.product-card:hover { box-shadow: 0 8px 30px rgba(0,0,0,.1); transform: translateY(-2px); }
.product-card-img {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  background: var(--surface);
}
.product-card-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.product-card:hover .product-card-img img { transform: scale(1.04); }
.product-card-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}
.product-card-brand {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: #94a3b8;
  margin-bottom: 4px;
}
.product-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 8px;
  flex: 1;
}
.product-card-price {
  font-family: 'Syne', sans-serif;
  font-size: 18px;
  font-weight: 800;
  color: var(--primary);
}
.product-card-market-price {
  font-size: 13px;
  color: #94a3b8;
  text-decoration: line-through;
  margin-left: 6px;
}
.product-card-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
}
.product-card-badge-new { background: #22c55e; }
.wishlist-btn {
  position: absolute;
  top: 8px; right: 8px;
  background: #fff;
  border: none;
  border-radius: 50%;
  width: 32px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,.1);
  font-size: 16px;
  transition: transform .15s;
}
.wishlist-btn:hover { transform: scale(1.1); }
.btn-atc {
  width: 100%;
  margin-top: 8px;
  padding: 9px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn-atc:hover    { opacity: .88; }
.btn-atc:disabled { background: #e2e8f0; color: #94a3b8; cursor: not-allowed; }

/* ── Filter Sidebar ─────────────────────────────────────── */
.filter-sidebar {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.filter-title {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
}
.filter-link {
  display: block;
  padding: 7px 0;
  font-size: 14px;
  color: #374151;
  text-decoration: none;
  border-bottom: 1px solid #f1f5f9;
  transition: color .15s;
}
.filter-link:hover,
.filter-link.active { color: var(--primary); font-weight: 600; }

/* ── Pagination ─────────────────────────────────────────── */
.pagination-custom { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.page-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
}
.page-btn.active  { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:hover:not(.active) { border-color: var(--primary); color: var(--primary); }

/* ── Footer ─────────────────────────────────────────────── */
.site-footer { background: var(--primary); color: rgba(255,255,255,.75); margin-top: 60px; }
.footer-top  { padding: 48px 0; }
.footer-heading { font-family: 'Syne', sans-serif; font-weight: 700; color: #fff; font-size: 14px; margin-bottom: 16px; }
.footer-link { display: block; color: rgba(255,255,255,.6); text-decoration: none; font-size: 13px; padding: 3px 0; transition: color .15s; }
.footer-link:hover { color: #fff; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: 16px 0; font-size: 13px; text-align: center; color: rgba(255,255,255,.4); }

/* ── Mobile Menu ────────────────────────────────────────── */
.mobile-menu-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 1099;
}
.mobile-menu {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 300px;
  background: #fff;
  z-index: 1100;
  transform: translateX(-100%);
  transition: transform .3s;
  overflow-y: auto;
}
.mobile-menu.open         { transform: none; }
.mobile-menu-overlay.open { display: block; }

/* ── Section Titles ─────────────────────────────────────── */
.section-title {
  font-family: 'Syne', sans-serif;
  font-size: 22px;
  font-weight: 800;
  margin: 0;
}

/* ── Cart / Checkout ────────────────────────────────────── */
.cart-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}
.cart-item:last-child { border-bottom: none; }
.cart-item-img {
  width: 80px; height: 80px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.qty-control {
  display: flex;
  align-items: center;
  gap: 0;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  width: fit-content;
}
.qty-btn {
  background: none;
  border: none;
  width: 32px; height: 32px;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #374151;
  transition: background .15s;
  font-family: inherit;
}
.qty-btn:hover { background: var(--surface); }
.qty-input {
  width: 40px;
  text-align: center;
  border: none;
  border-left: 1.5px solid var(--border);
  border-right: 1.5px solid var(--border);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  padding: 0;
  height: 32px;
}
.qty-input:focus { outline: none; }

/* ── Order Summary Box ──────────────────────────────────── */
.order-summary {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.order-summary-row {
  display: flex;
  justify-content: space-between;
  font-size: 14px;
  padding: 6px 0;
  color: #374151;
}
.order-summary-row.total {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary);
  border-top: 2px solid var(--border);
  margin-top: 8px;
  padding-top: 12px;
}

/* ── Checkout Steps ─────────────────────────────────────── */
.checkout-steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 32px;
}
.checkout-step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: #94a3b8;
}
.checkout-step.active { color: var(--primary); }
.checkout-step.done   { color: #22c55e; }
.step-num {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid currentColor;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}
.checkout-step.done .step-num {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}
.checkout-step.active .step-num {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.step-divider { flex: 1; height: 2px; background: var(--border); margin: 0 8px; min-width: 24px; }

/* ── Account Cards ──────────────────────────────────────── */
.account-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  text-decoration: none;
  color: var(--text);
  display: block;
  transition: box-shadow .2s, transform .2s;
}
.account-card:hover { box-shadow: 0 8px 24px rgba(0,0,0,.08); transform: translateY(-2px); }
.account-card-icon { font-size: 28px; color: var(--primary); margin-bottom: 12px; }
.account-card-title { font-family: 'Syne', sans-serif; font-size: 16px; font-weight: 700; }
.account-card-count { font-size: 13px; color: #64748b; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 767px) {
  .header-search { display: none; }
  .site-nav      { display: none; }
}
