/* ============================================
   MEGA MENU — Premium Ayurvedic Design
   Organic Urban — Conversion-Focused Navigation
   ============================================
   
   Design tokens reference: core/variables.css
   Typography: Cormorant Garamond (serif) + Inter (sans)
   Palette: Warm off-white, muted olive/sage, soft shadows
   ============================================ */

/* ──────────────────────────────────
   MEGA MENU CONTAINER
   ────────────────────────────────── */
.mega-menu {
    position: absolute;
    top: calc(100% + 4px);
    left: 50%;
    transform: translateX(-50%) translateY(-8px);
    width: 88vw;
    max-width: 1000px;
    background: var(--bg-cream, #FAF8F4);
    border-radius: 16px;
    box-shadow:
        0 20px 60px rgba(30, 25, 19, 0.12),
        0 8px 24px rgba(30, 25, 19, 0.08),
        0 0 0 1px rgba(123, 154, 122, 0.1);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
        visibility 0s linear 0.3s;
    z-index: var(--z-dropdown, 1100);
    overflow: hidden;
}

/* Show on hover/focus */
.nav-item-with-dropdown:hover .mega-menu,
.nav-item-with-dropdown:focus-within .mega-menu,
.mega-menu.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
    transition-delay: 0s;
}

/* Hover intent bridge — desktop only, prevents menu closing when cursor moves between trigger and menu */
@media (min-width: 769px) {
    .nav-item-with-dropdown::after {
        content: '';
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        height: 12px;
    }
}

/* ──────────────────────────────────
   INNER GRID — 4 Columns
   ────────────────────────────────── */
.mega-menu-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0;
    padding: 24px 20px 20px;
}

/* ──────────────────────────────────
   COLUMN
   ────────────────────────────────── */
.mega-col {
    padding: 0 14px;
    border-right: 1px solid rgba(123, 154, 122, 0.1);
}

.mega-col:first-child {
    padding-left: 0;
}

.mega-col:last-child {
    border-right: none;
    padding-right: 0;
}

/* ──────────────────────────────────
   COLUMN TITLE (Skin Care, Hair Care...)
   ────────────────────────────────── */
.mega-col-title {
    display: block;
    font-family: var(--font-serif, 'Cormorant Garamond', Georgia, serif);
    font-size: 1.15rem;
    font-weight: 600;
    color: #4A5D3E;
    letter-spacing: 0.02em;
    text-decoration: none;
    margin-bottom: 14px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(123, 154, 122, 0.2);
    transition: color 0.2s ease;
}

.mega-col-title:hover {
    color: var(--accent-sage, #7A9A7A);
}

/* ──────────────────────────────────
   SECTION (Daily Rituals, Face Masks...)
   ────────────────────────────────── */
.mega-section {
    margin-bottom: 12px;
}

.mega-section-label {
    display: block;
    font-family: var(--font-sans, 'Inter', sans-serif);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-light, #9A938A);
    margin-bottom: 6px;
    padding-left: 2px;
}

/* ──────────────────────────────────
   LINKS
   ────────────────────────────────── */
.mega-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    font-family: var(--font-sans, 'Inter', sans-serif);
    font-size: 0.9rem;
    font-weight: 450;
    color: var(--text-dark, #1E1919);
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease;
    position: relative;
}

.mega-link:hover {
    background: rgba(123, 154, 122, 0.08);
    color: #4A5D3E;
    transform: translateX(2px);
}

/* Subtle hover indicator */
.mega-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) scaleY(0);
    width: 2px;
    height: 60%;
    background: var(--accent-sage, #7A9A7A);
    border-radius: 2px;
    transition: transform 0.2s ease;
}

.mega-link:hover::before {
    transform: translateY(-50%) scaleY(1);
}

