/* ── Variables ────────────────────────────────────────────── */
:root {
  --red: #b91c1c;
  --red-dark: #991b1b;
  --red-light: #fee2e2;
  --yellow: #facc15;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
  --white: #ffffff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,.1), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1);
  --font: 'Inter', sans-serif;
}

/* ── Reset ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font); background: var(--gray-50); color: var(--gray-900); min-height: 100vh; }
a { text-decoration: none; color: inherit; }
img { display: block; max-width: 100%; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }
input, select, textarea { font-family: inherit; }

/* ── Utilities ────────────────────────────────────────────── */
.container { max-width: 1280px; margin: 0 auto; padding: 0 1rem; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* ── Navbar ────────────────────────────────────────────────── */
.navbar { background: var(--red); color: #fff; position: sticky; top: 0; z-index: 100; box-shadow: var(--shadow-md); }
.navbar__inner { display: flex; align-items: center; gap: 1rem; padding: .75rem 1rem; max-width: 1280px; margin: 0 auto; }
.navbar__logo img { height: 36px; width: auto; }
.navbar__logo-text { font-size: 1.25rem; font-weight: 800; letter-spacing: -.5px; color: #fff; }

.navbar__nav { display: flex; align-items: center; gap: 1.5rem; font-size: .875rem; font-weight: 500; }
.navbar__nav a, .navbar__nav button { color: #fff; transition: color .15s; }
.navbar__nav a:hover, .navbar__nav button:hover { color: var(--yellow); }
.navbar__cat-btn { display: flex; align-items: center; gap: .25rem; padding: .5rem 0; }
.navbar__cat-btn svg { transition: transform .2s; }
.navbar__cat-btn.open svg { transform: rotate(180deg); }

.navbar__search { flex: 1; max-width: 420px; position: relative; }
.navbar__search input { width: 100%; padding: .5rem 2.5rem .5rem 1rem; border-radius: 999px; border: none; background: #fff; color: var(--gray-900); font-size: .875rem; outline: none; }
.navbar__search input:focus { box-shadow: 0 0 0 2px var(--yellow); }
.navbar__search-btn { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); color: var(--gray-400); }
.navbar__search-clear { position: absolute; right: 2rem; top: 50%; transform: translateY(-50%); color: var(--gray-400); }

.navbar__icons { display: flex; align-items: center; gap: 1rem; margin-left: auto; }
.navbar__cart-btn { position: relative; color: #fff; }
.navbar__cart-badge { position: absolute; top: -8px; right: -8px; background: var(--yellow); color: #000; font-size: 10px; font-weight: 700; border-radius: 999px; min-width: 18px; height: 18px; display: flex; align-items: center; justify-content: center; border: 2px solid var(--red); }
.navbar__hamburger { display: none; color: #fff; }

/* ── Category Dropdown ─────────────────────────────────────── */
/* The header has position:sticky, making it the containing block for position:absolute children */
.cat-dropdown { position: absolute; left: 0; right: 0; top: 100%; background: #fff; border-top: 2px solid var(--red); box-shadow: var(--shadow-lg); z-index: 99; display: none; }
.cat-dropdown.open { display: flex; flex-direction: column; }
.cat-dropdown__body { display: flex; max-height: 480px; }
.cat-dropdown__list { width: 260px; min-width: 260px; background: var(--gray-50); border-right: 1px solid var(--gray-200); overflow-y: auto; }
.cat-dropdown__item { display: flex; align-items: center; justify-content: space-between; padding: .75rem 1rem; font-size: .875rem; font-weight: 600; color: var(--gray-700); border-bottom: 1px solid var(--gray-100); cursor: pointer; transition: all .15s; }
.cat-dropdown__item:hover, .cat-dropdown__item.active { background: var(--red); color: #fff; }
.cat-dropdown__panel { flex: 1; overflow-y: auto; padding: 1.5rem; }
.cat-dropdown__panel-title { font-size: .9375rem; font-weight: 700; color: var(--red); margin-bottom: 1rem; padding-bottom: .75rem; border-bottom: 1px solid var(--gray-100); display: flex; justify-content: space-between; }
.cat-dropdown__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1.25rem; }
.cat-dropdown__sub-title { font-size: .8125rem; font-weight: 600; color: var(--gray-900); display: block; margin-bottom: .4rem; transition: color .15s; }
.cat-dropdown__sub-title:hover { color: var(--red); }
.cat-dropdown__children { display: flex; flex-direction: column; gap: .25rem; }
.cat-dropdown__child { font-size: .75rem; color: var(--gray-400); transition: color .15s; }
.cat-dropdown__child:hover { color: var(--red); }
.cat-dropdown__footer { border-top: 1px solid var(--gray-100); padding: .625rem 1rem; background: var(--gray-50); }
.cat-dropdown__footer a { font-size: .75rem; font-weight: 700; color: var(--red); display: flex; align-items: center; gap: .375rem; }

/* ── Mobile Menu ───────────────────────────────────────────── */
.mobile-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200; display: none; }
.mobile-overlay.open { display: block; }
.mobile-drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(85vw, 360px); background: #fff; z-index: 201; transform: translateX(100%); transition: transform .3s ease; overflow-y: auto; display: flex; flex-direction: column; }
.mobile-drawer.open { transform: translateX(0); }
.mobile-drawer__header { background: var(--red); color: #fff; padding: 1rem; display: flex; align-items: center; justify-content: space-between; }
.mobile-drawer__nav { padding: 1rem; flex: 1; }
.mobile-drawer__nav a, .mobile-drawer__nav button { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: .75rem; border-radius: 8px; font-size: .9375rem; font-weight: 600; color: var(--gray-800); transition: all .15s; }
.mobile-drawer__nav a:hover, .mobile-drawer__nav button:hover { background: var(--red-light); color: var(--red); }
.mobile-cats { padding-left: 1rem; display: none; }
.mobile-cats.open { display: flex; flex-direction: column; gap: .25rem; }
.mobile-cats a { font-size: .875rem; font-weight: 500; color: var(--gray-700); padding: .5rem .75rem; border-radius: 8px; }
.mobile-cats details > summary { list-style: none; }
.mobile-cats details > summary::-webkit-details-marker { display: none; }

/* ── Cart Drawer ───────────────────────────────────────────── */
.cart-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 200; display: none; }
.cart-overlay.open { display: block; }
.cart-drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(90vw, 420px); background: #fff; z-index: 201; transform: translateX(100%); transition: transform .3s ease; display: flex; flex-direction: column; }
.cart-drawer.open { transform: translateX(0); }
.cart-drawer__header { background: var(--gray-900); color: #fff; padding: 1.25rem 1.5rem; display: flex; align-items: center; justify-content: space-between; }
.cart-drawer__body { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .75rem; }
.cart-drawer__empty { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 1rem; color: var(--gray-400); }
.cart-item { background: var(--gray-50); border: 1px solid var(--gray-100); border-radius: var(--radius); padding: .875rem; display: flex; gap: .75rem; }
.cart-item__img { width: 60px; height: 60px; object-fit: contain; border-radius: 8px; background: #fff; flex-shrink: 0; }
.cart-item__info { flex: 1; min-width: 0; }
.cart-item__name { font-size: .8125rem; font-weight: 600; color: var(--gray-900); line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cart-item__price { font-size: .875rem; font-weight: 700; color: var(--red); margin-top: .25rem; }
.cart-item__controls { display: flex; align-items: center; gap: .5rem; margin-top: .5rem; }
.qty-btn { width: 24px; height: 24px; border-radius: 6px; background: var(--gray-200); color: var(--gray-700); font-size: .875rem; display: flex; align-items: center; justify-content: center; transition: all .15s; }
.qty-btn:hover { background: var(--red); color: #fff; }
.qty-display { font-size: .8125rem; font-weight: 700; min-width: 20px; text-align: center; }
.cart-item__remove { margin-left: auto; color: var(--gray-400); transition: color .15s; }
.cart-item__remove:hover { color: var(--red); }
.cart-drawer__footer { padding: 1.25rem 1.5rem; border-top: 1px solid var(--gray-100); background: var(--gray-50); }
.cart-totals { display: flex; flex-direction: column; gap: .5rem; margin-bottom: 1rem; }
.cart-totals__row { display: flex; justify-content: space-between; font-size: .875rem; color: var(--gray-500); }
.cart-totals__total { font-size: 1.125rem; font-weight: 700; color: var(--gray-900); border-top: 1px solid var(--gray-200); padding-top: .5rem; margin-top: .25rem; }

/* ── Buttons ────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .75rem 1.5rem; border-radius: var(--radius); font-size: .9375rem; font-weight: 700; transition: all .2s; cursor: pointer; }
.btn--primary { background: var(--red); color: #fff; box-shadow: 0 4px 12px rgba(185,28,28,.3); }
.btn--primary:hover { background: var(--red-dark); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(185,28,28,.35); }
.btn--primary:disabled { opacity: .5; transform: none; cursor: not-allowed; }
.btn--outline { background: transparent; color: var(--red); border: 2px solid var(--red); }
.btn--outline:hover { background: var(--red-light); }
.btn--dark { background: var(--gray-900); color: #fff; }
.btn--dark:hover { background: #000; }
.btn--ghost { background: transparent; color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn--ghost:hover { background: var(--gray-100); }
.btn--full { width: 100%; }
.btn--sm { padding: .5rem 1rem; font-size: .8125rem; border-radius: 8px; }

/* ── Product Card ───────────────────────────────────────────── */
.product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.product-card { background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-100); overflow: hidden; transition: all .25s; cursor: pointer; display: flex; flex-direction: column; }
.product-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); border-color: var(--gray-200); }
.product-card__img-wrap { aspect-ratio: 1; background: var(--gray-50); overflow: hidden; position: relative; padding: 1rem; display: flex; align-items: center; justify-content: center; }
.product-card__img { max-height: 160px; object-fit: contain; transition: transform .3s; }
.product-card:hover .product-card__img { transform: scale(1.05); }
.product-card__badges { position: absolute; top: .5rem; right: .5rem; display: flex; flex-direction: column; gap: .25rem; align-items: flex-end; }
.badge { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .6rem; border-radius: 999px; font-size: .6875rem; font-weight: 600; }
.badge--brand { background: var(--red); color: #fff; }
.badge--stock { background: #d1fae5; color: #065f46; }
.badge--out { background: #fee2e2; color: #991b1b; }
.product-card__body { padding: .875rem; flex: 1; display: flex; flex-direction: column; gap: .375rem; }
.product-card__model { font-size: .6875rem; color: var(--gray-400); font-weight: 500; }
.product-card__name { font-size: .875rem; font-weight: 600; color: var(--gray-900); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; flex: 1; }
.product-card__price { font-size: 1.0625rem; font-weight: 700; color: var(--gray-900); margin-top: .5rem; }
.product-card__price span { font-size: .75rem; font-weight: 400; color: var(--gray-400); }
.product-card__footer { padding: .75rem .875rem; border-top: 1px solid var(--gray-100); }
.product-card__add { width: 100%; padding: .5rem; font-size: .8125rem; font-weight: 700; background: var(--red); color: #fff; border-radius: 8px; transition: all .15s; display: flex; align-items: center; justify-content: center; gap: .375rem; }
.product-card__add:hover { background: var(--red-dark); }
.product-card__add:disabled { background: var(--gray-200); color: var(--gray-500); cursor: not-allowed; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar { background: #fff; border-radius: var(--radius); border: 1px solid var(--gray-100); padding: 1.25rem; }
.sidebar__section { margin-bottom: 1.5rem; }
.sidebar__title { font-size: .8125rem; font-weight: 700; color: var(--gray-500); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .875rem; }
.sidebar__option { display: flex; align-items: center; gap: .625rem; padding: .375rem 0; cursor: pointer; }
.sidebar__option input[type=radio], .sidebar__option input[type=checkbox] { accent-color: var(--red); width: 16px; height: 16px; }
.sidebar__label { font-size: .875rem; color: var(--gray-700); }
.sidebar__option:hover .sidebar__label { color: var(--red); }
.sidebar__option.active .sidebar__label { color: var(--red); font-weight: 600; }

/* ── Active Filters ─────────────────────────────────────────── */
.active-filters { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.filter-chip { display: inline-flex; align-items: center; gap: .375rem; padding: .3rem .75rem; background: var(--red-light); color: var(--red); border-radius: 999px; font-size: .8125rem; font-weight: 600; }
.filter-chip button { display: flex; align-items: center; color: var(--red); transition: opacity .15s; }
.filter-chip button:hover { opacity: .6; }

/* ── Pagination ─────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; justify-content: center; gap: .75rem; margin-top: 2.5rem; }
.pagination__btn { padding: .5rem 1.25rem; border-radius: var(--radius); border: 1px solid var(--gray-200); font-size: .875rem; font-weight: 600; color: var(--gray-700); background: #fff; transition: all .15s; }
.pagination__btn:hover:not(:disabled) { border-color: var(--red); color: var(--red); }
.pagination__btn:disabled { opacity: .4; cursor: not-allowed; }
.pagination__info { padding: .5rem 1rem; background: var(--gray-100); border-radius: 8px; font-size: .875rem; color: var(--gray-500); font-weight: 500; }

/* ── Brand Carousel ─────────────────────────────────────────── */
.brands-section { background: #fff; border-top: 1px solid var(--gray-100); padding: 3rem 0; margin-top: 4rem; }
.brands-section__title { text-align: center; font-size: 1rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: .1em; margin-bottom: 2rem; }
.brands-track-wrap { overflow: hidden; }
.brands-track { display: flex; gap: 2.5rem; animation: scroll-brands 30s linear infinite; width: max-content; }
.brands-track:hover { animation-play-state: paused; }
.brand-logo { height: 36px; width: auto; object-fit: contain; filter: grayscale(1); opacity: .5; transition: all .3s; flex-shrink: 0; }
.brand-logo:hover { filter: none; opacity: 1; }
@keyframes scroll-brands { 0%{transform:translateX(0)} 100%{transform:translateX(-50%)} }

/* ── Page Header ─────────────────────────────────────────────── */
.page-header { text-align: center; padding: 2.5rem 0 2rem; }
.page-header h1 { font-size: 2rem; font-weight: 800; color: var(--gray-900); }
.page-header h1 span { color: var(--red); }
.page-header p { font-size: 1rem; color: var(--gray-500); margin-top: .5rem; }

/* ── Layout helpers ─────────────────────────────────────────── */
.shop-layout { display: grid; grid-template-columns: 220px 1fr; gap: 1.5rem; align-items: start; }
.loading-state { display: flex; align-items: center; justify-content: center; min-height: 300px; }
.spinner { width: 36px; height: 36px; border: 3px solid var(--gray-200); border-top-color: var(--red); border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Skeleton ────────────────────────────────────────────────── */
.skeleton { background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 50%, var(--gray-100) 75%); background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: 8px; }
@keyframes shimmer { 0%{background-position:200% 0} 100%{background-position:-200% 0} }

/* ── Footer ────────────────────────────────────────────────── */
footer { background: var(--gray-900); color: var(--gray-400); text-align: center; padding: 1.5rem; font-size: .8125rem; margin-top: 4rem; }
footer a { color: var(--gray-400); transition: color .15s; }
footer a:hover { color: #fff; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 1024px) { .product-grid { grid-template-columns: repeat(3, 1fr); } .navbar__nav { display: none; } .navbar__hamburger { display: flex; } .shop-layout { grid-template-columns: 1fr; } .sidebar { display: none; } }
@media (max-width: 768px) { .product-grid { grid-template-columns: repeat(2, 1fr); } .navbar__search { display: none; } }
@media (max-width: 480px) { .product-grid { grid-template-columns: 1fr; } }
