/* ============================================================
   Saanvi Mega Menu — mega-menu.css
   Compatible with: WooCommerce + Astra Theme
   ============================================================ */

/* ── CSS Variables (overridden by inline dynamic CSS) ── */
:root {
    --smm-accent:      #6b3a2a;
    --smm-bg:          #ffffff;
    --smm-text:        #333333;
    --smm-border:      #f0ece8;
    --smm-shadow:      0 8px 40px rgba(0,0,0,0.12);
    --smm-radius:      12px;
    --smm-img-size:    160px;
    --smm-transition:  0.22s ease;
    --smm-font-head:   inherit;
    --smm-font-body:   inherit;
}

/* ── Wrapper li ── */
li.smm-menu-item {
    position: static !important; /* allow full-width panel */
    display: inline-flex !important;
    align-items: center !important;
    vertical-align: middle !important;
    align-self: center !important;
}

/* ── Trigger link ── */
a.smm-trigger {
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px;
    cursor: pointer;
    line-height: inherit !important;
    padding: 0 !important;
    margin: 0 !important;
    vertical-align: middle !important;
}

.smm-arrow {
    font-size: 0.55em;
    transition: transform var(--smm-transition);
    display: inline-block;
}

li.smm-menu-item:hover .smm-arrow,
li.smm-menu-item.smm-open .smm-arrow {
    transform: rotate(180deg);
}

/* ── Mega Panel ── */
.smm-mega-panel {
    display: none;
    position: fixed;          /* full-width across viewport */
    left: 0;
    right: 0;
    top: auto;                /* JS will set this */
    z-index: 99999;
    background: var(--smm-bg);
    border-top: 3px solid var(--smm-accent);
    box-shadow: var(--smm-shadow);
    padding: 32px 0 36px;
    animation: smm-slide-in var(--smm-transition) both;
}

@keyframes smm-slide-in {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

li.smm-menu-item:hover .smm-mega-panel,
li.smm-menu-item.smm-open .smm-mega-panel {
    display: block;
}

/* ── Inner grid ── */
.smm-mega-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    flex-wrap: wrap;
    gap: 28px 20px;
    justify-content: flex-start;
}

/* ── Single column ── */
.smm-column {
    flex: 0 0 calc(25% - 16px);
    min-width: 160px;
    max-width: 220px;
    text-align: center;
}

/* ── Category image ── */
.smm-cat-image-wrap {
    display: block;
    width: var(--smm-img-size);
    height: var(--smm-img-size);
    margin: 0 auto 12px;
    border-radius: var(--smm-radius);
    overflow: hidden;
    background: var(--smm-border);
    transition: box-shadow var(--smm-transition), transform var(--smm-transition);
}

.smm-cat-image-wrap:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.18);
    transform: translateY(-3px);
}

.smm-cat-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--smm-transition);
}

.smm-cat-image-wrap:hover .smm-cat-image {
    transform: scale(1.06);
}

/* ── Category heading ── */
.smm-cat-name {
    font-family: var(--smm-font-head);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    margin: 0 0 10px;
    color: var(--smm-text);
}

.smm-cat-name a {
    color: inherit;
    text-decoration: none;
    transition: color var(--smm-transition);
}

.smm-cat-name a:hover {
    color: var(--smm-accent);
}

/* ── Sub-category list ── */
.smm-sub-list {
    list-style: none;
    margin: 0;
    padding: 0;
    text-align: left;
}

.smm-sub-list li {
    padding: 2px 0;
    margin: 0;
}

.smm-sub-list li a {
    font-family: var(--smm-font-body);
    font-size: 0.82rem;
    color: var(--smm-sub-color, #666);
    text-decoration: none;
    transition: color var(--smm-transition), padding-left var(--smm-transition);
    display: inline-block;
}

.smm-sub-list li a:hover {
    color: var(--smm-accent);
    padding-left: 4px;
}

/* ── Divider between columns ── */
.smm-column + .smm-column {
    border-left: 1px solid var(--smm-border);
    padding-left: 20px;
}

/* ════════════════════════════════════════════
   RESPONSIVE
════════════════════════════════════════════ */

/* 3 columns on medium screens */
@media (max-width: 1100px) {
    .smm-column {
        flex: 0 0 calc(33.33% - 14px);
    }
}

/* 2 columns on tablet */
@media (max-width: 768px) {
    .smm-mega-panel {
        position: fixed;
        left: 0;
        right: 0;
        max-height: 80vh;
        overflow-y: auto;
        padding: 20px 0;
    }

    .smm-column {
        flex: 0 0 calc(50% - 10px);
        max-width: 100%;
    }

    .smm-column + .smm-column {
        border-left: none;
        padding-left: 0;
    }

    .smm-mega-inner {
        gap: 20px 12px;
    }

    --smm-img-size: 120px;
}

/* 1 column on mobile */
@media (max-width: 480px) {
    .smm-column {
        flex: 0 0 100%;
    }

    .smm-cat-image-wrap {
        width: 80px;
        height: 80px;
    }

    .smm-column {
        text-align: left;
        display: flex;
        align-items: flex-start;
        gap: 12px;
    }

    .smm-cat-image-wrap {
        flex-shrink: 0;
    }
}

/* ════════════════════════════════════════════
   ASTRA-SPECIFIC OVERRIDES
   Astra adds its own dropdown styles — reset them
════════════════════════════════════════════ */
.ast-header-break-point li.smm-menu-item .smm-mega-panel,
li.smm-menu-item > ul.sub-menu {
    /* hide Astra's auto-generated sub-menu if it appears */
    display: none !important;
}

/* Make sure our panel wins on z-index vs. sticky header */
.ast-header-sticky-wrap,
#masthead {
    z-index: 9999;
}

.smm-mega-panel {
    z-index: 99999;
}

/* Astra sometimes clips overflow on nav wrapper */
.main-navigation,
.ast-primary-header-bar,
#ast-hfb-header,
.site-header {
    overflow: visible !important;
}

/* Remove Astra default dropdown arrow on our item */
li.smm-menu-item > a > .dropdown-menu-toggle {
    display: none;
}
