/**
 * Enhanced Sidebar Navigation CSS
 * Jumia-style with improved animations and visual appeal
 */

/* ==========================================================================
   CATEGORY SIDEBAR - Enhanced Version
   ========================================================================== */

.category-sidebar {
    background: var(--white);
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 30px;
    transition: all 0.3s ease;
}

.category-sidebar:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

/* Header */
.category-header {
    background: linear-gradient(135deg, var(--primary-blue) 0%, var(--primary-dark) 100%);
    color: var(--white);
    padding: 18px 20px;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    text-align: center;
}

/* Category List */
.category-list {
    padding: 0;
    margin: 0;
    list-style: none;
}

.category-item {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.category-item:last-child {
    border-bottom: none;
}

.category-item:hover {
    background: #f9fbfc;
}

/* Category Link Wrapper */
.category-link-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

/* Category Link */
.category-link {
    flex: 1;
    display: flex;
    align-items: center;
    padding: 14px 20px;
    color: var(--text-dark);
    text-decoration: none;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
}

.category-link:hover {
    color: var(--primary-blue);
    padding-left: 25px;
    background: linear-gradient(90deg, rgba(0, 102, 204, 0.05) 0%, transparent 100%);
}

.category-link.active {
    color: var(--white);
    background: var(--secondary-teal);
    font-weight: 600;
}

.category-link.active .product-count {
    color: rgba(255, 255, 255, 0.8);
}

/* Category Name */
.category-name {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

/* Product Count */
.product-count {
    color: #999;
    font-size: 13px;
    font-weight: 400;
    margin-left: auto;
}

/* Category Toggle Arrow */
.category-toggle {
    padding: 14px 16px;
    cursor: pointer;
    color: var(--text-light);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.category-toggle:hover {
    color: var(--primary-blue);
    background: rgba(0, 102, 204, 0.05);
}

.category-toggle i {
    transition: transform 0.3s ease;
    font-size: 12px;
}

.category-item.expanded .category-toggle i {
    transform: rotate(90deg);
    color: var(--primary-blue);
}

/* Subcategory List */
.subcategory-list {
    display: none;
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fafbfc;
    border-top: 1px solid #f0f0f0;
    animation: slideDown 0.3s ease;
}

.subcategory-list.show {
    display: block;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Subcategory Item */
.subcategory-item {
    border-top: 1px solid #f0f0f0;
    transition: background 0.2s ease;
}

.subcategory-item:first-child {
    border-top: none;
}

.subcategory-item:hover {
    background: #f5f7f9;
}

/* Subcategory Link */
.subcategory-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px 12px 40px;
    color: var(--text-dark);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
}

.subcategory-link:hover {
    color: var(--primary-blue);
    padding-left: 45px;
}

.subcategory-link.active {
    color: var(--primary-blue);
    font-weight: 600;
    background: rgba(0, 102, 204, 0.08);
}

.subcategory-link i {
    font-size: 6px;
    color: var(--secondary-teal);
}

.subcategory-link:hover i {
    color: var(--primary-blue);
    transform: scale(1.3);
}

/* Loading State */
.category-sidebar.loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Empty State */
.category-sidebar-empty {
    padding: 40px 20px;
    text-align: center;
}

.category-sidebar-empty i {
    font-size: 48px;
    color: #ddd;
    margin-bottom: 15px;
}

.category-sidebar-empty p {
    color: #999;
    margin: 10px 0;
}

.category-sidebar-empty a {
    color: var(--primary-blue);
    text-decoration: none;
    font-weight: 600;
}

.category-sidebar-empty a:hover {
    text-decoration: underline;
}

/* Scrollbar Styling (for long category lists) */
.category-list {
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.category-list::-webkit-scrollbar {
    width: 6px;
}

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

.category-list::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.category-list::-webkit-scrollbar-thumb:hover {
    background: var(--text-light);
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .category-sidebar {
        margin-bottom: 20px;
    }

    .category-header {
        padding: 15px;
        font-size: 14px;
    }

    .category-link,
    .category-toggle {
        padding: 12px 15px;
    }

    .subcategory-link {
        padding: 10px 15px 10px 35px;
    }
}

/* Accessibility */
.category-link:focus,
.category-toggle:focus,
.subcategory-link:focus {
    outline: 2px solid var(--primary-blue);
    outline-offset: -2px;
}

/* Print Styles */
@media print {
    .category-sidebar {
        box-shadow: none;
        border: 1px solid #ddd;
    }

    .category-toggle {
        display: none;
    }

    .subcategory-list {
        display: block !important;
    }
}
