/* ==========================================================================
   FRDSMart — Modern Marketplace Design System
   Sections: 1.Tokens 2.Reset 3.Layout 4.Header/Nav 5.Hero 6.Cards
   7.Product detail 8.Forms/Buttons 9.Cart/Wishlist 10.Dashboard
   11.Reviews 12.Footer 13.Animations 14.Utilities 15.Responsive
   ========================================================================== */

/* ----- 1. Design Tokens ----- */
:root {
    --bg: #f1f3f6;
    --surface: #ffffff;
    --surface-soft: #f7f9fc;
    --surface-alt: #eef2f7;
    --ink: #14171f;
    --ink-soft: #2b3445;
    --muted: #6b7787;
    --line: #e3e8ef;
    --line-strong: #cbd5e1;

    --brand: #2563eb;
    --brand-strong: #1d4ed8;
    --brand-ink: #1e3a8a;
    --accent: #ff9f00;
    --accent-strong: #fb8c00;
    --deal: #ff4f64;
    --danger: #e23744;
    --success: #1aab5b;
    --star: #ffb400;

    --grad-hero-1: linear-gradient(120deg, #1e3a8a 0%, #2563eb 55%, #38bdf8 100%);
    --grad-hero-2: linear-gradient(120deg, #6d28d9 0%, #db2777 100%);
    --grad-hero-3: linear-gradient(120deg, #0f766e 0%, #16a34a 100%);
    --grad-brand: linear-gradient(135deg, #2563eb, #38bdf8);

    --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --shadow-md: 0 8px 24px rgba(16, 24, 40, .10);
    --shadow-lg: 0 20px 48px rgba(16, 24, 40, .16);
    --shadow-brand: 0 12px 30px rgba(37, 99, 235, .28);

    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 20px;
    --radius-pill: 999px;

    --header-h: 64px;
    --strip-h: 46px;
    --maxw: 1320px;

    --font: "Inter", "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
    --t-fast: .16s ease;
    --t: .26s cubic-bezier(.4, 0, .2, 1);
}

[data-theme="dark"] {
    --bg: #0b0f17;
    --surface: #141a24;
    --surface-soft: #1a2230;
    --surface-alt: #202a3a;
    --ink: #eef2f8;
    --ink-soft: #cdd6e4;
    --muted: #93a1b5;
    --line: #283143;
    --line-strong: #3a465c;
    --brand: #5b8cff;
    --brand-strong: #7ea6ff;
    --brand-ink: #bcd2ff;
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, .5);
    --shadow-lg: 0 24px 54px rgba(0, 0, 0, .6);
}

/* ----- 2. Reset ----- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    background: var(--bg);
    color: var(--ink);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background var(--t), color var(--t);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .4em; font-weight: 800; letter-spacing: -.01em; }
ul { margin: 0; padding: 0; list-style: none; }
button { font-family: inherit; }

:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

/* ----- 3. Layout ----- */
.page-shell {
    width: min(var(--maxw), calc(100% - 32px));
    margin: 26px auto 64px;
}

.messages {
    width: min(var(--maxw), calc(100% - 32px));
    margin: 16px auto 0;
    display: grid;
    gap: 10px;
}

.message {
    background: color-mix(in srgb, var(--success) 12%, var(--surface));
    color: var(--success);
    border: 1px solid color-mix(in srgb, var(--success) 35%, transparent);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    font-weight: 600;
    animation: slideDown .4s var(--t) both;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
    margin-top: 24px;
    box-shadow: var(--shadow-sm);
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 18px;
}

.section-heading h2 { margin: 0; font-size: 22px; }
.section-heading a { color: var(--brand); font-weight: 700; font-size: 14px; }
.muted, .brand-line { color: var(--muted); }

.quick-home-wrap {
    width: min(var(--maxw), calc(100% - 32px));
    margin: 18px auto 0;
}

.quick-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--brand);
    font-weight: 700;
    padding: 0 18px;
    box-shadow: var(--shadow-sm);
    transition: var(--t-fast);
}
.quick-home-btn::before { content: "←"; font-size: 16px; }
.quick-home-btn:hover { background: var(--brand); color: #fff; transform: translateX(-2px); }

/* ----- 4. Header / Navbar ----- */
.site-header {
    background: var(--grad-hero-1);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--shadow-md);
}

.header-inner {
    width: min(var(--maxw), calc(100% - 32px));
    margin: 0 auto;
    min-height: var(--header-h);
    display: grid;
    grid-template-columns: auto minmax(260px, 1fr) auto;
    align-items: center;
    gap: 20px;
    padding: 10px 0;
}

.brand {
    font-size: 25px;
    font-weight: 900;
    letter-spacing: -.02em;
    color: #fff;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
}
.brand .brand-mark {
    width: 34px; height: 34px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .16);
    border-radius: 10px;
    font-size: 18px;
    backdrop-filter: blur(4px);
}
.brand span { color: var(--accent); }

