/**
 * Pixelish Mega Menu Styles - LootNest Theme
 * Version: 1.0.0
 */

/* =================================================================
   1. CSS VARIABLES & ROOT STYLES
   ================================================================= */

:root {
    --pmm-primary-color: #22232a;
    --pmm-brand-color: #ff0150;
    --pmm-accent-color: #ff0150;
    --pmm-background: #22232a;
    --pmm-surface: #2a2b32;
    --pmm-surface-lighter: #32333a;
    --pmm-border: rgba(255, 255, 255, 0.1);
    --pmm-text-primary: #ffffff;
    --pmm-text-secondary: rgba(255, 255, 255, 0.8);
    --pmm-text-muted: rgba(255, 255, 255, 0.5);
    --pmm-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    --pmm-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.5);
    --pmm-transition: all 0.3s ease;
    --pmm-border-radius: 6px;
    --pmm-border-radius-sm: 4px;
    --pmm-spacing-xs: 0.25rem;
    --pmm-spacing-sm: 0.5rem;
    --pmm-spacing-md: 1rem;
    --pmm-spacing-lg: 1.5rem;
    --pmm-spacing-xl: 2rem;
    --pmm-spacing-xxl: 3rem;
    --pmm-font-size-sm: 0.875rem;
    --pmm-font-size-base: 1rem;
    --pmm-font-size-lg: 1.125rem;
    --pmm-font-size-xl: 1.25rem;
    --pmm-z-index: 999999;
}

/* =================================================================
   2. MEGA MENU CONTAINER & TRIGGER
   ================================================================= */

.pixelish-mega-menu {
    position: relative;
    display: inline-block;
    font-family: "Nudica", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: var(--pmm-font-size-base);
    line-height: 1.5;
}

.mega-menu-trigger {
    display: flex;
    align-items: center;
    gap: var(--pmm-spacing-sm);
    padding: 12px 16px;
    background: var(--pmm-primary-color);
    border: 1px solid var(--pmm-border);
    border-radius: var(--pmm-border-radius-sm);
    color: var(--pmm-text-primary);
    cursor: pointer;
    transition: var(--pmm-transition);
    text-decoration: none;
    user-select: none;
    font-weight: 500;
    min-height: 44px;
}

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

.mega-menu-title {
    font-weight: 500;
    white-space: nowrap;
    font-size: var(--pmm-font-size-base);
    color: var(--pmm-text-primary);
}

.mega-menu-icon {
    display: flex;
    align-items: center;
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.mega-menu-icon svg {
    width: 100%;
    height: 100%;
    fill: currentColor;
}

/* Hamburger icon styling */
.mega-menu-hamburger {
    display: flex;
    flex-direction: column;
    gap: 3px;
    width: 18px;
    height: 14px;
}

.mega-menu-hamburger span {
    display: block;
    height: 2px;
    width: 100%;
    background: currentColor;
    border-radius: 1px;
    transition: var(--pmm-transition);
}

.pixelish-mega-menu.menu-open .mega-menu-hamburger span:nth-child(1) {
    transform: rotate(45deg) translate(6px, 6px);
}

.pixelish-mega-menu.menu-open .mega-menu-hamburger span:nth-child(2) {
    opacity: 0;
}

.pixelish-mega-menu.menu-open .mega-menu-hamburger span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* =================================================================
   3. MEGA MENU DROPDOWN
   ================================================================= */

.mega-menu-dropdown {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    background: var(--pmm-background);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-20px);
    transition: var(--pmm-transition);
    z-index: var(--pmm-z-index);
    overflow-y: auto;
    padding: var(--pmm-spacing-xl);
    box-sizing: border-box;
}

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

.mega-menu-container {
    display: grid;
    grid-template-columns: 280px 1fr 400px;
    gap: var(--pmm-spacing-xxl);
    height: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding-top: var(--pmm-spacing-xl);
}

/* =================================================================
   4. MEGA MENU COLUMNS
   ================================================================= */

.mega-menu-column {
    position: relative;
    padding: var(--pmm-spacing-lg);
    background: var(--pmm-surface);
    border-radius: var(--pmm-border-radius);
    border: 1px solid var(--pmm-border);
}

.mega-menu-categories {
    background: var(--pmm-surface);
}

