/*
 * Catalogues Page Mobile-Responsive CSS
 * Top collapsible hamburger categories on mobile
 */

.catalogues-page .sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
}

.catalogues-page .sidebar-overlay.active {
    display: block;
}

/* Tablet */
@media (max-width: 1024px) {
    .catalogues-page .layout-grid {
        grid-template-columns: 200px 1fr;
        gap: 25px;
    }
    .catalogues-page .product-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

/* Mobile - Top collapsible sidebar */
@media (min-width: 768px) {
    .catalogues-page .category-box h3 i {
        display: none;
    }
    
    /* Enhanced Desktop Catalogues Category Box - Apply mobile polish consistently */
    .catalogues-page .category-box {
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        border-radius: 8px;
        background: #fff;
        display: flex;
        flex-direction: column;
        max-height: 600px;
        border: 1px solid #ddd;
    }
    
    .catalogues-page .category-box h3 {
        background: #81b9f0;
        color: white;
        font-weight: 600;
        font-size: 18px;
        padding: 16px 20px;
        margin: 0;
        border-radius: 8px 8px 0 0;
        border-bottom: none;
        position: sticky;
        top: 0;
        z-index: 1;
    }
    
    .catalogues-page .category-box ul,
    .catalogues-page .product-category-list {
        padding: 12px 16px;
        max-height: calc(600px - 64px);
        overflow-y: auto;
        list-style: none;
        margin: 0;
    }
    
    .catalogues-page .product-category-list li {
        padding: 0;
        border-bottom: 1px solid #eee;
        line-height: 1.4;
    }

    .cat-item-all {
        padding-bottom: 5px;
    }
    
    .catalogues-page .product-category-list li a {
        font-size: 15px;
        font-weight: 500;
        padding: 0 0 0 6px;
        border-radius: 6px;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        text-decoration: none;
        color: #888;
    }
    
    .catalogues-page .product-category-list li a:hover,
    .catalogues-page .product-category-list li a.active {
        background: #f0f8ff;
        color: #81b9f0;
    }
    
    .catalogues-page .product-category-list .children-list {
        background: #f9f9f9;
        padding: 0 0 0 20px;
        margin: 0;
        border-radius: 4px;
        max-height: none;
        overflow: visible;
    }
    
    .catalogues-page .product-category-list .children-list li {
        border-bottom: none;
        padding: 6px 0;
    }

    .catalogues-page .product-category-list .children-list li:last-child {
        padding-bottom: 0;
    }
    
    .catalogues-page .product-category-list .children-list li a {
        font-size: 14px;
    }
    
    /* Custom scrollbar for consistency */
    .catalogues-page .product-category-list::-webkit-scrollbar {
        width: 6px;
    }
    .catalogues-page .product-category-list::-webkit-scrollbar-track {
        background: #f1f1f1;
    }
    .catalogues-page .product-category-list::-webkit-scrollbar-thumb {
        background: #81b9f0;
        border-radius: 10px;
    }
    .catalogues-page .product-category-list::-webkit-scrollbar-thumb:hover {
        background: #6ea8e0;
    }
}

@media (max-width: 767px) {
    .catalogues-page .product-page-container {
        padding-top: 80px;
    }
    
    .catalogues-page .container {
        padding: 0 12px;
    }
    
    /* Stack layout */
    .catalogues-page .layout-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    /* Collapsible sidebar - top panel */
.catalogues-page .sidebar {
        order: -1; /* Show first */
        background: #fff;
        border-radius: 8px 8px 0 0;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        max-height: 60vh;
        overflow: hidden;
        transition: all 0.3s ease;
        margin-bottom: 20px;
    }
    
    .catalogues-page .sidebar.collapsed {
        max-height: 72px; /* Header height only */
        margin-bottom: 0;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    
    .catalogues-page .sidebar.collapsed .product-category-list {
        display: none;
    }
    
    /* Sidebar header */
    .catalogues-page .category-box h3 {
        margin: 0;
        padding: 16px 20px;
        background: #81b9f0;
        color: white;
        cursor: pointer;
        font-size: 18px;
        font-weight: 600;
        border-radius: 8px 8px 0 0;
    }
    
    @media (max-width: 767px) {
        .catalogues-page .category-box h3 i {
            font-size: 20px;
            margin-left: 8px;
            transition: transform 0.3s ease;
        }
        .catalogues-page .sidebar.collapsed .category-box h3 i {
            transform: rotate(180deg);
        }
    }
    
    .catalogues-page .sidebar.collapsed .category-box h3 {
        border-radius: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    }
    
    .catalogues-page .category-box h3 i {
        transition: transform 0.3s ease;
    }
    
    .catalogues-page .sidebar.collapsed .category-box h3 i.fa-chevron-down {
        transform: rotate(180deg);
    }
    
    .catalogues-page .sidebar-close {
        background: none;
        border: none;
        color: white;
        font-size: 20px;
        cursor: pointer;
        padding: 4px;
        opacity: 0.9;
        transition: opacity 0.2s;
    }
    
    .catalogues-page .sidebar-close:hover {
        opacity: 1;
    }
    
    /* Categories list */
    .catalogues-page .product-category-list {
        max-height: calc(60vh - 70px);
        overflow-y: auto;
        padding: 16px 20px;
        font-size: 16px;
    }
    
    .catalogues-page .product-category-list li {
        padding: 12px 0;
        border-bottom: 1px solid #eee;
    }
    
    .catalogues-page .product-category-list li a {
        display: block;
        padding: 12px 8px;
        min-height: 44px;
        border-radius: 6px;
        transition: background 0.2s;
        font-weight: 500;
    }
    
    .catalogues-page .product-category-list li a:hover,
    .catalogues-page .product-category-list li a.active {
        background: #f0f8ff;
        color: #81b9f0;
    }
    
    .catalogues-page .product-category-list .children-list {
        padding-left: 20px;
        margin-top: 8px;
        background: #f9f9f9;
        border-radius: 4px;
    }
    
    .catalogues-page .product-category-list .children-list li {
        border-bottom: none;
        padding: 8px 0;
        font-size: 15px;
    }
    
    /* Product grid */
    .catalogues-page .product-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    @media (min-width: 500px) and (max-width: 767px) {
        .catalogues-page .product-grid {
            grid-template-columns: repeat(2, 1fr);
        }
    }
    
    /* Toolbar */
    .catalogues-page .grid-toolbar {
        flex-direction: column;
        gap: 12px;
        padding: 16px;
    }
    
    .catalogues-page .sort-dropdown-container {
        order: 2;
        flex-direction: row;
        justify-content: flex-end;
        gap: 10px;
    }
    
    .catalogues-page .custom-sort-button {
        padding: 12px;
        font-size: 16px;
        min-height: 48px;
        min-width: 160px;
    }
    
    /* Pagination */
    .catalogues-page .pagination ul {
        gap: 8px;
        padding: 16px;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .catalogues-page .pagination ul li a,
    .catalogues-page .pagination ul li span {
        padding: 12px 16px;
        min-height: 44px;
        font-size: 16px;
    }
    
    /* Cards */
    .catalogues-page .product-card {
        padding: 20px;
    }
    
    .catalogues-page .product-card h4 {
        font-size: 18px;
    }
    
    .catalogues-page .add-to-cart {
        padding: 14px;
        font-size: 16px;
        min-height: 50px;
    }
}

/* Extra small */
@media (max-width: 480px) {
    .catalogues-page .container {
        padding: 0 8px;
    }
    
    .catalogues-page .category-box h3 {
        padding: 14px 16px;
        font-size: 17px;
    }
}

@media print {
    .catalogues-page .sidebar-overlay,
    .catalogues-page .sidebar-close {
        display: none !important;
    }
}
