/* ==========================================================
   app.css : styles communs à toutes les pages du DA
   Les styles propres à une page restent dans le <style> de sa vue
   (chargé après ce fichier, donc il peut le compléter ou le surcharger).
   ========================================================== */

/* ---------- Thème ---------- */
:root{
    --bg: #F7F7F9;
    --sidebar-bg: #EBEBEE;
    --white: #F7F7F8;
    --panel: #E1E1E5;
    --panel-strong: #CFCFD4;
    --text: #171A20;
    --grey-600: #6B6D70;
    --grey-400: #9C9EA1;
    --grey-200: #E4E4E7;
    --grey-700: #4B4D51;
    --grey-soft: #ECECEE;
    --blue: #3E6AE1;
    --blue-soft: #EAF0FE;
    --red: #E82127;
    --red-soft: #FDECEC;
    --shadow-card: 0 1px 2px rgba(23,26,32,0.04), 0 4px 16px rgba(23,26,32,0.06);
    --shadow-pop: 0 2px 6px rgba(23,26,32,0.10);
    --radius-lg: 18px;
    --radius-md: 14px;
    --radius-pill: 999px;
}

/* ---------- Base ---------- */
*{box-sizing:border-box; margin:0; padding:0;}
body{
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    display:flex;
    min-height:100vh;
    font-weight:400;
    -webkit-font-smoothing: antialiased;
}
a{color:inherit; text-decoration:none;}
button{font-family:'Inter'; cursor:pointer;}

/* ---------- Menu latéral ---------- */
.sidebar{
    width: 226px; flex-shrink:0; padding: 10px 16px;
    display:flex; flex-direction:column;
    background: var(--sidebar-bg);
    border-right: 1px solid rgba(0,0,0,0.09);
}

.brand { display: flex; align-items: center; width: 100%; box-sizing: border-box; }
.brand-logo { width: 170px; height: 100px; object-fit: contain; flex-shrink: 0; display: block; }

.nav{display:flex; flex-direction:column; margin-bottom:auto;}
.nav a{
    display:flex; align-items:center; gap:12px; padding:11px 14px;
    border-radius: var(--radius-md); font-size:13.5px; font-weight:500;
    color: var(--grey-600); transition: background .15s ease, color .15s ease;
}
.nav a svg{width:17px; height:17px; opacity:0.75;}
.nav a:hover{color: var(--text);}
.nav a.active{ background: var(--white); color: var(--text); box-shadow: var(--shadow-pop); font-weight:600; }
.nav a.active svg{opacity:1;}
.nav-badge{
    margin-left:auto; background: var(--blue); color:#fff;
    font-size:10px; font-weight:700; padding:1px 6px; border-radius: var(--radius-pill);
}
.nav-badge-red{background: var(--red);}

.centre-card{
    display:block; background: var(--panel); border-radius: var(--radius-md);
    padding:16px; margin-top:16px; box-shadow: var(--shadow-card);
    transition: transform .15s ease, box-shadow .15s ease;
}
.centre-card:hover{
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(23,26,32,0.06), 0 10px 24px rgba(23,26,32,0.08);
}
.centre-card .label{
    font-size:10px; color: var(--grey-400); font-weight:600;
    text-transform:uppercase; letter-spacing:0.05em; margin-bottom:6px;
}
.centre-card .name{font-size:13.5px; font-weight:700; margin-bottom:12px;}
.occ-bar{height:6px; background: var(--panel-strong); border-radius: var(--radius-pill); overflow:hidden; margin-bottom:8px;}
.occ-fill{height:100%; background: var(--blue); border-radius: var(--radius-pill);}
.occ-text{font-size:11px; color: var(--grey-600);}

/* ---------- Zone principale et titres ---------- */
.main{flex:1; min-width:0; padding: 26px 28px 40px;}
.topbar h1{font-size:26px; font-weight:700; letter-spacing:-0.01em;}
.topbar .sub{font-size:13px; color: var(--grey-600); margin-top:4px;}

/* ---------- Barre de recherche ---------- */
.toolbar{ display:flex; align-items:center; gap:12px; margin-bottom:18px; flex-wrap:wrap; }
.search-box{
    flex:1; min-width:260px; display:flex; align-items:center; gap:10px;
    background: var(--panel); border-radius: var(--radius-pill);
    padding:12px 18px; box-shadow: var(--shadow-card);
}
.search-box svg{width:16px; height:16px; color: var(--grey-400); flex-shrink:0;}
.search-box input{
    border:none; outline:none; font-family:'Inter'; font-size:13.5px;
    width:100%; background:transparent; color: var(--text);
}
.search-box input::placeholder{color: var(--grey-400);}
.search-box .hint{font-size:11px; color: var(--grey-400); white-space:nowrap;}

