/**
 * Mega Menu CSS Fixes
 * Ensures mega menu works properly in responsive developer mode
 * and across all devices
 */

/* ============================================
   BASE MEGA MENU STYLES
   ============================================ */

.ga-mega-menu-container {
    position: relative;
    z-index: 9999 !important;
}

.ga-mega-menu {
    position: fixed !important;
    left: 0;
    right: 0;
    background: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    z-index: 9998 !important;
    max-height: 80vh;
    overflow-y: auto;
    transform: translateY(-10px);
}

/* Active/visible state */
.ga-mega-menu.active {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

/* Inner container */
.ga-mega-menu-inner {
    position: relative;
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px;
}

/* Close button */
.ga-mega-menu-close {
    position: absolute;
    top: 20px;
    right: 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 10px;
    z-index: 10;
    transition: all 0.3s ease;
}

.ga-mega-menu-close:hover {
    transform: rotate(90deg);
    opacity: 0.7;
}

/* ============================================
   MENU TRIGGER STYLING
   ============================================ */

/* Make menu items clickable in responsive mode */
.ga-secondary-menu li {
    position: relative;
    cursor: pointer;
}

/* Visual indicator for dropdown items */
.ga-secondary-menu li:has(.ga-mega-menu-trigger)::after,
.ga-secondary-menu li a[href="#"]::after,
.ga-secondary-menu li a[href*="bulls"]::after,
.ga-secondary-menu li a[href*="services"]::after,
.ga-secondary-menu li a[href*="shop"]::after,
.ga-secondary-menu li a[href*="special"]::after {
    content: "▼";
    font-size: 10px;
    margin-left: 5px;
    display: inline-block;
    transition: transform 0.3s ease;
}

/* Rotate arrow when menu is open */
.ga-secondary-menu li.menu-open::after {
    transform: rotate(180deg);
}

/* ============================================
   RESPONSIVE ADJUSTMENTS
   ============================================ */

/* Tablet and mobile (up to 1024px) */
@media (max-width: 1024px) {
    .ga-mega-menu {
        position: absolute !important;
        top: 100% !important;
        width: 100%;
        max-height: 70vh;
    }
    
    .ga-mega-menu-inner {
        padding: 20px;
    }
    
    /* Stack menu columns on smaller screens */
    .ga-mega-menu-content {
        grid-template-columns: 1fr !important;
        gap: 20px;
    }
    
    /* Make touch targets larger */
    .ga-secondary-menu li a {
        padding: 12px 15px;
        display: block;
    }
    
    /* Prevent accidental link navigation on touch */
    .ga-secondary-menu li a[href="#"] {
        pointer-events: none;
    }
    
    .ga-secondary-menu li {
        pointer-events: auto;
    }
}

/* Mobile (up to 768px) */
@media (max-width: 768px) {
    .ga-mega-menu {
        position: fixed !important;
        top: 0 !important;
        bottom: 0;
        left: 0;
        right: 0;
        max-height: 100vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .ga-mega-menu-inner {
        padding: 60px 15px 30px;
        min-height: 100vh;
    }
    
    .ga-mega-menu-close {
        position: fixed;
        top: 15px;
        right: 15px;
        background: #fff;
        border: 1px solid #ddd;
        border-radius: 50%;
        width: 40px;
        height: 40px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Full width menu items on mobile */
    .ga-mega-menu-list {
        padding: 0;
    }
    
    .ga-mega-menu-list li {
        border-bottom: 1px solid #eee;
    }
    
    .ga-mega-menu-list a {
        display: block;
        padding: 15px 10px;
        color: #333;
        text-decoration: none;
    }
    
    .ga-mega-menu-list a:hover {
        background: #f5f5f5;
    }
}

/* ============================================
   SERVICES MEGA MENU SPECIFIC
   ============================================ */

.ga-services-menu-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px 0;
}

.ga-service-card {
    border: 1px solid #eee;
    border-radius: 8px;
    overflow: hidden;
    transition: all 0.3s ease;
}

.ga-service-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* ============================================
   SHOP MEGA MENU SPECIFIC
   ============================================ */

.ga-shop-menu-content {
    display: flex;
    gap: 40px;
    flex-wrap: wrap;
    justify-content: center;
}

.ga-shop-section {
    flex: 1;
    min-width: 250px;
}

.ga-shop-section-centered {
    max-width: 1000px;
    margin: 0 auto;
}

.ga-shop-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-top: 15px;
}

.ga-shop-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
    margin-top: 15px;
}

.ga-shop-header {
    text-align: center;
    margin-bottom: 20px;
}

.ga-shop-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.ga-shop-list li {
    margin-bottom: 10px;
}

.ga-shop-subheading a {
    font-weight: 500;
    color: #003c71;
    text-decoration: none;
    transition: color 0.3s ease;
}

.ga-shop-subheading a:hover {
    color: #0d2847;
    text-decoration: underline;
}

@media (max-width: 1024px) {
    .ga-shop-grid-4 {
        grid-template-columns: repeat(2, 1fr);
        gap: 20px;
    }
}

@media (max-width: 768px) {
    .ga-shop-columns {
        grid-template-columns: 1fr;
    }

    .ga-shop-grid-4 {
        grid-template-columns: 1fr;
        gap: 15px;
    }
}

/* ============================================
   SPECIALS MEGA MENU SPECIFIC
   ============================================ */

.ga-specials-menu-content {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

.ga-catalogue-card {
    text-align: center;
    transition: all 0.3s ease;
}

.ga-catalogue-card:hover {
    transform: translateY(-5px);
}

.ga-catalogue-image img {
    width: 100%;
    height: auto;
    border-radius: 4px;
}

/* ============================================
   DEVELOPER TOOLS SPECIFIC FIXES
   ============================================ */

/* When in responsive mode, ensure proper display */
@media screen and (max-width: 99999px) {
    .ga-mega-menu {
        will-change: transform, opacity;
    }
    
    /* Force GPU acceleration for smoother animations */
    .ga-mega-menu.active {
        transform: translateZ(0) translateY(0);
    }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */

/* Focus styles */
.ga-mega-menu a:focus,
.ga-mega-menu button:focus,
.ga-secondary-menu li:focus-within {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Screen reader only text */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ============================================
   ANIMATION ENHANCEMENTS
   ============================================ */

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateY(0);
    }
    to {
        opacity: 0;
        transform: translateY(-20px);
    }
}

.ga-mega-menu.active {
    animation: slideDown 0.3s ease forwards;
}

.ga-mega-menu:not(.active) {
    animation: slideUp 0.3s ease forwards;
}

/* ============================================
   Z-INDEX MANAGEMENT
   ============================================ */

/* Ensure proper stacking order */
.ga-header {
    position: relative;
    z-index: 1000;
}

.ga-secondary-nav-container {
    position: relative;
    z-index: 201;
}

.ga-mega-menu-container {
    position: relative;
    z-index: 9999;
}

.ga-mega-menu {
    z-index: 9998;
}

/* Overlay for mobile */
@media (max-width: 768px) {
    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: 9997;
    }
}