/* ========================================
   MEGA MENU STYLES FOR COSMETICS CATEGORIES
   ======================================== */

/* Container */
.mega-menu-container {
    position: relative;
    background: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    margin: 10px 0;
}

/* Main Menu */
.main-menu {
    display: flex;
    list-style: none;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 8px;
    overflow: hidden;
    flex-wrap: wrap;
}

.menu-item {
    position: relative;
    flex: 1;
    min-width: 0;
}

.menu-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 12px;
    color: #fff;
    text-decoration: none;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.3s ease;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    position: relative;
}

.menu-item:last-child .menu-link {
    border-right: none;
}

.menu-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
}

.menu-link::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 0;
    height: 3px;
    background: #FFD700;
    transition: all 0.3s ease;
    transform: translateX(-50%);
}

.menu-item:hover .menu-link::after {
    width: 80%;
}

.menu-icon {
    width: 20px;
    height: 20px;
    margin-right: 8px;
    opacity: 0.9;
}

.menu-text {
    flex: 1;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.menu-arrow {
    margin-left: 8px;
    transition: transform 0.3s ease;
    opacity: 0.8;
}

.menu-item:hover .menu-arrow {
    transform: rotate(180deg);
}

/* Mega Dropdown */
.mega-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border-radius: 0 0 12px 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 1000;
    border-top: 3px solid #667eea;
}

.menu-item:hover .mega-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-dropdown-inner {
    padding: 30px;
    display: flex;
    gap: 30px;
}

/* Subcategories Grid */
.subcategories-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 30px;
    flex: 1;
}

.subcategory-column {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.subcategory-column:hover {
    transform: translateY(-5px);
    border-color: #667eea;
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.1);
}

/* Subcategory Headers */
.subcategory-header {
    margin-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
    padding-bottom: 10px;
}

.subcategory-title {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: #2c3e50;
}

.subcategory-title a {
    color: #2c3e50;
    text-decoration: none;
    transition: color 0.3s ease;
}

.subcategory-title a:hover {
    color: #667eea;
    text-decoration: none;
}

/* Enhanced Subcategory Display */
.subcategory-count {
    font-size: 12px;
    color: #6c757d;
    font-weight: 400;
    margin-top: 4px;
}

.sub-link {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    color: #6c757d;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 14px;
    position: relative;
    overflow: hidden;
    gap: 8px;
}

.sub-icon {
    width: 16px;
    height: 16px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.sub-text {
    flex: 1;
}

.product-count {
    font-size: 11px;
    color: #999;
    font-weight: 500;
    background: #f8f9fa;
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.sub-link:hover .sub-icon {
    opacity: 1;
}

.sub-link:hover .product-count {
    background: #667eea;
    color: #fff;
}

/* Sub Items */
.sub-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sub-item {
    margin-bottom: 8px;
}

.sub-link {
    display: block;
    padding: 8px 12px;
    color: #6c757d;
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 14px;
    position: relative;
    overflow: hidden;
}

.sub-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: #667eea;
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.sub-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    text-decoration: none;
    padding-left: 20px;
}

.sub-link:hover::before {
    transform: scaleY(1);
}

/* No Subcategories Styling */
.no-subcategories {
    padding: 20px 0;
    text-align: center;
}

.direct-link {
    display: inline-block;
    padding: 12px 20px;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    color: #667eea;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 2px solid #e9ecef;
}

.direct-link:hover {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

/* View All Link */
.view-all {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e9ecef;
}

.view-all-link {
    display: block;
    padding: 12px 15px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff !important;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    text-align: center;
    transition: all 0.3s ease;
    font-size: 13px;
}

.view-all-link small {
    display: block;
    margin-top: 2px;
    opacity: 0.8;
    font-size: 11px;
}

.view-all-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
    color: #fff !important;
    text-decoration: none;
}

/* Featured Section */
.mega-featured {
    width: 300px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 15px;
    padding: 25px;
    color: #fff;
    text-align: center;
    position: relative;
    overflow: hidden;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.3);
}

.mega-featured::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    transition: transform 0.6s ease;
}

.mega-featured:hover::before {
    transform: scale(1.5);
}

