/*
 * Global Mobile Category Bar Styles
 * Shows on all pages EXCEPT shop/archives
 * Active on mobile/tablet (max-width: 991px)
 */

/* ===========================================
   HIDE ON DESKTOP (1201px+)
   =========================================== */
.goled-global-category-bar,
.goled-global-category-overlay,
.goled-global-category-panel {
    display: none !important;
}

/* ===========================================
   SMALL MOBILE ADJUSTMENTS
   =========================================== */

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

@media (max-width: 1200px) {

    /* ===========================================
       CATEGORY BAR - Default (scrolls with content)
       margin-top accounts for fixed mobile header (70px)
       =========================================== */
    .goled-global-category-bar {
        display: block !important;
        position: relative;
        margin-top: 70px;
        /* Space for fixed mobile header */
        z-index: 100;
        background: var(--card-bg);
        border-bottom: 1px solid var(--border-color);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }

    /* ===========================================
       CATEGORY BAR - Fixed (like utility bar in shop)
       Applied via JS when scrolled past
       Must be below sticky mobile header (70px height)
       =========================================== */
    body.global-category-bar-fixed .goled-global-category-bar {
        position: fixed !important;
        top: 70px !important;
        left: 0 !important;
        right: 0 !important;
        margin-top: 0 !important;
        z-index: 100 !important;
    }

    .goled-category-bar-btn {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        padding: 14px 16px;
        background: transparent;
        border: none;
        color: var(--text-color);
        font-size: 0.95rem;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .goled-category-bar-btn:hover,
    .goled-category-bar-btn:focus {
        background: var(--input-bg);
        color: var(--primary-color);
    }

    .goled-category-bar-btn.active {
        background: var(--primary-color);
        color: #000;
    }

    .goled-category-bar-btn i {
        font-size: 0.95rem;
    }

    /* ===========================================
       OFF-CANVAS OVERLAY
       =========================================== */
    .goled-global-category-overlay {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.6);
        z-index: 199;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s ease;
    }

    .goled-global-category-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* ===========================================
       OFF-CANVAS PANEL
       =========================================== */
    .goled-global-category-panel {
        display: flex !important;
        flex-direction: column;
        position: fixed;
        top: 0;
        left: 0;
        width: 320px;
        max-width: 85vw;
        height: 100vh;
        background: var(--card-bg);
        z-index: 200;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow: hidden;
    }

    .goled-global-category-panel.active {
        transform: translateX(0);
    }

    /* Panel Header */
    .goled-category-panel-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 20px;
        background: var(--body-bg);
        border-bottom: 1px solid var(--border-color);
        flex-shrink: 0;
    }

    .goled-category-panel-header h2 {
        margin: 0;
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-color);
    }

    .goled-category-panel-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: transparent;
        border: 1px solid var(--border-color);
        border-radius: 50%;
        color: var(--text-color);
        cursor: pointer;
        transition: all 0.2s ease;
    }

    .goled-category-panel-close:hover {
        background: var(--danger-color, #dc3545);
        border-color: var(--danger-color, #dc3545);
        color: #fff;
    }

    /* Panel Body */
    .goled-category-panel-body {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
        -webkit-overflow-scrolling: touch;
    }

    /* ===========================================
       CATEGORY LIST (Navigation only, no checkboxes)
       =========================================== */
    .goled-global-categories {
        margin: 0;
    }

    .goled-global-shop-link {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 14px;
        margin-bottom: 12px;
        background: var(--primary-color);
        border-radius: 8px;
        color: #000;
        text-decoration: none;
        font-weight: 600;
        transition: all 0.2s ease;
    }

    .goled-global-shop-link:hover {
        background: #e5a800;
        color: #000;
    }

    .goled-global-shop-link i {
        font-size: 1rem;
    }

    .goled-global-cat-list {
        list-style: none;
        margin: 0;
        padding: 0;
    }

    .goled-global-cat-list.goled-gcat-child {
        padding-left: 16px;
        margin-top: 4px;
        display: none;
        border-left: 2px solid var(--border-color);
    }

    .goled-global-cat-list.goled-gcat-child.active {
        display: block;
    }

    .goled-global-cat-item {
        margin-bottom: 2px;
    }

    .goled-global-cat-row {
        display: flex;
        align-items: center;
    }

    .goled-global-cat-link {
        flex: 1;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 10px 12px;
        color: var(--text-color);
        text-decoration: none;
        border-radius: 6px;
        transition: all 0.2s ease;
    }

    .goled-global-cat-link:hover {
        background: var(--input-bg);
        color: var(--primary-color);
    }

    .goled-gcat-count {
        font-size: 0.85rem;
        color: var(--text-muted);
        margin-left: 8px;
    }

    .goled-gcat-expand {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        background: transparent;
        border: none;
        color: var(--text-muted);
        cursor: pointer;
        transition: all 0.2s ease;
        flex-shrink: 0;
    }

    .goled-gcat-expand:hover {
        color: #333;
    }

    .goled-gcat-expand i {
        transition: transform 0.2s ease;
    }

    .goled-global-cat-item.expanded>.goled-global-cat-row .goled-gcat-expand i {
        transform: rotate(180deg);
    }

    /* Prevent body scroll when panel is open */
    body.global-category-panel-open {
        overflow: hidden;
    }
}

@media (max-width: 575px) {
    .goled-global-category-panel {
        width: 280px;
    }

    .goled-category-panel-body {
        padding: 15px;
    }
}