.global-search {
    display: grid;
    grid-template-columns: 130px 1fr auto;
    background: #fff;
    border-radius: var(--radius-pill);
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    height: 46px;
}
.global-search select,
.global-search input,
.global-search button { border: 0; background: #fff; color: #14171f; font-size: 14px; }
.global-search select { border-right: 1px solid var(--line); padding: 0 12px; cursor: pointer; }
.global-search input { padding: 0 16px; width: 100%; outline: none; }
.global-search button {
    background: var(--accent);
    color: #1a1300;
    font-weight: 800;
    padding: 0 24px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    transition: var(--t-fast);
}
.global-search button:hover { background: var(--accent-strong); }

.top-nav {
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}
.nav-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: var(--radius-pill);
    font-size: 14px;
    font-weight: 600;
    color: rgba(255, 255, 255, .92);
    transition: var(--t-fast);
    position: relative;
}
.nav-link:hover { background: rgba(255, 255, 255, .16); }
.nav-link .ico { font-size: 17px; }

.nav-badge {
    position: absolute;
    top: -2px; right: -2px;
    min-width: 18px; height: 18px;
    padding: 0 5px;
    background: var(--accent);
    color: #1a1300;
    border-radius: var(--radius-pill);
    font-size: 11px;
    font-weight: 800;
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 2px var(--brand-strong);
}

.theme-toggle {
    border: 1px solid rgba(255, 255, 255, .35);
    background: rgba(255, 255, 255, .12);
    color: #fff;
    border-radius: var(--radius-pill);
    width: 40px; height: 40px;
    cursor: pointer;
    font-size: 17px;
    transition: var(--t-fast);
}
.theme-toggle:hover { background: rgba(255, 255, 255, .24); transform: rotate(15deg); }

.nav-toggle {
    display: none;
    border: 0;
    background: rgba(255, 255, 255, .14);
    color: #fff;
    width: 42px; height: 42px;
    border-radius: 10px;
    font-size: 20px;
    cursor: pointer;
}