.mega-menu-subcategories {
    background: var(--pmm-surface);
}

.mega-menu-products {
    background: var(--pmm-surface);
}

/* Column headers */
.mega-menu-column-header {
    font-size: var(--pmm-font-size-xl);
    font-weight: 600;
    color: var(--pmm-text-primary);
    margin-bottom: var(--pmm-spacing-lg);
    padding-bottom: var(--pmm-spacing-sm);
    border-bottom: 2px solid var(--pmm-brand-color);
}

/* =================================================================
   5. MENU ITEMS & LINKS
   ================================================================= */

.mega-menu-item {
    margin-bottom: var(--pmm-spacing-xs);
}

.mega-menu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--pmm-spacing-md);
    color: var(--pmm-text-secondary);
    text-decoration: none;
    border-radius: var(--pmm-border-radius-sm);
    transition: var(--pmm-transition);
    font-weight: 500;
    position: relative;
    font-size: var(--pmm-font-size-base);
}

.mega-menu-link:hover {
    background: var(--pmm-surface-lighter);
    color: var(--pmm-brand-color);
    text-decoration: none;
    transform: translateX(4px);
}

.mega-menu-categories .mega-menu-link:hover {
    background: var(--pmm-surface-lighter);
    border-left: 3px solid var(--pmm-brand-color);
    padding-left: calc(var(--pmm-spacing-md) - 3px);
}

.mega-menu-count {
    font-size: var(--pmm-font-size-sm);
    color: var(--pmm-text-muted);
    font-weight: 400;
    background: var(--pmm-surface-lighter);
    padding: 2px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
}

.mega-menu-arrow {
    opacity: 0;
    transition: var(--pmm-transition);
    color: var(--pmm-brand-color);
    font-size: 14px;
}

.mega-menu-link:hover .mega-menu-arrow {
    opacity: 1;
}

.mega-menu-all-categories {
    margin-bottom: var(--pmm-spacing-lg);
}

.mega-menu-all-categories .mega-menu-link {
    font-weight: 600;
    color: var(--pmm-text-primary);
    background: var(--pmm-brand-color);
    border: none;
    text-align: center;
    justify-content: center;
}

.mega-menu-all-categories .mega-menu-link:hover {
    background: #e6014a;
    color: var(--pmm-text-primary);
    transform: none;
    border-left: none;
    padding-left: var(--pmm-spacing-md);
}

/* Active states */
.mega-menu-item.active .mega-menu-link {
    background: var(--pmm-surface-lighter);
    color: var(--pmm-brand-color);
    border-left: 3px solid var(--pmm-brand-color);
    padding-left: calc(var(--pmm-spacing-md) - 3px);
}

/* =================================================================
   6. SUBCATEGORIES SPECIFIC STYLING
   ================================================================= */

.mega-menu-subcategories .mega-menu-item {
    margin-bottom: var(--pmm-spacing-sm);
    border-radius: var(--pmm-border-radius-sm);
    transition: var(--pmm-transition);
    border: 1px solid transparent;
}

.mega-menu-subcategories .mega-menu-item:hover {
    background: var(--pmm-surface-lighter);
    border-color: var(--pmm-brand-color);
}

.mega-menu-subcategory-link {
    display: flex;
    align-items: center;
    gap: var(--pmm-spacing-md);
    padding: var(--pmm-spacing-md);
    text-decoration: none;
    color: var(--pmm-text-secondary);
    transition: var(--pmm-transition);
}

.mega-menu-subcategory-link:hover {
    color: var(--pmm-text-primary);
    text-decoration: none;
}

.mega-menu-subcategory-image {
    width: 50px;
    height: 50px;
    border-radius: var(--pmm-border-radius-sm);
    overflow: hidden;
    flex-shrink: 0;
    background: var(--pmm-surface-lighter);
}

.mega-menu-subcategory-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.mega-menu-subcategory-info {
    flex: 1;
}

.mega-menu-subcategory-name {
    font-weight: 500;
    color: var(--pmm-text-primary);
    margin-bottom: var(--pmm-spacing-xs);
    font-size: var(--pmm-font-size-base);
}

.mega-menu-subcategory-count {
    font-size: var(--pmm-font-size-sm);
    color: var(--pmm-text-muted);
}

/* =================================================================
   7. TRENDING PRODUCTS STYLING
   ================================================================= */

