/* ================================================================
   BAJRA BOOKSTORE CATEGORY TREE NAVIGATION — STYLESHEET
   Accents: #601320 (Crimson), #8E1616 (Warm Crimson), #FAF5F0 (Soft Pill Cream)
   Exact match to uploaded reference design.
   ================================================================ */

.bb-category-tree-wrapper {
    width: 100%;
    max-width: 320px;
    font-family: var(--bb-font-sans, "Inter", -apple-system, BlinkMacSystemFont, sans-serif);
    padding: 10px 0;
    user-select: none;
}

/* Header: "ENTIRE COLLECTION" */
.bb-category-tree-header {
    margin-bottom: 20px;
    padding-left: 18px;
}

.bb-category-tree-title {
    font-size: 11.5px !important;
    font-weight: 800 !important;
    letter-spacing: 0.16em !important;
    text-transform: uppercase !important;
    color: #8C99A8 !important;
    margin: 0 !important;
    line-height: 1.2 !important;
}

/* Main Category List */
.bb-category-tree-list {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* Category Item Node */
.bb-cat-item {
    position: relative;
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

/* Row container for title + toggle button */
.bb-cat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    border-radius: 12px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Top-level Parent Inactive State */
.bb-cat-parent > .bb-cat-row {
    padding: 10px 16px;
    background: transparent;
}

.bb-cat-parent > .bb-cat-row:hover {
    background: #FDFBF8;
}

/* Top-level Parent Link */
.bb-cat-parent > .bb-cat-row .bb-cat-link {
    flex: 1;
    display: flex;
    align-items: center;
    text-decoration: none !important;
    color: #2B2425 !important;
    font-size: 14.5px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    transition: color 0.2s ease;
}

.bb-cat-parent > .bb-cat-row:hover .bb-cat-link {
    color: #8E1616 !important;
}

/* Active / Expanded Parent Card: Soft rounded pill background with Crimson font */
.bb-cat-parent.bb-is-expanded > .bb-cat-row,
.bb-cat-parent.bb-is-active > .bb-cat-row,
.bb-cat-parent.bb-is-ancestor > .bb-cat-row {
    background: #FAF5F0 !important;
    border-radius: 14px !important;
    box-shadow: 0 2px 8px rgba(96, 19, 32, 0.04);
}

.bb-cat-parent.bb-is-expanded > .bb-cat-row .bb-cat-link,
.bb-cat-parent.bb-is-active > .bb-cat-row .bb-cat-link,
.bb-cat-parent.bb-is-ancestor > .bb-cat-row .bb-cat-link {
    color: #601320 !important;
    font-weight: 800 !important;
}

/* Chevron Toggle Button */
.bb-cat-toggle {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #8C99A8;
    transition: transform 0.25s ease, color 0.2s ease;
    border-radius: 50%;
    margin-left: 8px;
    outline: none;
}

.bb-cat-toggle:hover {
    color: #601320;
    background: rgba(96, 19, 32, 0.05);
}

.bb-chevron-icon {
    width: 14px;
    height: 14px;
    transition: transform 0.25s ease;
}

/* Expanded Chevron: Rotates smoothly */
.bb-cat-item.bb-is-expanded > .bb-cat-row .bb-chevron-icon {
    transform: rotate(180deg);
}

.bb-cat-parent.bb-is-expanded > .bb-cat-row .bb-cat-toggle {
    color: #601320;
}

/* Subcategory List: Indented cleanly underneath */
.bb-cat-children {
    list-style: none !important;
    margin: 8px 0 12px 0 !important;
    padding: 4px 0 4px 28px !important;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
}

/* Default collapsed state for non-expanded items */
.bb-cat-item:not(.bb-is-expanded) > .bb-cat-children {
    display: none;
}

.bb-cat-item.bb-is-expanded > .bb-cat-children {
    display: flex !important;
}

/* Subtle left vertical guide line */
.bb-cat-children::before {
    content: "";
    position: absolute;
    left: 18px;
    top: 6px;
    bottom: 6px;
    width: 1.5px;
    background: rgba(226, 232, 240, 0.6);
    border-radius: 2px;
}

/* Subcategory Row */
.bb-cat-child > .bb-cat-row {
    padding: 6px 12px;
    border-radius: 8px;
}

.bb-cat-child > .bb-cat-row .bb-cat-link {
    color: #5A5052 !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    line-height: 1.4 !important;
    text-decoration: none !important;
    transition: all 0.18s ease;
}

.bb-cat-child > .bb-cat-row:hover .bb-cat-link {
    color: #8E1616 !important;
    transform: translateX(3px);
}

/* Active Subcategory */
.bb-cat-child.bb-is-active > .bb-cat-row {
    background: #FAF5F0;
}

.bb-cat-child.bb-is-active > .bb-cat-row .bb-cat-link {
    color: #8E1616 !important;
    font-weight: 700 !important;
}

/* Nested 2nd/3rd level children */
.bb-cat-children .bb-cat-children {
    margin-top: 4px !important;
    padding-left: 20px !important;
}

.bb-cat-count {
    font-size: 11px;
    color: #94A3B8;
    margin-left: 6px;
    font-weight: normal;
}

/* ================================================================
   SHOP SIDEBAR & STICKY NAVIGATION STYLES
   ================================================================ */
.primary-sidebar .widget.bb-shop-sidebar-category-tree,
.sidebar .widget.bb-shop-sidebar-category-tree,
.widget_bajra_category_tree {
    background: #ffffff;
    border-radius: 16px;
    padding: 20px 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.04);
    border: 1px solid #f0e8e0;
    margin-bottom: 30px;
}

@media (min-width: 992px) {
    .primary-sidebar.gf-sticky,
    .sidebar.gf-sticky,
    .bb-shop-sidebar-category-tree {
        position: sticky !important;
        top: 96px !important;
    }
}

/* ================================================================
   MOBILE SHOP CATEGORY DRAWER & BUTTON
   ================================================================ */
.bb-mobile-shop-cat-bar {
    display: none;
    margin-bottom: 24px;
    width: 100%;
    position: relative;
    z-index: 15;
}

@media (max-width: 991px) {
    .bb-mobile-shop-cat-bar {
        display: block;
    }

    .bb-mobile-shop-cat-btn {
        display: flex;
        align-items: center;
        justify-content: space-between;
        width: 100%;
        padding: 14px 18px;
        background: #FAF5F0;
        border: 1.5px solid #ECDCCB;
        border-radius: 12px;
        color: #601320;
        font-family: var(--bb-font-sans, sans-serif);
        font-size: 14px;
        font-weight: 700;
        cursor: pointer;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        transition: all 0.2s ease;
        position: relative;
        z-index: 15;
    }

    .bb-mobile-shop-cat-btn:hover {
        background: #F5EAE0;
        border-color: #601320;
    }

    .bb-mobile-shop-cat-btn .bb-btn-icon {
        display: inline-flex;
        align-items: center;
        margin-right: 8px;
        color: #601320;
    }

    .bb-mobile-shop-cat-btn .bb-btn-text {
        flex: 1;
        text-align: left;
    }

    .bb-mobile-shop-cat-btn .bb-btn-chevron {
        display: inline-flex;
        align-items: center;
        transition: transform 0.25s ease;
    }

    .bb-mobile-shop-cat-btn.bb-is-open .bb-btn-chevron {
        transform: rotate(180deg);
    }

    .bb-mobile-shop-cat-drawer {
        margin-top: 10px;
        padding: 16px;
        background: #ffffff;
        border-radius: 14px;
        border: 1px solid #f0e8e0;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
        position: relative;
        z-index: 15;
    }
}

/* ================================================================
   SUPPRESS PREVIOUS / LEGACY DUPLICATE CATEGORY WIDGETS
   ================================================================ */
.primary-sidebar .widget_product_categories,
.primary-sidebar .widget_categories,
.primary-sidebar .g5plus-widget-product-categories,
.primary-sidebar .widget-product-categories,
.primary-sidebar .widget_product_tag_cloud,
.sidebar .widget_product_categories,
.sidebar .widget_categories,
.sidebar .g5plus-widget-product-categories,
.sidebar .widget-product-categories,
.sidebar .widget_product_tag_cloud,
.woocommerce-sidebar .widget_product_categories,
.woocommerce-sidebar .widget_categories,
.woocommerce-sidebar .g5plus-widget-product-categories,
.woocommerce-sidebar .widget-product-categories,
.widget.widget_product_categories:not(.bb-shop-sidebar-category-tree):not(.widget_bajra_category_tree),
.widget.g5plus-widget-product-categories,
.widget.widget_categories:not(.bb-shop-sidebar-category-tree):not(.widget_bajra_category_tree),
.widget_product_categories:not(.bb-shop-sidebar-category-tree):not(.widget_bajra_category_tree),
.widget_categories:not(.bb-shop-sidebar-category-tree):not(.widget_bajra_category_tree),
.sidebar .product-categories:not(.bb-category-tree-list),
.primary-sidebar .product-categories:not(.bb-category-tree-list),
.sidebar .widget:has(.product-categories):not(.bb-shop-sidebar-category-tree):not(.widget_bajra_category_tree),
.primary-sidebar .widget:has(.product-categories):not(.bb-shop-sidebar-category-tree):not(.widget_bajra_category_tree),
.sidebar .widget:has(a[href*="product-category"]):not(.bb-shop-sidebar-category-tree):not(.widget_bajra_category_tree),
.primary-sidebar .widget:has(a[href*="product-category"]):not(.bb-shop-sidebar-category-tree):not(.widget_bajra_category_tree),
/* Suppress subcategory cards / tabs inside main product archive area */
.gf-cate-filter,
.gsf-pretty-tabs,
ul[data-items-cate],
.product-category,
li.product-category,
.woocommerce-loop-category,
.site-content-archive > .gf-cate-filter,
.site-content-archive > .gsf-pretty-tabs,
.archive-markup > .gf-cate-filter,
.archive-markup > .gsf-pretty-tabs {
    display: none !important;
}

/* ================================================================
   ELIMINATE BLANK SPACE AT TOP OF SHOP & ARCHIVE PAGES
   ================================================================ */
.post-type-archive-product .gf-page-title,
.tax-product_cat .gf-page-title,
.tax-product_tag .gf-page-title,
.woocommerce-shop .gf-page-title,
.woocommerce-page .gf-page-title,
.bb-redesign .gf-page-title,
.post-type-archive-product .page-title-wrap,
.tax-product_cat .page-title-wrap,
.woocommerce-shop .page-title-wrap {
    display: none !important;
    height: 0 !important;
    min-height: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
}

.post-type-archive-product #primary-content,
.tax-product_cat #primary-content,
.tax-product_tag #primary-content,
.woocommerce-shop #primary-content,
.woocommerce-page #primary-content {
    padding-top: 24px !important;
    margin-top: 0 !important;
}

