/* ============================================================
   category.css — Discount Tiles category page
   Clean lightweight version
   Fixed: duplicate accordion rules, duplicate product-grid rules,
   smoother scrolling, lighter shadows, mobile drawer performance.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Inter:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after{
    box-sizing:border-box;
    margin:0;
    padding:0;
    -webkit-tap-highlight-color:transparent;
}

:root{
    --bg:#f5f5f7;
    --white:#ffffff;
    --black:#111111;
    --border:rgba(0,0,0,.08);
    --muted:#6e6e73;
    --subtle:#4b4742;
    --cream:#fafafc;
    --glass:rgba(255,255,255,.96);
    --font-heading:"Cormorant Garamond", Georgia, serif;
    --font-body:"Inter","SF Pro Display","Segoe UI",Arial,sans-serif;
    --shadow:0 4px 14px rgba(0,0,0,.045);
    --shadow-hover:0 6px 16px rgba(0,0,0,.075);
    --ease-out:cubic-bezier(.22,.8,.36,1);
}

html{
    scroll-behavior:auto;
}

body{
    background:#f5f5f7;
    color:var(--black);
    font-family:var(--font-body);
    -webkit-font-smoothing:antialiased;
    text-rendering:optimizeLegibility;
    overflow-x:hidden;
}

body.filter-open,
body.menu-open{
    overflow:hidden;
}

a{
    text-decoration:none;
    color:inherit;
}

img{
    max-width:100%;
    display:block;
}

button,
input,
select{
    font-family:inherit;
}

/* PAGE */

.shop-page{
    max-width:1600px;
    margin:0 auto;
    padding:22px;
}

/* HEADING */

.shop-heading{
    background:var(--glass);
    border:1px solid rgba(0,0,0,.06);
    border-radius:26px;
    padding:34px 38px;
    margin-bottom:18px;
    box-shadow:var(--shadow);
}

.shop-heading h1{
    font-family:var(--font-heading);
    font-size:46px !important;
    font-weight:600 !important;
    letter-spacing:-1.4px;
    line-height:1;
    margin:0 !important;
}

.shop-heading p{
    margin-top:12px;
    font-size:15px;
    color:var(--subtle);
    line-height:1.7;
}

/* TOP BAR */

.shop-topbar{
    background:var(--glass);
    border:1px solid rgba(0,0,0,.06);
    border-radius:22px;
    padding:14px 18px;
    margin-bottom:18px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    flex-wrap:wrap;
    box-shadow:var(--shadow);
}

.result-info{
    font-size:14px;
    font-weight:800;
    color:var(--subtle);
}

.top-actions{
    display:flex;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
}

.search-box,
.top-actions select{
    height:44px;
    border:1px solid var(--border);
    padding:0 14px;
    font-size:14px;
    background:#fff;
    outline:none;
    border-radius:14px;
}

.search-box{
    width:250px;
}

.search-box:focus,
.top-actions select:focus{
    border-color:var(--black);
    box-shadow:0 0 0 3px rgba(0,0,0,.055);
}

.top-actions button{
    height:44px;
    padding:0 22px;
    background:var(--black);
    color:#fff;
    border:1px solid var(--black);
    border-radius:14px;
    font-size:12px;
    font-weight:900;
    letter-spacing:.08em;
    text-transform:uppercase;
    cursor:pointer;
    transition:opacity .12s ease, box-shadow .12s ease;
}

.top-actions button:hover{
    opacity:.92;
    box-shadow:0 5px 12px rgba(0,0,0,.10);
}

/* MOBILE FILTER BUTTON */

.mobile-filter-btn{
    display:none;
    width:100%;
    height:50px;
    background:var(--black);
    color:#fff;
    border:0;
    border-radius:16px;
    font-size:12px;
    font-weight:900;
    letter-spacing:.08em;
    text-transform:uppercase;
    margin-bottom:14px;
    cursor:pointer;
}

/* LAYOUT */

.shop-layout{
    display:grid;
    grid-template-columns:280px minmax(0,1fr);
    gap:20px;
    align-items:start;
}

/* FILTER PANEL */

.filter-panel{
    background:var(--glass);
    border:1px solid rgba(0,0,0,.06);
    border-radius:24px;
    padding:24px;
    position:sticky;
    top:18px;
    box-shadow:var(--shadow);
    contain:layout paint;
}

.filter-title-row{
    display:flex;
    align-items:center;
    justify-content:space-between;
    margin-bottom:20px;
}

.filter-title-row h2{
    font-family:var(--font-heading);
    font-size:30px;
    font-weight:600;
}

.filter-title-row a{
    font-size:12px;
    font-weight:900;
    letter-spacing:.06em;
    text-transform:uppercase;
}

.active-filter-box{
    margin-bottom:20px;
}

