/*
 * Al-Jasim Traders
 * Catalog layout and sidebar styling
 *
 * This file is loaded after styles.css and modern-theme.css.
 */


/* =========================================================
   1. CATALOG TWO-COLUMN LAYOUT
   ========================================================= */

.catalog-page-layout {
    display: grid !important;
    grid-template-columns: 220px minmax(0, 1fr) !important;
    column-gap: 36px !important;
    row-gap: 0 !important;
    align-items: start !important;
    width: 100% !important;
    max-width: 1400px !important;
    margin-left: auto !important;
    margin-right: auto !important;
}

.catalog-page-layout > .catalog-sidebar {
    grid-column: 1 !important;
    grid-row: 1 !important;
    width: 220px !important;
    max-width: 220px !important;
    min-width: 0 !important;
    margin: 0 !important;
}

.catalog-page-layout > .catalog-content {
    grid-column: 2 !important;
    grid-row: 1 !important;
    width: auto !important;
    min-width: 0 !important;
    margin: 0 !important;
}


/* =========================================================
   2. SIDEBAR
   ========================================================= */

.catalog-sidebar {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}


/* =========================================================
   3. GLASS SIDEBAR BLOCKS
   ========================================================= */

.catalog-sidebar .filter-block {
    box-sizing: border-box;
    width: 100%;

    background: var(--glass-bg, rgba(255, 255, 255, 0.72));
    backdrop-filter: blur(var(--glass-blur, 12px));
    -webkit-backdrop-filter: blur(var(--glass-blur, 12px));

    border: 1px solid var(--glass-border, rgba(15, 23, 42, 0.08));
    border-radius: var(--radius-lg, 16px);
    box-shadow: var(--shadow-1, 0 4px 18px rgba(15, 23, 42, 0.06));

    padding: 18px;

    transition:
        box-shadow var(--dur-med, 0.25s) var(--ease-out, ease);
}

.catalog-sidebar .filter-block:hover {
    box-shadow: var(--shadow-2, 0 8px 28px rgba(15, 23, 42, 0.10));
}


/* =========================================================
   4. SIDEBAR HEADINGS
   ========================================================= */

.catalog-sidebar .filter-block h3 {
    margin: 0 0 12px;

    font-family: inherit;
    font-size: 13px !important;
    font-weight: 600;
    line-height: 1.35;
    letter-spacing: 0.02em;

    color: #1e293b;
}


/* =========================================================
   5. CATEGORY LIST RESET
   ========================================================= */