/* ================================================================
   IN-PAGE AJAX PRODUCT LOADING OVERLAY & SPINNER
   ================================================================ */
.gsf-product-wrap,
.site-content-archive,
.archive-markup {
    position: relative;
    transition: opacity 0.25s ease;
}

.bb-products-loading {
    pointer-events: none !important;
}

.bb-ajax-loader-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    z-index: 100;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    animation: bb-fade-in 0.2s ease forwards;
}

.bb-spinner {
    width: 46px;
    height: 46px;
    border: 3.5px solid #ECDCCB;
    border-top-color: #601320;
    border-right-color: #8E1616;
    border-radius: 50%;
    animation: bb-spin 0.65s linear infinite;
    box-shadow: 0 4px 12px rgba(96, 19, 32, 0.1);
}

.bb-spinner-text {
    margin-top: 14px;
    font-size: 13.5px;
    font-weight: 700;
    color: #601320;
    letter-spacing: 0.04em;
    font-family: var(--bb-font-sans, "Inter", sans-serif);
}

@keyframes bb-spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes bb-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

/* ================================================================
   FORCE STRICT DESKTOP 2-COLUMN LAYOUT (SIDEBAR LEFT + PRODUCTS RIGHT)
   Eliminates column drop, clears, and empty voids permanently.
   ================================================================ */