/* ---------- Pastilles de filtre ---------- */
.filter-chips{ display:flex; gap:8px; flex-wrap:wrap; margin-bottom:20px; }
.chip{
    display:flex; align-items:center; gap:7px; padding:9px 16px;
    border-radius: var(--radius-pill); background: var(--panel);
    font-size:12.5px; font-weight:600; color: var(--grey-600);
    cursor:pointer; box-shadow: var(--shadow-card);
    transition: all .15s ease; border:1.5px solid transparent;
}
.chip .dot{width:7px; height:7px; border-radius:50%; background:currentColor;}
.chip:hover{color: var(--text);}
.chip.active{background: var(--text); color:#fff;}
.chip.active .dot{background:#fff;}
.chip-count{font-size:10.5px; background: rgba(0,0,0,0.06); padding:1px 6px; border-radius: var(--radius-pill);}
.chip.active .chip-count{background: rgba(255,255,255,0.2);}

/* ---------- Tableaux (les colonnes `grid-template-columns` restent dans chaque page) ---------- */
.table-card{ background: var(--panel); border-radius: var(--radius-lg); box-shadow: var(--shadow-card); overflow:hidden; }
.table-head{ display:grid; padding:14px 24px; border-bottom:1px solid rgba(0,0,0,0.08); }
.table-head span{
    font-size:11px; font-weight:600; color: var(--grey-400);
    text-transform:uppercase; letter-spacing:0.04em;
}
.row{
    display:grid; padding:16px 24px; align-items:center;
    border-bottom:1px solid rgba(0,0,0,0.08);
    cursor:pointer; transition: background .15s ease;
}
.row:last-child{border-bottom:none;}
.row:hover{background: var(--panel-strong);}

.table-footer{
    display:flex; justify-content:space-between; align-items:center;
    padding:16px 24px; font-size:12px; color: var(--grey-600);
}
.pager{display:flex; gap:6px; flex-wrap:wrap;}
.pager a, .pager span{
    min-width:30px; height:30px; padding:0 8px; border-radius:9px;
    background: var(--panel-strong); color: var(--grey-600);
    font-size:12.5px; font-weight:600;
    display:flex; align-items:center; justify-content:center;
}
.pager a:hover{background: var(--grey-200);}
.pager .current{background: var(--text); color:#fff;}
.pager .disabled{opacity:0.4; pointer-events:none;}

.empty-state{ display:none; flex-direction:column; align-items:center; justify-content:center; padding:60px 20px; text-align:center; }
.empty-state.show{display:flex;}
.empty-state .icon{font-size:28px; margin-bottom:10px;}
.empty-state .title{font-size:14px; font-weight:600; margin-bottom:4px;}
.empty-state .sub{font-size:12.5px; color: var(--grey-600);}

/* ---------- Messages ---------- */
.result-banner{ padding:14px 18px; border-radius: var(--radius-md); font-size:13px; margin-bottom:18px; box-shadow: var(--shadow-card); }
.result-ok{background: var(--blue-soft); color: var(--blue);}
.result-ko{background: var(--red-soft); color: var(--red);}

/* ---------- Fenêtres (popups) : socle commun ---------- */
.modal-overlay{
    position:fixed; inset:0; background: rgba(23,26,32,0.45);
    display:none; align-items:center; justify-content:center; z-index:100; padding:20px;
}
.modal-overlay.show{display:flex;}
.modal-box{
    background: var(--panel); border-radius: var(--radius-lg);
    width:100%; max-width:460px; padding:26px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-head{
    display:flex; justify-content:space-between; align-items:flex-start;
    padding-bottom:18px; border-bottom:1px solid rgba(0,0,0,0.08); margin-bottom:18px;
}
.modal-head .ref{font-size:16px; font-weight:700;}
.modal-head .sub{font-size:12.5px; color: var(--grey-600); margin-top:4px;}
.modal-close{
    width:28px; height:28px; border:none; border-radius:50%;
    background: rgba(0,0,0,0.06); color: var(--grey-600);
    cursor:pointer; font-size:15px; line-height:1; flex-shrink:0;
}
.modal-close:hover{background: rgba(0,0,0,0.12); color: var(--text);}

/* ---------- Écrans étroits ---------- */
@media (max-width: 1000px){
    .sidebar{display:none;}
    .table-head{display:none;}
    .table-card .row{grid-template-columns: 1fr; gap:6px;}   /* plus spécifique que le .row de chaque page */
}

/* Bouton de déconnexion de la barre latérale */
.logout-btn {
    display: flex;
    align-items: center;
    justify-content: center;   /* icône + texte centrés */
    gap: 8px;
    width: 100%;
    box-sizing: border-box;
    margin-top: 10px;
    padding: 10px 14px;
    border-radius: 12px;       /* mêmes coins que la carte du dessus */
    border: 1px solid var(--border, rgba(0, 0, 0, .08));
    background: transparent;
    color: var(--grey-600, #6b7280);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;     /* enlève le soulignement du lien */
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.logout-btn:hover {
    background: color-mix(in srgb, var(--red, #e0245e) 10%, transparent);
    color: var(--red, #c81e4d);
    border-color: color-mix(in srgb, var(--red, #e0245e) 35%, transparent);
}
.logout-btn:focus-visible {            /* visible quand on navigue au clavier */
    outline: 2px solid var(--blue, #3e6ae1);
    outline-offset: 2px;
}