body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background: #f4f6f9;
    font-family: 'Inter', sans-serif;
    display: flex;
    min-height: 100vh;
    margin: 0;
}

/* ============================
   SIDEBAR
============================ */
/* Sidebar : desktop et mobile */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 250px;
    height: 100%;
    background: #fff;
    border-right: 1px solid #dee2e6;
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    z-index: 1000;
    transform: translateX(0);       /* visible par défaut */
    transition: transform 0.3s ease;
}

/* Desktop : toujours visible */
@media (min-width: 769px) {
    main, .content {
        margin-left: 250px; /* laisse la place pour la sidebar */
    }
    .sidebar {
        transform: translateX(0);
    }
}

/* Mobile : cachée par défaut */
@media (max-width: 768px) {
    main, .content {
        margin-left: 0;
        padding: 1rem;
    }
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.show {
        transform: translateX(0);
    }

    .hamburger {
        display: block;
    }
    .sidebar-actions {
        display: flex !important;
        flex-direction: column;
        margin-top: auto;
        padding-top: 1rem;
        border-top: 1px solid #dee2e6;
    }
}

/* Liens dans la sidebar */
.sidebar h4 {
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar .nav-link {
    color: #333;
    border-radius: 8px;
    margin: 4px 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    background: #0d6efd;
    color: #fff;
}

/* Main content */
main {
    margin-left: 250px;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
}
.content {
    margin-left: 250px; /* laisse la place pour la sidebar */
    flex: 1 0 auto;
    display: flex;
    flex-direction: column;
    padding: 2rem;
    min-width: 0; /* important pour éviter le débordement horizontal */
}

/* Container qui prend toute la hauteur dispo */
.table-container {
    height: calc(100vh - 120px); /* 100% de la hauteur de la fenêtre moins header/footer */
    overflow-y: auto;            /* Scroll vertical si besoin */
}

/* Table qui prend toute la largeur */
.table-fullscreen {
    width: 100%;
    table-layout: fixed; /* répartit les colonnes également si tu veux */
}

/* Optionnel : que les colonnes restent visibles si scroll horizontal */
.table-fullscreen th, .table-fullscreen td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Carte login moderne */
.login-card {
    max-width: 400px;
    width: 100%;
    padding: 2rem;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: background 0.3s, transform 0.3s, opacity 0.3s;
    opacity: 0;
    transform: translateY(20px);
}

/* Animation fade-in */
.login-card.show {
    opacity: 1;
    transform: translateY(0);
}

/* Titres */
.login-card h2 {
    margin-bottom: 1.5rem;
    text-align: center;
}

/* Labels et inputs */
.login-card label {
    font-weight: 600;
    display: block;
    margin-bottom: 0.3rem;
}
.login-card input {
    width: 100%;
    padding: 0.5rem;
    border-radius: 8px;
    border: 1px solid #ccc;
    margin-bottom: 1rem;
}

/* Bouton */
.login-card button {
    width: 100%;
    padding: 0.7rem;
    border: none;
    border-radius: 8px;
    background: #0d6efd;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.3s;
}
.login-card button:hover {
    background: #0b5ed7;
}

/* Message d’erreur */
.login-card p {
    text-align: center;
    font-weight: 600;
    margin-bottom: 1rem;
    color: #e74c3c;
}

/* Footer */
footer {
    flex-shrink: 0; /* ne rétrécit pas */
    text-align: center;
    padding: 10px;
    background: #fff;
    border-top: 1px solid #dee2e6;
    font-size: 14px;
    color: #555;
}

/* Overlay loader */
.loader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    z-index: 2000;
    transition: opacity 0.3s ease;
}

.loader-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-overlay .spinner-border {
    width: 3rem;
    height: 3rem;
    color: #0d6efd;
    margin-bottom: 10px;
}

.loader-overlay p {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 500;
}

/* Conteneur du bouton notifications */
.position-relative {
    position: relative; /* déjà présent dans ton HTML, référence pour le menu */
}

/* Desktop notifications */
.notif-menu {
    position: absolute;
    display: none;
    top: 100%;
    right: 0;
    width: 280px;
    max-height: 70vh;
    overflow-y: auto;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    padding: 0.5rem 0;
    z-index: 2000;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: translateY(-10px);
}

.notif-menu.show {
    opacity: 1;
    transform: translateY(0);
}

