/* ======================================================
   BASE
   ====================================================== */

html {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    width: 100%;
    min-width: 0;
    margin: 0;
    background: #f6f9ff;
}

/*
 * Ne pas masquer globalement les débordements avec
 * overflow-x:hidden : cela pourrait cacher du contenu
 * ou affecter certains éléments sticky.
 */

/* ======================================================
   HEADER
   ====================================================== */

.rems-header {
    position: sticky;
    top: 0;
    z-index: 1030;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 18px;

    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0;
    padding: 12px clamp(10px, 2vw, 24px);

    border-bottom: 1px solid #ece8f5;
    background: rgba(255, 255, 255, .95);

    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.rems-header .rems-logo {
    flex: 0 1 auto;
    min-width: 0;
    max-width: 40%;
}

.rems-header .rems-logo a,
.rems-header .rems-logo picture {
    display: block;
    max-width: 100%;
}

.rems-header .rems-logo img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 58px;
    object-fit: contain;
}

/* ======================================================
   ACTIONS
   ====================================================== */

.rems-header .rems-actions {
    display: flex;
    flex: 1 1 260px;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;

    min-width: 0;
    max-width: 100%;
}

.rems-header .rems-actions > * {
    min-width: 0;
    max-width: 100%;
}

/* ======================================================
   USER INFO
   ====================================================== */

.rems-header .user-info {
    flex: 0 1 220px;
    min-width: 0;
    max-width: 220px;

    color: #625977;
    text-align: right;
    font-size: 13px;
    line-height: 1.5;
}

.rems-header .user-info strong,
.rems-header .user-info small {
    display: block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rems-header .user-info small {
    color: #9b91ab;
    font-size: 11px;
}

/* ======================================================
   LOGIN / LOGOUT
   ====================================================== */

.rems-header .rems-auth {
    display: inline-flex;
    flex: 0 1 auto;
    align-items: center;
    justify-content: center;
    gap: 7px;

    min-width: 0;
    max-width: 100%;
    margin: 0;
    padding: 9px 14px;

    border-radius: 12px;
    font-size: 13px;
    line-height: 1.5;
    text-align: center;
    text-decoration: none;
    white-space: normal;
    overflow-wrap: anywhere;
}

.rems-header .rems-auth i {
    flex-shrink: 0;
    color: inherit;
    font-size: 16px;
}

.rems-header .rems-auth span {
    min-width: 0;
}

/* ======================================================
   LANGUAGE DROPDOWN
   ====================================================== */

.rems-header .lang-dropdown {
    flex: 0 1 190px;
    min-width: 0;
    max-width: 100%;
}

.rems-header .lang-dropdown .dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;

    width: 100%;
    min-width: 0;
    max-width: 100%;

    /* Supprime notamment l'ancien margin-right:200px. */
    margin: 0 !important;
    padding: 9px 12px;

    border: 1px solid #e9e2f5;
    border-radius: 12px;
    background: #f5f1fc;
    color: #87709e;

    font-size: 13px;
    line-height: 1.5;
}

.rems-header .lang-dropdown .dropdown-toggle::after {
    flex-shrink: 0;
    margin-left: 2px;
}

.rems-header .rems-language-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.rems-header .lang-dropdown img {
    display: block;
    flex: 0 0 22px;
    width: 22px;
    height: 16px;
    max-width: 22px;
    border-radius: 3px;
    object-fit: cover;
}

.rems-header .lang-dropdown .dropdown-menu {
    min-width: 12rem;
    max-width: calc(100vw - 24px);
    max-height: min(360px, 60vh);
    padding: 7px;

    overflow-y: auto;
    border: 1px solid #eee7f6;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(98, 75, 136, .12);
}

.rems-header .lang-dropdown .dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;

    min-width: 0;
    padding: 10px;
    border-radius: 9px;

    color: #796789;
    font-size: 13px;
    white-space: normal;
    overflow-wrap: anywhere;
}

.rems-header .lang-dropdown .dropdown-item:hover,
.rems-header .lang-dropdown .dropdown-item:focus {
    background: #f5f0fc;
}