/* Category strip / mega menu */
.category-strip {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: var(--header-h);
    z-index: 90;
    box-shadow: var(--shadow-sm);
}
.category-strip-inner {
    width: min(var(--maxw), calc(100% - 32px));
    margin: 0 auto;
    display: flex;
    gap: 4px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 6px 0;
}
.category-strip-inner::-webkit-scrollbar { display: none; }
.cat-chip {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 14px;
    border-radius: var(--radius-pill);
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ink-soft);
    transition: var(--t-fast);
}
.cat-chip .ico { font-size: 16px; }
.cat-chip:hover { background: var(--surface-alt); color: var(--brand); }
.cat-chip.active { background: var(--brand); color: #fff; }

/* ----- 5. Hero slider ----- */
.hero-slider {
    position: relative;
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    min-height: 380px;
}
.hero-slide {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    padding: 56px clamp(28px, 6vw, 80px);
    opacity: 0;
    visibility: hidden;
    transform: scale(1.04);
    transition: opacity .7s ease, transform .9s ease, visibility .7s;
    color: #fff;
    background: var(--grad-hero-1);
}
.hero-slide:nth-child(2) { background: var(--grad-hero-2); }
.hero-slide:nth-child(3) { background: var(--grad-hero-3); }
.hero-slide::after {
    content: "";
    position: absolute;
    right: -60px; top: -60px;
    width: 360px; height: 360px;
    background: radial-gradient(circle, rgba(255,255,255,.22), transparent 70%);
    border-radius: 50%;
}
.hero-slide.active { opacity: 1; visibility: visible; transform: scale(1); position: relative; }
.hero-slide > div { width: min(640px, 100%); position: relative; z-index: 2; }
.hero-slide h1 { font-size: clamp(28px, 4vw, 46px); margin: 12px 0 14px; }
.hero-slide p { font-size: clamp(15px, 2vw, 18px); opacity: .94; margin: 0 0 24px; max-width: 540px; }
.eyebrow {
    display: inline-block;
    background: rgba(255, 255, 255, .18);
    color: #fff;
    padding: 5px 14px;
    border-radius: var(--radius-pill);
    font-weight: 700;
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: .06em;
}
.hero-dots {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 9px;
    z-index: 5;
}
.hero-dots button {
    width: 11px; height: 11px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, .45);
    cursor: pointer;
    transition: var(--t-fast);
}
.hero-dots button.active { background: #fff; width: 30px; border-radius: var(--radius-pill); }

/* ----- Category showcase tiles ----- */
.category-showcase {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 14px;
    margin-top: 26px;
}
.cat-tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px 12px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--t);
    display: grid;
    gap: 8px;
    justify-items: center;
}
.cat-tile:hover { transform: translateY(-5px); box-shadow: var(--shadow-md); border-color: var(--brand); }
.cat-tile .cat-emoji {
    width: 56px; height: 56px;
    display: grid; place-items: center;
    background: var(--surface-alt);
    border-radius: 50%;
    font-size: 26px;
}
.cat-tile span { font-weight: 700; font-size: 13.5px; }

/* ----- 6. Product cards / grid ----- */
.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 20px;
    margin-top: 22px;
}
.product-grid.compact { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; }
.dynamic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }

.product-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    transition: var(--t);
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: var(--shadow-sm);
}
.product-card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }

.card-media {
    position: relative;
    overflow: hidden;
    background: var(--surface-soft);
    aspect-ratio: 1 / 1;
}
.card-media img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform .5s ease;
}
.product-card:hover .card-media img { transform: scale(1.08); }

.card-deal-badge {
    position: absolute;
    top: 10px; left: 10px;
    background: var(--deal);
    color: #fff;
    font-size: 11.5px;
    font-weight: 800;
    padding: 4px 9px;
    border-radius: var(--radius-pill);
    z-index: 2;
}
.card-wish {
    position: absolute;
    top: 10px; right: 10px;
    width: 36px; height: 36px;
    display: grid; place-items: center;
    background: rgba(255, 255, 255, .92);
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 17px;
    color: var(--deal);
    box-shadow: var(--shadow-sm);
    opacity: 0;
    transform: translateY(-6px);
    transition: var(--t);
    z-index: 2;
}
.product-card:hover .card-wish { opacity: 1; transform: translateY(0); }
.card-wish.is-saved { opacity: 1; background: var(--deal); color: #fff; }

.img-fallback {
    width: 100%; height: 100%;
    min-height: 180px;
    display: grid;
    place-items: center;
    color: var(--muted);
    background: var(--surface-alt);
    font-size: 13px;
}

.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-body h3 { font-size: 15px; margin: 0; font-weight: 700; }
.card-body h3 a { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-body h3 a:hover { color: var(--brand); }
.card-desc {
    font-size: 13px;
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.badge {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--brand-ink);
    background: color-mix(in srgb, var(--brand) 12%, transparent);
    border-radius: var(--radius-pill);
    padding: 4px 10px;
}

.price-row { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.price-now { font-size: 19px; font-weight: 900; color: var(--ink); }
.strike { color: var(--muted); text-decoration: line-through; font-size: 13px; }
.discount { color: var(--success); font-weight: 800; font-size: 13px; }

.rating-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--success);
    color: #fff;
    font-size: 12.5px;
    font-weight: 800;
    padding: 2px 8px;
    border-radius: 6px;
}
.review-count { color: var(--muted); font-size: 12.5px; }
.stock-tag { font-size: 12px; font-weight: 700; }
.stock-tag.in { color: var(--success); }
.stock-tag.low { color: var(--accent-strong); }
.stock-tag.out { color: var(--danger); }

.card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 6px; }
.card-actions .btn-primary, .card-actions .btn-secondary { flex: 1; font-size: 13px; min-height: 36px; padding: 0 10px; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }

/* Star helper */
.stars { display: inline-flex; gap: 1px; color: var(--star); font-size: 14px; letter-spacing: 1px; }
.stars .empty { color: var(--line-strong); }

/* ----- 7. Product detail ----- */
.detail-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(340px, .9fr);
    gap: 30px;
    align-items: start;
}
.gallery-shell {
    display: grid;
    grid-template-columns: 78px 1fr;
    gap: 14px;
    position: sticky;
    top: calc(var(--header-h) + var(--strip-h) + 16px);
}
.thumb-column { display: grid; gap: 10px; align-content: start; }
.thumb-btn {
    border: 2px solid var(--line);
    border-radius: 10px;
    padding: 2px;
    background: var(--surface);
    cursor: pointer;
    transition: var(--t-fast);
    overflow: hidden;
}
.thumb-btn img { width: 100%; height: 66px; object-fit: cover; border-radius: 7px; }
.thumb-btn:hover, .thumb-btn.active { border-color: var(--brand); transform: scale(1.04); }

.zoom-frame {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: crosshair;
    box-shadow: var(--shadow-sm);
}
.zoom-frame img {
    width: 100%;
    height: 540px;
    object-fit: contain;
    transition: transform .15s ease;
    transform-origin: center center;
}
.zoom-frame.zooming img { transform: scale(2); }
.zoom-hint {
    position: absolute;
    bottom: 12px; left: 12px;
    background: rgba(0, 0, 0, .62);
    color: #fff;
    font-size: 12px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    pointer-events: none;
}

.detail-panel { display: flex; flex-direction: column; gap: 14px; }
.detail-panel h1 { font-size: 26px; margin: 6px 0; }
.detail-rating-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.price-block { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 6px 0; }
.price { color: var(--ink); font-size: 34px; font-weight: 900; }
.price-block .discount { font-size: 16px; }

.delivery-box {
    border: 1px solid var(--line);
    background: var(--surface-soft);
    border-radius: var(--radius);
    padding: 16px;
    display: grid;
    gap: 10px;
}
.delivery-row { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.delivery-row .ico { font-size: 18px; width: 24px; text-align: center; }

.cta-row { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.cta-row .btn-primary, .cta-row .btn-secondary, .cta-row .btn-cart { flex: 1; min-width: 140px; min-height: 50px; font-size: 15px; }

.btn-cart {
    background: var(--accent);
    color: #1a1300;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: var(--radius-pill);
    font-weight: 800;
    cursor: pointer;
    transition: var(--t-fast);
}
.btn-cart:hover { background: var(--accent-strong); transform: translateY(-2px); }
.btn-buy {
    background: var(--deal);
    color: #fff;
    border: 0;
    border-radius: var(--radius-pill);
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    transition: var(--t-fast);
}
.btn-buy:hover { filter: brightness(1.06); transform: translateY(-2px); }

.seller-line {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13.5px;
    color: var(--muted);
    border-top: 1px dashed var(--line);
    padding-top: 12px;
}
.assured-tag {
    display: inline-flex; align-items: center; gap: 5px;
    color: var(--brand); font-weight: 800; font-size: 13px;
}

.spec-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.spec-grid div { display: grid; gap: 4px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--surface-soft); }
.spec-grid strong { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.spec-grid span { font-weight: 600; }

/* Tabs */
.detail-tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tab-btn {
    border: 0;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
    font-size: 15px;
    padding: 12px 18px;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    margin-bottom: -2px;
    transition: var(--t-fast);
}
.tab-btn:hover { color: var(--ink); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-pane { display: none; animation: fadeIn .35s var(--t) both; }
.tab-pane.active { display: block; }

/* Rating summary */
.rating-summary { display: flex; gap: 28px; align-items: center; flex-wrap: wrap; padding: 8px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.rating-big { text-align: center; }
.rating-big .num { font-size: 46px; font-weight: 900; line-height: 1; }
.rating-bars { flex: 1; min-width: 220px; display: grid; gap: 6px; }
.rating-bar-row { display: grid; grid-template-columns: 48px 1fr 36px; align-items: center; gap: 10px; font-size: 13px; }
.bar-track { height: 8px; background: var(--surface-alt); border-radius: var(--radius-pill); overflow: hidden; }
.bar-fill { height: 100%; background: var(--star); border-radius: var(--radius-pill); }

/* ----- 8. Forms & buttons ----- */
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    padding: 11px 13px;
    background: var(--surface);
    color: var(--ink);
    font-size: 14px;
    font-family: inherit;
    transition: var(--t-fast);
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); outline: none; }
textarea { min-height: 120px; resize: vertical; }

.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.toolbar h1 { font-size: 26px; margin: 0; }
.search-form {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) 160px 160px 170px auto;
    gap: 10px;
    align-items: end;
}

.btn-primary, .btn-secondary, .btn-danger, .btn-ghost {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 42px;
    border: 0;
    border-radius: var(--radius-pill);
    padding: 0 20px;
    color: #fff;
    cursor: pointer;
    font-weight: 700;
    font-size: 14px;
    text-align: center;
    transition: var(--t);
}
.btn-primary { background: var(--brand); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-strong); transform: translateY(-2px); box-shadow: var(--shadow-brand); }
.btn-secondary { background: var(--ink-soft); }
.btn-secondary:hover { filter: brightness(1.12); transform: translateY(-2px); }
.btn-ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--ink); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand); }
.btn-danger { background: var(--danger); }
.btn-danger:hover { filter: brightness(1.08); transform: translateY(-2px); }
.btn-block { width: 100%; }

