/* ============================================================
   AfriStore Shop (customer-facing) — Stylesheet
   ------------------------------------------------------------
   This is a separate design system from admin.css/seller.css —
   different colors, different fonts, different component names —
   so it's kept in its own file rather than importing the admin
   stylesheet. Variables below are extracted from the literal
   hex values already used throughout this page, so any other
   shop-portal page (e.g. the product detail page) can reuse them
   instead of re-typing the same hex codes.
   Used by: shop.html (homepage)
   ============================================================ */

:root {
    --shop-green: #008000;
    --shop-green-dark: #005f00;
    --shop-bg: #f5f5f5;
    --shop-text: #1a2e1a;
    --shop-muted: #6b7f6b;
    --shop-border: #d0e4d0;
    --shop-border-light: #eef2ee;
    --shop-card-alt: #e8f5e9;
    --shop-pill-bg: #f0f4f0;
    --whatsapp: #25D366;
    --whatsapp-dark: #128C7E;
    --shop-red: #e53935;
    --shop-red-alt: #ff4444;
    --shop-orange: #f57c00;
    --shop-mpesa-alt: #00a651;
    --shop-shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
    --shop-shadow-md: 0 8px 30px rgba(0,0,0,0.15);
    --shop-shadow-lg: 0 8px 30px rgba(0,0,0,0.18);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body { font-family: 'Plus Jakarta Sans', Arial, sans-serif; background: var(--shop-bg); padding-bottom: 0; }

/* ── STICKY WRAP: header + tagline + category pills stick together ── */
.sticky-wrap {
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shop-shadow-sm);
}

header {
    background: var(--shop-green);
    color: white;
    padding: 10px 16px;
}

/* Desktop: everything in one row. Mobile: logo/icons row, then search row below. */
.header-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.header-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.logo-block { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo-block img { height: 34px; width: 34px; object-fit: contain; border-radius: 8px; }
.logo-block h1 { font-family: 'Fredoka', sans-serif; font-size: 1.3em; font-weight: 700; line-height: 1; letter-spacing: -0.3px; }

.search-wrap { position: relative; width: 100%; }

#unified-search {
    width: 100%;
    padding: 9px 14px;
    border-radius: 25px;
    border: none;
    font-size: 0.9em;
    outline: none;
    font-family: inherit;
}

#seller-search-results {
    display: none; position: absolute; top: 44px; left: 0; width: 100%;
    background: white; border-radius: 12px; box-shadow: var(--shop-shadow-lg);
    border: 1px solid var(--shop-border); z-index: 300; max-height: 300px; overflow-y: auto;
}

