/*
 * Storefront category page — matched to the Metronic "categories" mockups
 * (web + mobile, light + dark): weekly-best-seller hero, sub-category tabs,
 * sort chips and the product grid.
 *
 * Scoped under .cv2 so nothing leaks onto other pages. Light is the base
 * palette; body.darkMode overrides the --cv2-* tokens. Accent tokens follow
 * --tw-brand so National Day (green) and the default brand both work.
 * Logical properties keep the layout mirrored for AR / EN.
 */

.cv2 {
    /* Page wash ends on the footer tone so content and footer read as one surface. */
    --cv2-bg-1: #fbfbfd;
    --cv2-bg-2: var(--tw-bg, #f4f4f6);
    --cv2-bg-3: var(--tw-foot, var(--tw-bg, #f4f4f6));
    --cv2-surface: #ffffff;
    --cv2-line: #e2e2e6;
    --cv2-line-soft: rgba(0, 0, 0, .08);
    --cv2-ink: #17171a;
    --cv2-ink-2: #62626b;
    --cv2-ink-3: #7c7c85;
    --cv2-chip: #e2e2e6;
    --cv2-accent: var(--tw-brand, #f43f5e);
    --cv2-accent-strong: var(--tw-brand-2, #fb7185);
    --cv2-accent-rgb: var(--tw-brand-rgb, 244, 63, 94);
    --cv2-accent-grad: linear-gradient(110deg, var(--cv2-accent), var(--cv2-accent-strong));
    --cv2-good: #16a34a;
    --cv2-grid-line: rgba(0, 0, 0, .035);
    --cv2-glow-red: rgba(var(--cv2-accent-rgb), .1);
    --cv2-glow-violet: rgba(124, 58, 237, .08);
    --cv2-frame: rgba(0, 0, 0, .09);
    --cv2-card-inset: rgba(255, 255, 255, .6);
    --cv2-hero-fallback: linear-gradient(120deg, #1b0b10 0%, #151517 55%);
    --cv2-hero-ink: #fdfdfd;
    --cv2-hero-ink-2: #d6d6dc;
    --cv2-font: "Baloo Bhaijaan 2", "Tahoma", sans-serif;

    position: relative;
    overflow: hidden;
    /* Content height only — min-height:100vh pushed a dead band before the footer. */
    padding-top: calc(var(--tw-header-h, 70px) + 24px);
    padding-bottom: 28px;
    padding-inline: 20px;
    font-family: var(--cv2-font);
    color: var(--cv2-ink);
    background: linear-gradient(180deg, var(--cv2-bg-1) 0%, var(--cv2-bg-2) 42%, var(--cv2-bg-3) 100%);
}

body.darkMode .cv2 {
    --cv2-bg-1: #16161a;
    --cv2-bg-2: var(--tw-bg, #0e0e11);
    --cv2-bg-3: var(--tw-foot, var(--tw-bg, #0e0e11));
    --cv2-surface: #151517;
    --cv2-line: #26262b;
    --cv2-line-soft: rgba(255, 255, 255, .07);
    --cv2-ink: #fdfdfd;
    --cv2-ink-2: #8b8b93;
    --cv2-ink-3: #77777f;
    --cv2-chip: #26262b;
    --cv2-good: #4ade80;
    --cv2-grid-line: rgba(255, 255, 255, .028);
    --cv2-glow-red: rgba(var(--cv2-accent-rgb), .13);
    --cv2-glow-violet: rgba(124, 58, 237, .11);
    --cv2-frame: rgba(255, 255, 255, .08);
    --cv2-card-inset: rgba(255, 255, 255, .04);
    --cv2-hero-ink-2: #b9b9c1;
}

/* Flush into the site footer — its default margin-top:40px left a mismatched strip. */
body:has(.cv2) .tw-footer {
    margin-top: 0;
}

.cv2 *,
.cv2 *::before,
.cv2 *::after {
    box-sizing: border-box;
}

.cv2 a,
.cv2 a:hover {
    text-decoration: none;
}

.cv2__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ── Backdrop ───────────────────────────────────────────────────────── */

.cv2__glow,
.cv2__grid-bg,
.cv2__floater {
    position: absolute;
    pointer-events: none;
}

.cv2__glow--a {
    top: -160px;
    inset-inline-end: -120px;
    width: 720px;
    height: 460px;
    background: radial-gradient(ellipse, var(--cv2-glow-red), transparent 62%);
    animation: cv2-pulse 8s ease-in-out infinite;
}

.cv2__glow--b {
    top: 120px;
    inset-inline-start: -200px;
    width: 640px;
    height: 480px;
    background: radial-gradient(ellipse, var(--cv2-glow-violet), transparent 62%);
    animation: cv2-drift 20s ease-in-out infinite;
}

.cv2__grid-bg {
    inset: 0;
    background-image:
        linear-gradient(var(--cv2-grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--cv2-grid-line) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(ellipse 70% 55% at 50% 26%, #000, transparent 80%);
    mask-image: radial-gradient(ellipse 70% 55% at 50% 26%, #000, transparent 80%);
}

.cv2__floater {
    z-index: 0;
    opacity: .16;
    filter: saturate(.6);
}

@keyframes cv2-float {
    0%, 100% { transform: translateY(0) rotate(var(--r, 0deg)); }
    50% { transform: translateY(-22px) rotate(var(--r, 0deg)); }
}

@keyframes cv2-pulse {
    0%, 100% { opacity: .5; }
    50% { opacity: 1; }
}

@keyframes cv2-drift {
    0% { transform: translate(0, 0); }
    33% { transform: translate(40px, -30px); }
    66% { transform: translate(-30px, 20px); }
    100% { transform: translate(0, 0); }
}

@keyframes cv2-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: none; }
}

.cv2__wrap {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    gap: 18px;
    /* Same content width as the footer so the page reads as one column. */
    max-width: var(--tw-max, 1280px);
    margin: 0 auto;
    padding: 22px 24px 28px;
    border: 1px solid var(--cv2-line);
    border-radius: 24px;
    background: color-mix(in srgb, var(--cv2-surface) 72%, transparent);
    box-shadow: inset 0 1px 0 var(--cv2-card-inset);
}

/* ── Hero ───────────────────────────────────────────────────────────── */

.cv2-hero {
    position: relative;
    overflow: hidden;
    border-radius: 20px;
    border: 1px solid rgba(var(--cv2-accent-rgb), .35);
    background: var(--cv2-hero-fallback);
    box-shadow: 0 0 0 1px rgba(var(--cv2-accent-rgb), .08), 0 14px 44px rgba(var(--cv2-accent-rgb), .09), inset 0 1px 0 rgba(255, 255, 255, .05);
    animation: cv2-in .3s ease-out;
}

.cv2-hero__bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
}

.cv2-hero__shade {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(90deg, rgba(15, 15, 17, .94) 0%, rgba(15, 15, 17, .82) 42%, rgba(15, 15, 17, .25) 100%);
}

.cv2-hero__glow {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse 60% 120% at 12% 50%, rgba(var(--cv2-accent-rgb), .2), transparent 60%);
}

.cv2-hero__inner {
    position: relative;
    display: grid;
    grid-template-columns: 1fr 200px;
    gap: 20px;
    align-items: center;
    padding: 26px 30px;
}

.cv2-hero__text {
    display: flex;
    flex-direction: column;
    gap: 9px;
    min-width: 0;
}

.cv2-hero__badge {
    align-self: flex-start;
    padding: 3px 14px;
    border-radius: 999px;
    background: var(--cv2-accent-grad);
    color: #fff;
    font-size: 11px;
    font-weight: 800;
}

.cv2-hero__title {
    margin: 0;
    font-family: var(--cv2-font);
    font-size: 26px;
    font-weight: 800;
    line-height: 1.3;
    color: var(--cv2-hero-ink);
    text-shadow: 0 2px 12px rgba(0, 0, 0, .45);
}

.cv2-hero__blurb {
    max-width: 420px;
    margin: 0;
    font-size: 13px;
    line-height: 1.8;
    color: var(--cv2-hero-ink-2);
    text-shadow: 0 1px 8px rgba(0, 0, 0, .5);
}

.cv2-hero__actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.cv2-hero .cv2-hero__cta {
    padding: 9px 26px;
    border-radius: 999px;
    background: var(--cv2-accent-grad);
    color: #fff;
    font-size: 12.5px;
    font-weight: 800;
    box-shadow: 0 4px 18px rgba(var(--cv2-accent-rgb), .35);
    transition: transform .2s, box-shadow .2s;
}

.cv2-hero .cv2-hero__cta:hover {
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(var(--cv2-accent-rgb), .5);
}

.cv2-hero__icon {
    display: block;
    width: 170px;
    height: 170px;
    justify-self: end;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .18);
    box-shadow: 0 8px 28px rgba(0, 0, 0, .5);
}

.cv2-hero__icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cv2-hero__icon--sm {
    display: none;
}

/* ── Tabs + sort ────────────────────────────────────────────────────── */

.cv2-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.cv2-tabs-wrap {
    display: flex;
    flex: 1;
    align-items: flex-start;
    gap: 8px;
    min-width: 0;
}

.cv2-tabs {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 8px;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.cv2-tabs::-webkit-scrollbar {
    display: none;
}

.cv2 .cv2-tab {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 7px;
    padding: 8px 18px;
    border-radius: 999px;
    border: 1px solid var(--cv2-line);
    background: var(--cv2-surface);
    color: var(--cv2-ink-2);
    font-family: inherit;
    font-size: 12.5px;
    font-weight: 800;
    white-space: nowrap;
    cursor: pointer;
    transition: all .2s;
}

.cv2 .cv2-tab:hover {
    color: var(--cv2-ink);
}

.cv2 .cv2-tab.is-on {
    border-color: transparent;
    background: var(--cv2-accent-grad);
    color: #fff;
}

.cv2-tab__count {
    padding: 0 8px;
    border-radius: 999px;
    background: var(--cv2-chip);
    color: var(--cv2-ink-2);
    font-size: 10.5px;
    font-weight: 800;
}

.cv2-tab.is-on .cv2-tab__count {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.cv2-tabs-toggle {
    display: none;
}

.cv2-sort {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    margin-inline-start: auto;
}

.cv2-sort__label {
    font-size: 11.5px;
    color: var(--cv2-ink-3);
}

.cv2-chip {
    padding: 5px 14px;
    border-radius: 999px;
    border: 1px solid var(--cv2-line);
    background: transparent;
    color: var(--cv2-ink-2);
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    transition: all .2s;
}

.cv2-chip.is-on {
    border-color: rgba(var(--cv2-accent-rgb), .4);
    background: rgba(var(--cv2-accent-rgb), .1);
    color: var(--cv2-accent);
}

/* ── Count line ─────────────────────────────────────────────────────── */

.cv2-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cv2-meta__count {
    font-size: 12px;
    color: var(--cv2-ink-2);
}

.cv2-meta__count b {
    color: var(--cv2-ink);
}

.cv2-meta__note {
    font-size: 11.5px;
    color: var(--cv2-ink-3);
}

.cv2-meta__mobile-note {
    display: none;
}

/* ── Grid + cards ───────────────────────────────────────────────────── */

.cv2-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 12px;
}

.cv2 .cv2-card {
    display: block;
    min-width: 0;
    overflow: hidden;
    border-radius: 16px;
    border: 1px solid var(--cv2-line);
    background: var(--cv2-surface);
    color: var(--cv2-ink);
    box-shadow: inset 0 1px 0 var(--cv2-card-inset);
    transition: all .2s;
    animation: cv2-in .3s ease-out;
}

.cv2 .cv2-card[hidden] {
    display: none;
}

.cv2 .cv2-card:hover {
    color: var(--cv2-ink);
    border-color: rgba(var(--cv2-accent-rgb), .5);
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 0 0 1px rgba(var(--cv2-accent-rgb), .15);
}

body:not(.darkMode) .cv2 .cv2-card:hover {
    box-shadow: 0 10px 30px rgba(0, 0, 0, .12), 0 0 0 1px rgba(var(--cv2-accent-rgb), .15);
}

.cv2-card__thumb {
    position: relative;
    display: block;
    aspect-ratio: 1 / 1;
    margin: 9px 9px 0;
    overflow: hidden;
    border-radius: 12px;
    background: var(--cv2-bg-2);
}

.cv2-card__thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cv2-card__badge {
    position: absolute;
    top: 9px;
    inset-inline-end: 9px;
    z-index: 2;
    padding: 2px 11px;
    border-radius: 999px;
    background: var(--cv2-accent-grad);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
    pointer-events: none;
}

.cv2-card__badge--new {
    background: rgba(74, 222, 128, .9);
}

.cv2-card__body {
    display: flex;
    flex-direction: column;
    gap: 7px;
    padding: 9px 11px 11px;
}

.cv2-card__row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.cv2-card__row--foot {
    /* The CTA is the only thing here, so it fills the row as the card action. */
    margin-top: 1px;
}

.cv2-card__name {
    min-width: 0;
    overflow: hidden;
    font-size: 12.5px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cv2-card__instant {
    flex-shrink: 0;
    padding: 1px 9px;
    border-radius: 999px;
    border: 1px solid rgba(74, 222, 128, .3);
    background: rgba(74, 222, 128, .1);
    color: var(--cv2-good);
    font-size: 9.5px;
    font-weight: 800;
    white-space: nowrap;
}

.cv2-card__cta {
    flex: 1;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(var(--cv2-accent-rgb), .4);
    background: rgba(var(--cv2-accent-rgb), .12);
    color: var(--cv2-accent);
    font-size: 11px;
    font-weight: 800;
    text-align: center;
    transition: all .2s;
}

.cv2-card:hover .cv2-card__cta {
    background: var(--cv2-accent-grad);
    color: #fff;
}

.cv2-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 56px 24px;
    border-radius: 20px;
    border: 1px dashed var(--cv2-line);
    background: var(--cv2-surface);
    box-shadow: inset 0 1px 0 var(--cv2-card-inset);
    text-align: center;
    animation: cv2-in .3s ease-out;
}

.cv2-empty__icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    margin-bottom: 6px;
    border-radius: 50%;
    border: 1px solid rgba(var(--cv2-accent-rgb), .3);
    background: radial-gradient(circle, rgba(var(--cv2-accent-rgb), .16), rgba(var(--cv2-accent-rgb), .05));
    color: var(--cv2-accent);
    box-shadow: 0 0 0 8px rgba(var(--cv2-accent-rgb), .05);
    animation: cv2-float 6s ease-in-out infinite;
}

.cv2-empty__title {
    margin: 0;
    font-family: var(--cv2-font);
    font-size: 18px;
    font-weight: 800;
    color: var(--cv2-ink);
}

.cv2-empty__text {
    max-width: 380px;
    margin: 0;
    font-size: 13px;
    line-height: 1.8;
    color: var(--cv2-ink-2);
}

.cv2 .cv2-empty__cta {
    margin-top: 8px;
    padding: 9px 26px;
    border-radius: 999px;
    background: var(--cv2-accent-grad);
    color: #fff;
    font-size: 12.5px;
    font-weight: 800;
    box-shadow: 0 4px 18px rgba(var(--cv2-accent-rgb), .35);
}

.cv2 .cv2-empty__cta:hover {
    color: #fff;
}

/* ── Responsive ─────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
    .cv2-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

@media (max-width: 860px) {
    .cv2-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 640px) {
    .cv2 {
        padding-top: calc(var(--tw-header-h, 60px) + 12px);
        padding-inline: 12px;
        padding-bottom: 20px;
    }

    .cv2__glow--a {
        top: -120px;
        width: 420px;
        height: 300px;
    }

    .cv2__glow--b {
        top: 34%;
        width: 380px;
        height: 320px;
    }

    .cv2__floater:nth-of-type(n+6) {
        display: none;
    }

    /* The count line and the sort chips share one row, so the wrap is a grid here. */
    .cv2__wrap {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 12px;
        padding: 14px 12px 18px;
        border-radius: 18px;
    }

    .cv2-hero,
    .cv2-tabs-wrap,
    .cv2-grid,
    .cv2-empty {
        grid-column: 1 / -1;
    }

    .cv2-hero {
        order: 0;
    }

    .cv2-hero {
        border-radius: 18px;
    }

    .cv2-hero__shade {
        background: linear-gradient(0deg, rgba(15, 15, 17, .93) 8%, rgba(15, 15, 17, .55) 55%, rgba(15, 15, 17, .15) 100%);
    }

    .cv2-hero__glow {
        display: none;
    }

    .cv2-hero__inner {
        display: block;
        padding: 74px 16px 15px;
    }

    .cv2-hero__text {
        display: grid;
        grid-template-columns: 56px 1fr;
        grid-template-areas: "icon badge" "icon title" "blurb blurb" "actions actions";
        column-gap: 10px;
        row-gap: 2px;
    }

    .cv2-hero__badge {
        grid-area: badge;
        align-self: end;
        justify-self: start;
        padding: 1px 10px;
        font-size: 9.5px;
    }

    .cv2-hero__title {
        grid-area: title;
        align-self: start;
        font-size: 18px;
    }

    .cv2-hero__blurb {
        grid-area: blurb;
        max-width: none;
        margin-top: 5px;
        font-size: 11px;
        line-height: 1.7;
    }

    .cv2-hero__actions {
        grid-area: actions;
        margin-top: 2px;
    }

    .cv2-hero .cv2-hero__cta {
        padding: 8px 24px;
        font-size: 11.5px;
    }

    .cv2-hero__icon {
        display: none;
    }

    .cv2-hero__icon.cv2-hero__icon--sm {
        display: block;
        grid-area: icon;
        width: 56px;
        height: 56px;
        border-radius: 13px;
        border-color: rgba(255, 255, 255, .2);
        box-shadow: none;
    }

    .cv2-bar {
        display: contents;
    }

    .cv2-tabs-wrap {
        order: 1;
    }

    .cv2-tabs {
        flex-wrap: wrap;
        gap: 7px;
        max-height: 37px;
        overflow: hidden;
        transition: max-height .3s ease;
    }

    .cv2-tabs.is-open {
        max-height: 200px;
        overflow-y: auto;
    }

    .cv2 .cv2-tab {
        padding: 7px 15px;
        gap: 6px;
        font-size: 11.5px;
    }

    .cv2-tab__count {
        padding: 0 7px;
        font-size: 9.5px;
    }

    .cv2-tabs-toggle {
        display: flex;
        flex-shrink: 0;
        align-items: center;
        justify-content: center;
        width: 34px;
        height: 34px;
        padding: 0;
        border-radius: 50%;
        border: 1px solid var(--cv2-line);
        background: var(--cv2-surface);
        color: var(--cv2-ink-2);
        font-size: 13px;
        font-weight: 800;
        cursor: pointer;
        transition: all .2s;
    }

    .cv2-tabs-toggle[hidden] {
        display: none;
    }

    .cv2-tabs-toggle[aria-expanded="true"] {
        border-color: rgba(var(--cv2-accent-rgb), .45);
        color: var(--cv2-accent);
    }

    .cv2-meta {
        order: 2;
        justify-content: flex-start;
    }

    .cv2-sort {
        order: 3;
        margin-inline-start: 0;
    }

    .cv2-grid {
        order: 4;
    }

    .cv2-sort__label,
    .cv2-meta__note {
        display: none;
    }

    .cv2-meta__mobile-note {
        display: inline;
    }

    .cv2-meta__count {
        font-size: 11px;
    }

    .cv2-chip {
        padding: 4px 12px;
        font-size: 10px;
    }

    .cv2-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .cv2 .cv2-card {
        border-radius: 15px;
    }

    .cv2-card__thumb {
        margin: 7px 7px 0;
        border-radius: 11px;
    }

    .cv2-card__badge {
        top: 7px;
        inset-inline-end: 7px;
        padding: 1px 9px;
        font-size: 8.5px;
    }

    .cv2-card__body {
        gap: 6px;
    }

    .cv2-card__row {
        gap: 6px;
    }

    .cv2-card__name {
        font-size: 11.5px;
    }

    .cv2-card__instant {
        padding: 0 7px;
        font-size: 8.5px;
    }

    .cv2-card__cta {
        padding: 5px 10px;
        font-size: 10px;
    }
}
