/**
* Path: css/responsive.css
* CSS pour rendre le site responsive
*/

/* Pour les écrans de 850px et moins */
@media screen and (max-width: 850px) {
    /* Généralités */
    body {
        display: grid;
        grid-template-areas: 
        "header"
        "main";
        grid-template-rows: auto 1fr;
        grid-template-columns: 1fr;
        height: auto;
        overflow: visible;
    }

    /* Header */
    header {
        height:80px;
        gap: 10px;
        flex-direction: row;
        justify-content: space-between;
        border-right:none;
        border-bottom: 1px solid gray;
    }

    .logo--reduit {
        width: 60px;
    }

    .menu {
        flex-direction: row;
        justify-content: center;
        width:100%;
        gap: 1vw;
        padding: 0;
    }
    .menu__item, .menu__user {
        flex-direction: row;
    }
    .menu__item a {
        flex:1;
    }
    .menu .material-symbols-outlined, #compte_menu .material-symbols-outlined {
        font-size: clamp(var(--small-icon), 2vw + 1rem, var(--big-icon));
    }
    .menu--reduit .material-symbols-outlined, #compte_menu.compte--reduit .material-symbols-outlined {
        font-size: clamp(calc(var(--small-icon) - 4px), 2vw + 1rem, calc(var(--small-icon) + 4px));
    }
    .menu--reduit {
        gap:1.5vw;
    }
    .menu--reduit .texte_menu {
        display: flex;
    }

    .menu__user ul li.deroulant {
        height: 80px;
        width: 60px;
    }
    .menu__user.menu--reduit ul .sous, .menu__user ul .sous {
        right: 5px; /* Aligne le bord droit du sous-menu avec le bord droit du parent */
        left: auto;
        top: 79px; /* Positionne le sous-menu juste en dessous du parent */
        height: max-content;
        border-top:none;
        border-left: 1px solid gray;
        border-radius: 0 0px 5px 5px;
    }

    .non-connecte .texte_menu {
        display: none;
    }

    #toggle_conteneur {
        display:none;
    }

    main {
        padding: 10px;
        overflow: visible;
    }

    .contenu {
        padding:0px;
    }
    .contenu__header {
        margin: -10px 0 25px -10px;
        width: calc(100% + 20px);
        flex-wrap: wrap;
        gap: 10px;
    }
    .contenu__header__title,
    .contenu__header h1 {
        min-width: 0;
        flex-wrap: wrap;
        overflow-wrap: anywhere;
    }
}


/* Pour les écrans de 600px et moins */
@media screen and (max-width: 728px) {
    #compte_header .texte_menu {
        display:none;
    }

    header .material-symbols-outlined {
        font-size: 35px;
    }
    .entete_batiment {
        gap: 5px;
    }
    .titre_page {
        width: calc(100% - 40px);
    }

    /* Main */

    .flex_column .row__text .row__email {
        flex-direction: column;
        align-items: flex-start;
    }

    .titre_page .info-symbols {
        display:none;
    }
    .description_batiment {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }

    .synthese {
        display: flex;
        flex-direction: column;
    }
    .liens-batiment ul li#notices {
        display: block;
    }
    .liens-batiment ul li#notice_secu, .liens-batiment ul li#notice_accessibilite {
        display: none;
    }
}

/* Pour les écrans de 400px et moins */
@media only screen and (max-width: 400px) {
    main {
        padding: 10px 0;
    }

    /* main n'a plus de marge laterale : l'en-tete reprend la largeur exacte. */
    .contenu__header {
        margin: -10px 0 25px 0;
        width: 100%;
    }

    .contenu {
        border-radius: 0px;
    }

    .titre_page.titre_page--deuxcolonnes {
        display: grid;
        grid-template-areas: "titre recherche bouton";
        align-items: center;
        grid-template-columns: 1fr auto auto;
        column-gap: 10px;
    }

    #recherche_conteneur {
        display:none;
    }

    #recherche_conteneur.show {
        display:flex;
        position: fixed;
        top:0;
        left:0;
        width:100%;
        height:79px;
        background-color: white;
        align-items: center;
        gap: 20px;
        padding: 0 10px;
    }

    #recherche_conteneur.show #fleche_retour {
        display:block;
        cursor: pointer;
        font-size: 25px;
    }

    #recherche_conteneur.show form {
        flex:1;
    }

    #recherche_icone {
        display:block;
        grid-area: recherche;
        cursor: pointer;
    }

    .filtres .filtre_texte {
        display:none;
    }

    .description_batiment #map {
        display:none;
    }
}

/* Liens visibles uniquement dans le burger mobile */
.menu__item .menu__item--mobile-only {
    display: none;
}

/* ── Burger menu sur mobile (≤ 600px) ──────────────────────────────────────── */
@media screen and (max-width: 600px) {

    /* Afficher le nom "NORESA" à côté du logo sur mobile */
    .logo--reduit {
        width: auto;
    }
    .logo--reduit > a {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 8px;
    }
    .logo--reduit .logo__nom {
        display: block;
    }
    .logo--reduit .logo__image img {
        width: 40px;
        height: 40px;
    }

    /* Cacher le menu utilisateur (initiales + dropdown) */
    #menu_user {
        display: none;
    }

    /* Afficher le bouton burger, cacher le toggle desktop */
    #toggle_conteneur {
        display: flex;
        width: auto;
        margin: 0;
        padding: 0 8px;
        flex-direction: row;
        align-items: center;
        justify-content: center;
    }
    #toggle_menu {
        display: none;
    }
    #open_menu {
        display: block;
        font-size: 30px;
        cursor: pointer;
        padding: 8px;
        color: var(--muted);
        transition: transform 0.25s ease;
    }
    #open_menu.is-open {
        transform: rotate(90deg);
    }

    /* La nav prend le moins de place possible dans l'en-tête */
    header {
        padding: 0 16px;
        box-sizing: border-box;
        width: 100%;
    }
    nav {
        flex: none;
        width: 0;
        min-width: 0;
        overflow: visible;
        padding: 0;
        margin: 0;
    }
    .menu {
        width: auto;
        flex: none;
    }
    #menu {
        width: auto;
        overflow: visible;
        position: static;
    }

    /* Cacher les items de navigation par défaut */
    .menu__item {
        display: none;
        position: fixed;
        top: 80px;
        left: 0;
        right: 0;
        width: 100%;
        flex-direction: column;
        background-color: var(--bg-color);
        border-bottom: 1px solid gray;
        z-index: 500;
        padding: 6px 0;
        box-shadow: 0 6px 16px rgba(0,0,0,.12);
    }

    /* Ouvrir le menu burger */
    #menu.show .menu__item {
        display: flex;
    }

    /* Style des liens dans le menu ouvert */
    #menu.show .menu__item a {
        flex-direction: row;
        justify-content: flex-start;
        align-items: center;
        padding: 13px 20px;
        gap: 12px;
        flex: none;
        border-radius: 0;
        width: 100%;
    }
    #menu.show .menu__item .texte_menu {
        display: block;
        font-size: 1rem;
        font-weight: 500;
    }
    #menu.show .menu__item .material-symbols-outlined {
        font-size: 22px;
    }

    /* Afficher les liens mobile-only quand le burger est ouvert */
    #menu.show .menu__item--mobile-only {
        display: flex;
    }
    /* Séparateur au-dessus du premier lien mobile-only */
    #menu.show .menu__item--mobile-only:first-of-type {
        border-top: 1px solid var(--border-color, #e5e7eb);
        margin-top: 4px;
        padding-top: 14px;
    }
}