.header-icons {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.sell-btn-text { display: inline; }

@media (max-width: 380px) {
    .icon-btn { padding: 8px 10px; font-size: 0.8em; }
    .sell-btn { padding: 8px 10px; font-size: 0.78em; }
    .sell-btn-text { display: none; }
    .logo-block h1 { font-size: 1.6em; }
}

.icon-btn {
    background: white;
    color: var(--shop-green);
    border: none;
    padding: 9px 12px;
    border-radius: 25px;
    font-size: 0.88em;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sell-btn {
    background: var(--whatsapp);
    color: white;
    border: none;
    padding: 9px 16px;
    border-radius: 25px;
    font-size: 0.88em;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

/* ── TAGLINE BANNER ── */
.tagline-banner {
    background: linear-gradient(90deg, var(--shop-green-dark), var(--shop-green));
    color: white;
    padding: 8px 16px;
    font-size: 0.8em;
    font-weight: 600;
    text-align: center;
    letter-spacing: 0.3px;
}

/* ── CATEGORY PILLS: horizontal scroll ── */
.cat-pills-row {
    background: white;
    padding: 10px 16px;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-top: 1px solid var(--shop-border-light);
    scrollbar-width: none;
}
.cat-pills-row::-webkit-scrollbar { display: none; }

.cat-pill {
    flex-shrink: 0;
    background: var(--shop-pill-bg);
    border: 2px solid transparent;
    color: var(--shop-text);
    padding: 7px 15px;
    border-radius: 20px;
    font-size: 0.85em;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    font-family: inherit;
}
.cat-pill.active { background: var(--shop-green); color: white; }

.cat-more-wrap { position: relative; flex-shrink: 0; }
.cat-more-popover {
    display: none; position: absolute; top: 42px; left: 0; min-width: 220px;
    background: white; border-radius: 12px; box-shadow: var(--shop-shadow-lg);
    border: 1px solid var(--shop-border); z-index: 250; padding: 10px;
}
.cat-more-search {
    width: 100%; padding: 8px 12px; border: 2px solid var(--shop-border); border-radius: 8px;
    font-size: 0.88em; outline: none; margin-bottom: 8px; font-family: inherit;
}
.cat-more-list { max-height: 240px; overflow-y: auto; }
.cat-more-item {
    display: block; width: 100%; text-align: left; padding: 8px 10px; border: none;
    background: none; font-size: 0.88em; cursor: pointer; border-radius: 8px;
    font-family: inherit; color: var(--shop-text);
}
.cat-more-item:hover { background: var(--shop-card-alt); }

/* ── CAROUSEL SECTIONS ── */
.carousel-section { padding: 16px 16px 4px; max-width: 1200px; margin: 0 auto; }
.carousel-heading {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.carousel-heading h2 { font-size: 1.05em; font-weight: 800; color: var(--shop-text); }
.carousel-heading a { font-size: 0.8em; color: var(--shop-green); font-weight: 700; text-decoration: none; }

.carousel-track {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 6px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
}
.carousel-track::-webkit-scrollbar { display: none; }

/* Reel carousel cards */
.reel-h-card {
    flex-shrink: 0;
    width: 120px;
    height: 190px;
    border-radius: 14px;
    overflow: hidden;
    position: relative;
    background: #000;
    text-decoration: none;
    scroll-snap-align: start;
    box-shadow: var(--shop-shadow-sm);
}
.reel-h-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.reel-h-badge {
    position: absolute; top: 6px; left: 6px; background: rgba(0,0,0,0.55); color: white;
    font-size: 0.62em; font-weight: 700; padding: 3px 8px; border-radius: 20px;
}
.reel-h-caption {
    position: absolute; bottom: 0; left: 0; right: 0; padding: 6px 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.85)); color: white;
}
.reel-h-caption-text { font-size: 0.68em; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.reel-h-seller { font-size: 0.6em; opacity: 0.85; }

/* Trending product carousel cards */
.trend-h-card {
    flex-shrink: 0;
    width: 140px;
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shop-shadow-sm);
    text-decoration: none;
    color: inherit;
    scroll-snap-align: start;
}
.trend-h-card img { width: 100%; aspect-ratio: 1/1; object-fit: cover; display: block; }
.trend-h-body { padding: 8px; }
.trend-h-body h4 { font-size: 0.8em; font-weight: 700; line-height: 1.25; margin-bottom: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trend-h-price { color: var(--shop-green); font-weight: 800; font-size: 0.88em; }

/* Featured seller carousel cards */
.seller-h-card {
    flex-shrink: 0;
    width: 84px;
    text-align: center;
    text-decoration: none;
    color: inherit;
    scroll-snap-align: start;
}
.seller-h-card img, .seller-h-avatar-fallback {
    width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
    margin: 0 auto 6px; display: flex; align-items: center; justify-content: center;
    background: var(--shop-card-alt); font-size: 1.4em; border: 2px solid var(--shop-border);
}
.seller-h-name { font-size: 0.72em; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── PRODUCT GRID: dense on mobile ── */
.grid-heading { padding: 20px 16px 0; max-width: 1200px; margin: 0 auto; }
.grid-heading h2 { font-size: 1.05em; font-weight: 800; color: var(--shop-text); }

.products {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    padding: 12px 14px 20px;
    max-width: 1200px;
    margin: 0 auto;
}

.card {
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shop-shadow-sm);
    position: relative;
    opacity: 0;
    transform: translateY(10px);
    animation: cardFadeIn 0.45s ease forwards;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.card:active { transform: scale(0.97); }

@media (hover: hover) {
    .card:hover { transform: translateY(-3px); box-shadow: 0 8px 20px rgba(0,0,0,0.14); }
}

@keyframes cardFadeIn {
    to { opacity: 1; transform: translateY(0); }
}

.card-accent {
    height: 4px;
    width: 100%;
    background: linear-gradient(90deg, var(--shop-green), var(--whatsapp));
}

.card img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    display: block;
}

.no-image {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #eee;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.4em;
}

.card-body { padding: 8px; }
.card-body h3 { font-size: 0.85em; margin-bottom: 3px; line-height: 1.25; font-weight: 700; }

.price {
    color: var(--shop-green);
    font-size: 1.05em;
    font-weight: 800;
    margin: 5px 0;
}

.wishlist-btn {
    position: absolute; top: 8px; right: 8px; background: white; border: none;
    width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 0.85em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2); z-index: 5;
    transition: transform 0.15s ease;
}
.wishlist-btn:active { transform: scale(0.85); }

/* ── CART SIDEBAR ── */
.cart-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 200;
}

.cart-sidebar {
    position: fixed;
    top: 0; right: -400px;
    width: 350px;
    max-width: 92%;
    height: 100%;
    background: white;
    z-index: 300;
    transition: right 0.3s ease;
    display: flex;
    flex-direction: column;
}

.cart-sidebar.open { right: 0; }

.cart-header {
    background: var(--shop-green);
    color: white;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.close-cart {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
}

.cart-items {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.cart-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid #eee;
}

.cart-item-name { font-weight: bold; }
.cart-item-price { color: var(--shop-green); }

.remove-btn {
    background: var(--shop-red-alt);
    color: white;
    border: none;
    padding: 5px 10px;
    border-radius: 5px;
    cursor: pointer;
}

.cart-footer {
    padding: 20px;
    border-top: 2px solid #eee;
}

.cart-total {
    font-size: 1.3em;
    font-weight: bold;
    margin-bottom: 15px;
    color: var(--shop-green);
}

.checkout-btn {
    width: 100%;
    background: var(--whatsapp);
    color: white;
    border: none;
    padding: 15px;
    border-radius: 5px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
}

.checkout-btn:hover { background: var(--whatsapp-dark); }

.empty-cart {
    text-align: center;
    color: #888;
    margin-top: 50px;
    font-size: 1.1em;
}

footer {
    text-align: center;
    padding: 20px;
    color: #888;
    font-size: 0.9em;
}

/* ── BOTTOM MOBILE NAV ── */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: #0f9d0f;
    border-top: 1px solid #0c7a0c;
    box-shadow: 0 -2px 12px rgba(0,0,0,0.15);
    z-index: 150;
    padding: 6px 0 max(6px, env(safe-area-inset-bottom));
}
.bottom-nav-inner {
    display: flex;
    justify-content: space-around;
    align-items: center;
}
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    text-decoration: none;
    color: rgba(255,255,255,0.75);
    font-size: 0.65em;
    font-weight: 700;
    background: none;
    border: none;
    font-family: inherit;
    cursor: pointer;
    padding: 4px 6px;
}
.bottom-nav-item.active { color: #ffffff; }
.bottom-nav-icon { font-size: 1.35em; line-height: 1; }

@media (max-width: 639px) {
    .bottom-nav { display: block; }
    body { padding-bottom: 62px; }
}

@keyframes locationHintBounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(4px); }
}

