/* ==========================================================
   HUB LOGISTIQUE CRF59
   Croix-Rouge française
   Fichier : style.css
========================================================== */

*{
    margin:0;
    padding:0;
    box-sizing:border-box;
}

:root{

    --bg:#f5f5f5;
    --surface:#ffffff;
    --surface-2:#f5f5f5;
    --text:#222222;
    --text-muted:#666666;
    --border:#dddddd;
    --shadow:rgba(0,0,0,.08);
    --shadow-strong:rgba(0,0,0,.3);

    --primary:#D71920;
    --primary-contrast:#ffffff;

    --sidebar-bg:#D71920;
    --sidebar-text:#ffffff;
    --sidebar-text-muted:rgba(255,255,255,.85);
    --sidebar-hover:#ffe7e7;
    --sidebar-active:#a8141a;

    --topbar-bg:#ffffff;

    --input-bg:#ffffff;

    --accent-blue:#3b82c4;
    --accent-green:#28a745;
    --accent-orange:#f0a500;
    --accent-teal:#17a2b8;

}

:root[data-theme="dark"]{

    --bg:#14161a;
    --surface:#1e2126;
    --surface-2:#22252b;
    --text:#f0f0f2;
    --text-muted:#a3a6ad;
    --border:#2c2f36;
    --shadow:rgba(0,0,0,.4);
    --shadow-strong:rgba(0,0,0,.6);

    --primary:#e8434b;
    --primary-contrast:#ffffff;

    --sidebar-bg:#191b20;
    --sidebar-text:#f0f0f2;
    --sidebar-text-muted:rgba(240,240,242,.7);
    --sidebar-hover:#262931;
    --sidebar-active:#e8434b;

    --topbar-bg:#1e2126;

    --input-bg:#22252b;

}

html,
body{

    width:100%;
    height:100%;

    font-family:Arial, Helvetica, sans-serif;

    background:var(--bg);
    color:var(--text);

    transition:background .2s, color .2s;

}

#app{

    display:flex;

    height:100vh;

}


/* ===========================
        MENU
=========================== */

#sidebar{

    width:260px;

    background:var(--sidebar-bg);

    color:var(--sidebar-text);

    display:flex;

    flex-direction:column;

    box-shadow:2px 0px 8px var(--shadow);

    overflow-y:auto;

    flex-shrink:0;

}

.logo{

    padding:20px;

    text-align:center;

    border-bottom:1px solid rgba(255,255,255,.15);

}

.logo-img{

    display:block;

    width:100%;

    max-width:210px;

    margin:0 auto 12px;

    padding:10px 14px;

    background:white;

    border-radius:10px;

    box-shadow:0 2px 8px var(--shadow-strong);

}

.logo h2{

    font-size:16px;

    letter-spacing:.5px;

    color:var(--sidebar-text);

}

nav{

    display:flex;

    flex-direction:column;

    padding:15px;

    gap:4px;

}

nav button{

    display:flex;
    align-items:center;
    gap:10px;

    padding:12px 14px;

    border:none;

    border-radius:8px;

    cursor:pointer;

    background:transparent;

    color:var(--sidebar-text);

    font-size:15px;

    font-weight:bold;

    text-align:left;

    transition:.2s;

}

nav button:hover{

    background:rgba(255,255,255,.12);

}

nav button.actif{

    background:var(--sidebar-active);

    color:white;

}


/* ===========================
        CONTENU
=========================== */

#main{

    flex:1;

    display:flex;

    flex-direction:column;

    min-width:0;

}


/* ===========================
        BARRE HAUTE
=========================== */

#topbar{

    height:70px;

    background:var(--topbar-bg);

    display:flex;

    justify-content:space-between;

    align-items:center;

    padding:0 25px;

    box-shadow:0 2px 8px var(--shadow);

    gap:15px;

}

#titrePage{

    color:var(--primary);

    font-size:26px;

}

#topbar > div:last-child{

    display:flex;
    align-items:center;
    gap:10px;

}

#version{

    background:var(--primary);

    color:white;

    padding:8px 14px;

    border-radius:20px;

    font-size:13px;

}

#btnTheme{

    background:transparent;

    border:1px solid var(--border);

    color:var(--text);

    width:38px;
    height:38px;

    border-radius:50%;

    cursor:pointer;

    font-size:16px;

    display:flex;
    align-items:center;
    justify-content:center;

}

