/* VERSION: 3.0.0 */
/* css/menubar.css */
/* Modern Glassmorphic Menubar & Desktop Dropdown System */

/* --- Menubar Bar Container --- */
.bar {
    background: var(--bg-surface-glass, rgba(14, 18, 28, 0.85));
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-bottom: 1px solid var(--glass-border, rgba(255, 255, 255, 0.10));
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), inset 0 -1px 0 rgba(255, 255, 255, 0.04);
    font-size: 0.82rem;
    flex-shrink: 0;
    user-select: none;
    height: 36px;
    display: flex;
    align-items: center;
    color: var(--text-main, #f4f4f5);
    z-index: 100;
    position: relative;
    width: 100%;
    font-family: inherit;
    transition: opacity 0.3s ease;
    opacity: 1;
}

/* FADE OUT STATE (during media playback immersion) */
.bar.fade-out {
    opacity: 0;
    pointer-events: none;
}

.bar.fade-out .dropdown-menu {
    display: none !important;
}

/* --- Top Menubar Layout --- */
.top-menubar > ul {
    display: flex; 
    align-items: center; 
    list-style: none; 
    margin: 0; 
    padding: 0 8px; 
    height: 100%; 
    width: 100%;
    gap: 2px;
}

.top-menubar > ul > li {
    position: relative; 
    padding: 0;
    margin: 0;
    height: 100%; 
    display: flex; 
    align-items: center; 
    cursor: pointer; 
    flex-shrink: 0;
    touch-action: manipulation;
}

/* Top-level menu label button */
.top-menubar > ul > li > span {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted, rgba(240, 246, 252, 0.82));
    border: 1px solid transparent;
    transition: all 0.15s ease;
}

/* Hover state when menubar is inactive */
.top-menubar > ul > li:hover > span {
    background-color: rgba(255, 255, 255, 0.10);
    border-color: rgba(255, 255, 255, 0.15);
    color: #ffffff;
}

/* Active / Open state when a dropdown is open */
.top-menubar > ul > li.is-open > span {
    background-color: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.35);
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

/* --- Floating Glassmorphic Dropdown Menus --- */
.dropdown-menu {
    display: none;
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
    pointer-events: none;
    position: absolute; 
    top: calc(100% + 5px); 
    left: 0; 
    background: var(--bg-surface-elevated, rgba(16, 20, 32, 0.94)); 
    backdrop-filter: blur(32px) saturate(190%);
    -webkit-backdrop-filter: blur(32px) saturate(190%);
    border: 1px solid var(--glass-border, rgba(255, 255, 255, 0.14)); 
    border-radius: 12px;
    list-style: none; 
    margin: 0; 
    padding: 6px; 
    min-width: 230px; 
    z-index: 1000; 
    box-shadow: var(--glass-shadow-deep), var(--glass-rim-top);
    transition: opacity 0.14s cubic-bezier(0.16, 1, 0.3, 1), transform 0.14s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Strictly open only when .is-open class is applied by MenuManager */
.top-menubar > ul > li.is-open .dropdown-menu {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* Dropdown Menu Items */
.dropdown-menu li:not(.menu-divider) { 
    padding: 7px 11px;
    margin: 2px 0;
    border-radius: 8px;
    white-space: nowrap; 
    color: var(--text-muted, rgba(240, 246, 252, 0.88));
    font-size: 0.8rem;
    font-weight: 450;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.12s ease;
}

/* Vibrant Greyscale On-Hover Highlight for Menu Selections */
.dropdown-menu li:not(.menu-divider):hover,
.dropdown-menu li:not(.menu-divider).menu-item-focused { 
    background-color: rgba(255, 255, 255, 0.14); 
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.22);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.dropdown-menu li:not(.menu-divider):hover span,
.dropdown-menu li:not(.menu-divider):hover strong,
.dropdown-menu li:not(.menu-divider).menu-item-focused span,
.dropdown-menu li:not(.menu-divider).menu-item-focused strong {
    color: #ffffff;
}

.dropdown-menu li:not(.menu-divider):active {
    filter: brightness(0.92);
    transform: scale(0.99);
}

/* Subtle separator dividers */
.menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
    margin: 4px 6px;
    padding: 0 !important;
    pointer-events: none;
}

/* Sleek Monospace Keyboard Shortcut Pills */
.shortcut-text {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.68rem;
    color: var(--text-muted, #a1a1aa);
    margin-left: 16px;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    letter-spacing: 0.02em;
    transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}

.dropdown-menu li:hover .shortcut-text,
.dropdown-menu li.menu-item-focused .shortcut-text {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.35);
}

/* --- Mobile Responsiveness --- */
@media (max-width: 768px) {
    .top-menubar {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .top-menubar > ul > li > span {
        padding: 4px 8px;
        font-size: 0.76rem;
    }

    .dropdown-menu {
        position: fixed;
        top: 35px;
        left: 8px !important;
        right: 8px !important;
        min-width: auto;
        max-width: calc(100vw - 16px);
        max-height: calc(100vh - 48px);
        overflow-y: auto;
    }

    .shortcut-text {
        display: none;
    }
}