/* ----- 9. Cart & Wishlist ----- */
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.cart-line {
    display: grid;
    grid-template-columns: 92px 1fr auto;
    gap: 16px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    margin-bottom: 14px;
    align-items: center;
}
.cart-line img { width: 92px; height: 92px; object-fit: cover; border-radius: var(--radius-sm); }
.cart-line .meta h3 { font-size: 16px; margin: 0 0 4px; }
.qty-stepper { display: inline-flex; align-items: center; gap: 8px; }
.qty-stepper input { width: 64px; text-align: center; }
.cart-summary {
    position: sticky;
    top: calc(var(--header-h) + var(--strip-h) + 16px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    box-shadow: var(--shadow-sm);
}
.summary-row { display: flex; justify-content: space-between; padding: 8px 0; font-size: 14px; }
.summary-row.total { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 14px; font-size: 20px; font-weight: 900; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .emoji { font-size: 56px; margin-bottom: 12px; }

/* ----- 10. Dashboard ----- */
.dashboard-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 16px; }
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: var(--t);
}
.kpi-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.kpi-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--brand); }
.kpi-card.danger::before { background: var(--danger); }
.kpi-card.success::before { background: var(--success); }
.kpi-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0; font-weight: 700; }
.kpi-card p { font-size: 34px; font-weight: 900; margin: 8px 0 0; }
.kpi-card .kpi-ico { position: absolute; right: 16px; top: 16px; font-size: 24px; opacity: .5; }

