/* Page principale */
.page {
    display: flex;
    flex-direction: column;
    height: 100vh;
    width: 100%;
}

main {
    flex: 1;
}

/* Conteneur de layout principal */
.layout-container {
    display: flex;
    flex-direction: column;
    height: 100%; /* Prend toute la hauteur de la fenêtre (viewport height) */
    width: 100%; /* Prend toute la largeur de la fenêtre (viewport width) */
    overflow: hidden; /* Empêche les barres de défilement, utile pour un layout sans débordement */
}


/* Conteneur principal avec sidebar et contenu */
.main-container {
    display: flex;
    flex: 1;
    margin-top: 60px; /* Hauteur de la top-bar */
    height: calc(100vh - 60px);
    overflow: hidden;
}


/* Barre supérieure fixe */
.top-bar {
    height: 60px;
    background-color: #e9ecef;
    border-bottom: 1px solid #dee2e6;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.top-bar-content {
    height: 100%;
    padding: 0 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Partie gauche avec logo + titre */
.top-bar-left {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Menu Burger */
.burger-menu {
    display: none;
    flex-direction: column;
    justify-content: space-around;
    width: 30px;
    height: 25px;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 0;
    z-index: 1001;
}

    .burger-menu span {
        width: 100%;
        height: 3px;
        background-color: #212529;
        border-radius: 10px;
        transition: all 0.3s ease;
    }

    .burger-menu.active span:nth-child(1) {
        transform: rotate(45deg) translate(8px, 8px);
    }

    .burger-menu.active span:nth-child(2) {
        opacity: 0;
    }

    .burger-menu.active span:nth-child(3) {
        transform: rotate(-45deg) translate(7px, -7px);
    }

/* Overlay pour fermer le menu */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 60px;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s ease;
}

    .sidebar-overlay.active {
        display: block;
        opacity: 1;
    }

/* Logo */
.logo-link {
    display: flex;
    align-items: center;
    transition: opacity 0.2s ease;
}

    .logo-link:hover {
        opacity: 0.8;
    }

    .logo-link img {
        vertical-align: middle;
    }

/* Titre de l'application */
.app-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: #212529;
    text-decoration: none;
    margin: 0;
}

    .app-title:hover {
        color: #0056b3;
    }

/* Partie droite - Menu utilisateur */
.top-bar-right {
    display: flex;
    align-items: center;
}

.user-menu {
    position: relative;
}

/* Bouton du menu utilisateur */
.user-menu-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .user-menu-button:hover {
        background-color: #f0f0f0;
        transform: scale(1.05);
    }

    .user-menu-button img {
        border-radius: 50%;
        display: block;
    }

/* Menu déroulant utilisateur */
.user-menu-dropdown {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background-color: white;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1001;
}

    .user-menu-dropdown.show {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }

/* Items du menu déroulant */
.dropdown-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1.25rem;
    color: #212529;
    text-decoration: none;
    transition: background-color 0.2s ease;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    cursor: pointer;
    font-size: 0.95rem;
}

    .dropdown-item:hover {
        background-color: #f8f9fa;
    }

    .dropdown-item:first-child {
        border-radius: 8px 8px 0 0;
    }

    .dropdown-item:last-child {
        border-radius: 0 0 8px 8px;
    }

/* Icône dans le menu déroulant */
.dropdown-icon {
    margin-right: 0.75rem;
    font-size: 1.1rem;
}

/* Séparateur dans le menu déroulant */
.dropdown-divider {
    height: 1px;
    background-color: #dee2e6;
    margin: 0.5rem 0;
}

/* Bouton de déconnexion */
.logout-btn {
    color: #dc3545;
    font-weight: 500;
}

    .logout-btn:hover {
        background-color: #fff5f5;
    }



.sidebar {
    width: 280px;
    background: linear-gradient(180deg, var(--secondary-color) , var(--main-color) );
    overflow-y: auto;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}



/* Conteneur de droite qui héberge le contenu principal et le footer */
.content-area {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.content-wrapper {
    flex: 1;
    overflow: auto;
    width: 100%;
    flex-direction: column;
    display:flex;

}

/* Contenu principal : scrollable si trop long */
.main-content {
    flex-grow: 1;
    overflow: auto;
    background-color: #f8f9fa;

}



.footer {
    padding: 1rem;
    background-color: #e9ecef;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

    .footer p {
        margin: 0;
        color: #6c757d;
    }



/* Bandeau supérieur (ancien style) */
.top-banner {
    padding: 0.5rem 1rem;
    background-color: #e9ecef;
    border-bottom: 1px solid #ccc;
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

/* Ancienne barre supérieure */
.top-row {
    background-color: #f7f7f7;
    border-bottom: 1px solid #d6d5d5;
    justify-content: flex-end;
    height: 3.5rem;
    display: flex;
    align-items: center;
}

    .top-row ::deep a,
    .top-row ::deep .btn-link {
        white-space: nowrap;
        margin-left: 1.5rem;
        text-decoration: none;
    }

        .top-row ::deep a:hover,
        .top-row ::deep .btn-link:hover {
            text-decoration: underline;
        }

        .top-row ::deep a:first-child {
            overflow: hidden;
            text-overflow: ellipsis;
        }



@media (max-width: 768px) {
    /* Afficher le bouton burger sur mobile */
    .burger-menu {
        display: flex;
    }

    /* Cacher le titre sur très petit écran */
    @media (max-width: 480px) {
        .app-title {
            display: none;
        }
    }

    /* Sidebar en position fixe cachée par défaut */
    .sidebar {
        position: fixed;
        top: 60px;
        left: 0;
        bottom: 0;
        width: 240px;
        z-index: 999;
        transform: translateX(-100%);
    }

        /* Sidebar visible quand active */
        .sidebar.active {
            transform: translateX(0);
            box-shadow: 2px 0 8px rgba(0, 0, 0, 0.3);
        }

    /* Le contenu prend toute la largeur sur mobile */
    .content-wrapper {
        width: 100%;
    }

    .top-bar-content {
        padding: 0 1rem;
    }

    .top-row {
        justify-content: space-between;
    }

        .top-row ::deep a,
        .top-row ::deep .btn-link {
            margin-left: 0;
        }
}

/* Desktop */
@media (min-width: 769px) {
    /* Cacher le bouton burger sur desktop */
    .burger-menu {
        display: none !important;
    }

    .page {
        flex-direction: row;
    }

    .sidebar {
        width: 240px;
        height: 100vh;
        position: sticky;
        top: 0;
    }

    .top-row {
        position: sticky;
        top: 0;
        z-index: 1;
    }

        .top-row.auth ::deep a:first-child {
            flex: 1;
            text-align: right;
            width: 0;
        }

    .top-row,
    article {
        padding-left: 2rem !important;
        padding-right: 1.5rem !important;
    }
}
                                