/**
 * Thanos Theme - Mega Menu Component
 *
 * Premium category navigation with mega dropdown
 * @package Thanos_Theme
 */

/* =========================================
   Categories Button / Trigger
   ========================================= */
.mega-menu-trigger {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--thanos-surface);
    border: 1px solid var(--thanos-border);
    border-radius: 8px;
    color: var(--thanos-text);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.mega-menu-trigger:hover {
    background: var(--thanos-surface-hover);
    border-color: var(--thanos-primary);
}

.mega-menu-trigger.active {
    background: var(--thanos-primary);
    border-color: var(--thanos-primary);
    color: #fff;
}

.mega-menu-trigger svg {
    width: 18px;
    height: 18px;
}

.mega-menu-trigger .trigger-icon-close {
    display: none;
}

.mega-menu-trigger.active .trigger-icon-menu {
    display: none;
}

.mega-menu-trigger.active .trigger-icon-close {
    display: block;
}

/* =========================================
   Mega Menu Dropdown
   ========================================= */
.mega-menu {
    position: fixed;
    top: 70px; /* Header height */
    left: 0;
    right: 0;
    max-height: calc(100vh - 70px);
    overflow-y: auto;
    background: var(--thanos-bg-dark);
    border-top: 1px solid var(--thanos-border);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

.mega-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mega-menu-inner {
    display: grid;
    grid-template-columns: 280px 1fr;
    max-width: 1400px;
    margin: 0 auto;
    min-height: 400px;
}

/* =========================================
   Categories Sidebar
   ========================================= */
.mega-menu-categories {
    background: var(--thanos-surface);
    border-right: 1px solid var(--thanos-border);
    padding: 20px 0;
    overflow-y: auto;
    max-height: 500px;
}

.mega-category-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    color: var(--thanos-text);
    cursor: pointer;
    transition: all 0.2s;
}

.mega-category-item:hover,
.mega-category-item.active {
    background: var(--thanos-primary);
    color: #fff;
}

.mega-category-item .cat-name {
    display: flex;
    align-items: center;
    gap: 12px;
}

.mega-category-item .cat-icon {
    width: 20px;
    height: 20px;
    opacity: 0.7;
}

.mega-category-item .cat-count {
    font-size: 0.8rem;
    opacity: 0.6;
}

.mega-category-item .cat-arrow {
    width: 16px;
    height: 16px;
    opacity: 0.5;
}

/* =========================================
   Content Area
   ========================================= */
.mega-menu-content {
    padding: 30px;
    display: none;
}

.mega-menu-content.active {
    display: block;
}

.mega-content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--thanos-border);
}

.mega-content-title {
    font-size: 1.25rem;
    font-weight: 600;
}

.mega-content-link {
    color: var(--thanos-primary);
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.mega-content-link:hover {
    text-decoration: underline;
}

.mega-content-link svg {
    width: 16px;
    height: 16px;
}

/* Featured Videos Grid */
.mega-videos-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.mega-video-card {
    background: var(--thanos-surface);
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.mega-video-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.mega-video-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}

.mega-video-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.mega-video-card:hover .mega-video-thumb img {
    transform: scale(1.05);
}

.mega-video-thumb .duration {
    position: absolute;
    bottom: 6px;
    right: 6px;
    background: rgba(0, 0, 0, 0.8);
    color: #fff;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
}

.mega-video-info {
    padding: 10px;
    background: var(--thanos-bg-card);
}

.mega-video-title {
    font-size: 0.85rem;
    font-weight: 500;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Subcategories */
.mega-subcategories {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 20px;
}

.mega-subcategory {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--thanos-surface);
    border-radius: 6px;
    color: var(--thanos-text);
    font-size: 0.9rem;
    transition: all 0.2s;
}

.mega-subcategory:hover {
    background: var(--thanos-primary);
    color: #fff;
}

.mega-subcategory .sub-count {
    margin-left: auto;
    font-size: 0.75rem;
    opacity: 0.6;
}

/* =========================================
   Quick Links Section
   ========================================= */
.mega-quick-links {
    display: flex;
    gap: 20px;
    padding: 20px 30px;
    background: var(--thanos-surface);
    border-top: 1px solid var(--thanos-border);
}

.mega-quick-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    background: var(--thanos-bg-dark);
    border-radius: 8px;
    color: var(--thanos-text);
    transition: all 0.2s;
}

.mega-quick-link:hover {
    background: var(--thanos-primary);
    color: #fff;
}

.mega-quick-link svg {
    width: 20px;
    height: 20px;
}

.mega-quick-link .link-text {
    font-size: 0.9rem;
    font-weight: 500;
}

/* =========================================
   Loading State
   ========================================= */
.mega-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--thanos-text-muted);
}

.mega-loading::after {
    content: '';
    width: 30px;
    height: 30px;
    border: 3px solid var(--thanos-border);
    border-top-color: var(--thanos-primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* =========================================
   Overlay
   ========================================= */
.mega-menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s;
    z-index: 999;
}

.mega-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* =========================================
   Responsive
   ========================================= */
@media (max-width: 1200px) {
    .mega-videos-grid {
        grid-template-columns: repeat(3, 1fr);
    }

    .mega-subcategories {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 992px) {
    .mega-menu-inner {
        grid-template-columns: 1fr;
    }

    .mega-menu-categories {
        display: flex;
        overflow-x: auto;
        padding: 15px;
        gap: 10px;
        border-right: none;
        border-bottom: 1px solid var(--thanos-border);
    }

    .mega-category-item {
        padding: 10px 16px;
        white-space: nowrap;
        border-radius: 20px;
        background: var(--thanos-bg-dark);
    }

    .mega-category-item .cat-arrow {
        display: none;
    }

    .mega-videos-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .mega-subcategories {
        grid-template-columns: repeat(2, 1fr);
    }

    .mega-quick-links {
        flex-wrap: wrap;
    }
}

@media (max-width: 768px) {
    .mega-menu {
        top: 60px; /* Smaller header height on mobile */
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }

    .mega-menu-trigger {
        padding: 8px 12px;
    }

    .mega-menu-trigger span {
        display: none;
    }

    .mega-menu-content {
        padding: 20px;
    }

    .mega-videos-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }

    .mega-subcategories {
        grid-template-columns: 1fr;
    }

    .mega-quick-links {
        padding: 15px;
        gap: 10px;
    }

    .mega-quick-link {
        flex: 1;
        padding: 10px 15px;
        justify-content: center;
    }

    .mega-quick-link .link-text {
        display: none;
    }
}
