/* ============================================
   JAVDA Mobile Catalog CSS
   ALL rules strictly inside max-width: 767px
   Zero impact on desktop
   ============================================ */

@media screen and (max-width: 767px) {

    /* NO HORIZONTAL SCROLL */
    html, body { overflow-x: hidden !important; }

    /* SIDEBAR - hide, show as panel via JS */
    .sidebar {
        display: none;
        position: fixed !important;
        top: 0 !important; left: 0 !important;
        right: 0 !important; bottom: 0 !important;
        z-index: 9999 !important;
        background: #fff !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch;
        padding: 0 !important;
        width: 100% !important;
        float: none !important;
    }
    .sidebar.filter-open { display: block !important; }

    /* CONTENT full width */
    .content {
        width: 100% !important;
        float: none !important;
        padding: 0 4px !important;
    }

    /* OVERLAY */
    .filter-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.45);
        z-index: 9998;
    }
    .filter-overlay.show { display: block; }

    /* FILTER BUTTON */
    .mobile-filter-btn {
        display: flex !important;
        align-items: center;
        gap: 8px;
        background: #c9a96e;
        color: #fff;
        border: none;
        border-radius: 20px;
        padding: 9px 16px;
        font-size: 13px;
        font-weight: 500;
        cursor: pointer;
        margin: 8px 0;
        min-height: 40px;
    }

    /* BREADCRUMB - no bullets */
    .breadcrumb ul,
    .breadcrumb ol,
    nav.breadcrumb ul {
        list-style: none !important;
        padding-left: 0 !important;
        margin: 0 !important;
        display: flex !important;
        flex-wrap: wrap;
        gap: 2px;
        font-size: 11px;
    }
    .breadcrumb li { list-style: none !important; display: inline !important; }
    .breadcrumb li::before,
    .breadcrumb li::marker { display: none !important; content: none !important; }

    /* SHAPE FILTER - horizontal scroll */
    .diamonds-filter {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 8px;
        padding: 8px 4px 12px !important;
        list-style: none !important;
        margin: 0 !important;
    }
    .diamonds-filter::-webkit-scrollbar { display: none; }
    .diamonds-filter li {
        flex: 0 0 auto !important;
        float: none !important;
        display: inline-flex !important;
        list-style: none !important;
    }
    .diamonds-filter li a {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        text-decoration: none;
        min-width: 56px;
    }
    .diamonds-filter li .img-holder {
        width: 50px; height: 50px;
        border: 1px solid #ddd;
        border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        background: #f9f9f9;
    }
    .diamonds-filter li .img-holder img {
        width: 34px; height: 34px; object-fit: contain;
    }
    .diamonds-filter li.active .img-holder {
        border: 2px solid #c9a96e; background: #fdf8f0;
    }
    .diamonds-filter li strong.title {
        font-size: 10px; color: #555;
        text-align: center; white-space: nowrap;
    }
    .diamonds-filter li.active strong.title {
        color: #c9a96e; font-weight: 600;
    }

    /* METAL STRIP */
    .mobile-metal-strip {
        display: flex;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 6px;
        padding: 0 4px 12px;
        border-bottom: 1px solid #eee;
        margin-bottom: 8px;
    }
    .mobile-metal-strip::-webkit-scrollbar { display: none; }
    .mobile-metal-strip a {
        flex: 0 0 auto;
        display: inline-block;
        padding: 6px 12px;
        border: 1px solid #ddd;
        border-radius: 20px;
        font-size: 11px;
        color: #444;
        text-decoration: none;
        white-space: nowrap;
        background: #fff;
    }
    .mobile-metal-strip a.active-metal {
        background: #c9a96e; border-color: #c9a96e;
        color: #fff; font-weight: 500;
    }

    /* PRODUCT GRID 2 columns */
    .products-holder {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 6px !important;
        padding: 6px 0 !important;
        float: none !important;
        width: 100% !important;
        overflow: visible !important;
    }

    /* PRODUCT CARD */
    .product-box {
        width: 100% !important;
        float: none !important;
        margin: 0 !important;
        border: 1px solid #eee !important;
        border-radius: 8px !important;
        overflow: hidden;
        background: #fff !important;
    }
    .product-box .product-frame { width: 100% !important; }
    .product-box .image-holder {
        width: 100% !important;
        float: none !important;
        aspect-ratio: 1 / 1;
        overflow: hidden;
        background: #f9f9f9 !important;
        position: relative;
        padding: 4px !important;
    }
    .product-box .image-holder a {
        display: block; width: 100%; height: 100%;
    }
    .product-box .image-holder img {
        width: 100% !important; height: 100% !important;
        object-fit: contain !important; display: block;
    }
    .product-box .image-holder img:nth-child(2) {
        position: absolute; top: 0; left: 0;
    }
    .product-box > a {
        display: block;
        padding: 6px 6px 8px !important;
        text-decoration: none; color: inherit;
    }
    .product-box .item-no {
        display: block; font-size: 9px; color: #999; margin-bottom: 2px;
    }
    .product-box p.title {
        font-size: 11px !important; line-height: 1.3; color: #333;
        margin: 0 0 4px !important;
        display: -webkit-box;
        -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
    }
    .product-box .price {
        font-size: 13px !important; font-weight: 600; color: #222; display: block;
    }
    .product-box .strikeprice {
        font-size: 10px; color: #999; text-decoration: line-through;
    }

    /* SORT BAR */
    .filter-holder {
        display: flex !important;
        flex-wrap: wrap; align-items: center;
        gap: 6px; padding: 6px 0 !important;
        border-bottom: 1px solid #eee; margin-bottom: 6px;
    }
    .sort-by { flex: 1; min-width: 130px; }
    .sort-by label { display: none; }
    .sort-by select, .sort-by .sorting {
        width: 100% !important; min-height: 36px;
        font-size: 12px; border: 1px solid #ddd;
        border-radius: 4px; padding: 5px 8px; background: #fff;
    }
    .filter-holder .items { font-size: 11px; color: #777; white-space: nowrap; }

    /* PAGINATION */
    .paging ul, nav.paging ul {
        display: flex !important; flex-wrap: wrap;
        gap: 4px; list-style: none !important;
        padding: 8px 0 !important; margin: 0; justify-content: center;
    }
    .paging ul li a, nav.paging ul li a {
        display: flex; align-items: center; justify-content: center;
        min-width: 34px; min-height: 34px;
        border: 1px solid #ddd; border-radius: 4px;
        font-size: 12px; color: #333; text-decoration: none; background: #fff;
    }
    .paging ul li.active a, nav.paging ul li.active a {
        background: #c9a96e; border-color: #c9a96e; color: #fff;
    }

    /* FILTER PANEL */
    .mobile-filter-close {
        display: flex !important;
        align-items: center; justify-content: space-between;
        padding: 14px 16px !important; background: #fff;
        border-bottom: 2px solid #c9a96e !important;
        position: sticky; top: 0; z-index: 10; margin: 0 !important;
    }
    .mobile-filter-close strong { font-size: 16px; font-weight: 600; color: #222; }
    .mobile-filter-close span {
        cursor: pointer; color: #c9a96e; font-size: 28px; line-height: 1; padding: 0 4px;
    }
    .sidebar ul, .sidebar li {
        list-style: none !important; padding-left: 0 !important; margin-left: 0 !important;
    }
    .sidebar li::before, .sidebar li::marker { display: none !important; content: none !important; }
    .sidebar .side-nav { padding: 0 !important; border-bottom: 6px solid #f5f5f5; }
    .sidebar .side-nav h1 { font-size: 13px !important; margin: 0 !important; font-weight: 400 !important; }
    .sidebar .side-nav h1 a {
        display: flex !important; align-items: center; justify-content: space-between;
        padding: 13px 16px !important; min-height: 48px !important;
        color: #333 !important; text-decoration: none !important;
        border-bottom: 1px solid #f2f2f2 !important; font-size: 14px !important;
    }
    .sidebar .side-nav h1 a::after { content: '›'; color: #c9a96e; font-size: 18px; font-weight: 300; }
    .sidebar .nav { border-bottom: 1px solid #eee !important; margin: 0 !important; padding: 0 !important; }
    .sidebar .nav > p {
        display: flex !important; align-items: center; justify-content: space-between;
        padding: 13px 16px !important; margin: 0 !important;
        font-size: 12px !important; font-weight: 700 !important;
        letter-spacing: 0.8px !important; color: #444 !important;
        background: #f9f7f3 !important; cursor: pointer;
        min-height: 48px; border-top: 1px solid #eee; text-transform: uppercase;
    }
    .sidebar .nav ul { padding: 4px 0 8px !important; margin: 0 !important; }
    .sidebar .nav ul li a {
        display: flex !important; align-items: center; justify-content: space-between;
        padding: 10px 16px !important; font-size: 13px !important;
        color: #444 !important; text-decoration: none !important;
        min-height: 44px !important; border-bottom: 1px solid #f8f8f8 !important;
    }
    .sidebar .nav ul li.active a {
        color: #c9a96e !important; font-weight: 600 !important; background: #fdf8f0 !important;
    }
    .mobile-apply-btn {
        display: block !important;
        width: calc(100% - 32px) !important; margin: 16px !important;
        background: #c9a96e !important; color: #fff !important;
        border: none !important; border-radius: 6px !important;
        padding: 15px !important; font-size: 15px !important;
        font-weight: 600 !important; text-align: center; cursor: pointer; min-height: 50px;
    }

} /* END mobile only */


/* ============================================
   DESKTOP - 768px and above only
   ============================================ */
@media screen and (min-width: 768px) {

    /* Full width stacked layout - critical fix */
    .two-columns {
        display: block !important;
        width: 100% !important;
    }

    /* Sidebar = horizontal filter bar at top */
    .sidebar {
        display: block !important;
        position: static !important;
        float: none !important;
        width: 100% !important;
        background: #f9f7f3 !important;
        border-bottom: 2px solid #c9a96e !important;
        padding: 0 !important;
        overflow: visible !important;
        z-index: auto !important;
        margin-bottom: 0 !important;
    }

    /* Content - full width, no left offset */
    .content {
        float: none !important;
        width: 100% !important;
        padding: 0 20px !important;
        max-width: 100% !important;
        margin-left: 0 !important;
        display: block !important;
    }

    /* ── CATEGORY ROW ────────────────────────── */
    .sidebar .side-nav {
        display: flex !important;
        align-items: center !important;
        padding: 8px 20px !important;
        border-bottom: 0.5px solid #e0d8cc !important;
        flex-wrap: wrap;
        gap: 5px;
    }

    .sidebar .side-nav h1 {
        font-size: 11px !important;
        font-weight: 700 !important;
        color: #888 !important;
        text-transform: uppercase !important;
        letter-spacing: 0.5px !important;
        margin: 0 8px 0 0 !important;
        min-width: 100px;
        flex-shrink: 0;
        padding: 0 !important;
    }

    .sidebar .side-nav h1 a {
        display: inline-block !important;
        padding: 4px 12px !important;
        font-size: 12px !important;
        border: 0.5px solid #ddd !important;
        border-radius: 14px !important;
        background: #fff !important;
        color: #555 !important;
        text-decoration: none !important;
        min-height: auto !important;
        white-space: nowrap !important;
        line-height: 1.6 !important;
        border-bottom: 0.5px solid #ddd !important;
    }

    .sidebar .side-nav h1 a::after { content: none !important; }
    .sidebar .side-nav h1 a:hover {
        background: #c9a96e !important;
        border-color: #c9a96e !important;
        color: #fff !important;
    }

    /* ── ALL FILTER ROWS (.nav) ──────────────── */
    .sidebar .nav {
        display: flex !important;
        align-items: center !important;
        padding: 8px 20px !important;
        margin: 0 !important;
        flex-wrap: wrap;
        gap: 5px;
        border-bottom: 0.5px solid #e0d8cc !important;
    }

    .sidebar .nav:last-child {
        border-bottom: none !important;
    }

    /* Row title */
    .sidebar .nav > p {
        display: flex !important;
        align-items: center !important;
        gap: 4px;
        font-size: 11px !important;
        font-weight: 700 !important;
        color: #888 !important;
        text-transform: uppercase !important;
        background: none !important;
        padding: 0 !important;
        margin: 0 8px 0 0 !important;
        min-height: auto !important;
        border: none !important;
        cursor: default !important;
        white-space: nowrap;
        min-width: 100px;
        flex-shrink: 0;
    }

    /* Filter pills - NO !important on display so JS can override */
    .sidebar .nav ul {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        padding: 0 !important;
        margin: 0 !important;
        list-style: none !important;
    }

    .sidebar .nav ul li {
        padding: 0 !important;
        margin: 0 !important;
    }

    .sidebar .nav ul li a {
        display: inline-block !important;
        padding: 4px 12px !important;
        font-size: 12px !important;
        border: 0.5px solid #ddd !important;
        border-radius: 14px !important;
        background: #fff !important;
        color: #555 !important;
        text-decoration: none !important;
        white-space: nowrap !important;
        min-height: auto !important;
        line-height: 1.6 !important;
        border-bottom: 0.5px solid #ddd !important;
    }

    .sidebar .nav ul li a:hover,
    .sidebar .nav ul li.active a {
        background: #c9a96e !important;
        border-color: #c9a96e !important;
        color: #fff !important;
    }

    /* Toggle button + hint */
    .desktop-filter-toggle {
        font-size: 11px !important;
        padding: 3px 10px !important;
        border: 0.5px solid #c9a96e !important;
        border-radius: 14px !important;
        background: #fff !important;
        color: #c9a96e !important;
        font-weight: 600 !important;
        cursor: pointer !important;
        white-space: nowrap !important;
    }

    .desktop-filter-hint {
        font-size: 11px !important;
        color: #bbb !important;
        font-style: italic !important;
        margin-left: 6px !important;
    }

    /* Separator between Metal and Budget */
    .desktop-row-sep {
        display: inline-block;
        width: 1px;
        height: 18px;
        background: #ddd;
        margin: 0 12px;
        flex-shrink: 0;
        align-self: center;
    }

    /* 4 column product grid */
    .products-holder {
        display: grid !important;
        grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
        gap: 16px !important;
        float: none !important;
        width: 100% !important;
    }

    .product-box {
        width: 100% !important;
        float: none !important;
        margin: 0 !important;
    }

    .product-box .image-holder {
        width: 100% !important;
        float: none !important;
        padding: 0 !important;
    }

    .product-box .image-holder img {
        width: 100% !important;
        height: auto !important;
        object-fit: contain !important;
    }

    /* Hide mobile-only elements on desktop */
    .mobile-filter-btn,
    .mobile-filter-close,
    .mobile-apply-btn,
    .mobile-metal-strip,
    .filter-overlay {
        display: none !important;
    }

    .diamonds-filter {
        overflow-x: visible !important;
    }

}

/* ============================================
   CATEGORY ICON STRIP - Mobile + Desktop
   ============================================ */

/* Mobile */
@media screen and (max-width: 767px) {
    .category-icon-strip {
        display: flex;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        gap: 10px;
        padding: 10px 8px;
        background: #f9f7f3;
        border-bottom: 1px solid #e0d8cc;
    }
    .category-icon-strip::-webkit-scrollbar { display: none; }
    .category-icon-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        text-decoration: none;
        flex: 0 0 auto;
        min-width: 60px;
    }
    .category-icon-item .cat-icon {
        width: 48px;
        height: 48px;
        border-radius: 12px;
        background: #fff;
        border: 1px solid #e0d8cc;
        display: flex;
        align-items: center;
        justify-content: center;
        padding: 8px;
        color: #c9a96e;
    }
    .category-icon-item.active .cat-icon {
        background: #c9a96e;
        border-color: #c9a96e;
        color: #fff;
    }
    .category-icon-item .cat-icon svg {
        width: 100%;
        height: 100%;
    }
    .category-icon-item .cat-name {
        font-size: 9px;
        color: #555;
        text-align: center;
        line-height: 1.2;
        max-width: 60px;
        word-break: break-word;
    }
    .category-icon-item.active .cat-name {
        color: #c9a96e;
        font-weight: 600;
    }
}

/* Desktop */
@media screen and (min-width: 768px) {
    .category-icon-strip {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px 20px;
        background: #f9f7f3;
        border-bottom: 0.5px solid #e0d8cc;
    }
    .category-icon-item {
        display: flex;
        align-items: center;
        gap: 6px;
        text-decoration: none;
        padding: 5px 12px 5px 6px;
        border: 0.5px solid #e0d8cc;
        border-radius: 20px;
        background: #fff;
        color: #c9a96e;
        transition: all 0.15s;
    }
    .category-icon-item:hover,
    .category-icon-item.active {
        background: #c9a96e;
        border-color: #c9a96e;
        color: #fff;
    }
    .category-icon-item .cat-icon {
        width: 24px;
        height: 24px;
        display: flex;
        align-items: center;
        justify-content: center;
        flex-shrink: 0;
    }
    .category-icon-item .cat-icon svg {
        width: 100%;
        height: 100%;
    }
    .category-icon-item .cat-name {
        font-size: 12px;
        font-weight: 500;
        white-space: nowrap;
        color: inherit;
    }
    /* Hide old side-nav after JS replaces it */
    .sidebar .side-nav:empty { display: none !important; }
}


/* Desktop category icons - bigger */
@media screen and (min-width: 768px) {
    .category-icon-strip {
        display: flex !important;
        flex-wrap: wrap;
        gap: 10px;
        padding: 12px 20px;
        background: #f9f7f3;
        border-bottom: 0.5px solid #e0d8cc;
    }
    .category-icon-item {
        display: flex !important;
        flex-direction: column !important;
        align-items: center;
        gap: 6px;
        text-decoration: none;
        padding: 10px 14px;
        border: 0.5px solid #e0d8cc;
        border-radius: 12px;
        background: #fff;
        color: #666;
        min-width: 80px;
    }
    .category-icon-item:hover,
    .category-icon-item.active {
        background: #fdf8f0;
        border-color: #c9a96e;
        color: #c9a96e;
    }
    .category-icon-item .cat-icon {
        width: 52px !important;
        height: 52px !important;
        display: flex;
        align-items: center;
        justify-content: center;
        border-radius: 8px;
        overflow: hidden;
    }
    .category-icon-item .cat-icon img {
        width: 52px !important;
        height: 52px !important;
        object-fit: cover;
        border-radius: 8px;
    }
    .category-icon-item .cat-name {
        font-size: 11px;
        font-weight: 500;
        text-align: center;
        color: inherit;
        white-space: nowrap;
    }
}