/**
 * Mega Menu Widget Styles - Body Portal Pattern
 * All classes prefixed with smm- to avoid conflicts
 */

/* Reset */
.smm-nav *, .smm-mobile * { 
    box-sizing: border-box; 
    margin: 0; 
    padding: 0; 
}

/* Desktop nav visible, mobile hidden */
.smm-nav { 
    display: flex; 
    justify-content: flex-start; /* Default left alignment */
}

.smm-mobile { 
    display: none; 
}

/* Nav list */
.smm-list { 
    display: flex; 
    align-items: center; 
    list-style: none; 
    flex-wrap: nowrap; 
}

.smm-item::before { 
    display: none !important; 
}

/* Nav link */
.smm-link {
    display: inline-flex; 
    align-items: center; 
    gap: 5px;
    padding: 6px 0; 
    text-decoration: none; 
    white-space: nowrap;
    background: none; 
    border: none; 
    cursor: pointer;
    font-size: 15px; 
    font-weight: 500; 
    color: #4b5563;
    transition: color 0.2s;
}

.smm-link:hover,
.smm-item.smm-open > .smm-link { 
    color: #111827; 
}

/* Chevron */
.smm-chev { 
    transition: transform 0.25s; 
    flex-shrink: 0; 
}

.smm-item.smm-open > .smm-link .smm-chev { 
    transform: rotate(180deg); 
}

/* Portal dropdown — lives on body, position:fixed set by JS (frontend only) */
.smm-dd {
    position: fixed;
    z-index: 999999;
    width: var(--smm-w, 380px);
    max-width: 90vw;
    padding: var(--smm-pad, 8px);
    background: var(--smm-bg, #ffffff);
    border-radius: var(--smm-radius, 16px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.14);
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.smm-dd.smm-show {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/*
 * EDITOR inline dropdown (.smm-dd-inline)
 * Rendered in normal flow, stacks below its nav item.
 * Always visible (.smm-show applied in PHP) so style changes
 * preview live without any hover interaction.
 * All CSS vars from {{WRAPPER}} apply here directly.
 */
.smm-dd.smm-dd-inline,
.smm-dd.smm-dd-inline.smm-show {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: var(--smm-w, 380px) !important;
    max-width: 100% !important;
    padding: var(--smm-pad, 8px) !important;
    background: var(--smm-bg, #ffffff) !important;
    border-radius: var(--smm-radius, 16px) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    z-index: 10 !important;
    margin-top: 8px;
    display: block !important;
    box-shadow: 0 8px 32px rgba(0,0,0,0.14) !important;
}

/* smm-editor: let list wrap so dropdowns stack below their trigger */
.smm-editor .smm-list {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0 !important;
}

.smm-editor .smm-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    padding-bottom: 16px;
}

/* Dropdown row */
.smm-row {
    display: flex; 
    align-items: center; 
    gap: 14px;
    padding: 11px 13px; 
    border-radius: 12px;
    text-decoration: none; 
    color: inherit;
    transition: background 0.15s;
}

.smm-row:hover { 
    background: var(--smm-hover, rgba(0,0,0,0.04)); 
}

/* Icon box */
.smm-icon-box {
    width: 42px; 
    height: 42px; 
    border-radius: 10px;
    background: var(--smm-icon-bg, #f3f4f6);
    display: flex; 
    align-items: center; 
    justify-content: center;
    flex-shrink: 0; 
    font-size: 18px;
    transition: transform 0.15s, background 0.15s;
}

.smm-row:hover .smm-icon-box { 
    transform: scale(1.06); 
}

/* Text */
.smm-text { 
    flex: 1; 
    min-width: 0; 
    display: flex; 
    flex-direction: column; 
    gap: 2px; 
}

.smm-text strong { 
    font-size: 14px; 
    font-weight: 500; 
    color: var(--smm-title, #111827); 
    line-height: 1.4; 
    display: block;
    transition: color 0.15s;
}

.smm-text small { 
    font-size: 12px; 
    color: var(--smm-desc, #6b7280); 
    line-height: 1.4; 
    display: block;
    transition: color 0.15s;
}

/* Arrow */
.smm-arr { 
    font-size: 15px; 
    color: #9ca3af; 
    flex-shrink: 0; 
    opacity: 0; 
    transform: translateX(-4px); 
    transition: opacity 0.15s, transform 0.15s; 
}

.smm-row:hover .smm-arr { 
    opacity: 1; 
    transform: translateX(0); 
}

/* Mobile breakpoint */
@media (max-width: 1024px) {
    .smm-nav { 
        display: none; 
    }
    
    .smm-mobile { 
        display: block; 
    }
    
    .smm-mlist { 
        list-style: none; 
        width: 100%; 
    }
    
    .smm-mitem { 
        border-bottom: 1px solid rgba(0,0,0,0.08); 
    }
    
    .smm-mitem:last-child { 
        border-bottom: none; 
    }
    
    .smm-mbtn {
        display: flex; 
        align-items: center; 
        justify-content: space-between;
        width: 100%; 
        padding: 15px 20px; 
        background: none; 
        border: none;
        font-size: 15px; 
        font-weight: 500; 
        color: #4b5563; 
        cursor: pointer; 
        text-align: left;
    }
    
    .smm-mbtn[aria-expanded="true"] { 
        color: #111827; 
    }
    
    .smm-mbtn[aria-expanded="true"] .smm-chev { 
        transform: rotate(180deg); 
    }
    
    .smm-mlink { 
        display: block; 
        padding: 15px 20px; 
        color: #4b5563; 
        text-decoration: none; 
        font-size: 15px; 
        font-weight: 500; 
    }
    
    .smm-mdd { 
        overflow: hidden; 
        background: rgba(0,0,0,0.02); 
        max-height: 0; 
        transition: max-height 0.28s ease; 
    }
    
    .smm-mdd:not([hidden]) { 
        display: block; 
    }
    
    .smm-mrow { 
        display: flex; 
        align-items: center; 
        gap: 14px; 
        padding: 11px 20px; 
        text-decoration: none; 
        color: inherit; 
        transition: background 0.15s; 
    }
    
    .smm-mrow:hover { 
        background: rgba(0,0,0,0.03); 
    }
    
    .smm-mrow .smm-icon-box { 
        width: 34px; 
        height: 34px; 
        font-size: 15px; 
    }
    
    .smm-mrow .smm-text strong { 
        font-size: 13px; 
    }
    
    .smm-mrow .smm-text small { 
        font-size: 11px; 
    }
}

@media (max-width: 768px) {
    .smm-mbtn, .smm-mlink { 
        padding: 13px 16px; 
        font-size: 14px; 
    }
}
