/**
 * MegaMenu Frontend Styles — Toska Header edition
 * Restyled to match the header's emerald/gold cinematic identity.
 * Structural rules (layout, positioning, mobile behaviour) preserved
 * from the original plugin; only colours/surfaces/trigger icon changed.
 */

:root {
    --pmm-teal:    #2ec4b6;
    --pmm-teal-l:  #7efff5;
    --pmm-teal-d:  #0d8c7c;
    --pmm-teal-dd: #0d5c4a;
    --pmm-green-m: #0d2818;
    --pmm-gold:    #ffd166;
    --pmm-gold-d:  #b5862a;
    --pmm-text:    #c8f7f2;
    --pmm-dim:     rgba(200,247,242,.55);
}

/* === MegaMenu Frontend Styles === */
.pmm-megamenu {
    background: transparent;
    box-shadow: none;
    position: relative;
    z-index: 2147483000;
    font-family: Tahoma, 'Vazirmatn', sans-serif;
}

.pmm-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    direction: rtl;
}

/* Embedded mode: sits inline inside the Toska header row, no centering box */
.tch-mega-embedded.pmm-megamenu { z-index: 2147483000; }
.tch-mega-embedded .tch-mega-container {
    max-width: none;
    margin: 0;
    padding: 0;
}

/* === Header === */
.pmm-header {
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 12px 0;
    position: relative;
}

.tch-mega-embedded .tch-mega-header {
    padding: 0;
    display: block;
}

.pmm-menu-trigger {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: absolute;
    right: 0;
    top: 12px;
}

.tch-mega-embedded .tch-mega-trigger {
    position: static;
    flex-direction: row;
}

/* --- Trigger button: solid emerald medallion with the label
       overlaid directly on the icon in a contrasting colour --- */
.pmm-menu-toggle {
    background: radial-gradient(circle at 35% 30%, var(--pmm-teal-d), var(--pmm-teal-dd) 70%);
    border: 1.5px solid rgba(255, 209, 102, 0.45);
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: transform .25s cubic-bezier(.4,0,.2,1), box-shadow .25s cubic-bezier(.4,0,.2,1), border-color .2s;
    color: #fff;
    box-shadow: 0 4px 14px rgba(13, 92, 74, 0.5), inset 0 0 0 1px rgba(255,255,255,0.04);
    /* Size will be set via inline style */
}

.pmm-menu-toggle:hover {
    border-color: rgba(255, 209, 102, 0.75);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(13, 92, 74, 0.6), 0 0 0 3px rgba(46, 196, 182, 0.18);
}

.pmm-menu-toggle.active {
    border-color: var(--pmm-gold);
    box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.22), 0 6px 22px rgba(13, 92, 74, 0.65);
}

.tch-mega-ring {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1px solid rgba(255, 209, 102, 0.35);
    opacity: 0;
    transform: scale(.85);
    transition: opacity .25s ease, transform .25s ease;
    pointer-events: none;
}

.pmm-menu-toggle:hover .tch-mega-ring,
.pmm-menu-toggle.active .tch-mega-ring {
    opacity: 1;
    transform: scale(1);
}

/* Icon sits behind, faded — a watermark under the label */
.tch-mega-icon {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1;
    opacity: .3;
    color: #eafffb;
    transition: opacity .25s ease, transform .35s cubic-bezier(.4,0,.2,1);
    pointer-events: none;
}

.pmm-menu-toggle:hover .tch-mega-icon,
.pmm-menu-toggle.active .tch-mega-icon {
    opacity: .18;
}

/* Label overlaid on top of the icon, in a contrasting colour */
.tch-mega-label {
    position: relative;
    z-index: 2;
    font-weight: 800;
    font-size: 12.5px;
    color: var(--pmm-gold);
    text-shadow: 0 1px 3px rgba(0,0,0,.55);
    letter-spacing: .2px;
    pointer-events: none;
}

.pmm-menu-toggle.active .tch-mega-label { color: #fff; }

/* === Menu List Base === */
.pmm-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 4px;
}

.pmm-menu-item {
    position: relative;
}

