/* ==========================================================================
   STRUCTURE INDUSTRIELLE WMS (wms-layout.css)
   ========================================================================== */

/* --- Scrollbars discrètes et globales --- */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: rgba(150, 150, 150, 0.25);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(150, 150, 150, 0.45);
}

body {
    margin: 0;
    padding: 0;
    height: 100vh;
    overflow: hidden;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
}

.wms-shell {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100vw;
    background-color: var(--bg);
}

/* --- Barre supérieure --- */
.wms-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
    padding: 0 24px;
    background-color: var(--card);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
    z-index: 10;
}

.wms-topbar .brand h1 {
    margin: 0;
    font-size: 19px;
    font-weight: 700;
    color: var(--primary);
}

.wms-topbar .brand .wms-version {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.global-search {
    flex: 1;
    max-width: 550px;
    position: relative;
    margin: 0 30px;
}

.global-search input {
    width: 100%;
    padding: 9px 16px;
    border-radius: 6px;
    border: 1px solid var(--line);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    transition: border-color 0.15s ease;
}

.global-search input:focus {
    border-color: var(--primary);
    outline: none;
}

.user-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

#user-panel {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.04);
    padding: 5px 12px;
    border-radius: 30px;
    font-size: 13px;
    border: 1px solid var(--line);
}

#user-panel button {
    background: transparent;
    border: none;
    color: var(--danger);
    cursor: pointer;
    font-weight: bold;
    padding: 0 4px;
}

/* --- Corps principal & Sidebar --- */
.wms-body {
    display: flex;
    flex: 1;
    overflow: hidden;
    position: relative;
}

/* Sidebar augmentée pour le texte, marges réduites */
.wms-sidebar {
    width: 100px;
    background-color: var(--card);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 12px 0;
    overflow-y: auto;
    overflow-x: hidden;
    flex-shrink: 0;
    gap: 16px;
}

.wms-sidebar .nav-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
}

.wms-sidebar .nav-label {
    font-size: 9px;
    text-transform: uppercase;
    color: var(--primary);
    margin-bottom: 6px;
    font-weight: 700;
    letter-spacing: 0.5px;
    opacity: 0.8;
}

.wms-sidebar .nav-item {
    width: 90%;
    padding: 6px 4px;
    border-radius: 8px;
    background: transparent;
    border: 1px solid transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin-bottom: 4px;
    transition: all 0.2s ease;
    cursor: pointer;
    color: var(--text);
    gap: 3px;
}

.wms-sidebar .nav-item:hover {
    background: rgba(96, 165, 250, 0.08);
    border-color: rgba(96, 165, 250, 0.25);
}

.wms-sidebar .nav-icon {
    font-size: 18px;
}

.wms-sidebar .nav-text {
    font-size: 9px;
    text-align: center;
    line-height: 1.1;
    opacity: 0.85;
}

/* --- Espace de travail central --- */
.wms-workspace {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 0px 4px;
    overflow-y: auto;
    background-color: var(--bg);
}

/* --- Bandeau KPIs affiné --- */
.stats-ribbon {
    display: flex;
    gap: 12px;
    overflow-x: auto;
    padding-bottom: 8px;
    flex-shrink: 0;
}

.stats-ribbon .stat {
    flex: 1;
    min-width: 180px;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.stats-ribbon .stat:hover {
    transform: translateY(-2px);
    border-color: rgba(96, 165, 250, 0.4);
}

.stats-ribbon .split-stat {
    flex-direction: row;
    padding: 0;
    gap: 0;
}

.stats-ribbon .stat-half {
    flex: 1;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.stats-ribbon .stat-half:first-child {
    border-right: 1px solid var(--line);
}

/* --- Contrôles Grille (Zones & Allées) compactés --- */
.grid-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 8px;
    background: var(--card);
    padding: 0px 12px;
    border-radius: 8px;
    border: 1px solid var(--line);
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    flex-shrink: 0;
        align-items: center;
    justify-content: center;
}

#zoneSelector, #rowSelector {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    align-items: center;
    justify-content: center;
}

/* Cache la scrollbar des sélecteurs s'il n'y a pas besoin */
#zoneSelector::-webkit-scrollbar, #rowSelector::-webkit-scrollbar {
    height: 4px;
}

.grid-container {
    flex: 1;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 16px;
    overflow-y: auto;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* --- Tiroir d'édition contextuel de droite --- */
.wms-context-drawer {
    width: 320px;
    background-color: var(--card);
    border-left: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    padding: 16px;
    overflow-y: auto;
    flex-shrink: 0;
    box-shadow: -2px 0 10px rgba(0,0,0,0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* État fermé sur PC */
.wms-context-drawer.drawer-closed {
    width: 0;
    padding: 0;
    border: none;
    overflow: hidden;
}

/* Rendu adaptatif pour tablettes et mobiles */
@media (max-width: 1150px) {
    .wms-context-drawer {
        position: fixed;
        right: -340px; /* Caché par défaut */
        top: 60px;
        bottom: 0;
        z-index: 90;
        width: 320px;
        /* On remet le padding ici car on annule le comportement drawer-closed du PC */
        padding: 16px; 
        box-shadow: -10px 0 30px rgba(0,0,0,0.3);
    }
    
    /* État ouvert sur mobile/tablette */
    .wms-context-drawer.drawer-open {
        right: 0;
    }
}