.notif-bubble-arrow {
    position: absolute;
    top: -8px;
    right: 12px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-bottom: 8px solid #fff;
}
.notif-menu ul li {
    padding: 0.5rem 1rem;
    border-bottom: 1px solid #eee;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: flex-start; /* pour que la date soit en bas */
    flex-direction: column;
}

.notif-menu ul li .notif-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.notif-menu ul li .notif-date {
    align-self: flex-end;
    font-size: 0.75rem;
    color: #888;
}

.notif-menu ul li:last-child {
    border-bottom: none;
}

/* Notifications non lues par défaut */
#notifList li:not(.read) {
    font-weight: 600;
}

/* Notifications lues */
#notifList li.read {
    font-weight: normal;
    color: #555;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Hamburger */
.hamburger {
    display: none; /* visible uniquement sur mobile */
    position: fixed;
    top: 15px;
    left: 15px;
    font-size: 2rem;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1000;
}

.grid-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}
.card.full-width { grid-column: 1 / -1; }
.card h2 { margin-bottom: 1rem; font-size: 20px; margin: 10px; }
.card p { margin: 10px; }
.card { font-size: 1rem; line-height: 1.5; }
.status-indicator { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-left: 8px; }
.status-indicator.active { background-color: #4caf50; box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7); animation: pulse 1.5s infinite; }
.status-indicator.inactive { background-color: #f44336; animation: blink 1s infinite; }
@keyframes pulse { 0%{transform:scale(0.95);box-shadow:0 0 0 0 rgba(76,175,80,0.7);} 70%{transform:scale(1);box-shadow:0 0 0 8px rgba(76,175,80,0);} 100%{transform:scale(0.95);box-shadow:0 0 0 0 rgba(76,175,80,0);} }
@keyframes blink { 0%,50%,100%{opacity:1;} 25%,75%{opacity:0;} }

/* Sidebar actions mobile */
.sidebar-actions {
    display: none; /* par défaut, caché sur desktop */
    flex-direction: column;
    margin-top: auto; /* pousse en bas de la sidebar */
    padding-top: 1rem;
    border-top: 1px solid #dee2e6;
}

.sidebar-actions button {
    display: block;
    width: 100%;
    margin-bottom: 0.5rem;
}

.sidebar-actions .username {
    font-weight: 600;
    margin-top: 0.5rem;
}

/* TOAST */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
}

.toast {
    background-color: #333;
    color: #fff;
    padding: 0.8rem 1.2rem;
    margin-bottom: 0.5rem;
    border-radius: 0.3rem;
    box-shadow: 0 2px 6px rgba(0,0,0,0.3);
    opacity: 0;
    transform: translateX(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(0);
}

/* MODAL */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(0,0,0,0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background-color: #fff;
    padding: 1.5rem;
    border-radius: 0.5rem;
    text-align: center;
    min-width: 300px;
    max-width: 90%;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.modal-buttons {
    margin-top: 1rem;
    display: flex;
    justify-content: center;
    gap: 1rem;
}


/* ============================
   Mobile notif panel
============================ */
#mobileNotifPanel {
    position: fixed;
    top: 0;
    right: -100%; /* caché */
    width: 100%;
    max-width: 100%;
    height: 100%;
    background: #fff;
    z-index: 1500;
    box-shadow: -4px 0 12px rgba(0,0,0,0.2);
    transition: right 0.3s ease;
    padding: 1rem;
}

#mobileNotifPanel.show {
    right: 0;
}

#mobileNotifPanel.d-none {
    display: block !important; /* force l'affichage */
}

#closeNotifPanel {
    display: block;
    margin-bottom: 1rem;
    background: none;
    border: none;
    font-size: 1rem;
    cursor: pointer;
}

/* Desktop : on cache complètement */
@media (min-width: 769px) {
    #mobileNotifPanel {
        display: none !important;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .sidebar-actions {
        display: flex !important; /* visible sur mobile */
    }

    .row.g-3 > [class*="col-"] {
        flex: 0 0 100%;
        max-width: 100%;
    }

    .card {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }

    .hamburger {
        display: block;
    }

    main, .content {
        flex: 1 0 auto; /* s'étire pour remplir l'espace restant */
        margin-left: 0;  /* supprime la marge */
        padding: 1rem;   /* padding réduit sur mobile */
    }
    .navbar h5 {
        margin-left: 50px; /* décale le titre à droite pour laisser la place au hamburger */
        font-size: 1rem;   /* optionnel : réduire un peu la taille du texte */
    }
}