.pmm-menu-link {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    text-decoration: none;
    color: var(--pmm-text);
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.pmm-menu-link:hover {
    background: rgba(46, 196, 182, 0.14);
    color: var(--pmm-teal-l);
}

.pmm-menu-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.pmm-icon-emoji {
    font-size: 20px;
    line-height: 1;
}

.pmm-icon-image {
    width: 28px;
    height: 28px;
    object-fit: cover;
    border-radius: 6px;
}

.pmm-dropdown-arrow {
    display: flex;
    align-items: center;
    margin-right: 4px;
    transition: transform 0.2s ease;
}

.pmm-menu-item.has-dropdown:hover .pmm-dropdown-arrow {
    transform: rotate(180deg);
}
/* Vertical style expands by click, not hover — the arrow should follow
   the same trigger so it doesn't rotate before the panel actually opens. */
.pmm-style-vertical .pmm-menu-item.has-dropdown:hover .pmm-dropdown-arrow {
    transform: none;
}
.pmm-style-vertical .pmm-menu-item.has-dropdown.mobile-open > .pmm-menu-link .pmm-dropdown-arrow,
.pmm-style-vertical .pmm-submenu-item.has-dropdown.mobile-open > .pmm-menu-link .pmm-dropdown-arrow {
    transform: rotate(180deg);
}

/* === Dropdown Base === */
.pmm-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    list-style: none;
    margin: 8px 0 0 0;
    padding: 8px;
    background: var(--pmm-green-m);
    border: 1.5px solid rgba(46, 196, 182, 0.28);
    border-radius: 12px;
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.55);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    z-index: 2147483200;
}

.pmm-menu-item.has-dropdown:hover > .pmm-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.pmm-submenu-item .pmm-menu-link {
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
}

.pmm-submenu-item .pmm-menu-link:hover {
    background: rgba(46, 196, 182, 0.16);
    color: var(--pmm-teal-l);
    padding-right: 18px;
}

.pmm-submenu-item .pmm-icon-image {
    width: 24px;
    height: 24px;
    border-radius: 5px;
}

/* === Nested Dropdown === */
.pmm-submenu-item.has-dropdown {
    position: relative;
}

.pmm-submenu-item .pmm-dropdown {
    top: 0;
    right: 100%;
    margin: 0 8px 0 0;
}

.pmm-submenu-item.has-dropdown:hover > .pmm-dropdown {
    transform: translateX(0);
}

/* === Active States === */
.pmm-menu-item.active > .pmm-menu-link,
.pmm-submenu-item.active > .pmm-menu-link {
    background: rgba(255, 209, 102, 0.14);
    color: var(--pmm-gold);
}

/* ================================================ */
/* === HORIZONTAL STYLE (Always Open) === */
/* ================================================ */
.pmm-menu-list.pmm-style-horizontal {
    display: flex !important;
    flex-direction: row !important;
    position: static !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    background: transparent !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    min-width: auto !important;
}

.pmm-style-horizontal .pmm-menu-toggle {
    display: none !important;
}

/* ================================================ */
/* === VERTICAL STYLE (Click to Open) === */
/* ================================================ */
.pmm-style-vertical .pmm-menu-toggle {
    display: flex !important;
}

.pmm-menu-list.pmm-style-vertical {
    /* position/top/left/right are intentionally NOT !important — on
       screens wider than 768px, JS measures the trigger button and sets
       these inline as position:fixed with exact pixel coordinates, so
       the panel always lands directly under the button regardless of
       any wrapping flex/RTL context. These are just the pre-JS/fallback
       values. */
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    background: var(--pmm-green-m) !important;
    border: 1.5px solid rgba(46, 196, 182, 0.3) !important;
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.6) !important;
    border-radius: 14px !important;
    padding: 12px !important;
    min-width: 280px !important;
    max-width: min(340px, calc(100vw - 20px)) !important;
    flex-direction: column !important;
    gap: 4px !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translateY(-10px) !important;
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease !important;
    z-index: 2147483300 !important;
}

.pmm-menu-list.pmm-style-vertical.active {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translateY(0) !important;
}

.pmm-style-vertical .pmm-menu-item {
    width: 100%;
}

.pmm-style-vertical .pmm-menu-link {
    width: 100%;
    justify-content: flex-start;
}

/* Nested submenus for the vertical style always expand INLINE
   (accordion, downward) instead of flying out sideways — the flyout
   used to overlap unrelated header content behind it. Same behaviour
   at every screen size now, so there is only one code path to trust. */
.pmm-style-vertical .pmm-dropdown {
    position: static !important;
    right: auto !important;
    top: auto !important;
    margin: 4px 0 4px 0 !important;
    max-height: 0 !important;
    opacity: 1 !important;
    visibility: visible !important;
    transform: none !important;
    overflow: hidden !important;
    border: none !important;
    box-shadow: none !important;
    background: rgba(0,0,0,.15) !important;
    padding: 0 !important;
    min-width: 0 !important;
    transition: max-height 0.3s ease, padding 0.3s ease !important;
}
.pmm-style-vertical .pmm-menu-item.has-dropdown:hover > .pmm-dropdown {
    /* cancel the generic hover-flyout behaviour — vertical style opens
       nested items by click only (see .mobile-open below) */
    max-height: 0 !important;
}
.pmm-style-vertical .pmm-menu-item.has-dropdown.mobile-open > .pmm-dropdown,
.pmm-style-vertical .pmm-submenu-item.has-dropdown.mobile-open > .pmm-dropdown {
    max-height: 600px !important;
    padding: 6px !important;
}

