/* Categories Section Overrides */
.categories-section {
    padding: 60px 0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.categories-heading {
    text-align: center;
    font-size: 1.6rem;
    /* Reduced from 2.2rem */
    font-weight: 700;
    margin-bottom: 40px;
    background: linear-gradient(90deg, #111827, #374151);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

#dynamic-category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    /* Reduced min-width */
    gap: 15px;
    /* Reduced gap */
    padding: 15px;
}

/* Enhanced Category Item */
.enhanced-category-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    text-decoration: none;
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    /* Slightly smaller radius */
    padding: 15px 10px;
    /* Reduced padding */
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05),
        0 2px 4px -1px rgba(0, 0, 0, 0.03);
    position: relative;
    overflow: hidden;
    cursor: pointer;
}

.enhanced-category-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    border-color: var(--primary-color, #007bff);
}

/* Glassmorphism Icon Wrapper */
.glass-icon {
    width: 45px;
    /* Reduced from 64px */
    height: 45px;
    /* Reduced from 64px */
    border-radius: 50%;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 10px;
    /* Reduced margin */
    transition: transform 0.3s ease;
    color: #0284c7;
    /* Sky blue tone */
}

.enhanced-category-item:hover .glass-icon {
    transform: scale(1.1) rotate(5deg);
    background: linear-gradient(135deg, #bae6fd 0%, #7dd3fc 100%);
    color: #0369a1;
}

.glass-icon svg {
    width: 24px;
    /* Reduced from 32px */
    height: 24px;
    /* Reduced from 32px */
    fill: currentColor;
}

.category-emoji {
    font-size: 24px;
    line-height: 1;
}

/* Category Text */
.category-info h3 {
    font-size: 0.85rem;
    /* Reduced from 1rem */
    font-weight: 600;
    color: #1f2937;
    margin: 0 0 2px 0;
    font-family: 'Poppins', sans-serif;
    line-height: 1.2;
}

.category-info p {
    font-size: 0.65rem;
    /* Reduced from 0.75rem */
    color: #6b7280;
    margin: 0;
    font-weight: 500;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    #dynamic-category-grid {
        grid-template-columns: repeat(3, 1fr);
        /* 3 columns on mobile now */
        gap: 10px;
        padding: 10px;
    }

    .enhanced-category-item {
        padding: 12px 5px;
    }

    .glass-icon {
        width: 40px;
        height: 40px;
    }

    .glass-icon svg {
        width: 20px;
        height: 20px;
    }

    .category-info h3 {
        font-size: 0.75rem;
    }

    .category-info p {
        font-size: 0.6rem;
    }
}

/* --- Sub-category Modal Styles --- */
.subcategory-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    /* Darker backdrop */
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    backdrop-filter: blur(4px);
}

.subcategory-modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.subcategory-modal-content {
    background: #fff;
    width: 90%;
    max-width: 500px;
    max-height: 80vh;
    border-radius: 20px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateY(20px);
    transition: transform 0.3s ease;
}

.subcategory-modal-overlay.active .subcategory-modal-content {
    transform: translateY(0);
}

.subcategory-modal-header {
    padding: 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: #fdfdfd;
    position: sticky;
    top: 0;
}

.subcategory-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    font-family: 'Poppins', sans-serif;
    color: #111827;
}

.subcategory-close-btn {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #6b7280;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.subcategory-close-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.subcategory-list {
    padding: 20px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
}

.subcategory-item-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #f9fafb;
    border-radius: 10px;
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.subcategory-item-link:hover {
    background: #e0f2fe;
    color: #0284c7;
    border-color: #bae6fd;
    transform: translateX(4px);
}

.subcategory-icon-wrapper {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #e0f2fe 0%, #bae6fd 100%);
    border-radius: 8px;
    transition: all 0.3s;
}

.subcategory-item-link:hover .subcategory-icon-wrapper {
    background: linear-gradient(135deg, #bae6fd 0%, #7dd3fc 100%);
    transform: rotateY(180deg);
}

.subcategory-icon {
    width: 18px;
    height: 18px;
    fill: #0284c7;
}

.subcategory-text {
    flex-grow: 1;
}

.subcategory-arrow {
    font-size: 18px;
    color: #9ca3af;
}

.subcategory-item-link:hover .subcategory-arrow {
    color: #0284c7;
}

/* Scrollbar for modal */
.subcategory-list::-webkit-scrollbar {
    width: 6px;
}

.subcategory-list::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.subcategory-list::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.subcategory-list::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}