.mega-menu-products-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--pmm-spacing-lg);
}

.mega-menu-product {
    background: var(--pmm-surface-lighter);
    border: 1px solid var(--pmm-border);
    border-radius: var(--pmm-border-radius);
    overflow: hidden;
    transition: var(--pmm-transition);
    text-decoration: none;
    color: var(--pmm-text-primary);
    position: relative;
}

.mega-menu-product:hover {
    transform: translateY(-4px);
    box-shadow: var(--pmm-shadow-lg);
    border-color: var(--pmm-brand-color);
    text-decoration: none;
    color: var(--pmm-text-primary);
}

.mega-menu-product-image {
    width: 100%;
    height: 140px;
    overflow: hidden;
    position: relative;
    background: var(--pmm-surface);
}

.mega-menu-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--pmm-transition);
}

.mega-menu-product:hover .mega-menu-product-image img {
    transform: scale(1.05);
}

.mega-menu-product-badge {
    position: absolute;
    top: var(--pmm-spacing-sm);
    right: var(--pmm-spacing-sm);
    background: var(--pmm-brand-color);
    color: white;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.mega-menu-product-info {
    padding: var(--pmm-spacing-md);
}

.mega-menu-product-title {
    font-weight: 600;
    margin-bottom: var(--pmm-spacing-sm);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    color: var(--pmm-text-primary);
    font-size: var(--pmm-font-size-base);
}

.mega-menu-product-price {
    font-weight: 700;
    color: var(--pmm-brand-color);
    margin-bottom: var(--pmm-spacing-sm);
    font-size: var(--pmm-font-size-lg);
}

.mega-menu-product-rating {
    display: flex;
    align-items: center;
    gap: var(--pmm-spacing-xs);
    font-size: var(--pmm-font-size-sm);
    color: var(--pmm-text-muted);
}

.mega-menu-stars {
    display: flex;
    gap: 2px;
}

.mega-menu-star {
    width: 14px;
    height: 14px;
    color: #fbbf24;
}

/* =================================================================
   8. LOADING STATES
   ================================================================= */

.mega-menu-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: var(--pmm-text-muted);
    font-style: italic;
    flex-direction: column;
    gap: var(--pmm-spacing-md);
}