@media (min-width: 992px) {
    #primary-content .container > .row,
    #primary-content > .row,
    .post-type-archive-product #primary-content .row,
    .tax-product_cat #primary-content .row,
    .tax-product_tag #primary-content .row,
    .woocommerce-shop #primary-content .row,
    .woocommerce-page #primary-content .row,
    .gsf-sidebar-left #primary-content .row,
    .gsf-sidebar-right #primary-content .row {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: flex-start !important;
        justify-content: flex-start !important;
        gap: 32px !important;
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    #primary-content .row::before,
    #primary-content .row::after {
        display: none !important;
        content: none !important;
        width: 0 !important;
        height: 0 !important;
    }

    /* Category sidebar on LEFT */
    #primary-content .row > .primary-sidebar,
    #primary-content .row > .sidebar,
    #primary-content .row > .col-lg-3,
    #primary-content .row > .col-lg-4,
    #primary-content .row > .order-lg-1,
    .primary-sidebar,
    .sidebar.col-lg-3 {
        flex: 0 0 280px !important;
        max-width: 280px !important;
        width: 280px !important;
        min-width: 280px !important;
        order: 1 !important;
        float: none !important;
        clear: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }

    /* Product grid column on RIGHT */
    #primary-content .row > .site-content-archive,
    #primary-content .row > .col-lg-9,
    #primary-content .row > .col-lg-8,
    #primary-content .row > .order-lg-2,
    #primary-content .row > [class*="col-lg-"]:not(.primary-sidebar):not(.sidebar) {
        flex: 1 1 auto !important;
        max-width: calc(100% - 312px) !important;
        width: calc(100% - 312px) !important;
        order: 2 !important;
        float: none !important;
        clear: none !important;
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Ensure child wrappers never clear or push down */
.site-content-archive,
.gsf-product-wrap,
.archive-markup,
.products-wrap,
.woocommerce-products-header,
.woocommerce-notices-wrapper,
.woocommerce-result-count,
.woocommerce-ordering,
ul.products,
.products {
    clear: none !important;
    margin-top: 0 !important;
    float: none !important;
}