/* === Mobile Styles (Both Horizontal & Vertical) === */
@media (max-width: 768px) {
    .pmm-menu-toggle {
        display: flex !important;
    }

    .pmm-style-horizontal .pmm-menu-toggle,
    .pmm-style-vertical .pmm-menu-toggle {
        display: flex !important;
    }

    .pmm-menu-list,
    .pmm-menu-list.pmm-style-horizontal,
    .pmm-menu-list.pmm-style-vertical {
        position: fixed !important;
        top: 0 !important;
        right: -100% !important;
        width: 280px !important;
        height: 100vh !important;
        height: 100dvh !important;
        background: linear-gradient(160deg,#071410 0%,#0a1f16 25%,#0d2818 55%,#081a10 100%) !important;
        border-left: 1.5px solid rgba(46, 196, 182, 0.25) !important;
        flex-direction: column !important;
        padding: 80px 20px 20px !important;
        gap: 0 !important;
        box-shadow: -6px 0 30px rgba(0, 0, 0, 0.5) !important;
        transition: right 0.3s ease !important;
        overflow-y: auto !important;
        z-index: 2147483600 !important;
        opacity: 1 !important;
        visibility: visible !important;
        transform: none !important;
        border-radius: 0 !important;
        margin: 0 !important;
        min-width: auto !important;
    }
    
    .pmm-menu-list.active,
    .pmm-menu-list.pmm-style-horizontal.active,
    .pmm-menu-list.pmm-style-vertical.active {
        right: 0 !important;
    }
    
    .pmm-menu-item {
        width: 100%;
        border-bottom: 1px solid rgba(46, 196, 182, 0.14);
    }
    
    .pmm-menu-link {
        width: 100%;
        padding: 14px 16px;
        border-radius: 0;
    }
    
    /* Nested-dropdown accordion mechanics now live in the global
       .pmm-style-vertical rules above (same behaviour at every width);
       this block only adds the mobile-only indent + arrow rotation on
       top of that shared mechanism, so there is no specificity fight
       between a mobile-only rule and the global one anymore. */
    .pmm-style-vertical .pmm-dropdown,
    .pmm-dropdown {
        padding-right: 20px !important;
    }

    .pmm-dropdown-arrow {
        margin-right: auto;
        margin-left: 8px;
    }
    
    .pmm-menu-item.mobile-open > .pmm-menu-link .pmm-dropdown-arrow {
        transform: rotate(180deg);
    }
}

/* === Overlay === */
.pmm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 20, 12, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    z-index: 2147482900; /* just below the menu panel/list, but far above
                             any other widget on the page (floating cart,
                             call buttons, etc.) so it dims everything
                             behind the open menu, not just page content. */
}

.pmm-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* === Animations === */
@keyframes pmm-fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.pmm-menu-item.has-dropdown:hover > .pmm-dropdown {
    animation: pmm-fadeIn 0.3s ease;
}

/* === Smooth Scrolling === */
@media (max-width: 768px) {
    .pmm-menu-list {
        -webkit-overflow-scrolling: touch;
        scrollbar-width: thin;
        scrollbar-color: #cbd5e1 transparent;
    }
    
    .pmm-menu-list::-webkit-scrollbar {
        width: 6px;
    }
    
    .pmm-menu-list::-webkit-scrollbar-track {
        background: transparent;
    }
    
    .pmm-menu-list::-webkit-scrollbar-thumb {
        background: #cbd5e1;
        border-radius: 3px;
    }
}

/* === Elementor Compatibility === */
.elementor-widget-shortcode .pmm-megamenu {
    margin: 0;
}

/* === WordPress Admin Bar === */
body.admin-bar .pmm-menu-list {
    top: 32px;
}

@media screen and (max-width: 782px) {
    body.admin-bar .pmm-menu-list {
        top: 46px;
    }
}

/* === RTL Support === */
[dir="ltr"] .pmm-container {
    direction: ltr;
}

[dir="ltr"] .pmm-dropdown {
    right: auto;
    left: 0;
}

[dir="ltr"] .pmm-submenu-item .pmm-dropdown {
    right: auto;
    left: 100%;
    margin: 0 0 0 8px;
}

[dir="ltr"] .pmm-menu-list {
    right: auto;
    left: -100%;
}

[dir="ltr"] .pmm-menu-list.active {
    right: auto;
    left: 0;
}