#btnTheme:hover{

    background:var(--surface-2);

}

#btnDeconnexion{

    background:transparent;

    border:1px solid var(--primary);

    color:var(--primary);

    padding:8px 14px;

    border-radius:20px;

    font-size:13px;

    cursor:pointer;

}


/* ===========================
        CONTENU
=========================== */

#contenu{

    flex:1;

    padding:30px;

    overflow:auto;

    background:var(--bg);

}


/* ===========================
        CARTES
=========================== */

.card{

    background:var(--surface);

    border-radius:12px;

    padding:20px;

    margin-bottom:20px;

    box-shadow:0 3px 12px var(--shadow);

}

.card h2{

    color:var(--primary);

    margin-bottom:15px;

}

.card-header{

    display:flex;

    justify-content:space-between;

    align-items:center;

    gap:15px;

    margin-bottom:20px;

    flex-wrap:wrap;

}


/* ===========================
        CARTES STATISTIQUES
=========================== */

.stats-grid{

    display:grid;

    grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));

    gap:20px;

    margin-bottom:20px;

}

.stat-card{

    background:var(--surface);

    border-radius:12px;

    padding:22px;

    box-shadow:0 3px 12px var(--shadow);

    display:flex;
    flex-direction:column;
    gap:14px;

    transition:.2s;

}

.stat-card-clickable{

    cursor:pointer;

}

.stat-card-clickable:hover{

    transform:translateY(-3px);

    box-shadow:0 6px 18px var(--shadow-strong);

}

.stat-card-top{

    display:flex;
    align-items:center;
    gap:14px;

}

.stat-icon{

    width:48px;
    height:48px;
    min-width:48px;

    border-radius:50%;

    display:flex;
    align-items:center;
    justify-content:center;

    font-size:22px;

    color:white;

}

.stat-icon-blue{ background:var(--accent-blue); }
.stat-icon-green{ background:var(--accent-green); }
.stat-icon-orange{ background:var(--accent-orange); }
.stat-icon-teal{ background:var(--accent-teal); }
.stat-icon-primary{ background:var(--primary); }

.stat-value{

    font-size:30px;
    font-weight:bold;
    color:var(--text);

}

.stat-label{

    font-size:13px;
    color:var(--text-muted);

}

.stat-delta{

    font-size:12px;
    color:var(--accent-green);

}


/* ===========================
        ACCES RAPIDES
=========================== */

.quick-actions{

    display:grid;

    grid-template-columns:repeat(auto-fit, minmax(220px, 1fr));

    gap:14px;

}

.quick-action{

    display:flex;
    align-items:center;
    gap:14px;

    padding:16px 18px;

    background:var(--surface-2);

    border:1px solid var(--border);

    border-radius:10px;

    cursor:pointer;

    transition:.2s;

}

.quick-action:hover{

    border-color:var(--primary);

    transform:translateY(-2px);

    box-shadow:0 4px 12px var(--shadow);

}

.quick-action-icon{

    width:42px;
    height:42px;
    min-width:42px;

    display:flex;
    align-items:center;
    justify-content:center;

    font-size:20px;

    background:var(--surface);

    border-radius:8px;

}

.quick-action-label{

    flex:1;

    font-weight:bold;

    color:var(--text);

}

.quick-action-arrow{

    color:var(--text-muted);

    font-size:18px;

}


/* ===========================
        CALENDRIER DISPONIBILITES
=========================== */

.calendar-nav{

    display:flex;

    align-items:center;

    justify-content:space-between;

    margin-bottom:15px;

}

.calendar{

    display:grid;

    grid-template-columns:repeat(7, 1fr);

    gap:6px;

}

.calendar-header-day{

    text-align:center;

    font-weight:bold;

    font-size:12px;

    color:var(--text-muted);

    padding:4px 0 8px;

}

.calendar-day{

    aspect-ratio:1;

    min-height:60px;

    border-radius:8px;

    padding:6px;

    background:var(--surface-2);

    border:1px solid var(--border);

    cursor:pointer;

    display:flex;
    flex-direction:column;
    gap:4px;

    transition:.15s;

    overflow:hidden;

}

.calendar-day:hover{

    border-color:var(--primary);

}

.calendar-day.hors-mois{

    opacity:.35;

    cursor:default;

}

