/* Product Categories Popup Styles */

.product-categories-popup {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
}

.product-categories-popup.active {
    display: block;
}

.popup-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    animation: fadeIn 0.3s ease-out;
}

.popup-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 1200px;
    max-height: 90vh;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    animation: slideIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
}

.popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    border-bottom: 1px solid #E5E7EB;
    background-color: #F9FAFB;
}

.popup-header h2 {
    margin: 0;
    font-family: var(--font-heading, 'Gilda Display', serif);
    font-size: 1.5rem;
    color: #1F2937;
}

.popup-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    line-height: 1;
    color: #6B7280;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s;
}

.popup-close:hover {
    background-color: #F3F4F6;
    color: #1F2937;
}

.popup-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

/* Adjust product categories page styling to fit within popup */
.popup-content .product-categories-page {
    padding: 0;
    gap: 1.5rem;
}

.popup-content .product-item {
    cursor: pointer;
}

.popup-content .current-category-title {
    margin-top: 0;
}

/* Popup-specific category sidebar adjustments */
.popup-content .categories-sidebar {
    flex: 0 0 220px;
}

.popup-content .category-filter-list {
    max-height: 60vh; /* Use viewport height instead of fixed pixels */
    overflow-y: auto;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 0.5rem;
    background-color: white;
    /* Only show scrollbar when content overflows */
    scrollbar-width: thin;
    scrollbar-color: #CBD5E0 transparent;
}

/* Hide scrollbar track when not needed */
.popup-content .category-filter-list::-webkit-scrollbar {
    width: 6px;
}

.popup-content .category-filter-list::-webkit-scrollbar-track {
    background: transparent;
}

.popup-content .category-filter-list::-webkit-scrollbar-thumb {
    background-color: #CBD5E0;
    border-radius: 3px;
}

.popup-content .category-filter-list::-webkit-scrollbar-thumb:hover {
    background-color: #A0AEC0;
}

.popup-content .category-item-content {
    padding: 0.6rem 0.8rem;
    font-size: 0.9rem;
}

.popup-content .category-filter-item.subcategory .category-item-content {
    padding: 0.5rem 0.8rem 0.5rem 1.8rem;
}

.popup-content .subcategory-list {
    max-height: 40vh; /* Reduced and responsive for popup */
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translate(-50%, -48%);
    }
    to { 
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Loading overlay */
.product-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.7);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
}

.product-loading-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid var(--btn-bck, #1DB5BE);
    border-radius: 50%;
    border-top-color: transparent;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .popup-container {
        width: 95%;
        max-height: 95vh;
    }
    
    .popup-content {
        padding: 16px;
    }
    
    .popup-content .product-categories-page {
        flex-direction: column;
        gap: 1rem;
    }
    
    .popup-content .categories-sidebar {
        flex: none;
        width: 100%;
    }
    
    .popup-content .category-filter-list {
        max-height: 40vh; /* Smaller on mobile */
    }
}