.chart-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.chart-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.chart-box h3 { font-size: 16px; margin: 0 0 14px; }
.donut-wrap { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.donut { width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.donut::after { content: ""; position: absolute; width: 96px; height: 96px; background: var(--surface); border-radius: 50%; }
.donut .donut-label { position: relative; z-index: 2; text-align: center; }
.donut .donut-label .pct { font-size: 26px; font-weight: 900; }
.legend { display: grid; gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.legend-dot { width: 13px; height: 13px; border-radius: 4px; }

.hbar-chart { display: grid; gap: 12px; }
.hbar-row { display: grid; grid-template-columns: 120px 1fr 42px; gap: 12px; align-items: center; font-size: 13px; }
.hbar-track { height: 22px; background: var(--surface-alt); border-radius: var(--radius-sm); overflow: hidden; }
.hbar-fill { height: 100%; background: var(--grad-brand); border-radius: var(--radius-sm); transition: width 1s var(--t); }

/* ----- 11. Reviews ----- */
.review-list { display: grid; gap: 14px; }
.review-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.review-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.review-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--grad-brand); color: #fff; display: grid; place-items: center; font-weight: 800; }
.verdict-tag { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 800; padding: 3px 10px; border-radius: var(--radius-pill); }
.verdict-tag.genuine { background: color-mix(in srgb, var(--success) 15%, transparent); color: var(--success); }
.verdict-tag.fake { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.sentiment-tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: var(--radius-pill); background: var(--surface-alt); color: var(--ink-soft); }

.prediction-panel { border-left: 6px solid var(--success); }
.prediction-panel.fake { border-left-color: var(--danger); }
.verdict-hero { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.verdict-ring {
    width: 110px; height: 110px;
    border-radius: 50%;
    display: grid; place-items: center;
    font-size: 30px; font-weight: 900;
    color: #fff;
}
.verdict-ring.genuine { background: conic-gradient(var(--success) var(--p, 90%), var(--surface-alt) 0); }
.verdict-ring.fake { background: conic-gradient(var(--danger) var(--p, 80%), var(--surface-alt) 0); }
.verdict-ring span { width: 80px; height: 80px; background: var(--surface); border-radius: 50%; display: grid; place-items: center; font-size: 22px; color: var(--ink); }

.prediction-preview { margin-top: 18px; border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 18px; background: var(--surface-soft); }
.prediction-preview.hidden { display: none; }
.review-form label { display: grid; gap: 6px; margin-bottom: 14px; font-weight: 600; font-size: 14px; }

/* ----- Auth ----- */
.auth-wrap { display: grid; place-items: center; min-height: 60vh; }
.auth-card { width: min(440px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 32px; box-shadow: var(--shadow-md); }
.auth-card.wide { width: min(760px, 100%); }
.auth-card h1 { text-align: center; }
.auth-form label { display: grid; gap: 6px; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.auth-meta { text-align: center; margin-top: 16px; color: var(--muted); font-size: 14px; }
.auth-meta a { color: var(--brand); font-weight: 700; }
.grid-two { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Horizontal rail */
.horizontal-rail { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-top: 24px; box-shadow: var(--shadow-sm); }
.rail-track { display: flex; gap: 16px; overflow-x: auto; padding: 6px 2px 12px; scrollbar-width: thin; }
.mini-card { flex: 0 0 auto; width: 180px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: grid; gap: 8px; transition: var(--t); box-shadow: var(--shadow-sm); }
.mini-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.mini-card img { height: 130px; width: 100%; object-fit: cover; border-radius: var(--radius-sm); }
.mini-card strong { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }

/* Pagination */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; margin-top: 30px; flex-wrap: wrap; }
.pagination a, .pagination span {
    min-width: 42px; height: 42px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface);
    padding: 0 14px;
    font-weight: 700;
    transition: var(--t-fast);
}
.pagination a:hover { background: var(--brand); color: #fff; border-color: var(--brand); }
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line); padding: 12px; text-align: left; font-size: 14px; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
tbody tr { transition: var(--t-fast); }
tbody tr:hover { background: var(--surface-soft); }
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

/* Layout helpers for list page */
.list-layout { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
.filter-rail {
    position: sticky;
    top: calc(var(--header-h) + var(--strip-h) + 16px);
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    box-shadow: var(--shadow-sm);
}
.filter-group { margin-bottom: 18px; }
.filter-group h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 0 0 10px; }
.filter-group label { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 7px; cursor: pointer; }
.filter-group label input { width: auto; }

/* ----- 12. Footer ----- */
.site-footer { background: var(--ink); color: #cbd5e1; margin-top: 60px; }
[data-theme="dark"] .site-footer { background: #060a11; }
.footer-inner { width: min(var(--maxw), calc(100% - 32px)); margin: 0 auto; padding: 48px 0 24px; display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 32px; }
.footer-col h4 { color: #fff; font-size: 15px; margin-bottom: 14px; }
.footer-col a { display: block; color: #93a1b5; font-size: 14px; padding: 4px 0; transition: var(--t-fast); }
.footer-col a:hover { color: #fff; }
.footer-brand .brand { color: #fff; margin-bottom: 12px; }
.footer-brand p { font-size: 14px; color: #93a1b5; max-width: 280px; }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .1); padding: 18px 0; text-align: center; font-size: 13px; color: #6b7787; }
.footer-badges { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.footer-badges span { background: rgba(255, 255, 255, .08); padding: 5px 12px; border-radius: var(--radius-pill); font-size: 12px; }

/* ----- 13. Animations ----- */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@keyframes pop { 0% { transform: scale(.8); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes shimmer { 0% { background-position: -400px 0; } 100% { background-position: 400px 0; } }

.reveal { opacity: 0; }
.reveal.in { animation: fadeUp .6s var(--t) both; }
.pop { animation: pop .35s var(--t); }

.skeleton {
    background: linear-gradient(90deg, var(--surface-alt) 25%, var(--surface-soft) 50%, var(--surface-alt) 75%);
    background-size: 800px 100%;
    animation: shimmer 1.4s infinite linear;
    border-radius: var(--radius-sm);
}
.skeleton-card { height: 320px; border-radius: var(--radius); }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ----- 14. Utilities ----- */
.flex { display: flex; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.mt-0 { margin-top: 0; }
.center { text-align: center; }
.wrap { flex-wrap: wrap; }
.hidden { display: none !important; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-alt); padding: 5px 12px; border-radius: var(--radius-pill); font-size: 13px; font-weight: 600; }
.divider { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* Toast */
.toast-stack { position: fixed; bottom: 24px; right: 24px; display: grid; gap: 10px; z-index: 9999; }
.toast {
    background: var(--ink);
    color: #fff;
    padding: 14px 18px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-weight: 600;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
    animation: slideDown .3s var(--t) both;
    min-width: 220px;
}
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* Scroll to top */
.scroll-top {
    position: fixed;
    bottom: 24px; left: 24px;
    width: 46px; height: 46px;
    border-radius: 50%;
    background: var(--brand);
    color: #fff;
    border: 0;
    font-size: 20px;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    opacity: 0;
    pointer-events: none;
    transform: translateY(20px);
    transition: var(--t);
    z-index: 80;
}
.scroll-top.show { opacity: 1; pointer-events: auto; transform: translateY(0); }

/* ----- 15. Responsive ----- */
@media (max-width: 1080px) {
    .list-layout { grid-template-columns: 1fr; }
    .filter-rail { position: static; }
    .cart-layout { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 920px) {
    .header-inner { grid-template-columns: auto 1fr auto; gap: 12px; }
    .top-nav { position: fixed; inset: var(--header-h) 0 auto auto; flex-direction: column; align-items: stretch; background: var(--surface); width: min(280px, 80vw); padding: 14px; gap: 4px; box-shadow: var(--shadow-lg); transform: translateX(110%); transition: var(--t); height: calc(100vh - var(--header-h)); }
    .top-nav.open { transform: translateX(0); }
    .top-nav .nav-link { color: var(--ink); }
    .top-nav .nav-link:hover { background: var(--surface-alt); }
    .nav-toggle { display: grid; place-items: center; }
    .detail-layout { grid-template-columns: 1fr; }
    .gallery-shell { position: static; }
    .search-form { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 640px) {
    .global-search { grid-template-columns: 1fr auto; }
    .global-search select { display: none; }
    .gallery-shell { grid-template-columns: 1fr; }
    .thumb-column { grid-auto-flow: column; overflow-x: auto; }
    .thumb-btn img { width: 64px; }
    .zoom-frame img { height: 360px; }
    .search-form { grid-template-columns: 1fr; }
    .footer-inner { grid-template-columns: 1fr; gap: 20px; }
    .rating-summary { flex-direction: column; align-items: flex-start; }
    .hero-slide { padding: 32px 24px; }
    .cart-line { grid-template-columns: 72px 1fr; }
    .cart-line .line-actions { grid-column: 1 / -1; }
    .page-shell { width: calc(100% - 24px); }
}