.calendar-day.aujourdhui{

    border-color:var(--primary);

    border-width:2px;

}

.calendar-day-number{

    font-size:13px;

    font-weight:bold;

    color:var(--text);

}

.calendar-day-label{

    font-size:10px;

    font-weight:bold;

    color:var(--text);

    line-height:1.2;

}

.calendar-day.dispo{

    background:rgba(40,167,69,.2);

    border-color:var(--accent-green);

}

.calendar-day.indispo{

    background:rgba(220,53,69,.2);

    border-color:#dc3545;

}

.calendar-day.conges{

    background:rgba(59,130,196,.2);

    border-color:var(--accent-blue);

}

.calendar-legend{

    display:flex;

    gap:20px;

    margin-top:18px;

    font-size:13px;

    color:var(--text);

    flex-wrap:wrap;

}

.calendar-legend-item{

    display:flex;

    align-items:center;

    gap:7px;

}

.calendar-legend-dot{

    width:12px;

    height:12px;

    border-radius:50%;

    display:inline-block;

}

@media(max-width:700px){

    .calendar-day-label{ display:none; }

    .calendar-day{ min-height:36px; }

}


/* ===========================
        GRILLE DISPONIBILITES (PLANNING ADMIN)
=========================== */

.dispo-matrix{

    border-collapse:collapse;

    font-size:11px;

}

.dispo-matrix th,
.dispo-matrix td{

    padding:0;

    border:1px solid var(--border);

    text-align:center;

}

.dispo-matrix th{

    background:var(--surface-2);

    color:var(--text);

    padding:6px 3px;

    font-size:11px;

    min-width:24px;

}

.dispo-matrix th.dispo-matrix-name-col,
.dispo-matrix td.dispo-matrix-name-col{

    text-align:left;

    padding:6px 10px;

    white-space:nowrap;

    position:sticky;

    left:0;

    z-index:1;

    min-width:160px;

}

.dispo-matrix th.dispo-matrix-name-col{

    background:var(--surface-2);

    z-index:2;

}

.dispo-matrix td.dispo-matrix-name-col{

    background:var(--surface);

    font-weight:bold;

    color:var(--text);

}

.dispo-cell{

    width:24px;

    height:28px;

    background:var(--surface-2);

}

.dispo-cell.dispo{ background:var(--accent-green); }
.dispo-cell.indispo{ background:#dc3545; }
.dispo-cell.conges{ background:var(--accent-blue); }


/* ===========================
        BADGES
=========================== */

.badge{

    display:inline-block;

    padding:4px 10px;

    border-radius:12px;

    font-size:12px;

    font-weight:bold;

    color:white;

}

.badge-actif{

    background:var(--accent-green);

}

.badge-inactif{

    background:#6c757d;

}


/* ===========================
        TABLEAUX
=========================== */

table{

    width:100%;

    border-collapse:collapse;

    background:var(--surface);

    color:var(--text);

}

table th{

    background:var(--primary);

    color:white;

    padding:12px;

    text-align:left;

}

table td{

    padding:10px;

    border-bottom:1px solid var(--border);

}

table tr:hover{

    background:var(--surface-2);

}


/* ===========================
        BOUTONS
=========================== */

.btn{

    background:var(--primary);

    color:white;

    border:none;

    padding:10px 18px;

    border-radius:8px;

    cursor:pointer;

    font-weight:bold;

    transition:.25s;

}

.btn:hover{

    opacity:.9;

}

.btn:disabled{

    opacity:.6;

    cursor:not-allowed;

}

.btn-sm{

    padding:6px 12px;

    font-size:13px;

}

.btn-success{

    background:var(--accent-green);

}

.btn-warning{

    background:var(--accent-orange);

    color:black;

}

.btn-danger{

    background:#dc3545;

}

.btn-secondary{

    background:#6c757d;

}


/* ===========================
        CHAMPS
=========================== */

input,
select,
textarea{

    width:100%;

    padding:10px;

    border:1px solid var(--border);

    border-radius:6px;

    margin-bottom:15px;

    font-family:inherit;

    background:var(--input-bg);

    color:var(--text);

}

label{

    display:block;

    margin-bottom:5px;

    font-weight:bold;

    color:var(--text);

}


/* ===========================
        POPUP / MODAL
=========================== */

.overlay{

    display:none;

    position:fixed;

    top:0;
    left:0;
    right:0;
    bottom:0;

    background:rgba(0,0,0,.55);

    z-index:9998;

    align-items:center;

    justify-content:center;

}

.overlay.actif{

    display:flex;

}

.modal{

    background:var(--surface);

    color:var(--text);

    border-radius:12px;

    padding:25px;

    width:500px;

    max-width:90vw;

    max-height:85vh;

    overflow-y:auto;

    box-shadow:0 0 20px var(--shadow-strong);

}

.modal h2{

    color:var(--primary);

    margin-bottom:15px;

}

.modal-actions{

    display:flex;

    gap:10px;

    justify-content:flex-end;

    margin-top:10px;

}


/* ===========================
        PAGE DE CONNEXION
=========================== */

.login-page{

    width:100%;

    height:100vh;

    display:flex;

    align-items:center;

    justify-content:center;

    background:var(--bg);

}

.login-card{

    background:var(--surface);

    border-radius:12px;

    padding:35px;

    width:380px;

    max-width:90vw;

    box-shadow:0 3px 20px var(--shadow-strong);

    text-align:center;

}

.login-logo{

    display:block;

    width:100%;

    max-width:260px;

    margin:0 auto 15px;

}

.login-card h1{

    color:var(--primary);

    font-size:22px;

    margin-bottom:5px;

}

.login-card p{

    color:var(--text-muted);

    margin-bottom:20px;

    font-size:14px;

}

.login-card form{

    text-align:left;

}

.login-error{

    color:#dc3545;

    font-size:13px;

    margin-bottom:10px;

    min-height:16px;

}

.login-theme-toggle{

    position:fixed;

    top:20px;

    right:20px;

}


/* ===========================
        RESPONSIVE
=========================== */

@media(max-width:900px){

#sidebar{

    width:80px;

}

.logo h2{

    display:none;

}

nav button span.label{

    display:none;

}

#titrePage{

    font-size:20px;

}

}


