/**
 * Menu Panel Styles
 * Side menu that slides from right and compresses content
 * 
 * @package Alledio Production Dashboard
 * @version 1.0
 */

/* Menu button before logo */
.menu-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 0;
    margin-right: 12px;
    flex-shrink: 0;
    color: #2c3e50; /* Dark color for light background */
    margin-left: 30px;
    margin-right: 20px;
    outline: none; /* Remove focus outline */
}

.menu-button:hover {
    background: rgba(0, 0, 0, 0.05);
    opacity: 0.8;
}

.menu-button:focus {
    outline: none; /* Remove focus outline */
    border: none; /* Ensure no border on focus */
}

.menu-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

.menu-button svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
}

/* Menu panel - overlays content, doesn't push it */
.menu-panel {
    position: fixed;
    top: var(--top-bar-height, 70px); /* Position below top-bar */
    left: -250px; /* Hide off-screen (no transform to avoid stacking context) */
    width: 200px;
    min-width: 150px;
    height: calc(100vh - var(--top-bar-height, 70px)); /* Full height minus top-bar */
    background: var(--color-surface, #1e1e1e);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 100 !important; /* Below all modals (6000+) so modals appear above menu */
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    box-shadow: 1px 0px 3px rgba(0, 0, 0, 0.1); /* Shadow only on right side, no top shadow */
    isolation: auto; /* Don't create stacking context */
    transform: none; /* Avoid transform to prevent stacking context issues */
}

.menu-panel.open {
    left: 0; /* Slide in by changing position */
    z-index: 100 !important; /* Ensure menu stays below modals (6000+) */
}

/* When any popup/modal is open, ensure menu stays below */
body.popup-open .menu-panel,
body.popup-open .menu-panel.open {
    z-index: 100 !important; /* Stay below modals (6000+) */
}

/* When product details modal is open, ensure menu stays on top */
body.product-details-modal-open .menu-panel,
body.product-details-modal-open .menu-panel.open {
    z-index: 100 !important; /* Above product details modal (50) */
}

/* Menu items */
.menu-items {
    flex: 1;
    padding: 12px 0;
    width: 100%;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: transparent;
    border: none;
    width: 100%;
    cursor: pointer;
    color: var(--color-text, #ffffff);
    transition: var(--transition-fast, all 0.2s ease);
    text-align: left;
    font-size: 12px;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-left-color: var(--color-primary, #2d8998);
}

.menu-item:active {
    background: rgba(255, 255, 255, 0.08);
}

.menu-item svg {
    width: 18px;
    height: 18px;
    stroke: currentColor;
    fill: none;
    flex-shrink: 0;
}

/* Certificates icon uses fill instead of stroke */
#menuItemCertificates svg {
    fill: currentColor;
    stroke: none;
}

.menu-item-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Menu delimiter */
.menu-delimiter {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 8px 16px;
    flex-shrink: 0;
}

/* Admin badge - hidden */
.menu-item .admin-badge {
    display: none;
}

/* Menu footer (optional) */
.menu-panel-footer {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: auto;
    flex-shrink: 0;
    text-align: center;
}

.menu-version {
    font-size: 9px;
    color: #888888;
    opacity: 0.7;
}

/* Responsive adjustments */
@media (max-width: 1024px) {
    .menu-panel {
        min-width: 200px;
    }
}

@media (max-width: 768px) {
    .menu-panel {
        min-width: 180px;
        box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    }
}

/* ==================== DARK MODE ==================== */
@media (prefers-color-scheme: dark) {
    .menu-button {
        color: var(--color-text-primary, #ffffff);
        background-color: var(--color-bg, #0f1113);
    }
    
    .menu-button:hover {
        background: var(--color-bg-hover, rgba(255, 255, 255, 0.1));
    }
    
    .menu-panel {
        background: var(--color-bg, #0f1113);
        border-right-color: var(--color-border, rgba(255, 255, 255, 0.1));
    }
    
    .menu-panel-header {
        border-color: var(--color-border, rgba(255, 255, 255, 0.1));
    }
    
    .menu-version {
        color: #888888;
    }
    
    .menu-item {
        color: var(--color-text-primary, #e5e7eb);
    }
    
    .menu-item:hover {
        background: rgba(255, 255, 255, 0.08);
        border-left-color: var(--color-primary, #2d8998);
    }
    
    .menu-item:active {
        background: rgba(255, 255, 255, 0.12);
    }
    
    .menu-delimiter {
        background: rgba(255, 255, 255, 0.1);
    }
}

/* ==================== LIGHT MODE ==================== */
@media (prefers-color-scheme: light) {
    .menu-panel {
        background: var(--color-bg, #ffffff);
        border-right-color: rgba(0, 0, 0, 0.1);
    }
    
    .menu-button {
        border: none;
        color: var(--color-text-primary, #2c3e50);
    }
    
    .menu-button:hover {
        background: rgba(0, 0, 0, 0.05);
        opacity: 0.8;
    }
    
    .menu-panel-header{
        border-color: rgba(0, 0, 0, 0.1);
    }
    
    .menu-version {
        color: #666666;
    }
    
    .menu-item {
        color: #1e1e1e;
    }
    
    .menu-item:hover {
        background: rgba(0, 0, 0, 0.03);
    }
    
    .menu-item:active {
        background: rgba(0, 0, 0, 0.06);
    }
    
    .menu-delimiter {
        background: rgba(0, 0, 0, 0.1);
    }
}

/* Box sizing is handled globally in app.css */