.active-filter-box a{
    display:block;
    font-size:13px;
    margin-bottom:6px;
    color:var(--muted);
}

.filter-block{
    margin-bottom:24px;
}

.filter-block a{
    display:block;
    padding:10px 0;
    border-bottom:1px solid rgba(0,0,0,.06);
    font-size:14px;
    color:var(--subtle);
    transition:color .12s ease;
}

.filter-block a:hover,
.filter-block a.active{
    color:var(--black);
}

.filter-block a.active{
    font-weight:900;
}

.filter-block small{
    color:var(--muted);
    font-size:11px;
}

/* MOBILE FILTER ELEMENTS */

.mobile-filter-overlay,
.mobile-filter-head,
.mobile-filter-bottom{
    display:none;
}

/* ============================================================
   PRODUCT GRID
   ============================================================ */

.product-grid{
    display:grid;
    grid-template-columns:repeat(4,minmax(0,1fr));
    gap:16px;
    align-items:start;
}

/* ============================================================
   PRODUCT CARD
   ============================================================ */

.product-card{
    background:#fff;
    border:1px solid rgba(0,0,0,.06);
    border-radius:20px;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    box-shadow:0 3px 10px rgba(0,0,0,.045);
    transition:box-shadow .12s ease;
    contain:layout paint;
    transform:translateZ(0);
    backface-visibility:hidden;
}

.product-card:hover{
    box-shadow:var(--shadow-hover);
}

/* IMAGE */

.card-image{
    height:240px;
    min-height:240px;
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:18px;
    border-bottom:1px solid rgba(0,0,0,.06);
    background:#fff;
    overflow:hidden;
    flex-shrink:0;
}

.card-image img{
    width:100%;
    height:100%;
    object-fit:contain;
    display:block;
    transform:translateZ(0);
}

/* CARD BODY */

.card-body{
    padding:14px 16px 16px;
    display:flex;
    flex-direction:column;
    flex:1;
    min-height:0;
}

/* TITLE */

.card-title{
    display:-webkit-box;
    -webkit-line-clamp:2;
    -webkit-box-orient:vertical;
    overflow:hidden;
    font-family:var(--font-heading);
    font-size:20px;
    line-height:1.1;
    font-weight:600;
    margin-bottom:8px;
}

.card-title a{
    display:block;
    color:var(--black);
}

/* BADGES */

.card-badges{
    display:flex;
    align-items:center;
    gap:5px;
    flex-wrap:wrap;
    margin-bottom:10px;
}

.cbadge{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    height:22px;
    padding:0 7px;
    border-radius:6px;
    font-size:9px;
    font-weight:900;
    letter-spacing:.05em;
    text-transform:uppercase;
    line-height:1;
    white-space:nowrap;
}

.cbadge.category{
    background:#f5efe3;
    color:#8a6416;
    border:1px solid #ead7ae;
}

.cbadge.brand{
    background:#111827;
    color:#fff;
}

.cbadge.discount{
    background:#dc2626;
    color:#fff;
}

.cbadge.special{
    background:#f59e0b;
    color:#fff;
}

.cbadge.flag{
    width:28px;
    height:20px;
    padding:0;
    overflow:hidden;
    background:#fff;
    border:1px solid rgba(0,0,0,.08);
    border-radius:4px;
}

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

.cbadge.offer{
    display:none;
}

/* PRICE */

.card-price{
    display:flex;
    align-items:baseline;
    gap:4px;
    margin-bottom:8px;
    flex-wrap:wrap;
}

.card-price .from{
    font-size:12px;
    color:var(--muted);
}

.card-price .amount{
    font-size:20px;
    font-weight:900;
    color:var(--black);
}

.card-price .unit{
    font-size:12px;
    color:var(--muted);
}

.old-price{
    text-decoration:line-through;
    color:#9ca3af;
    font-size:14px;
    font-weight:700;
    margin-bottom:2px;
}

.sale-price{
    color:#dc2626;
    font-size:20px;
    font-weight:900;
    line-height:1.05;
}

.sale-price span{
    font-size:12px;
    color:#64748b;
    font-weight:600;
}

.normal-price{
    color:#111827;
    font-size:20px;
    font-weight:900;
    line-height:1.05;
}

.normal-price span{
    font-size:12px;
    color:#64748b;
}

/* BOX INFO */

.card-box-info{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:8px;
    font-size:12px;
    color:var(--muted);
    border-top:1px solid rgba(0,0,0,.06);
    padding-top:8px;
    margin-bottom:10px;
}

/* BUTTONS */

.card-buttons{
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-top:auto;
    padding-top:10px;
}

.card-buttons.single{
    grid-template-columns:1fr;
}

.btn-primary,
.btn-secondary{
    height:38px;
    border-radius:999px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:10.5px;
    font-weight:900;
    letter-spacing:.05em;
    text-transform:uppercase;
    transition:background .12s ease, color .12s ease, border-color .12s ease, opacity .12s ease;
    white-space:nowrap;
}

