/* ============================================================
   category.css — Discount Tiles category page
   Fixed: card body spacing, button alignment, double dot bug
   ============================================================ */

@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,.94);
    --font-heading:"Cormorant Garamond", Georgia, serif;
    --font-body:"Inter","SF Pro Display","Segoe UI",Arial,sans-serif;
    --shadow:0 8px 22px rgba(0,0,0,.05);
    --ease-out:cubic-bezier(.22,.8,.36,1);
}

html{
    scroll-behavior:auto;
}

body{
    background:linear-gradient(180deg,#fafafc 0%,#f3f3f5 100%);
    color:var(--black);
    font-family:var(--font-body);
    -webkit-font-smoothing:antialiased;
    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:30px;
    padding:36px 40px;
    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.6px;
    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:24px;
    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:16px;
}

.search-box{
    width:250px;
}

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

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

.top-actions button:hover{
    opacity:.92;
    box-shadow:0 8px 18px 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:18px;
    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:26px;
    padding:24px;
    position:sticky;
    top:18px;
    box-shadow:var(--shadow);
}

.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:26px;
}

.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 .16s ease;
}

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

.filter-block a.active{
    font-weight:900;
    color:var(--black);
}

.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;
}

/* ============================================================
   PRODUCT CARD — FIXED
   Key fixes:
   1. Removed double dot (..card-body)
   2. Card uses flex column so buttons always sit at bottom
   3. Tightened title margin so badges show without gap
   4. card-buttons always shows both buttons
   ============================================================ */

.product-card{
    background:#fff;
    border:1px solid rgba(0,0,0,.06);
    border-radius:22px;
    display:flex;
    flex-direction:column;
    overflow:hidden;
    box-shadow:0 4px 14px rgba(0,0,0,.05);
    transition:box-shadow .16s ease;
}

.product-card:hover{
    box-shadow:0 10px 24px rgba(0,0,0,.09);
}

/* IMAGE */

.card-image{
    height:240px;
    min-height:240px;
    width:100%;
    display:flex;
    align-items:center;
    justify-content:center;
    padding:20px;
    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;
}

/* CARD BODY — fixed single declaration, no double dot */

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

/* TITLE — moved to top, tighter margin */

.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 — category, brand, flag, discount */

.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.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;
}

.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);
}

/* 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 — always 2 side by side, pinned to bottom */

.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:40px;
    border-radius:999px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:11px;
    font-weight:900;
    letter-spacing:.06em;
    text-transform:uppercase;
    transition:background .16s ease, color .16s ease, border-color .16s ease, opacity .16s 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:28px;
    padding:60px;
    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:14px;
    display:flex;
    align-items:center;
    justify-content:center;
    background:#fff;
    border:1px solid var(--border);
    font-weight:800;
    transition:background .16s ease, color .16s ease, box-shadow .16s ease;
}

.pagination a:hover{
    box-shadow:0 6px 14px rgba(0,0,0,.08);
}

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

/* FILTER ACCORDION */

.filter-accordion-btn{
    width:100%;
    border:0;
    background:none;
    padding:0;
    margin:0 0 14px;
    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:18px;
    line-height:1;
    flex-shrink:0;
}

.filter-accordion-content{
    display:grid;
    grid-template-rows:0fr;
    overflow:hidden;
    transition:grid-template-rows .22s var(--ease-out);
    padding-top:0;
}

.filter-accordion-content > *{
    min-height:0;
}

.filter-accordion.open .filter-accordion-content{
    grid-template-rows:1fr;
    padding-top:4px;
}

.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 .16s 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:24px;
    }

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

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

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

    .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,.38);
        opacity:0;
        visibility:hidden;
        pointer-events:none;
        z-index:999998;
        transition:opacity .18s ease, visibility .18s 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 26px 26px 0 !important;
        box-shadow:14px 0 28px rgba(0,0,0,.16) !important;
        transform:translateX(-105%) !important;
        transition:transform .22s var(--ease-out) !important;
        padding:0 0 100px 0 !important;
        -webkit-overflow-scrolling:touch;
    }

    body.filter-open .filter-panel{
        transform:translateX(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:18px;
    }

    .card-image{
        height:185px;
        min-height:185px;
        padding:14px;
    }

    .card-body{
        padding:12px 12px 14px;
    }

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

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

    .card-buttons{
        gap:6px;
    }

    .btn-primary,
    .btn-secondary{
        height:36px;
        font-size:10px;
    }
}

@media(max-width:380px){

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

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


/* =========================================
   FILTER ACCORDION FIX
========================================= */

.filter-accordion-content{
    display:none;
    padding-top:12px;
}

.filter-accordion.open .filter-accordion-content{
    display:block;
}

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

.filter-accordion-btn strong{
    width:24px;
    height:24px;
    display:flex;
    align-items:center;
    justify-content:center;
    font-size:22px;
    line-height:1;
    font-weight:300;
}

/* =========================================
   PERFECT SMOOTH ACCORDION
========================================= */

.filter-accordion-content{
    max-height:0;
    overflow:hidden;
    opacity:0;
    transition:
        max-height .35s ease,
        opacity .22s ease,
        padding-top .22s ease;
    padding-top:0;
}

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

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

.filter-accordion-btn strong{
    width:28px;
    height:28px;
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:50%;
    font-size:22px;
    line-height:1;
    font-weight:300;
    transition:
        transform .28s ease,
        background .2s ease;
}

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

.filter-accordion-content a{
    display:flex;
    align-items:center;
    justify-content:space-between;
    padding:10px 0;
    transition:
        padding-left .18s ease,
        color .18s ease;
}

.filter-accordion-content a:hover{
    padding-left:6px;
}