.catalog-sidebar ul.category-tree-list,
.catalog-sidebar ul.category-tree-list ul {
    display: block !important;
    list-style: none !important;
    list-style-type: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.catalog-sidebar ul.category-tree-list li {
    display: block !important;
    list-style: none !important;
    list-style-type: none !important;
    margin: 0 !important;
    padding: 0 !important;
}


/* =========================================================
   6. CATEGORY BUTTONS
   ========================================================= */

.catalog-sidebar ul.category-tree-list .cat-filter-btn {
    box-sizing: border-box;

    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;

    width: 100% !important;

    margin: 1px 0 !important;
    padding: 7px 8px !important;

    border: 0 !important;
    border-radius: 8px !important;

    background: transparent !important;

    color: #475569 !important;

    font-family: inherit !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;

    text-align: left !important;
    cursor: pointer !important;

    transition:
        background 0.18s ease,
        color 0.18s ease,
        padding-left 0.18s ease !important;
}


/* =========================================================
   7. CATEGORY HOVER
   ========================================================= */

.catalog-sidebar ul.category-tree-list .cat-filter-btn:hover {
    color: #0e8c74 !important;

    background: linear-gradient(
        135deg,
        rgba(14, 140, 116, 0.12),
        rgba(14, 140, 116, 0.05)
    ) !important;

    padding-left: 12px !important;
}


/* =========================================================
   8. ACTIVE CATEGORY
   ========================================================= */

/* JavaScript adds .active to the clicked button */
.catalog-sidebar ul.category-tree-list .cat-filter-btn.active {
    color: #0e8c74 !important;

    background: linear-gradient(
        135deg,
        rgba(14, 140, 116, 0.12),
        rgba(14, 140, 116, 0.05)
    ) !important;

    font-weight: 600 !important;
}

/* Compatibility if .active is placed on the <li> */
.catalog-sidebar ul.category-tree-list li.active > .cat-filter-btn {
    color: #0e8c74 !important;

    background: linear-gradient(
        135deg,
        rgba(14, 140, 116, 0.12),
        rgba(14, 140, 116, 0.05)
    ) !important;

    font-weight: 600 !important;
}


/* =========================================================
   9. CATEGORY COUNTS
   ========================================================= */

.catalog-sidebar ul.category-tree-list .count {
    flex-shrink: 0;
    margin-left: 6px;

    color: #475569 !important;

    font-size: 11px !important;
    font-weight: 500 !important;
}

.catalog-sidebar ul.category-tree-list .cat-filter-btn:hover .count,
.catalog-sidebar ul.category-tree-list .cat-filter-btn.active .count,
.catalog-sidebar ul.category-tree-list li.active > .cat-filter-btn .count {
    color: #18a88c !important;
}


/* =========================================================
   10. SUB-CATEGORIES
   ========================================================= */

.catalog-sidebar .subcategory-tree {
    margin: 2px 0 5px !important;
    padding: 0 0 0 10px !important;

    border-left: 1px solid rgba(14, 140, 116, 0.14);

    list-style: none !important;
    overflow: hidden;

    transition: max-height 0.28s ease;
}

.catalog-sidebar .subcategory-tree .cat-filter-btn {
    padding-top: 5px !important;
    padding-bottom: 5px !important;

    font-size: 11.5px !important;
    font-weight: 400 !important;
    color: #475569 !important;
}

.catalog-sidebar .subcategory-tree .cat-filter-btn:hover {
    padding-left: 10px !important;
    color: #0e8c74 !important;
}

.catalog-sidebar .subcategory-tree li.active > .cat-filter-btn,
.catalog-sidebar .subcategory-tree .cat-filter-btn.active {
    color: #0e8c74 !important;
    font-weight: 600 !important;
}


/* =========================================================
   11. STATUS FILTER
   ========================================================= */

.catalog-sidebar .filter-dropdown {
    box-sizing: border-box;
    width: 100%;

    min-height: 36px;

    padding: 7px 30px 7px 9px;

    border: 1px solid var(--glass-border, rgba(15, 23, 42, 0.12));
    border-radius: 8px;

    background: rgba(255, 255, 255, 0.75);

    color: #475569;

    font-family: inherit;
    font-size: 12px !important;
    font-weight: 500;

    cursor: pointer;

    transition:
        border-color 0.18s ease,
        box-shadow 0.18s ease;
}

.catalog-sidebar .filter-dropdown:focus {
    outline: none;
    border-color: #18a88c;
    box-shadow: 0 0 0 3px rgba(14, 140, 116, 0.10);
}


/* =========================================================
   12. RESPONSIVE
   ========================================================= */

@media (max-width: 900px) and (min-width: 701px) {
    .catalog-page-layout {
        grid-template-columns: 190px minmax(0, 1fr) !important;
        column-gap: 24px !important;
    }

    .catalog-page-layout > .catalog-sidebar {
        width: 190px !important;
        max-width: 190px !important;
    }
}

@media (max-width: 700px) {
    .catalog-page-layout {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
    }

    .catalog-page-layout > .catalog-sidebar,
    .catalog-page-layout > .catalog-content {
        display: block !important;
        width: 100% !important;
        max-width: none !important;
    }

    .catalog-page-layout > .catalog-sidebar {
        margin-bottom: 24px !important;
    }
}

/* =========================================================
   PRODUCT CATEGORY SIDEBAR
   Matches the actual markup generated by catalog-sidebar.php
   ========================================================= */

/* Main and nested category lists */
.catalog-sidebar .category-tree-list,
.catalog-sidebar .category-tree-list ul.category-subtree {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
    list-style-type: none !important;
}

/* Category items */
.catalog-sidebar .category-tree-list li.category-item {
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

/* Normal category links */
.catalog-sidebar .category-tree-list a.cat-filter-link {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    box-sizing: border-box !important;
    margin: 1px 0 !important;
    padding: 7px 8px !important;
    border-radius: 8px !important;
    color: #475569 !important;
    background: transparent !important;
    font-family: inherit !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
    transition:
        color 0.18s ease,
        background 0.18s ease,
        padding-left 0.18s ease !important;
}

/* Mouseover */
.catalog-sidebar .category-tree-list a.cat-filter-link:hover {
    color: #0e8c74 !important;
    background: linear-gradient(
        135deg,
        rgba(14, 140, 116, 0.12),
        rgba(14, 140, 116, 0.05)
    ) !important;
    text-decoration: none !important;
    padding-left: 12px !important;
}

/* Active category: .is-active belongs to the LI */
.catalog-sidebar .category-tree-list li.category-item.is-active > a.cat-filter-link {
    color: #0e8c74 !important;
    background: linear-gradient(
        135deg,
        rgba(14, 140, 116, 0.12),
        rgba(14, 140, 116, 0.05)
    ) !important;
    font-weight: 600 !important;
    text-decoration: none !important;
}

/* Active + hover */
.catalog-sidebar .category-tree-list li.category-item.is-active > a.cat-filter-link:hover {
    color: #0e8c74 !important;
    background: linear-gradient(
        135deg,
        rgba(14, 140, 116, 0.16),
        rgba(14, 140, 116, 0.07)
    ) !important;
}

/* Category counts */
.catalog-sidebar .category-tree-list a.cat-filter-link .count {
    flex-shrink: 0;
    margin-left: 6px;
    color: #475569 !important;
    font-size: 11px !important;
    font-weight: 500 !important;
}

.catalog-sidebar .category-tree-list a.cat-filter-link:hover .count,
.catalog-sidebar .category-tree-list li.category-item.is-active > a.cat-filter-link .count {
    color: #18a88c !important;
}

/* Subcategory indentation */
.catalog-sidebar .category-tree-list ul.category-subtree {
    margin: 2px 0 5px !important;
    padding: 0 0 0 10px !important;
    border-left: 1px solid rgba(14, 140, 116, 0.14);
}

.catalog-sidebar .category-tree-list ul.category-subtree a.cat-filter-link {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
    font-size: 11.5px !important;
    font-weight: 400 !important;
}

.catalog-sidebar .category-tree-list ul.category-subtree a.cat-filter-link:hover {
    padding-left: 10px !important;
}

/* Active ancestor */
.catalog-sidebar .category-tree-list li.category-item.is-ancestor > a.cat-filter-link {
    color: #0e8c74 !important;
}

/* Remove browser link styling */
.catalog-sidebar .category-tree-list a.cat-filter-link,
.catalog-sidebar .category-tree-list a.cat-filter-link:visited,
.catalog-sidebar .category-tree-list a.cat-filter-link:focus {
    text-decoration: none !important;
}

.catalog-sidebar .category-tree-list a.cat-filter-link:focus {
    outline: none;
}
