/* ================================================================
   jumia-mobile.css  — Jumia-fidelity UI layer
   Load AFTER all existing stylesheets in <head>.
   Adds:
     • Fixed 5-tab bottom navigation (mobile)
     • Dual-pane categories drawer (mobile)
     • Flash-Sales red bar with countdown
     • Jumia-style product cards (discount badge, Express logo,
       "Few units left" warning)
     • Cart summary (subtotal, green delivery box, orange CTA)
     • Desktop: bottom nav converts to top mega-menu strip
   ================================================================ */

/* ── 1. DESIGN TOKENS ──────────────────────────────────────── */
:root {
  --j-orange:       #ff7a00;
  --j-orange-dark:  #e56700;
  --j-orange-light: #fff4e8;
  --j-red:          #e02020;
  --j-red-dark:     #b71c1c;
  --j-green:        #ff7a00;   /* orange theme override */
  --j-green-bg:     #fff4e8;   /* orange theme override */
  --j-white:        #ffffff;
  --j-gray-50:      #fafafa;
  --j-gray-100:     #f5f5f5;
  --j-gray-200:     #eeeeee;
  --j-gray-400:     #bdbdbd;
  --j-gray-600:     #757575;
  --j-gray-800:     #424242;
  --j-gray-900:     #212121;
  --j-radius:       6px;
  --j-shadow-sm:    0 1px 4px rgba(0,0,0,.10);
  --j-shadow-md:    0 4px 16px rgba(0,0,0,.12);
  --j-bottom-nav-h: 60px;
  --j-font:         'Roboto', 'Helvetica Neue', Arial, sans-serif;
}

/* ── 2. GLOBAL RESET HELPERS ───────────────────────────────── */
.j-reset { box-sizing: border-box; margin: 0; padding: 0; }
*, *::before, *::after { box-sizing: border-box; }

/* ── 3. BOTTOM NAVIGATION (mobile) ────────────────────────── */
.j-bottom-nav {
  display: none; /* shown via media query below */
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--j-bottom-nav-h);
  background: var(--j-white);
  border-top: 1px solid var(--j-gray-200);
  box-shadow: 0 -2px 10px rgba(0,0,0,.08);
  z-index: 9000;
}

.j-bottom-nav__inner {
  display: flex;
  height: 100%;
}

.j-bnav-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: var(--j-gray-600);
  font-size: 0.6rem;
  font-family: var(--j-font);
  font-weight: 500;
  letter-spacing: 0.2px;
  transition: color 0.15s;
  padding: 4px 2px;
  position: relative;
}

.j-bnav-tab svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.j-bnav-tab--active,
.j-bnav-tab:hover {
  color: var(--j-orange);
}

.j-bnav-tab--active svg path,
.j-bnav-tab--active svg line,
.j-bnav-tab--active svg circle,
.j-bnav-tab--active svg polyline {
  stroke: var(--j-orange);
}

/* Search tab active state */
.j-bnav-tab--search.j-bnav-tab--active,
.j-bnav-tab--search:hover {
  color: var(--j-orange);
}
.j-bnav-tab--search.j-bnav-tab--active svg path,
.j-bnav-tab--search.j-bnav-tab--active svg circle {
  stroke: var(--j-orange);
}

/* Cart / Wishlist badge on bottom nav */
.j-bnav-badge {
  position: absolute;
  top: 4px;
  right: calc(50% - 18px);
  background: var(--j-orange);
  color: #fff;
  font-size: 0.55rem;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  line-height: 1;
  border: 2px solid var(--j-white);
}

/* Add bottom padding to body so content isn't hidden behind nav */
@media (max-width: 767px) {
  body { padding-bottom: calc(var(--j-bottom-nav-h) + 8px); }
  .j-bottom-nav { display: block; }
}

/* ── 4. DUAL-PANE CATEGORY DRAWER (mobile) ─────────────────── */
.j-cat-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 8500;
}
.j-cat-overlay.open { display: block; }

.j-cat-drawer {
  position: fixed;
  top: 0; left: 0; bottom: 0;
  width: 92vw;
  max-width: 480px;
  background: var(--j-white);
  z-index: 8600;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 0.28s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.j-cat-drawer.open { transform: translateX(0); }

.j-cat-drawer__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--j-orange);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  flex-shrink: 0;
}
.j-cat-drawer__close {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.j-cat-drawer__body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Left pane: primary category list */
.j-cat-left {
  width: 120px;
  flex-shrink: 0;
  overflow-y: auto;
  background: var(--j-gray-100);
  border-right: 1px solid var(--j-gray-200);
}

.j-cat-left-item {
  display: block;
  padding: 14px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--j-gray-800);
  text-decoration: none;
  border-left: 3px solid transparent;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  line-height: 1.3;
  word-break: break-word;
}
.j-cat-left-item:hover,
.j-cat-left-item.active {
  background: var(--j-white);
  border-left-color: var(--j-orange);
  color: var(--j-orange);
}