.rems-header .lang-dropdown .dropdown-item.active,
.rems-header .lang-dropdown .dropdown-item:active {
    background: #eee6fa;
    color: #70548e;
}

.rems-header .rems-language-option {
    flex: 1;
    min-width: 0;
    overflow-wrap: anywhere;
}

/* ======================================================
   BANNER
   ====================================================== */

.choir-banner {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    height: clamp(100px, 16vw, 180px);

    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

/* ======================================================
   PAGE LAYOUT
   ====================================================== */

.rems-page-shell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.rems-page-shell > .row {
    min-width: 0;
}

/*
 * Important pour permettre aux colonnes de rétrécir,
 * même lorsqu'elles contiennent des composants flex/grid.
 */
.rems-page-shell > .row > *,
.rems-page-main,
.rems-public-content,
.rems-sidebar,
#sidebar-menu,
#action-menu {
    min-width: 0;
}

.rems-page-main,
.rems-public-content {
    overflow-wrap: anywhere;
}

.rems-page-main {
    padding: clamp(12px, 2vw, 24px) !important;
}

.rems-page-main img,
.rems-public-content img,
.rems-page-main video,
.rems-public-content video {
    max-width: 100%;
}

/*
 * Les tableaux larges doivent être placés dans
 * un conteneur .table-responsive dans leur propre vue.
 */

/* ======================================================
   NAVIGATION WRAPPER
   ====================================================== */

.rems-navigation-shell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.rems-navigation-shell .navbar,
.rems-navigation-shell .navbar > .container,
.rems-navigation-shell .navbar > .container-fluid,
.rems-navigation-shell .navbar-collapse {
    min-width: 0;
    max-width: 100%;
}

.rems-navigation-shell .navbar {
    flex-wrap: wrap;
}

.rems-navigation-shell .navbar-nav .nav-link {
    white-space: normal;
    overflow-wrap: anywhere;
}

/* ======================================================
   TABLET
   ====================================================== */

@media (max-width: 991.98px) {
    .rems-header .user-info {
        display: none;
    }

    .rems-header .rems-logo img {
        max-height: 48px;
    }

    .rems-header .rems-actions {
        flex-basis: 220px;
    }

    .rems-header .lang-dropdown {
        flex-basis: 160px;
    }
}

/* ======================================================
   PHONE
   ====================================================== */

@media (max-width: 575.98px) {
    .rems-header {
        gap: 10px;
        padding: 10px;
    }

    .rems-header .rems-logo {
        max-width: 50px;
    }

    .rems-header .rems-logo img {
        width: 42px;
        max-width: 100%;
        max-height: 42px;
    }

    .rems-header .rems-actions {
        flex: 1 1 0;
        gap: 7px;
    }

    /*
     * Le menu déroulant s'ancre au header complet
     * sur téléphone, pas à un petit bouton.
     */
    .rems-header .lang-dropdown {
        position: static;
        flex: 1 1 100px;
    }

    .rems-header .lang-dropdown .dropdown-toggle {
        gap: 5px;
        padding: 8px;
        font-size: 12px;
    }

    .rems-header .lang-dropdown .dropdown-menu {
        position: absolute !important;
        inset: 100% 10px auto 10px !important;
        transform: none !important;

        width: auto !important;
        min-width: 0 !important;
        max-width: calc(100% - 20px);
        margin-top: 6px !important;
    }

    .rems-header .rems-auth {
        flex: 0 1 auto;
        gap: 5px;
        padding: 8px 10px;
        font-size: 12px;
    }
}

/* ======================================================
   VERY NARROW WIDTHS / LARGE TEXT ZOOM
   ====================================================== */

@media (max-width: 359.98px) {
    .rems-header .rems-logo {
        margin-inline: auto;
    }

    .rems-header .rems-actions {
        flex-basis: 100%;
        width: 100%;
    }
}

@media (max-width: 239.98px) {
    .rems-header .lang-dropdown,
    .rems-header .rems-auth {
        flex: 1 1 100%;
        width: 100%;
    }
}