﻿/* Default = Desktop -> check app.css */

/* navbar */
#NavBar {
    display: flex;
    flex-direction: row;
    align-items: center;
    width: 100%;
    z-index: 1030;
    height: var(--navbar-height);
    color: var(--white-color);
    background-color: var(--turquoise-color);
}

.navbar-separator {
    color: var(--dark-teal-color);
    height: 2px;
    margin: 0.5rem 0;
}

.navbar-mobile-logo {
    display: none;
    height: var(--navbar-height);
    width: auto;
    flex-shrink: 0;
    transition: 0.2s ease;
}

.navbar-mobile-img {
    width: auto;
    height: 100%;
    object-fit: contain;
}

.top-bar-options {
    margin-left: auto;
}

.navbar-notif-frame {
    position: absolute;
    right: -12px;
    top: calc(100% + 8px);
    min-width: 300px;
    background: white;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
    list-style: none;
    padding: 0.5rem 0;
    margin: 0;
    transform-origin: top right;
/*    transform: scale(0.92) translateY(-8px);*/
/*    opacity: 0;*/
/*    pointer-events: none;*/
    transition: transform 0.35s cubic-bezier(0.77, 0.2, 0.05, 1), opacity 0.25s ease;
    z-index: 2000;
    text-decoration: none;
}

.navbar-notif-empty {
    text-align: center;
    padding: 0.5rem 1rem;
/*    font-weight: bold;*/
}

#adminMenu {

}

.admin-menu-backdrop {
    display: none;
}

/* La deconnexion du header (top-bar-options) n'est visible que sur desktop
   (mobile-hidden la cache) ; sans ca, la version du menu burger restait
   affichee aussi, donnant deux moyens de se deconnecter en meme temps. */
.desktop-hidden {
    display: none;
}

/* === Admin Burger Menu === */

.admin-menu-toggle {
    display: block;
    position: relative;
    user-select: none;
    -webkit-user-select: none;
}

.admin-burger {
    --burger-width: 26px;
    --burger-line-height: 3px;
    --burger-line-active-height: 4px;
    --burger-gap: 5px;
    --burger-color: var(--mint-color);
    --burger-active-color: var(--white-color);

    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--burger-gap);
    width: var(--burger-width);
    cursor: pointer;
}

.admin-burger__checkbox {
    position: absolute;
    inset: -7px -9px;
    width: 44px;
    height: 36px;
    margin: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
    -webkit-touch-callout: none;
}

.admin-burger__line {
    display: block;
    width: var(--burger-width);
    height: var(--burger-line-height);
    background: var(--burger-color);
    border-radius: 999px;
    transform-origin: left center;
    z-index: 1;
    transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1), 
            background 0.5s cubic-bezier(0.77, 0.2, 0.05, 1), 
            opacity 0.35s ease,
            height 0.35s ease,
            margin 0.35s ease;
}

.admin-burger__checkbox:checked ~ .admin-burger__line {
    background: var(--burger-active-color);
/*    margin-left: 1px;*/
}

.admin-burger__checkbox:checked ~ .admin-burger__line--top {
    transform: rotate(45deg) translate(1px, -1px);
    height: var(--burger-line-active-height);
}

.admin-burger__checkbox:checked ~ .admin-burger__line--middle {
    opacity: 0;
    transform: scaleX(0);
}

.admin-burger__checkbox:checked ~ .admin-burger__line--bottom {
    transform: rotate(-45deg) translate(0px, 2px);
    height: var(--burger-line-active-height);
}


/* Viewport Content */
.viewport-content-mobile {
    display: none;
}

.viewport-content-fallback {
    margin: 0 auto;
    padding: 2rem 1.5rem;
    border-radius: 1.5rem;
    background: #fff;
    text-align: center;
    max-width: 500px;
}


.register-form {
    padding: 2rem 1.5rem;
}


/* Mobile card */
.mobile-card {
/*    background-color: white;*/
}