.featured-image {
    width: 100%;
    max-width: 120px;
    height: auto;
    border-radius: 8px;
    margin-bottom: 15px;
    position: relative;
    z-index: 2;
}

.featured-content {
    position: relative;
    z-index: 2;
}

.featured-content h6 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: #fff;
}

.featured-content p {
    font-size: 14px;
    opacity: 0.9;
    margin: 0;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .main-menu {
        flex-wrap: wrap;
    }
    
    .menu-link {
        font-size: 13px;
        padding: 14px 10px;
    }
    
    .subcategories-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 20px;
    }
    
    .mega-featured {
        width: 250px;
    }
}

@media (max-width: 992px) {
    .mega-dropdown-inner {
        flex-direction: column;
        padding: 20px;
    }
    
    .subcategories-grid {
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 15px;
    }
    
    .mega-featured {
        width: 100%;
        margin-top: 20px;
    }
    
    .menu-link {
        font-size: 12px;
        padding: 12px 8px;
    }
    
    .mega-footer {
        flex-direction: column;
        text-align: center;
        gap: 20px;
    }
    
    .mega-featured {
        width: 100%;
        max-width: 300px;
    }
    
    .subcategory-count {
        display: none;
    }
    
    .product-count {
        display: none;
    }
}

@media (max-width: 768px) {
    .main-menu {
        flex-direction: column;
    }
    
    .menu-item {
        width: 100%;
    }
    
    .menu-link {
        justify-content: space-between;
        padding: 15px 20px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }
    
    .mega-dropdown {
        position: static;
        opacity: 1;
        visibility: visible;
        transform: none;
        box-shadow: none;
        border-radius: 0;
        background: #f8f9fa;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }
    
    .menu-item:hover .mega-dropdown {
        max-height: 800px;
    }
    
    .subcategories-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .subcategory-column {
        margin-bottom: 10px;
    }
    
    .mega-footer {
        padding-top: 15px;
        margin-top: 20px;
    }
    
    .category-summary {
        text-align: center;
    }
    
    .sub-link {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .sub-icon {
        width: 14px;
        height: 14px;
    }
}

/* Animation Enhancements */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.subcategory-column {
    animation: fadeInUp 0.5s ease forwards;
}

.subcategory-column:nth-child(1) { animation-delay: 0.1s; }
.subcategory-column:nth-child(2) { animation-delay: 0.2s; }
.subcategory-column:nth-child(3) { animation-delay: 0.3s; }
.subcategory-column:nth-child(4) { animation-delay: 0.4s; }

/* Color Variations for Different Categories */
.menu-item:nth-child(1) .menu-link::after { background: #FF6B6B; }
.menu-item:nth-child(2) .menu-link::after { background: #4ECDC4; }
.menu-item:nth-child(3) .menu-link::after { background: #45B7D1; }
.menu-item:nth-child(4) .menu-link::after { background: #96CEB4; }
.menu-item:nth-child(5) .menu-link::after { background: #FFEAA7; }
.menu-item:nth-child(6) .menu-link::after { background: #DDA0DD; }
.menu-item:nth-child(7) .menu-link::after { background: #98D8C8; }
.menu-item:nth-child(8) .menu-link::after { background: #F7DC6F; }

/* Accessibility */
.menu-link:focus,
.sub-link:focus,
.view-all-link:focus {
    outline: 2px solid #FFD700;
    outline-offset: 2px;
}

/* Loading State */
.mega-dropdown.loading {
    opacity: 0.7;
}

.mega-dropdown.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border: 2px solid #667eea;
    border-top: 2px solid transparent;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Animation for product count */
@keyframes countUp {
    from {
        transform: scale(0);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.product-count {
    animation: countUp 0.3s ease 0.2s both;
}

/* Hover effect for subcategory columns */
.subcategory-column:hover {
    transform: translateY(-8px);
    border-color: #667eea;
    box-shadow: 0 15px 40px rgba(102, 126, 234, 0.15);
}

.subcategory-column:hover .subcategory-title a {
    color: #667eea;
}

/* Enhanced loading state */
.mega-dropdown.loading .subcategory-column {
    opacity: 0.5;
    pointer-events: none;
}