.btn-primary{
    background:#111;
    color:#fff;
    border:1px solid #111;
}

.btn-primary:hover{
    background:#000;
    opacity:.92;
}

.btn-secondary{
    background:#fff;
    color:#111;
    border:1px solid var(--border);
}

.btn-secondary:hover{
    background:#111;
    color:#fff;
    border-color:#111;
}

/* EMPTY STATE */

.empty-box{
    background:var(--glass);
    border:1px solid rgba(0,0,0,.06);
    border-radius:26px;
    padding:56px;
    text-align:center;
    box-shadow:var(--shadow);
}

.empty-box h2{
    font-family:var(--font-heading);
    font-size:40px;
    margin-bottom:10px;
}

/* PAGINATION */

.pagination{
    display:flex;
    justify-content:center;
    gap:6px;
    margin:34px 0;
    flex-wrap:wrap;
}

.pagination a{
    min-width:40px;
    height:40px;
    border-radius:12px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#fff;
    border:1px solid var(--border);
    font-weight:800;
    transition:background .12s ease, color .12s ease, box-shadow .12s ease;
}

.pagination a:hover{
    box-shadow:0 4px 10px rgba(0,0,0,.07);
}

.pagination a.active{
    background:var(--black);
    color:#fff;
    border-color:var(--black);
}

/* ============================================================
   FILTER ACCORDION — single smooth version
   ============================================================ */

.filter-accordion{
    margin-bottom:18px;
}

.filter-accordion-btn{
    width:100%;
    border:0;
    background:none;
    padding:0;
    margin:0 0 10px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    cursor:pointer;
}

.filter-accordion-btn span{
    font-size:14px;
    font-weight:900;
    text-transform:uppercase;
    letter-spacing:.05em;
    color:#111827;
}

.filter-accordion-btn strong{
    width:28px;
    height:28px;
    border-radius:50%;
    background:#111827;
    color:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:20px;
    line-height:1;
    font-weight:400;
    flex-shrink:0;
    transition:transform .18s ease, background .12s ease;
}

.filter-accordion.open .filter-accordion-btn strong{
    transform:rotate(180deg);
}

.filter-accordion-content{
    max-height:0;
    overflow:hidden;
    opacity:0;
    padding-top:0;
    transition:max-height .24s var(--ease-out), opacity .16s ease, padding-top .16s ease;
}

.filter-accordion.open .filter-accordion-content{
    max-height:1000px;
    opacity:1;
    padding-top:8px;
}

.filter-accordion-content a{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:10px 0;
    border-bottom:1px solid rgba(0,0,0,.06);
    color:#374151;
    text-decoration:none;
    font-size:14px;
    font-weight:600;
    transition:color .12s ease;
}

.filter-accordion-content a:hover{
    color:#000;
}

.filter-accordion-content a.active{
    font-weight:900;
    color:#000;
}

