/* RESET */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: #f5f7fb;
    color: #1f2937;
}


/* SIDEBAR */

.sidebar {
    position: fixed;
    top: 0;
    left: 0;

    width: 240px;
    height: 100vh;

    background: #0f172a;
    color: white;
    
    display: flex;
    flex-direction: column;
}

.logo {
    padding: 25px 20px;
    font-size: 27px;
    font-weight: bold;

    border-bottom: 1px solid #1e293b;
}

.logo span {
    color: #3b82f6;
}

.sidebar-nav {
    padding: 20px 12px;

    display: flex;
    flex-direction: column;

    gap: 6px;
}

.sidebar a {
    color: #cbd5e1;
    text-decoration: none;
    padding: 13px 15px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    transition: 0.2s;
}

.sidebar a:hover {
    background: #1e293b;
    color: white;
}

.sidebar-bottom {
    margin-top: auto;
    padding: 15px 12px;
    border-top: 1px solid #1e293b;
}


/* FORMULAIRE DE DÉCONNEXION */

.logout-form {
    margin: 0;
    padding: 0;
}

.logout-button {
    width: 100%;

    border: none;
    background: transparent;

    color: #cbd5e1;

    padding: 13px 15px;
    border-radius: 8px;

    display: flex;
    align-items: center;
    gap: 12px;

    font-family: inherit;
    font-size: inherit;
    text-align: left;

    cursor: pointer;

    transition: 0.2s;
}

.logout-button:hover {
    background: #1e293b;
    color: white;
}


/* MAIN */

.main-content {
    margin-left: 240px;
    min-height: 100vh;
}


/* TOPBAR */

.topbar {
    position: fixed;
    top: 0;
    right: 0;

    height: 75px;

    background: white;
    border-bottom: 1px solid #e5e7eb;

    padding: 0 30px;

    display: flex;
    align-items: center;
    justify-content: space-between;

    z-index: 900;
}

.main-content .topbar {
    left: 240px;
}

.topbar h2 {
    font-size: 21px;
}

.topbar-title {
    display: flex;
    flex: 1;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.topbar-title h2 {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Bouton « page précédente » */
.back-button {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #374151;
    cursor: pointer;
}

.back-button:hover {
    background: #f3f4f6;
    color: #111827;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.avatar {
    width: 38px;
    height: 38px;

    border-radius: 50%;

    background: #e0e7ff;

    display: flex;

    align-items: center;
    justify-content: center;
}


/* CONTENT */

.content {
    padding: 105px 30px 30px;
}


/* ================================
   RESPONSIVE
================================ */

/* Bouton menu : caché sur PC */

.menu-toggle {
    display: none;
}


/* Overlay : caché par défaut */

.sidebar-overlay {
    display: none;
}


/* TABLETTE */

@media (max-width: 1024px) {

    .sidebar {
        width: 200px;
    }

    .main-content {
        margin-left: 200px;
    }

    .topbar {
        padding: 0 20px;
    }

    .content {
        padding: 20px;
    }

    .main-content .topbar {
        left: 200px;
    }
}


/* MOBILE */

@media (max-width: 768px) {

    /* Sidebar cachée hors écran */

    .sidebar {
        width: 240px;
        left: -240px;

        transition: left 0.3s ease;

        z-index: 1000;
    }

    /* Sidebar ouverte */

    .sidebar.open {
        left: 0;
    }

    /* Contenu prend toute la largeur */

    .main-content {
        margin-left: 0;
    }

    /* Barre supérieure */

    .topbar {
        height: 65px;
        padding: 0 15px;
        gap: 15px;
    }

    .topbar h2 {
        font-size: 18px;
    }

    /* Bouton menu */

    .menu-toggle {
        display: flex;

        align-items: center;
        justify-content: center;

        width: 40px;
        height: 40px;

        border: none;
        border-radius: 8px;

        background: #f1f5f9;

        font-size: 22px;

        cursor: pointer;
    }

    /* Overlay */

    .sidebar-overlay {
        position: fixed;

        top: 0;
        left: 0;

        width: 100%;
        height: 100%;

        background: rgba(0, 0, 0, 0.4);

        z-index: 999;
    }

    .sidebar-overlay.show {
        display: block;
    }

    /* Contenu */

    .content {
        padding: 85px 15px 15px;
    }

    /* Informations utilisateur */

    .user-info {
        font-size: 14px;
    }

    .avatar {
        width: 34px;
        height: 34px;
    }

    .main-content .topbar {
        left: 0;
    }
}


/* PETITS TÉLÉPHONES */

@media (max-width: 480px) {

    .topbar {
        padding: 0 10px;
    }

    .topbar h2 {
        font-size: 16px;
    }

    .user-info span {
        display: none;
    }

    .content {
        padding: 80px 10px 10px;
    }
}



/* =========================================
   MESSAGES FLASH — CONFIRMATION ET ERREUR
   ========================================= */

.flash-messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
    margin-bottom: 16px;
}

.flash-message {
    padding: 12px 16px;
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.flash-error {
    color: #991b1b;
    background: #fef2f2;
    border-color: #fecaca;
}

.flash-success {
    color: #166534;
    background: #f0fdf4;
    border-color: #bbf7d0;
}

.flash-warning {
    color: #92400e;
    background: #fffbeb;
    border-color: #fde68a;
}

.flash-info {
    color: #1e40af;
    background: #eff6ff;
    border-color: #bfdbfe;
}

/* Adaptation aux petits écrans */
@media (max-width: 480px) {
    .flash-messages {
        margin-bottom: 12px;
    }

    .flash-message {
        padding: 11px 12px;
        font-size: 13px;
    }
}


/* =========================================
   MENU D'ACTIONS (icône réglages) — partagé par plusieurs pages
   ========================================= */

.actions-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #4b5563;
    cursor: pointer;
}

.actions-toggle:hover,
.actions-toggle[aria-expanded="true"] {
    background: #f3f4f6;
    color: #111827;
}

.actions-list {
    position: fixed;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    min-width: 190px;
    padding: 6px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #ffffff;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.actions-list[hidden] {
    display: none;
}

.actions-list form {
    margin: 0;
}

.action-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    width: 100%;
    box-sizing: border-box;
    padding: 9px 12px;
    border: none;
    border-radius: 7px;
    background: transparent;
    color: #111827;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.action-item:hover {
    background: #f3f4f6;
}

.action-item small {
    color: #9ca3af;
    font-size: 11px;
    font-weight: 400;
}

.action-item.is-danger {
    color: #b42318;
}

.action-item.is-danger:hover {
    background: #fef2f2;
}

.action-item.is-disabled {
    color: #9ca3af;
    cursor: not-allowed;
}

.action-item.is-disabled:hover {
    background: transparent;
}