.mobile-card-title {
    font-weight: bold;
    text-align: center;
    margin-bottom: 2rem;
}

.mobile-card .card {
    background-color: var(--light-blue);
    border-radius: 0.75rem;
    border: none;
    padding: 0.25rem;
}

.mobile-card .card .card-title {
    font-weight: bold;
    margin-bottom: 0;
}


/* ============ TABLET ============ */

@media (max-width: 1024px) {
    /* Tablet and below */
    .dashboard-stat-bar {
        grid-template-columns: 100%;
    }
}


/* ============ MOBILE ============ */

@media (max-width: 768px) {
    /* Variables */
    :root {
        --navbar-height: 7rem;
        --admin-subnav-height: 0;
    }
    .register-container {
        padding: unset;
    }
    .entry-card-wrapper {
       
        flex-direction: column;
    }

    .register-form {
        padding: 1.5rem 1rem;
    }

    .desktop-hidden {
        display: list-item;
    }

    /* Les lignes label+champ (form-content-row) sont cote a cote sur desktop ;
       sur mobile ca ecrase le champ (label a largeur fixe). On empile a la place. */
    .form-content-row {
        flex-direction: column;
        align-items: stretch;
        gap: 0.3em;
    }

    .form-content-row label {
        min-width: unset;
    }

    .form-content-row .form-control {
        width: 100%;
    }

    .mobile-hidden {
        display: none !important;
        pointer-events: none;
        user-select: none;
        cursor: default;
    }

    .huge-title {
        font-size: 3.25rem;
        width: fit-content;
        margin-top: 2rem;
        margin-left: auto;
        margin-right: auto;
        overflow-wrap: anywhere;
    }

    [class*="btn-bar"] {
        gap: 0.3rem;
    }

    /* Viewport */
    .viewport-content-desktop {
        display: none;
    }

    .viewport-content-mobile {
        display: block;
    }

    /* Le message "page non disponible en mobile" doit se sentir comme une
       carte centree (pas collee au haut de l'ecran) ; le vrai contenu mobile
       (listes, formulaires) doit lui rester ancre en haut comme d'habitude. */
    .viewport-content-mobile:has(.viewport-content-fallback) {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-height: calc(100vh - var(--navbar-height) - 3.75rem);
    }

    .vp-content-fallback-title {
        font-weight: bold;
        margin-bottom: 1.5rem;
        text-align: center;
    }

    .vp-content-fallback-text {
        text-align: left;
        font-size: large;
        line-height: 1.4;
        margin-bottom: 1.5rem;
    }

    /* navbar */
    #NavBar {
        padding: 0;
        padding-right: 1.5rem;
    }

    .sub-navbar {
        display: none;
        height: 0;
    }

    .navbar-mobile-logo {
        display: block;
        /* Le logo est calque sur --navbar-height (7rem) par defaut : ca le rend
           aussi large que haut (~160px), ce qui laisse a peine assez de place
           pour la cloche/langue/burger et les fait passer a la ligne au moindre
           ecart de largeur. On le limite a une taille fixe plus raisonnable. */
        height: var(--mobile-navbar-height);
        max-width: 45vw;
        margin-left: 0.5rem;
    }

    /* Fond floute derriere le menu, comme une vraie modale : on ne doit pas
       pouvoir lire ce qu'il y a dessous pendant qu'il est ouvert. */
    .admin-menu-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(6, 79, 99, 0.55);
        backdrop-filter: blur(6px);
        -webkit-backdrop-filter: blur(6px);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
        z-index: 1090;
    }

    #adminMenuToggle:has(input:checked) .admin-menu-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    #adminMenu {
        position: fixed;
        top: 50%;
        left: 50%;
        right: auto;
        transform-origin: center;
        transform: translate(-50%, -50%) scale(0.92);
        width: min(90vw, 360px);
        max-height: calc(100vh - 100px);
        overflow-y: auto;
        overflow-x: hidden;
        border-radius: 16px;
        padding: 0.75rem 1rem;
    }

    #adminMenuToggle:has(input:checked) #adminMenu {
        transform: translate(-50%, -50%) scale(1);
    }

    #adminMenu li {
