/**
 * Terrino — Shell commun (v2.6.0).
 *
 * Bandeau supérieur (image d'en-tête pleine largeur + fil d'Ariane + bloc
 * utilisateur) partagé entre la vitrine publique et l'espace membre. Chargé :
 *   - côté membre : enqueue classique (rewrite-rules.php) ;
 *   - côté public : injecté inline dans le <head> des pages autonomes.
 *
 * Couleurs : --club-primary / --club-secondary, définies par la page (vitrine)
 * ou par le thème (espace membre).
 */

/* ── Bandeau supérieur ─────────────────────────────────────────────────── */
/* Non sticky : l'image d'en-tête peut être haute, on la laisse défiler. La
   sidebar, elle, reste figée (top:0) une fois le bandeau passé. */
.tb-topbar {
    position: relative;
    z-index: 20;
    background: var(--club-primary, #1C7241);
    width: 100%;
}

.tb-topbar__bar {
    position: relative;
    display: flex;
    align-items: stretch;
    width: 100%;
}

/* Image d'en-tête : pleine largeur, cliquable vers l'accueil. */
.tb-topbar__banner {
    display: block;
    flex: 1;
    min-width: 0;
    line-height: 0;
}
.tb-topbar__banner-img {
    display: block;
    width: 100%;
    height: auto;
    /* Ratio naturel de l'image (desktop 1920×300, mobile 720×420). Sur très
       grand écran on borne la hauteur (le motif se recadre proprement, le logo
       est à gauche). */
    max-height: 220px;
    object-fit: cover;
    object-position: left center;
}
.tb-topbar__name {
    display: inline-block;
    padding: 22px 24px;
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
}

/* Bloc utilisateur / connexion — superposé à droite du bandeau. */
.tb-topbar__user {
    position: absolute;
    top: 0;
    right: 0;
    height: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 20px;
}
.tb-topbar__avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.9);
    color: var(--club-primary, #1C7241);
    font-weight: 700;
    font-size: 14px;
    border: 2px solid rgba(255, 255, 255, 0.6);
}
.tb-topbar__uinfo {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.tb-topbar__uname { color: #fff; font-size: 14px; font-weight: 700; }
.tb-topbar__urole { color: rgba(255, 255, 255, 0.85); font-size: 12px; }

.tb-topbar__logout {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.55);
    color: #fff;
    text-decoration: none;
    font-size: 12.5px;
    font-weight: 600;
    transition: background 0.15s;
}
.tb-topbar__logout:hover { background: rgba(255, 255, 255, 0.28); color: #fff; }

.tb-topbar__btn {
    display: inline-block;
    padding: 9px 20px;
    border-radius: 20px;
    background: #fff;
    color: var(--club-primary, #1C7241);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 700;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}
.tb-topbar__btn:hover { opacity: 0.92; }

/* ── Fil d'Ariane ─────────────────────────────────────────────────────── */
.tb-breadcrumb {
    background: rgba(0, 0, 0, 0.14);
    padding: 7px clamp(16px, 3vw, 32px);
    font-size: 12.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.tb-breadcrumb a { color: rgba(255, 255, 255, 0.92); text-decoration: none; font-weight: 600; }
.tb-breadcrumb a:hover { color: #fff; text-decoration: underline; }
.tb-breadcrumb__sep { color: rgba(255, 255, 255, 0.6); }
.tb-breadcrumb__current { color: #fff; font-weight: 600; }

/* ── Responsive : masquer le libellé déconnexion, garder l'icône ──────── */
@media (max-width: 640px) {
    .tb-topbar__uinfo { display: none; }
    .tb-topbar__logout-label { display: none; }
    .tb-topbar__user { gap: 8px; padding: 0 12px; }
}

/* ── Hamburger (mobile) ────────────────────────────────────────────────── */
.tb-topbar__burger {
    display: none;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: #fff;
    border-radius: 10px;
    padding: 6px;
    cursor: pointer;
    line-height: 0;
}
.tb-topbar__burger:hover { background: rgba(255, 255, 255, 0.28); }

/* ── Tiroir latéral mobile (menu complet du rôle) ──────────────────────── */
.tb-drawer { display: none; }
.tb-drawer.is-open { display: block; position: fixed; inset: 0; z-index: 200; }
.tb-drawer__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.45); }
.tb-drawer__panel {
    position: absolute; top: 0; right: 0; height: 100%;
    width: min(82vw, 320px);
    background: #fff;
    display: flex; flex-direction: column;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.2);
    animation: tb-drawer-in 0.2s ease-out;
}
@keyframes tb-drawer-in { from { transform: translateX(100%); } to { transform: translateX(0); } }
.tb-drawer__head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 14px 16px; border-bottom: 1px solid #eef0ef;
    background: var(--club-primary, #1C7241);
}
.tb-drawer__title { color: #fff; font-weight: 700; font-size: 16px; }
.tb-drawer__close { background: transparent; border: 0; color: #fff; cursor: pointer; padding: 4px; line-height: 0; }
.tb-drawer__nav { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 2px; }
.tb-drawer__item {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 10px;
    color: #444; text-decoration: none; font-size: 15px; font-weight: 500;
}
.tb-drawer__item:hover, .tb-drawer__item:focus { background: var(--club-secondary, #e6f7ee); color: var(--club-primary, #1C7241); }
.tb-drawer__logout {
    display: flex; align-items: center; gap: 12px; padding: 14px 18px;
    border-top: 1px solid #eef0ef; color: #d32f2f; text-decoration: none;
    font-size: 14px; font-weight: 600;
}
.tb-drawer__login { color: var(--club-primary, #1C7241); }
body.tb-no-scroll { overflow: hidden; }

/* ── Bottom nav mobile (4 entrées) — homepage + pages membres ──────────── */
.terrino-bottom-nav {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 90;
    background: #fff; border-top: 1px solid #e6e8e7;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    justify-content: space-around;
}
.terrino-bottom-nav__item {
    display: flex; flex-direction: column; align-items: center; gap: 2px;
    flex: 1; padding: 4px 2px; text-decoration: none;
    color: #7a8288; font-size: 11px; font-weight: 500;
}
.terrino-bottom-nav__item svg { width: 22px; height: 22px; }
.terrino-bottom-nav__item--active { color: var(--club-primary, #1C7241); }

/* ── Bascule desktop / mobile ──────────────────────────────────────────── */
@media (max-width: 767px) {
    .tb-topbar__burger { display: inline-flex; }
    /* On masque nom/rôle/déconnexion textuels : le hamburger prend le relais. */
    .tb-topbar__uinfo { display: none; }
    .tb-topbar__logout-label { display: none; }
    .tb-topbar__logout { padding: 8px; }
    .terrino-bottom-nav { display: flex; }
    /* Marge basse pour ne pas masquer le contenu derrière le bottom nav. */
    .t-shell__content, .td-content-wrapper { padding-bottom: 68px; }
}