/* Pending review popup — shown once per browser session on /shop when
   a logged-in buyer has a delivered, unreviewed order (web backup to
   the WhatsApp review reminders). */
.pending-review-overlay {
    display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5);
    z-index: 500; align-items: center; justify-content: center; padding: 20px;
}
.pending-review-box {
    background: white; border-radius: 16px; padding: 28px; max-width: 360px;
    width: 100%; text-align: center; box-shadow: var(--shop-shadow-md);
}
.pending-review-icon { font-size: 2.6em; margin-bottom: 10px; }
.pending-review-title { font-size: 1.15em; font-weight: 800; color: var(--shop-text); margin-bottom: 6px; }
.pending-review-subtitle { color: var(--shop-muted); font-size: 0.88em; margin-bottom: 20px; }
.pending-review-actions { display: flex; gap: 10px; }
.pending-review-rate-btn {
    flex: 1; padding: 12px; background: var(--shop-green); color: white; border: none;
    border-radius: 10px; font-weight: 700; cursor: pointer; text-decoration: none; font-size: 0.9em;
}
.pending-review-dismiss-btn {
    flex: 1; padding: 12px; background: #eee; color: #333; border: none;
    border-radius: 10px; font-weight: 700; cursor: pointer; font-size: 0.9em; font-family: inherit;
}

@media (min-width: 640px) {
    header { padding: 14px 30px; }
    .header-row { flex-direction: row; align-items: center; }
    .header-top-row { display: contents; }
    .logo-block { order: 1; }
    .logo-block h1 { font-size: 1.6em; }
    .search-wrap { flex: 1 1 auto; width: auto; order: 2; max-width: 420px; margin: 0 20px; }
    .header-icons { order: 3; }
    .tagline-banner { padding: 9px 30px; font-size: 0.85em; }
    .cat-pills-row { padding: 12px 30px; }
    .carousel-section { padding: 20px 30px 4px; }
    .grid-heading { padding: 24px 30px 0; }
    .products { padding: 14px 30px 30px; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
    .card-body { padding: 14px; }
    .card-body h3 { font-size: 1em; }
    .price { font-size: 1.2em; }
    .trend-h-card { width: 170px; }
    .reel-h-card { width: 140px; height: 220px; }
    .cart-qty-stepper { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
    .cart-qty-btn { width: 26px; height: 26px; border-radius: 50%; border: none; background: var(--shop-green); color: white; font-size: 1em; font-weight: 800; cursor: pointer; line-height: 1; }
    .cart-qty-value { font-weight: 700; min-width: 16px; text-align: center; }
}