/*        max-width: 90%;*/
    }

    .admin-menu-item {
        max-width: unset;
        font-size: 1.1rem;
        gap: 0.75rem;
        height: 60px;
        border-radius: 12px;
    }

    .admin-burger {
        --burger-width: 32px;
        --burger-line-height: 4px;
        --burger-line-active-height: 5px;
        --burger-gap: 6px;
    }

    .top-bar-options {
        gap: 0.75rem;
    }

    /* Le tableau de bord (menu de filtres + contenu) n'avait aucune regle
       mobile : la barre laterale a 20% de largeur ecrasait tout sur un
       telephone. On empile le menu au-dessus du contenu a la place. */
    .Dashboard-Layout {
        flex-direction: column;
    }

    .Dashboard-content-lmenu,
    .Dashboard-Content-rcontent {
        width: 100%;
    }

    .Dashboard-content-lmenu {
        position: static;
        height: auto;
    }

    .dashboard-section-selector {
        padding-left: 1rem;
        padding-right: 1rem;
        padding-top: 1rem;
    }

    .Dashboard-Content-rcontent {
        padding: 1rem;
    }

    .navbar-btn {
        font-size: 1.2rem !important;
    }

    .navbar-notif-frame {
        right: 24px;
        top: calc(100% + 16px);
        border-radius: 16px;
        padding: 0.75rem 1rem;
        transform: translateX(50%);
    }

    .navbar-notif-frame li {
        font-size: 1.1rem;
    }

    /* Mobile and below */
    /* 100vh is the LARGEST possible viewport (address bar hidden) on
       mobile browsers -- with the address bar visible (the common case
       right after a page loads), the real visible area is shorter, so
       #main-div and its internal #content scroll area could compute
       taller than what's actually reachable/interactable, effectively
       trapping the bottom of long pages out of reach. 100dvh tracks the
       real, current visible viewport instead. */
    #main-div {
        height: 100dvh;
    }

    #content {
        padding: 1.75rem 1rem 2rem;
        margin-top: var(--navbar-height);
    }


    .burger-menu {
        display: block !important;
    }

    .mobile-menu {
        display: flex !important;
    }

    .btn-mobile-menu {
        display: block;
    }

    .top-bar-image {
        display: none;
    }


    /* Mobile card */
    .mobile-card {
        margin: 0 auto;
        padding: 2rem 1.5rem;
        border-radius: 1.5rem;
        background: #fff;
        text-align: center;
        max-width: 500px;
    }

    .mobile-card .row {
        margin: 0;
        padding: 0;
        width: 100%;
        gap: 1.5rem;
    }

    .mobile-card [class*="col-"] {
        padding: 0;
    }

    .mobile-card-title {
        margin-bottom: 1.5rem;
    }

    /* Zone tactile plus large pour le lien "Renvoyer le code" sur mobile. */
    .mfa-resend-btn {
        padding: 0.5rem 0.75rem;
        font-size: 1rem;
    }

    .fic-open-btn {
        width: 100%;
    }
}


/* ============ SMALL PHONE ============ */

@media (max-width: 480px) {
    /* Small phones */
}

@media (max-width: 768px) {
    .form-select-component-wrapper .form-select-component-option-display + div {
        bottom: 100%;
        top: auto;
    }

    /* RessourceDisplay's back/previous/next row: on a narrow card the two
       .form-action-buttons groups half-wrap awkwardly (justify-content:
       space-between leaves an uneven gap). Stack them as full-width rows
       instead, each one centering its own button(s). */
    .resource-nav-row {
        flex-direction: column;
        align-items: stretch;
    }

    .resource-nav-row .form-action-buttons {
        justify-content: center;
    }
}
