/* ==========================================================
   CIS LEYME - STRUCTURE GÉNÉRALE
   ========================================================== */

.app-body {
    margin: 0;
    min-height: 100vh;

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


/* ==========================================================
   BARRE SUPÉRIEURE
   ========================================================== */

.app-header {
    position: fixed;

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

    z-index: 1000;

    height: 70px;

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

    padding: 0 24px;

    background: var(--color-primary);
    color: #ffffff;
}


.app-header__brand,
.app-header__user {
    display: flex;
    align-items: center;

    gap: 16px;
}


/* ==========================================================
   IDENTITÉ CIS LEYME
   ========================================================== */

.app-brand {
    display: flex;
    align-items: center;

    gap: 12px;

    color: #ffffff;

    text-decoration: none;

    font-weight: 700;
}


.app-brand__logo {
    display: block;

    width: 100px;
    height: 100px;

    object-fit: contain;

    flex-shrink: 0;
}


.app-brand__name {
    font-size: 1.05rem;

    white-space: nowrap;
}


.app-user-name {
    font-size: 0.9rem;
}


/* ==========================================================
   BOUTON DU MENU MOBILE
   ========================================================== */

.app-menu-toggle {
    display: none;

    border: 0;

    background: transparent;
    color: #ffffff;

    font-size: 1.6rem;

    cursor: pointer;
}


/* ==========================================================
   STRUCTURE PRINCIPALE
   ========================================================== */

.app-layout {
    display: flex;

    min-height: 100vh;

    /*
     * Compensation de la barre supérieure fixe.
     */
    padding-top: 70px;
}


/* ==========================================================
   MENU LATÉRAL
   ========================================================== */

.app-sidebar {
    position: fixed;

    top: 70px;
    bottom: 0;
    left: 0;

    width: 250px;

    overflow-y: auto;

    background: #ffffff;

    border-right: 1px solid var(--color-border);
}


.app-navigation {
    padding: 18px 12px;
}


.app-navigation__section {
    margin: 24px 12px 8px;

    color: var(--color-muted);

    font-size: 0.72rem;
    font-weight: 700;

    text-transform: uppercase;

    letter-spacing: 0.08em;
}


.app-navigation__link {
    display: flex;
    align-items: center;

    gap: 12px;

    min-height: 44px;

    padding: 0 12px;
    margin: 3px 0;

    border-radius: 8px;

    color: var(--color-text);

    text-decoration: none;

    transition:
        background 0.15s ease,
        color 0.15s ease;
}


.app-navigation__link:hover {
    background: var(--color-background);
}


.app-navigation__link.is-active {
    background: var(--color-primary);

    color: #ffffff;
}


.app-navigation__link.is-disabled {
    opacity: 0.45;

    cursor: default;
}


.app-navigation__link.is-disabled:hover {
    background: transparent;
}


.app-navigation__icon {
    width: 22px;

    text-align: center;

    flex-shrink: 0;
}


/* ==========================================================
   COLONNE PRINCIPALE
   ========================================================== */

.app-main {
    width: calc(100% - 250px);

    min-height: calc(100vh - 70px);

    margin-left: 250px;

    display: flex;
    flex-direction: column;
}


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

.app-content {
    width: 100%;

    padding: 32px;

    /*
     * Le contenu occupe l'espace restant et maintient
     * naturellement le footer en bas de page.
     */
    flex: 1;
}


/* ==========================================================
   PIED DE PAGE
   ========================================================== */

.app-footer {
    width: 100%;

    padding: 18px 32px;

    text-align: center;

    font-size: 0.78rem;

    color: var(--color-muted);

    background: #ffffff;

    border-top: 1px solid var(--color-border);
}


.app-footer strong {
    color: var(--color-text);

    font-weight: 600;
}


/* ==========================================================
   COMPOSANTS PROPRES AU LAYOUT
   ========================================================== */

.button-secondary {
    background: rgba(255, 255, 255, 0.12);

    color: #ffffff;

    border: 1px solid rgba(255, 255, 255, 0.35);
}


.button-secondary:hover {
    background: rgba(255, 255, 255, 0.22);
}


.alert-success {
    background: #eaf7ef;

    border: 1px solid #b9dfc7;

    color: #216e3a;
}


/* ==========================================================
   TABLETTE
   ========================================================== */

@media (max-width: 900px) {

    .app-user-name {
        display: none;
    }


    .app-content {
        padding: 24px;
    }

}


/* ==========================================================
   SMARTPHONE
   ========================================================== */

@media (max-width: 700px) {

    .app-header {
        height: 60px;

        padding: 0 14px;
    }


    .app-layout {
        padding-top: 60px;
    }


    .app-menu-toggle {
        display: block;
    }


    /*
     * Le logo reste affiché mais le nom de l'application
     * disparaît pour conserver de la place.
     */
    .app-brand__name {
        display: none;
    }


    .app-brand__logo {
        width: 84px;
        height: 84px;
    }


    /*
     * Le menu est placé hors écran jusqu'à l'appui
     * sur le bouton ☰.
     */
    .app-sidebar {
        top: 60px;

        width: 270px;

        transform: translateX(-100%);

        transition: transform 0.2s ease;

        z-index: 900;

        box-shadow:
            4px 0 12px rgba(0, 0, 0, 0.08);
    }


    .app-sidebar.is-open {
        transform: translateX(0);
    }


    /*
     * Le contenu récupère toute la largeur de l'écran.
     */
    .app-main {
        width: 100%;

        min-height: calc(100vh - 60px);

        margin-left: 0;
    }


    .app-content {
        width: 100%;

        margin-left: 0;

        padding: 20px 16px;
    }


    .app-header__user {
        gap: 8px;
    }


    .app-header__user .button {
        padding: 8px 10px;

        font-size: 0.82rem;
    }


    .app-footer {
        padding: 16px;

        font-size: 0.72rem;
    }

}

/* ==========================================================
   CIS LEYME - BOUTON DU MENU ADMINISTRATION

   Bouton bleu, indépendant du menu principal.
   Son affichage est contrôlé dans le layout Blade.
   ========================================================== */

.app-admin-toggle {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 42px;
    height: 42px;

    flex-shrink: 0;

    border: 1px solid #2563eb;
    border-radius: 8px;

    background: #2563eb;
    color: #ffffff;

    font-size: 1.5rem;
    line-height: 1;

    cursor: pointer;

    transition: background 0.2s ease;
}

/* Effet au passage de la souris */
.app-admin-toggle:hover {
    background: #1d4ed8;
}

/* Adaptation aux petits écrans */
@media (max-width: 700px) {
    .app-admin-toggle {
        width: 36px;
        height: 36px;

        font-size: 1.3rem;
    }
}


/* ==========================================================
   PANNEAU D'ADMINISTRATION - CÔTÉ DROIT
   ========================================================== */

.app-admin-sidebar {
    position: fixed;

    top: 70px;
    right: 0;
    bottom: 0;

    width: 280px;

    overflow-y: auto;

    background: #ffffff;
    border-left: 3px solid #2563eb;

    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);

    z-index: 950;

    /* Panneau masqué à droite par défaut */
    transform: translateX(100%);
    visibility: hidden;

    transition:
        transform 0.25s ease,
        visibility 0.25s ease;
}

/* Panneau ouvert */
.app-admin-sidebar.is-open {
    transform: translateX(0);
    visibility: visible;
}

/* Adaptation smartphone */
@media (max-width: 700px) {
    .app-admin-sidebar {
        top: 60px;
        width: min(300px, 90vw);
    }
}


/* ==========================================================
   CIS LEYME - COULEURS DU MENU ADMINISTRATION
   Le menu gauche reste rouge.
   Le menu droit utilise le bleu.
   ========================================================== */

/* Lien actif dans le panneau droit */
.app-admin-sidebar .app-navigation__link.is-active {
    background: #2563eb;
    color: #ffffff;
}

/* Survol des liens non actifs */
.app-admin-sidebar .app-navigation__link:not(.is-active):hover {
    background: #eff6ff;
    color: #1d4ed8;
}

/* Titre de la section Administration */
.app-admin-sidebar .app-navigation__section {
    color: #2563eb;
}