.filter-accordion-content small{
    color:#9ca3af;
    font-size:12px;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media(max-width:1400px){
    .product-grid{
        grid-template-columns:repeat(3,minmax(0,1fr));
    }
}

@media(max-width:900px){
    .shop-layout{
        display:block;
    }

    .product-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .shop-heading h1{
        font-size:34px !important;
    }
}

/* MOBILE FILTER DRAWER */

@media(max-width:768px){

    .shop-page{
        padding:10px;
    }

    .shop-heading{
        padding:24px;
        border-radius:22px;
    }

    .shop-heading h1{
        font-size:30px !important;
    }

    .shop-heading p{
        font-size:14px;
    }

    .shop-topbar{
        flex-direction:column;
        align-items:flex-start;
        border-radius:20px;
    }

    .top-actions{
        width:100%;
    }

    .search-box,
    .top-actions select,
    .top-actions button{
        width:100%;
    }

    .mobile-filter-btn{
        display:block;
        position:static !important;
        width:100%;
        z-index:1;
    }

    body.menu-open .mobile-filter-btn{
        display:none !important;
    }

    .mobile-filter-overlay{
        display:block;
        position:fixed;
        inset:0;
        background:rgba(0,0,0,.32);
        opacity:0;
        visibility:hidden;
        pointer-events:none;
        z-index:999998;
        transition:opacity .16s ease, visibility .16s ease;
    }

    body.filter-open .mobile-filter-overlay{
        opacity:1;
        visibility:visible;
        pointer-events:auto;
    }

    body.menu-open .mobile-filter-overlay{
        display:none !important;
    }

    .filter-panel{
        position:fixed !important;
        top:0 !important;
        left:0 !important;
        width:88vw !important;
        max-width:390px !important;
        height:100vh !important;
        height:100dvh !important;
        overflow-y:auto !important;
        background:#fff !important;
        z-index:999999 !important;
        border:0 !important;
        border-radius:0 24px 24px 0 !important;
        box-shadow:10px 0 22px rgba(0,0,0,.14) !important;
        transform:translate3d(-105%,0,0) !important;
        transition:transform .20s var(--ease-out) !important;
        padding:0 0 100px 0 !important;
        -webkit-overflow-scrolling:touch;
        will-change:transform;
        contain:layout paint;
    }

    body.filter-open .filter-panel{
        transform:translate3d(0,0,0) !important;
    }

    body.menu-open .filter-panel{
        display:none !important;
    }

    .mobile-filter-head{
        display:flex;
        align-items:center;
        justify-content:space-between;
        position:sticky;
        top:0;
        background:#fff;
        padding:18px 20px;
        border-bottom:1px solid var(--border);
        z-index:5;
    }

    .mobile-filter-head strong{
        font-size:16px;
        font-weight:900;
    }

    .mobile-filter-head button{
        width:40px;
        height:40px;
        border-radius:50%;
        background:#f3f4f6;
        border:0;
        font-size:28px;
        cursor:pointer;
    }

    .filter-title-row,
    .active-filter-box,
    .filter-block{
        padding-left:20px;
        padding-right:20px;
    }

    .filter-title-row{
        margin-top:20px;
    }

    .mobile-filter-bottom{
        display:block;
        position:sticky;
        bottom:0;
        background:#fff;
        padding:16px 20px;
        border-top:1px solid var(--border);
    }

    .mobile-filter-bottom button{
        width:100%;
        height:48px;
        border-radius:16px;
        background:var(--black);
        color:#fff;
        border:0;
        font-size:12px;
        font-weight:900;
        letter-spacing:.08em;
        text-transform:uppercase;
        cursor:pointer;
    }

    body.filter-open #dt-ai-chat,
    body.menu-open #dt-ai-chat{
        display:none !important;
    }

    .product-grid{
        grid-template-columns:repeat(2,minmax(0,1fr));
        gap:10px;
    }

    .product-card{
        border-radius:16px;
    }

    .card-image{
        height:180px;
        min-height:180px;
        padding:12px;
    }

    .card-body{
        padding:11px 11px 13px;
    }

    .card-title{
        font-size:16px;
        margin-bottom:6px;
    }

    .card-badges{
        gap:4px;
        margin-bottom:8px;
    }

    .cbadge{
        height:20px;
        padding:0 6px;
        font-size:8px;
    }

    .card-price .amount,
    .sale-price,
    .normal-price{
        font-size:17px;
    }

    .old-price{
        font-size:12px;
    }

    .card-box-info{
        font-size:11px;
    }

    .card-buttons{
        gap:6px;
        padding-top:8px;
    }

    .btn-primary,
    .btn-secondary{
        height:35px;
        font-size:9.5px;
        letter-spacing:.04em;
    }
}

@media(max-width:380px){

    .product-grid{
        grid-template-columns:1fr;
    }

    .card-image{
        height:220px;
        min-height:220px;
    }
}

/* REDUCED MOTION */

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

/* ============================================================
   MOBILE CATEGORY PAGE — COMPACT FILTER AND SORT
   Keeps desktop unchanged
============================================================ */

@media (max-width: 768px) {

    /* Reduce page spacing so products appear sooner */
    .shop-page {
        padding: 8px 10px 14px;
    }

    /* Compact category heading */
    .shop-heading {
        padding: 15px 18px;
        margin-bottom: 10px;
        border-radius: 18px;
    }

    .shop-heading h1 {
        font-size: 27px !important;
        line-height: 1.05;
        letter-spacing: -0.7px;
    }

    /* Hide long category description on mobile */
    .shop-heading p {
        display: none;
    }

    /* Product count and sort on one row */
    .shop-topbar {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: 10px;

        padding: 10px 12px;
        margin-bottom: 8px;
        border-radius: 16px;
    }

    .result-info {
        flex: 0 0 auto;
        font-size: 13px;
        white-space: nowrap;
    }

    .top-actions {
        width: auto;
        flex: 1;
        justify-content: flex-end;
    }

    /* Hide duplicate category search */
    .top-actions .search-box {
        display: none !important;
    }

    /* Hide duplicate Search button */
    .top-actions button[type="submit"] {
        display: none !important;
    }

    /* Keep only sorting */
    .top-actions select {
        width: 100%;
        max-width: 185px;
        height: 42px;
        padding: 0 34px 0 12px;
        border-radius: 12px;
        font-size: 13px;
        background-color: #fff;
    }

    /* Compact filter button */
    .mobile-filter-btn {
        display: block;
        height: 46px;
        margin: 0 0 10px;
        border-radius: 14px;
        font-size: 12px;
    }

    /* Products start closer to filter button */
    .shop-layout {
        margin-top: 0;
    }
}
