/* ==========================================================================
   Mega Menu — AtrAroma
   ========================================================================== */

/* Reset */
.mm-nav,
.mm-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

/* Nav bar */
.mm-nav {
    display: flex;
    align-items: stretch;
    position: relative;
}

.mm-nav > li {
    position: relative;
}

/* Top-level links */
.mm-link {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 14px 20px;
    color: #fff;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    white-space: nowrap;
    transition: color 0.2s ease;
}

.mm-link:hover {
    color: rgba(255, 255, 255, 0.8);
}

/* Mega panel — hidden by default */
.mm-panel {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: #fff;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-6px);
    transition: opacity 0.3s ease, visibility 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}

/* Show on hover (desktop) */
@media (hover: hover) and (min-width: 1024px) {
    .mm-has-panel:hover > .mm-panel {
        visibility: visible;
        opacity: 1;
        transform: translateY(0);
        pointer-events: auto;
    }
}

/* Show when toggled (JS .is-active) */
.mm-has-panel.is-active > .mm-panel {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* Active link highlight */
.mm-has-panel.is-active > .mm-link {
    color: rgba(255, 255, 255, 0.85);
}

/* Panel heading */
.mm-heading {
    font-size: 0.8rem;
    font-weight: 700;
    color: #2c3e50;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #e74c3c;
}

/* Term grid — CSS Grid, responsive */
.mm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 14px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 32px 40px;
}

/* Term card */
.mm-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 12px;
    background: #f8f9fa;
    border-radius: 10px;
    text-decoration: none;
    color: #333;
    transition: background 0.2s ease, box-shadow 0.2s ease;
}

.mm-card:hover {
    background: #fff;
    box-shadow: 0 4px 18px rgba(0, 0, 0, 0.08);
}

.mm-card:focus {
    outline: none;
}

.mm-card__img {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease;
}

.mm-card:hover .mm-card__img {
    transform: scale(1.06);
}

.mm-card__name {
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
    line-height: 1.3;
}

.mm-card__count {
    font-size: 0.72rem;
    font-weight: 600;
    color: #999;
    background: #e8e8e8;
    padding: 2px 10px;
    border-radius: 50px;
}

/* Spinner */
.mm-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: #999;
    font-size: 0.85rem;
}

.mm-spinner::after {
    content: "";
    width: 18px;
    height: 18px;
    margin-right: 10px;
    border: 2px solid #ddd;
    border-top-color: #e74c3c;
    border-radius: 50%;
    animation: mm-spin 0.6s linear infinite;
}

@keyframes mm-spin {
    to { transform: rotate(360deg); }
}

.mm-empty {
    padding: 30px;
    text-align: center;
    color: #999;
}

/* Keyboard-only focus (no mouse outline) */
.mm-card:focus-visible,
.mm-link:focus-visible {
    outline: 2px solid #e74c3c;
    outline-offset: 2px;
}

/* Hamburger toggle (hidden on desktop) */
.mm-toggle {
    display: none;
    background: none;
    border: none;
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    padding: 10px;
    line-height: 1;
}

/* Overlay */
.mm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.mm-overlay.is-visible {
    display: block;
    opacity: 1;
}

/* ==========================================================================
   Mobile (< 1024px)
   ========================================================================== */

@media (max-width: 1023px) {

    .mm-toggle {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 0.9rem;
    }

    /* Off-canvas drawer */
    .mm-menu {
        position: fixed;
        top: 0;
        right: -100%;
        bottom: 0;
        width: 85%;
        max-width: 360px;
        flex-direction: column;
        align-items: stretch;
        background: #2c3e50;
        z-index: 999;
        padding: 20px 0;
        overflow-y: auto;
        transition: right 0.3s ease;
    }

    .mm-menu.is-open {
        right: 0;
    }

    .mm-link {
        padding: 14px 24px;
        font-size: 1rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    }

    /* Accordion panel */
    .mm-panel {
        position: static;
        box-shadow: none;
        border-radius: 0;
        transform: none;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        transition: max-height 0.35s ease, opacity 0.3s ease;
        background: rgba(0, 0, 0, 0.1);
        visibility: visible;
    }

    .mm-has-panel.is-active > .mm-panel {
        max-height: 4000px;
        opacity: 1;
    }

    .mm-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        padding: 16px 20px;
    }

    .mm-heading {
        color: #fff;
        border-bottom-color: rgba(255, 255, 255, 0.2);
        margin: 0 0 12px;
        padding: 16px 24px 8px;
    }

    .mm-card {
        background: rgba(255, 255, 255, 0.07);
        color: #fff;
        padding: 12px 8px;
    }

    .mm-card:hover {
        background: rgba(255, 255, 255, 0.12);
        box-shadow: none;
    }

    .mm-card__img {
        width: 48px;
        height: 48px;
    }

    .mm-card__count {
        background: rgba(255, 255, 255, 0.12);
        color: rgba(255, 255, 255, 0.6);
    }
}