.mega-menu-spinner {
    width: 24px;
    height: 24px;
    border: 3px solid var(--pmm-border);
    border-top: 3px solid var(--pmm-brand-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Close button */
.mega-menu-close {
    position: fixed;
    top: var(--pmm-spacing-xl);
    right: var(--pmm-spacing-xl);
    width: 44px;
    height: 44px;
    background: var(--pmm-surface);
    border: 1px solid var(--pmm-border);
    border-radius: 50%;
    color: var(--pmm-text-primary);
    font-size: 24px;
    cursor: pointer;
    transition: var(--pmm-transition);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: calc(var(--pmm-z-index) + 1);
}

.mega-menu-close:hover {
    background: var(--pmm-brand-color);
    border-color: var(--pmm-brand-color);
    color: white;
}

/* =================================================================
   9. RESPONSIVE DESIGN
   ================================================================= */

/* Tablet Styles */
@media (max-width: 1199px) {
    .mega-menu-container {
        grid-template-columns: 250px 1fr 350px;
        gap: var(--pmm-spacing-xl);
    }
    
    .mega-menu-products-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 991px) {
    .mega-menu-dropdown {
        padding: var(--pmm-spacing-lg);
    }
    
    .mega-menu-container {
        grid-template-columns: 200px 1fr;
        gap: var(--pmm-spacing-lg);
    }
    
    .mega-menu-products {
        display: none;
    }
}

/* Mobile Styles */
@media (max-width: 767px) {
    .mega-menu-dropdown {
        padding: var(--pmm-spacing-md);
    }
    
    .mega-menu-container {
        display: block;
        gap: 0;
        padding-top: var(--pmm-spacing-lg);
    }
    
    .mega-menu-column {
        margin-bottom: var(--pmm-spacing-lg);
        border: 1px solid var(--pmm-border);
    }
    
    .mega-menu-subcategories,
    .mega-menu-products {
        display: none;
    }
    
    .mega-menu-subcategories.active,
    .mega-menu-products.active {
        display: block;
    }
    
    /* Mobile navigation */
    .mega-menu-mobile-back {
        display: flex;
        align-items: center;
        gap: var(--pmm-spacing-sm);
        padding: var(--pmm-spacing-md);
        color: var(--pmm-brand-color);
        cursor: pointer;
        border-bottom: 1px solid var(--pmm-border);
        margin: calc(-1 * var(--pmm-spacing-lg)) calc(-1 * var(--pmm-spacing-lg)) var(--pmm-spacing-lg);
        background: var(--pmm-surface-lighter);
        font-weight: 500;
    }
    
    .mega-menu-mobile-back:hover {
        background: var(--pmm-primary-color);
        color: var(--pmm-text-primary);
    }
}

@media (max-width: 480px) {
    .mega-menu-dropdown {
        padding: var(--pmm-spacing-sm);
    }
    
    .mega-menu-column {
        padding: var(--pmm-spacing-md);
    }
    
    .mega-menu-link {
        padding: var(--pmm-spacing-sm) var(--pmm-spacing-md);
    }
    
    .mega-menu-subcategory-image {
        width: 40px;
        height: 40px;
    }
    
    .mega-menu-close {
        top: var(--pmm-spacing-md);
        right: var(--pmm-spacing-md);
        width: 40px;
        height: 40px;
    }
}

/* =================================================================
   10. DARK MODE SUPPORT
   ================================================================= */

/* Dark mode is default for LootNest theme */
/* Light mode override if needed */
.light-theme {
    --pmm-primary-color: #ffffff;
    --pmm-brand-color: #ff0150;
    --pmm-accent-color: #ff0150;
    --pmm-background: #ffffff;
    --pmm-surface: #f8f9fa;
    --pmm-surface-lighter: #e9ecef;
    --pmm-border: rgba(0, 0, 0, 0.1);
    --pmm-text-primary: #22232a;
    --pmm-text-secondary: rgba(34, 35, 42, 0.8);
    --pmm-text-muted: rgba(34, 35, 42, 0.5);
    --pmm-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    --pmm-shadow-lg: 0 10px 30px rgba(0, 0, 0, 0.15);
}

/* =================================================================
   11. ACCESSIBILITY
   ================================================================= */

.mega-menu-link:focus,
.mega-menu-trigger:focus {
    outline: 2px solid var(--pmm-brand-color);
    outline-offset: 2px;
}

.mega-menu-dropdown {
    role: "menu";
}

.mega-menu-item {
    role: "menuitem";
}

/* Keyboard navigation */
.mega-menu-link:focus {
    background: var(--pmm-surface-lighter);
    color: var(--pmm-brand-color);
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* =================================================================
   12. UTILITY CLASSES
   ================================================================= */

.mega-menu-hidden {
    display: none !important;
}

.mega-menu-loading-state {
    pointer-events: none;
    opacity: 0.6;
}

.mega-menu-error {
    color: var(--pmm-accent-color);
    text-align: center;
    padding: var(--pmm-spacing-lg);
}

.mega-menu-empty {
    color: var(--pmm-text-muted);
    text-align: center;
    padding: var(--pmm-spacing-xxl);
    font-style: italic;
    background: var(--pmm-surface-lighter);
    border-radius: var(--pmm-border-radius);
    border: 1px dashed var(--pmm-border);
}

.mega-menu-error {
    color: var(--pmm-brand-color);
    text-align: center;
    padding: var(--pmm-spacing-xxl);
    background: rgba(255, 1, 80, 0.1);
    border-radius: var(--pmm-border-radius);
    border: 1px solid var(--pmm-brand-color);
}

/* Animation classes for dynamic content */
.mega-menu-fade-in {
    animation: fadeIn 0.4s ease-out;
}

.mega-menu-slide-in {
    animation: slideIn 0.4s ease-out;
}

.mega-menu-scale-in {
    animation: scaleIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from { 
        opacity: 0;
        transform: translateY(30px);
    }
    to { 
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from { 
        opacity: 0;
        transform: scale(0.9);
    }
    to { 
        opacity: 1;
        transform: scale(1);
    }
}

/* Overlay background */
body.mega-menu-open {
    overflow: hidden;
}

body.mega-menu-open::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: calc(var(--pmm-z-index) - 1);
    animation: fadeIn 0.3s ease-out;
}
