/* =========================================
   MEGA MENU CUSTOM STYLES (Clean Isolation)
   ========================================= */

/* DESKTOP STYLES (>= 1200px) */
@media (min-width: 1200px) {

    /* Parent List Item */
    .mega-dropdown {
        position: relative;
    }

    /* The Mega Menu Container */
    .mega-dropdown .mega-menu {
        position: absolute;
        top: 120%;
        left: 50%;
        transform: translateX(-50%) translateY(20px);
        width: 900px;
        background: rgba(255, 255, 255, 0.98);
        backdrop-filter: blur(25px);
        -webkit-backdrop-filter: blur(25px);
        border: 1px solid rgba(0, 0, 0, 0.08);
        border-radius: 20px;
        box-shadow: 0 30px 60px rgba(0, 0, 0, 0.15);
        padding: 30px;

        /* Hidden by default */
        opacity: 0;
        visibility: hidden;
        z-index: 99999;
        transition: all 0.3s ease;
        display: block;
        /* Ensures it's rendered for transition */
        pointer-events: none;
        /* Prevents accidental clicks when hidden */
    }

    /* HOVER STATE - REVEAL */
    .mega-dropdown:hover .mega-menu {
        opacity: 1;
        visibility: visible;
        pointer-events: all;
        top: 100%;
        /* Slide up */
        transform: translateX(-50%) translateY(0);
    }

    /* Grid Layout */
    .mega-menu-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 40px;
    }

    /* Styles for content */
    .mega-column ul {
        display: block !important;
        list-style: none;
        padding: 0;
        margin: 0;
    }

    .mega-column h3 {
        font-size: 0.85rem;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 1px;
        color: #0A6A6E;
        border-bottom: 2px solid rgba(10, 106, 110, 0.1);
        padding-bottom: 10px;
        margin-bottom: 15px;
        display: flex;
        align-items: center;
        gap: 8px;
    }

    .mega-link {
        display: flex;
        align-items: center;
        gap: 15px;
        text-decoration: none;
        padding: 10px;
        border-radius: 12px;
        transition: 0.2s;
    }

    .mega-link:hover {
        background: rgba(10, 106, 110, 0.05);
    }

    .mega-icon {
        width: 40px;
        height: 40px;
        background: #f8fafc;
        border-radius: 8px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.2rem;
        color: #64748b;
    }

    .mega-link:hover .mega-icon {
        background: #0A6A6E;
        color: #fff;
    }

    .mega-text strong {
        display: block;
        color: #1e293b;
        font-size: 0.95rem;
    }

    .mega-text span {
        display: block;
        color: #64748b;
        font-size: 0.75rem;
    }
}

/* MOBILE STYLES (< 1200px) */
@media (max-width: 1199px) {
    .mega-dropdown .mega-menu {
        display: none;
        /* Completely hidden */
        background: #fff;
        margin: 10px 0;
        padding-left: 15px;
        border-left: 2px solid rgba(13, 131, 135, 0.3);
    }

    /* Active state for .mega-dropdown (toggled by the link click in main.js) */
    .mega-dropdown.active .mega-menu {
        display: block;
    }

    .mega-menu-grid {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }

    /* Column Headers (Clickable) */
    .mega-column h3 {
        font-size: 14px;
        color: #0A6A6E;
        text-transform: uppercase;
        margin: 0;
        padding: 12px 0;
        cursor: pointer;
        display: flex;
        justify-content: space-between;
        align-items: center;
        border-bottom: 1px solid #f1f5f9;
    }

    /* Chevron Icon */
    .mega-column h3::after {
        content: '\F282';
        /* bootstrap icon chevron-down */
        font-family: 'bootstrap-icons';
        font-size: 12px;
        transition: transform 0.3s;
        transform: rotate(0deg);
    }

    /* Rotate chevron when column is active */
    .mega-column.active h3::after {
        transform: rotate(180deg);
    }

    /* Hide list by default on mobile */
    .mega-column ul {
        display: none;
        /* Hidden by default */
        padding-left: 10px;
        border-left: 1px solid #f1f5f9;
        margin-bottom: 15px;
        margin-top: 10px;
    }

    /* Show list when column is active */
    .mega-column.active ul {
        display: block;
        animation: fadeIn 0.3s ease;
    }

    @keyframes fadeIn {
        from {
            opacity: 0;
            transform: translateY(-5px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .mega-link {
        padding: 10px 0;
        display: block;
        color: #334155;
        font-weight: 500;
        border-bottom: 1px solid #f8fafc;
    }

    .mega-link:last-child {
        border-bottom: none;
    }

    .mega-icon,
    .mega-text span {
        display: none;
        /* Simplified mobile view */
    }
}