/* =========================================================================
   AstroKrishiv storefront — "Shop" mega-menu + "Pujas" dropdown
   Desktop (>= 1200px, navbar-expand-xl): hover / focus opens a full-width
   panel under the navbar: left column = groups, right = items.
   Mobile (< 1200px): everything renders inline inside the collapsed navbar
   as a tap-to-expand accordion (no hover, no absolute positioning).
   Palette follows docs/03: Cosmic Deep Purple / Sacred Gold.
   ========================================================================= */

:root {
    --ak-mega-bg: #1e0a2f;
    --ak-mega-bg-2: #2c003e;
    --ak-mega-border: rgba(212, 175, 55, 0.25);
    --ak-mega-gold: #d4af37;
    --ak-mega-gold-2: #ffc107;
    --ak-mega-text: rgba(255, 255, 255, 0.92);
    --ak-mega-muted: rgba(255, 255, 255, 0.65);
    --ak-mega-hover: rgba(212, 175, 55, 0.12);
}

/* ---- Shared (all widths) ------------------------------------------------ */
.ak-caret {
    font-size: 0.6em;
    margin-left: 4px;
    vertical-align: middle;
    transition: transform 0.2s ease;
}

.ak-mega-groups,
.ak-mega-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ak-mega-group-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: var(--ak-mega-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    padding: 10px 14px;
    border-radius: 8px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ak-mega-group-link:hover,
.ak-mega-group.is-active > .ak-mega-group-link,
.ak-mega-group.is-open > .ak-mega-group-link {
    color: var(--ak-mega-gold-2);
    background: var(--ak-mega-hover);
}

.ak-mega-group-chevron {
    font-size: 0.65em;
    opacity: 0.8;
    transition: transform 0.2s ease;
}

.ak-mega-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ak-mega-text);
    text-decoration: none;
    font-size: 0.9rem;
    padding: 6px 8px;
    border-radius: 8px;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.ak-mega-item:hover,
.ak-mega-item:focus-visible {
    color: var(--ak-mega-gold-2);
    background: var(--ak-mega-hover);
    outline: none;
}

.ak-mega-thumb {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 0 1px var(--ak-mega-border), 0 2px 6px rgba(0, 0, 0, 0.35);
}

.ak-mega-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ak-mega-thumb .fa {
    color: var(--ak-mega-gold);
    font-size: 1rem;
}

.ak-mega-glyph {
    color: var(--ak-mega-gold-2);
    font-size: 1.35rem;
    line-height: 1;
    font-family: "Segoe UI Symbol", "Noto Sans Symbols", "Apple Symbols", sans-serif;
}

.ak-mega-item-label {
    line-height: 1.25;
}

.ak-mega-viewall {
    display: inline-block;
    margin-top: 10px;
    color: var(--ak-mega-gold);
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
}

.ak-mega-viewall:hover {
    color: var(--ak-mega-gold-2);
    text-decoration: underline;
}

.ak-mega-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 10px 20px;
    border-top: 1px solid var(--ak-mega-border);
    padding-top: 12px;
    margin-top: 12px;
}

.ak-mega-footer-link {
    color: var(--ak-mega-text);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
}

.ak-mega-footer-link:hover {
    color: var(--ak-mega-gold-2);
}

.ak-mega-footer-cta {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 12px;
    text-decoration: none;
    color: var(--ak-mega-muted);
    font-size: 0.82rem;
}

.ak-mega-footer-cta-label {
    color: var(--ak-mega-bg);
    background: linear-gradient(135deg, var(--ak-mega-gold-2), var(--ak-mega-gold));
    padding: 6px 12px;
    border-radius: 999px;
    font-weight: 700;
    white-space: nowrap;
}

.ak-mega-footer-cta:hover .ak-mega-footer-cta-label {
    filter: brightness(1.08);
}

/* Pujas dropdown, dark to match the navbar */
.ak-hover-dropdown > .nav-link:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
}

.ak-dropdown {
    background: var(--ak-mega-bg-2);
    border: 1px solid var(--ak-mega-border);
    min-width: 230px;
}

.ak-dropdown .dropdown-item {
    color: var(--ak-mega-text);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 9px 16px;
}

.ak-dropdown .dropdown-item:hover,
.ak-dropdown .dropdown-item:focus,
.ak-dropdown .dropdown-item.active {
    color: var(--ak-mega-gold-2);
    background: var(--ak-mega-hover);
}