/* Sub-note text (Bhringraj · Amla · Shikakai) */
.mega-link-note {
    display: block;
    font-family: var(--font-sans, 'Inter', sans-serif);
    font-size: 0.75rem;
    color: var(--text-light, #9A938A);
    font-style: italic;
    padding: 0 10px 4px;
    line-height: 1.4;
}

/* ──────────────────────────────────
   COMING SOON BADGE
   ────────────────────────────────── */
.mega-link--coming-soon {
    color: var(--text-muted, #736C64);
}

.mega-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #8B7355;
    background: rgba(212, 165, 116, 0.15);
    border: 1px solid rgba(212, 165, 116, 0.3);
    border-radius: 10px;
    margin-left: 6px;
    white-space: nowrap;
}

/* ──────────────────────────────────
   FEATURED PRODUCT CARD
   ────────────────────────────────── */
.mega-featured {
    display: block;
    margin-top: 16px;
    padding: 0;
    border-radius: 10px;
    overflow: hidden;
    text-decoration: none;
    background: var(--bg-soft, #EFE9E1);
    transition: all 0.3s ease;
    position: relative;
}

.mega-featured:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(30, 25, 19, 0.1);
}

.mega-featured img {
    width: 100%;
    height: 100px;
    object-fit: cover;
    display: block;
    transition: transform 0.4s ease;
}

.mega-featured:hover img {
    transform: scale(1.03);
}

.mega-featured-badge {
    position: absolute;
    top: 8px;
    left: 8px;
    padding: 3px 10px;
    font-family: var(--font-sans, 'Inter', sans-serif);
    font-size: 0.6rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--white, #fff);
    background: rgba(74, 93, 62, 0.85);
    border-radius: 6px;
    backdrop-filter: blur(4px);
}

.mega-featured-name {
    display: block;
    padding: 10px 12px;
    font-family: var(--font-serif, 'Cormorant Garamond', Georgia, serif);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-dark, #1E1919);
}

/* ──────────────────────────────────
   SHOP BY CONCERN STRIP
   ────────────────────────────────── */
.mega-concern-strip {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: rgba(123, 154, 122, 0.06);
    border-top: 1px solid rgba(123, 154, 122, 0.1);
}

.mega-concern-label {
    font-family: var(--font-sans, 'Inter', sans-serif);
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted, #736C64);
    white-space: nowrap;
    flex-shrink: 0;
}

.mega-concern-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mega-concern-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 14px;
    font-family: var(--font-sans, 'Inter', sans-serif);
    font-size: 0.78rem;
    font-weight: 450;
    color: #4A5D3E;
    background: rgba(123, 154, 122, 0.1);
    border: 1px solid rgba(123, 154, 122, 0.15);
    border-radius: 20px;
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mega-concern-pill:hover {
    background: rgba(123, 154, 122, 0.2);
    border-color: rgba(123, 154, 122, 0.3);
    color: #3A4D2E;
    transform: translateY(-1px);
}

/* ──────────────────────────────────
   HIDE OLD DROPDOWN WHEN MEGA MENU IS ACTIVE
   ────────────────────────────────── */
.nav-item-with-dropdown .nav-dropdown {
    display: none !important;
}

/* ══════════════════════════════════
   MOBILE MEGA MENU (Accordion)
   ══════════════════════════════════ */
@media (max-width: 768px) {
    .mega-menu {
        position: static;
        transform: none;
        width: 100%;
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
        background: transparent;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        display: none;
    }

    .mega-menu.is-open {
        display: block;
    }

    /* Stack columns vertically */
    .mega-menu-inner {
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: 0;
    }

    /* Each column becomes an accordion section */
    .mega-col {
        padding: 0;
        border-right: none;
        border-bottom: 1px solid rgba(123, 154, 122, 0.1);
    }

    .mega-col:last-child {
        border-bottom: none;
    }

    .mega-col-title {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 14px 16px;
        margin-bottom: 0;
        border-bottom: none;
        font-size: 1.1rem;
        cursor: pointer;
    }

    .mega-col-title::after {
        content: '+';
        font-family: var(--font-sans, 'Inter', sans-serif);
        font-size: 1.2rem;
        font-weight: 300;
        color: var(--text-muted, #736C64);
        transition: transform 0.3s ease;
    }

    .mega-col.is-expanded .mega-col-title::after {
        content: '−';
    }

    /* Sections hidden by default on mobile */
    .mega-section,
    .mega-featured {
        display: none;
        padding-left: 16px;
        padding-right: 16px;
    }

    .mega-col.is-expanded .mega-section,
    .mega-col.is-expanded .mega-featured {
        display: block;
    }

    .mega-col.is-expanded .mega-featured {
        margin-bottom: 16px;
    }

    .mega-link {
        padding: 10px 12px;
        min-height: 44px;
    }

    .mega-link-note {
        padding-left: 12px;
    }

    /* Concern strip: wrap on mobile */
    .mega-concern-strip {
        flex-direction: column;
        align-items: flex-start;
        padding: 16px;
        gap: 10px;
    }

    .mega-concern-links {
        gap: 6px;
    }

    .mega-concern-pill {
        font-size: 0.75rem;
        padding: 6px 12px;
        min-height: 36px;
    }
}

/* ──────────────────────────────────
   TABLET (2-column)
   ────────────────────────────────── */
@media (min-width: 769px) and (max-width: 1024px) {
    .mega-menu {
        width: 98vw;
    }

    .mega-menu-inner {
        grid-template-columns: repeat(2, 1fr);
        gap: 24px 0;
        padding: 24px 20px 20px;
    }

    .mega-col:nth-child(2) {
        border-right: none;
    }

    .mega-col:nth-child(3) {
        border-top: 1px solid rgba(123, 154, 122, 0.1);
        padding-top: 24px;
    }

    .mega-col:nth-child(4) {
        border-top: 1px solid rgba(123, 154, 122, 0.1);
        padding-top: 24px;
    }
}

/* ──────────────────────────────────
   ANIMATION: Staggered column reveal
   ────────────────────────────────── */
@media (min-width: 769px) {
    .mega-col {
        opacity: 0;
        transform: translateY(8px);
        transition: opacity 0.3s ease, transform 0.3s ease;
    }

    .nav-item-with-dropdown:hover .mega-col,
    .mega-menu.is-open .mega-col {
        opacity: 1;
        transform: translateY(0);
    }

    .mega-col:nth-child(1) {
        transition-delay: 0.05s;
    }

    .mega-col:nth-child(2) {
        transition-delay: 0.1s;
    }

    .mega-col:nth-child(3) {
        transition-delay: 0.15s;
    }

    .mega-col:nth-child(4) {
        transition-delay: 0.2s;
    }
}

/* ──────────────────────────────────
   FOCUS / ACCESSIBILITY
   ────────────────────────────────── */
.mega-link:focus-visible,
.mega-col-title:focus-visible,
.mega-concern-pill:focus-visible,
.mega-featured:focus-visible {
    outline: 2px solid var(--accent-sage, #7A9A7A);
    outline-offset: 2px;
    border-radius: 6px;
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {

    .mega-menu,
    .mega-col,
    .mega-link,
    .mega-featured,
    .mega-featured img,
    .mega-concern-pill {
        transition: none !important;
        transform: none !important;
    }
}