/**
 * Mobile Categories Offcanvas Styles
 * Bottom-up sliding offcanvas for product categories
 */

/* Categories Offcanvas Container */
.categories-offcanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    visibility: hidden;
    opacity: 0;
    transition: all 0.3s ease;
}

.categories-offcanvas.active {
    visibility: visible;
    opacity: 1;
}

/* Overlay */
.categories-offcanvas-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

/* Offcanvas Content */
.categories-offcanvas-content {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    max-height: 80vh;
    background: #fff;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    overflow: hidden;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.1);
}

.categories-offcanvas.active .categories-offcanvas-content {
    transform: translateY(0);
}

/* Header */
.categories-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px;
    border-bottom: 1px solid #eee;
    background: #f8f9fa;
}

.categories-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.categories-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: #666;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.categories-close-btn:hover {
    background: #e9ecef;
    color: #333;
}

/* Body */
.categories-body {
    max-height: calc(80vh - 80px);
    overflow-y: auto;
    padding: 0;
    -webkit-overflow-scrolling: touch;
}

/* Categories List */
.categories-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.category-item {
    border-bottom: 1px solid #f0f0f0;
}

.category-item:last-child {
    border-bottom: none;
}

/* Category Link Wrapper */
.category-link-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
    background: #fff;
    transition: background-color 0.3s ease;
}

.category-link-wrapper:hover {
    background: #f8f9fa;
}

/* Category Link */
.category-link {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    font-weight: 500;
    font-size: 15px;
    transition: color 0.3s ease;
}

.category-link:hover {
    color: #007cba;
    text-decoration: none;
}

.category-count {
    color: #666;
    font-weight: normal;
}

/* Category Toggle Button */
.category-toggle {
    background: none;
    border: none;
    padding: 15px 20px;
    color: #666;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.category-toggle:hover {
    color: #007cba;
}

.category-toggle i {
    transition: all 0.3s ease;
}

.category-toggle[aria-expanded="true"] i {
    transform: rotate(180deg);
}

/* Subcategories List */
.subcategories-list {
    list-style: none;
    margin: 0;
    padding: 0;
    background: #f8f9fa;
}

.subcategories-list.collapse {
    display: none;
}

.subcategories-list.collapse.in,
.subcategories-list.collapsing {
    display: block;
}

.subcategory-item {
    border-bottom: 1px solid #e9ecef;
}

.subcategory-item:last-child {
    border-bottom: none;
}

.subcategory-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px 12px 40px;
    text-decoration: none;
    color: #555;
    font-size: 14px;
    transition: all 0.3s ease;
}

.subcategory-link:hover {
    color: #007cba;
    background: #e9ecef;
    text-decoration: none;
}

.subcategory-count {
    font-size: 12px;
    color: #888;
}

/* No Categories Message */
.no-categories {
    padding: 40px 20px;
    text-align: center;
    color: #666;
    font-style: italic;
}

/* Footer Mobile Categories Button */
.goal-footer-mobile .categories-menu-btn {
    position: relative;
}

.goal-footer-mobile .categories-menu-btn i {
    font-size: 18px;
    margin-bottom: 4px;
}

/* Responsive Adjustments */
@media (max-width: 480px) {
    .categories-offcanvas-content {
        max-height: 85vh;
    }

    .categories-header h3 {
        font-size: 16px;
    }

    .category-link {
        font-size: 14px;
        padding: 12px 15px;
    }

    .category-toggle {
        padding: 12px 15px;
    }

    .subcategory-link {
        padding: 10px 15px 10px 30px;
        font-size: 13px;
    }
}

/* Smooth scrolling for mobile */
@media (max-width: 768px) {
    .categories-body::-webkit-scrollbar {
        width: 4px;
    }

    .categories-body::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 2px;
    }

    .categories-body::-webkit-scrollbar-thumb {
        background: #c1c1c1;
        border-radius: 2px;
    }

    .categories-body::-webkit-scrollbar-thumb:hover {
        background: #a1a1a1;
    }
}

/* Animation for better UX */
.category-item {
    opacity: 0;
    animation: fadeInUp 0.5s ease forwards;
}

.category-item:nth-child(1) {
    animation-delay: 0.1s;
}

.category-item:nth-child(2) {
    animation-delay: 0.2s;
}

.category-item:nth-child(3) {
    animation-delay: 0.3s;
}

.category-item:nth-child(4) {
    animation-delay: 0.4s;
}

.category-item:nth-child(5) {
    animation-delay: 0.5s;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Active states */
.category-item.active .category-link {
    color: #007cba;
    background: #f0f8ff;
}

/* Loading state */
.categories-body.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 200px;
}

.categories-body.loading::after {
    content: '';
    width: 40px;
    height: 40px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #007cba;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}