/* Right pane: subcategory thumbnail grid */
.j-cat-right {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.j-cat-sub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.j-cat-sub-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  color: var(--j-gray-800);
  padding: 10px 4px;
  border-radius: var(--j-radius);
  transition: background 0.12s;
}
.j-cat-sub-item:hover { background: var(--j-gray-50); }

.j-cat-sub-item__thumb {
  width: 56px;
  height: 56px;
  border-radius: var(--j-radius);
  background: var(--j-gray-100);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.j-cat-sub-item__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.j-cat-sub-item__thumb svg { color: var(--j-gray-400); }

.j-cat-sub-item__label {
  font-size: 0.68rem;
  text-align: center;
  line-height: 1.3;
  color: var(--j-gray-800);
}

/* ── 5. STICKY SEARCH HEADER (mobile) ──────────────────────── */
.j-sticky-search {
  display: none;
}
@media (max-width: 767px) {
  .j-sticky-search {
    display: flex;
    position: sticky;
    top: 0;
    z-index: 800;
    background: #f0f0f0;
    padding: 8px 12px;
    gap: 10px;
    align-items: center;
    border-bottom: 1px solid var(--j-gray-200);
    box-shadow: var(--j-shadow-sm);
  }
}

.j-sticky-search__form {
  flex: 1;
  display: flex;
  align-items: center;
  background: var(--j-white);
  border-radius: 24px;
  overflow: hidden;
  border: 1px solid var(--j-gray-200);
  height: 40px;
}
.j-sticky-search__input {
  flex: 1;
  border: none;
  outline: none;
  padding: 0 14px;
  font-size: 14px; /* prevent iOS zoom */
  font-family: var(--j-font);
  color: var(--j-gray-900);
  background: transparent;
}
.j-sticky-search__input::placeholder { color: var(--j-gray-400); }
.j-sticky-search__btn {
  background: none;
  border: none;
  padding: 0 14px;
  cursor: pointer;
  color: var(--j-gray-600);
  display: flex;
  align-items: center;
}
.j-sticky-search__btn:hover { color: var(--j-orange); }

.j-sticky-search__cart {
  position: relative;
  color: var(--j-gray-700);
  display: flex;
  align-items: center;
}
.j-sticky-search__cart svg { width: 26px; height: 26px; }

/* ── 6. FLASH SALES BAR ────────────────────────────────────── */
.j-flash-bar {
  background: var(--j-red);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  font-family: var(--j-font);
  font-size: 0.88rem;
  font-weight: 700;
}

.j-flash-bar__label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 1rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  flex-shrink: 0;
}

.j-flash-bar__timer {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  background: rgba(0,0,0,.22);
  border-radius: 4px;
  padding: 4px 8px;
  letter-spacing: 0.5px;
}
.j-flash-bar__timer-label {
  font-size: 0.65rem;
  opacity: .85;
  margin-right: 4px;
  font-weight: 400;
}
.j-flash-bar__digits {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.j-flash-bar__see-all {
  margin-left: auto;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 600;
  text-decoration: underline;
  white-space: nowrap;
  flex-shrink: 0;
}
.j-flash-bar__see-all:hover { opacity: .85; }

/* ── 7. PRODUCT CARDS (Jumia style) ────────────────────────── */
.j-product-card {
  background: var(--j-white);
  border-radius: var(--j-radius);
  box-shadow: var(--j-shadow-sm);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.18s, transform 0.18s;
  font-family: var(--j-font);
  position: relative;
}
.j-product-card:hover {
  box-shadow: var(--j-shadow-md);
  transform: translateY(-2px);
}

.j-product-card__img-wrap {
  position: relative;
  aspect-ratio: 1 / 1;
  background: var(--j-gray-50);
  overflow: hidden;
}
.j-product-card__img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
  display: block;
}
.j-product-card:hover .j-product-card__img-wrap img {
  transform: scale(1.04);
}

/* Discount badge — top-right */
.j-discount-badge {
  position: absolute;
  top: 8px; right: 8px;
  background: var(--j-red);
  color: #fff;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 7px;
  border-radius: 3px;
  line-height: 1.3;
  letter-spacing: 0.3px;
  z-index: 2;
}

/* Jumia Express logo badge — top-left */
.j-express-badge {
  position: absolute;
  top: 8px; left: 8px;
  background: var(--j-orange);
  color: #fff;
  font-size: 0.58rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
  z-index: 2;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.j-express-badge svg { width: 10px; height: 10px; }

/* "Few units left" ribbon — bottom of image */
.j-low-stock-ribbon {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(230, 74, 25, 0.92);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  text-align: center;
  padding: 4px 6px;
  letter-spacing: 0.3px;
}

.j-product-card__body {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 4px;
}

.j-product-card__name {
  font-size: 0.83rem;
  font-weight: 500;
  color: var(--j-gray-800);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-decoration: none;
}
.j-product-card__name:hover { color: var(--j-orange); }

.j-product-card__price-row {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
}
.j-product-card__price {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--j-gray-900);
}
.j-product-card__old-price {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--j-gray-400);
  text-decoration: line-through;
}