/* ---- Desktop: hover mega-panel ----------------------------------------- */
@media (min-width: 1200px) {
    .navbar > .container {
        position: relative;
    }

    .ak-mega-panel {
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        z-index: 1040;
        /* transparent bridge so the pointer can travel from the link to the panel */
        padding-top: 0.8rem;
        display: none;
    }

    .ak-mega:hover .ak-mega-panel,
    .ak-mega:focus-within .ak-mega-panel,
    .ak-mega.is-open .ak-mega-panel {
        display: block;
    }

    /* Invisible bridge below the "Shop" / "Pujas" links: the pointer must cross
       the navbar's bottom padding to reach the panel, and this keeps the <li>
       hovered while it does. */
    .ak-mega .ak-mega-toggle,
    .ak-hover-dropdown {
        position: relative;
    }

    /* On the Pujas item the bridge lives on the <li> so it can never collide
       with pseudo-elements on the link itself. */
    .ak-mega:hover .ak-mega-toggle::after,
    .ak-mega.is-open .ak-mega-toggle::after,
    .ak-hover-dropdown:hover::before,
    .ak-hover-dropdown.show::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: 100%;
        height: 1.6rem;
    }

    .ak-mega:hover .ak-caret,
    .ak-hover-dropdown:hover .ak-caret,
    .ak-hover-dropdown.show .ak-caret,
    .ak-mega:focus-within .ak-caret,
    .ak-mega.is-open .ak-caret {
        transform: rotate(180deg);
    }

    .ak-mega-inner {
        position: relative;
        background: linear-gradient(160deg, var(--ak-mega-bg-2) 0%, var(--ak-mega-bg) 100%);
        border: 1px solid var(--ak-mega-border);
        border-radius: 0 0 14px 14px;
        box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
        padding: 16px 18px 14px;
        min-height: 360px;
    }

    .ak-mega-groups {
        width: 230px;
        padding-right: 14px;
        border-right: 1px solid var(--ak-mega-border);
        min-height: 300px;
    }

    .ak-mega-group-link {
        margin-bottom: 4px;
    }

    .ak-mega-group.is-active .ak-mega-group-chevron {
        transform: translateX(3px);
    }

    .ak-mega-pane {
        display: none;
        position: absolute;
        top: 16px;
        left: 262px;
        right: 18px;
        bottom: 66px;
        overflow-y: auto;
        padding: 4px 2px 4px 4px;
    }

    .ak-mega-group.is-active .ak-mega-pane {
        display: block;
    }

    .ak-mega-items {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: 4px 20px;
        align-content: start;
    }

    .ak-mega-footer {
        position: relative;
        margin-top: 0;
        padding-top: 12px;
    }

    /* Pull the footer to the bottom of the panel regardless of pane height */
    .ak-mega-inner {
        display: flex;
        flex-direction: column;
    }

    .ak-mega-groups {
        flex: 1 0 auto;
    }
}

@media (min-width: 1400px) {
    .ak-mega-items {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* ---- Mobile / tablet: inline accordion -------------------------------- */
@media (max-width: 1199.98px) {
    .ak-mega-panel {
        display: none;
        margin: 4px 0 8px;
        border-left: 2px solid var(--ak-mega-border);
        padding-left: 8px;
    }

    .ak-mega.is-open .ak-mega-panel {
        display: block;
    }

    .ak-mega.is-open .ak-caret {
        transform: rotate(180deg);
    }

    .ak-mega-group-link {
        padding: 10px 8px;
        font-size: 0.85rem;
        text-transform: uppercase;
        letter-spacing: 0.3px;
    }

    .ak-mega-group.is-open .ak-mega-group-chevron {
        transform: rotate(90deg);
    }

    .ak-mega-pane {
        display: none;
        padding: 4px 0 8px 8px;
    }

    .ak-mega-group.is-open .ak-mega-pane {
        display: block;
    }

    .ak-mega-items {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2px 10px;
    }

    .ak-mega-item {
        font-size: 0.85rem;
        padding: 6px 4px;
    }

    .ak-mega-thumb {
        flex-basis: 34px;
        width: 34px;
        height: 34px;
    }

    .ak-mega-footer {
        flex-direction: column;
        align-items: flex-start;
        padding: 12px 8px 4px;
    }

    .ak-dropdown {
        border: none;
        background: rgba(255, 255, 255, 0.04);
        margin-left: 8px;
    }
}

@media (max-width: 575.98px) {
    .ak-mega-items {
        gap: 0 6px;
    }

    .ak-mega-item {
        font-size: 0.8rem;
        padding: 5px 2px;
        gap: 7px;
    }

    .ak-mega-thumb {
        flex-basis: 30px;
        width: 30px;
        height: 30px;
    }
}

@media (max-width: 359.98px) {
    .ak-mega-items {
        grid-template-columns: 1fr;
    }
}