/* ===========================
        PAGE HUB (LANCEUR)
=========================== */

.hub-page{

    min-height:100vh;

    background:var(--bg);

    display:flex;

    flex-direction:column;

}

.hub-topbar{

    display:flex;

    justify-content:space-between;

    align-items:center;

    padding:15px 30px;

    background:var(--topbar-bg);

    box-shadow:0 2px 8px var(--shadow);

}

.hub-topbar-brand{

    display:flex;

    align-items:center;

    gap:12px;

    font-weight:bold;

    font-size:18px;

    color:var(--primary);

}

.hub-topbar-logo{

    height:40px;

    border-radius:6px;

    background:white;

    padding:4px 6px;

}

.hub-topbar-actions{

    display:flex;

    align-items:center;

    gap:10px;

}

.hub-main{

    flex:1;

    padding:60px 30px;

    max-width:1000px;

    margin:0 auto;

    width:100%;

    text-align:center;

}

.hub-title{

    color:var(--primary);

    font-size:28px;

    margin-bottom:10px;

}

.hub-subtitle{

    color:var(--text-muted);

    font-size:15px;

    margin-bottom:40px;

}

.hub-apps{

    display:grid;

    grid-template-columns:repeat(auto-fit, minmax(240px, 1fr));

    gap:24px;

    text-align:left;

}

.hub-app-tile{

    background:var(--surface);

    border-radius:14px;

    padding:28px 24px;

    box-shadow:0 3px 14px var(--shadow);

    cursor:pointer;

    transition:.2s;

    position:relative;

}

.hub-app-tile:hover{

    transform:translateY(-4px);

    box-shadow:0 8px 22px var(--shadow-strong);

}

.hub-app-icon{

    font-size:34px;

    margin-bottom:14px;

}

.hub-app-titre{

    font-size:17px;

    font-weight:bold;

    color:var(--text);

    margin-bottom:8px;

}

.hub-app-description{

    font-size:13px;

    color:var(--text-muted);

}

.hub-app-tile-indisponible{

    cursor:not-allowed;

    opacity:.6;

}

.hub-app-tile-indisponible:hover{

    transform:none;

    box-shadow:0 3px 14px var(--shadow);

}

.hub-app-badge{

    position:absolute;

    top:20px;

    right:20px;

}

@media(max-width:700px){

    .hub-main{

        padding:40px 18px;

    }

    .hub-title{

        font-size:22px;

    }

}