.j-product-card__actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.j-btn-cart {
  flex: 1;
  background: var(--j-orange);
  color: #fff;
  border: none;
  border-radius: var(--j-radius);
  padding: 9px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  font-family: var(--j-font);
  cursor: pointer;
  transition: background 0.15s;
  text-align: center;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.j-btn-cart:hover { background: var(--j-orange-dark); color: #fff; }
.j-btn-cart:disabled,
.j-btn-cart--oos {
  background: var(--j-gray-200);
  color: var(--j-gray-400);
  cursor: not-allowed;
}

.j-btn-wishlist {
  background: none;
  border: 1px solid var(--j-gray-200);
  border-radius: var(--j-radius);
  padding: 8px 10px;
  cursor: pointer;
  color: var(--j-gray-400);
  transition: color 0.15s, border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.j-btn-wishlist:hover,
.j-btn-wishlist.active { color: var(--j-red); border-color: var(--j-red); }
.j-btn-wishlist svg { width: 18px; height: 18px; }

/* ── 8. PRODUCT CARD GRID WRAPPER ──────────────────────────── */
.j-product-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 0;
}
@media (min-width: 480px) {
  .j-product-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
}
@media (min-width: 768px) {
  .j-product-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; }
}
@media (min-width: 1024px) {
  .j-product-grid { grid-template-columns: repeat(5, 1fr); gap: 18px; }
}
@media (min-width: 1280px) {
  .j-product-grid { grid-template-columns: repeat(6, 1fr); }
}

/* ── 9. CART SUMMARY (Jumia-style) ─────────────────────────── */
.j-cart-summary {
  background: var(--j-white);
  border-radius: var(--j-radius);
  box-shadow: var(--j-shadow-sm);
  overflow: hidden;
  font-family: var(--j-font);
}

.j-cart-summary__header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--j-gray-100);
}
.j-cart-summary__title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--j-gray-900);
  margin: 0;
}

.j-cart-summary__delivery-box {
  margin: 14px 20px 0;
  background: var(--j-green-bg);
  border: 1px solid #ffb366;
  border-radius: var(--j-radius);
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--j-green);
}
.j-cart-summary__delivery-box svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

.j-cart-summary__lines {
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.j-cart-summary__line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.88rem;
  color: var(--j-gray-700);
}
.j-cart-summary__line--subtotal .j-summary-label {
  font-weight: 700;
  color: var(--j-gray-900);
}
.j-cart-summary__line--subtotal .j-summary-val {
  font-weight: 700;
  color: var(--j-gray-900);
  font-size: 1.02rem;
}
.j-summary-free {
  color: var(--j-green);
  font-weight: 700;
}
.j-cart-summary__divider {
  border: none;
  border-top: 1px solid var(--j-gray-100);
  margin: 4px 0;
}
.j-cart-summary__total-line {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--j-gray-900);
  padding-top: 4px;
}

.j-cart-summary__cta {
  margin: 0 20px 20px;
  display: block;
  width: calc(100% - 40px);
  background: var(--j-orange);
  color: #fff;
  text-align: center;
  border: none;
  border-radius: 4px;
  padding: 15px 20px;
  font-size: 1rem;
  font-weight: 700;
  font-family: var(--j-font);
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s;
  letter-spacing: 0.3px;
}
.j-cart-summary__cta:hover { background: var(--j-orange-dark); color: #fff; }

.j-cart-summary__secure {
  text-align: center;
  font-size: 0.72rem;
  color: var(--j-gray-400);
  padding: 0 20px 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

/* ── 10. DESKTOP UPGRADES (768px+) ─────────────────────────── */
@media (min-width: 768px) {
  /* Bottom nav hidden — desktop uses existing top navbar */
  .j-bottom-nav { display: none !important; }
  body { padding-bottom: 0; }

  /* Sticky search bar hidden on desktop */
  .j-sticky-search { display: none !important; }

  /* Product grid slightly larger cards */
  .j-product-card__name { font-size: 0.88rem; }
  .j-product-card__price { font-size: 1.08rem; }
}

/* ── 11. CATEGORY SECTION HEADER ───────────────────────────── */
.j-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 10px;
  font-family: var(--j-font);
}
.j-section-header__title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--j-gray-900);
  margin: 0;
}
.j-section-header__see-all {
  font-size: 0.8rem;
  color: var(--j-orange);
  font-weight: 600;
  text-decoration: none;
}
.j-section-header__see-all:hover { text-decoration: underline; }

/* ── 12. CAROUSEL TRACK ─────────────────────────────────────── */
.j-product-scroll {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.j-product-scroll::-webkit-scrollbar { display: none; }

.j-product-scroll .j-product-card {
  flex: 0 0 155px;
  scroll-snap-align: start;
}
@media (min-width: 480px) {
  .j-product-scroll .j-product-card { flex: 0 0 185px; }
}
@media (min-width: 768px) {
  .j-product-scroll .j-product-card { flex: 0 0 210px; }
}