/*
 * Charte graphique BCJ37 pour l'administration OpenAdmin.
 *
 * Approche volontairement basee sur la surcharge des variables Bootstrap 5
 * exposees par OpenAdmin (--bs-primary, --primary-color, ...) plus quelques
 * regles ciblees. Aucun fichier du package n'est modifie : une mise a jour
 * d'OpenAdmin n'ecrasera pas ce theme.
 *
 * Palette reprise du site public (frontend React) :
 *   bleu de marque #0e4daa, degrade signature rose -> bleu.
 */

:root {
    --bcj-blue: #0e4daa;
    --bcj-blue-dark: #0a2f68;
    --bcj-blue-darker: #08234f;
    --bcj-pink: #ff65a3;
    --bcj-gradient: linear-gradient(94deg, #ff65a3, #0e4daa);

    /* Surcharge de la couleur primaire Bootstrap : boutons, liens, etats actifs. */
    --bs-primary: #0e4daa;
    --bs-primary-rgb: 14, 77, 170;
    --primary-color: #0e4daa;
    --bs-link-color: #0e4daa;
    --bs-link-color-rgb: 14, 77, 170;
    --bs-link-hover-color: #0a2f68;
}

/* ------------------------------------------------------------------ */
/* Barre laterale                                                     */
/* ------------------------------------------------------------------ */

.sidebar.bg-semi-dark {
    background: var(--bcj-blue-darker) !important;
}

/* Zone marque (logo) : degrade signature du club. */
.navbar-brand.bg-semi-dark {
    background: var(--bcj-gradient) !important;
    color: #fff !important;
}

.sidebar a {
    color: #d3ddf0;
}

.sidebar a:hover,
.sidebar a:focus {
    color: #fff;
    background: rgba(255, 255, 255, 0.08);
}

/* Etat actif : fond + barre rose (l'info n'est pas portee par la seule couleur). */
.sidebar a.active,
.sidebar li.active > a {
    color: #fff;
    background: rgba(255, 255, 255, 0.12);
    border-left: 3px solid var(--bcj-pink);
}

/* ------------------------------------------------------------------ */
/* Barre superieure                                                   */
/* ------------------------------------------------------------------ */

.custom-navbar.bg-white {
    border-bottom: 2px solid var(--bcj-blue);
}

/* ------------------------------------------------------------------ */
/* Boutons                                                            */
/* ------------------------------------------------------------------ */

.btn-primary {
    --bs-btn-bg: var(--bcj-blue);
    --bs-btn-border-color: var(--bcj-blue);
    --bs-btn-hover-bg: var(--bcj-blue-dark);
    --bs-btn-hover-border-color: var(--bcj-blue-dark);
    --bs-btn-active-bg: var(--bcj-blue-dark);
    --bs-btn-active-border-color: var(--bcj-blue-dark);
}

/* ------------------------------------------------------------------ */
/* Accessibilite : focus toujours visible                            */
/* ------------------------------------------------------------------ */

a:focus-visible,
.btn:focus-visible,
.page-link:focus,
.form-control:focus,
.form-select:focus,
.custom-select:focus {
    outline: 2px solid var(--bcj-blue);
    outline-offset: 2px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--bcj-blue);
    box-shadow: 0 0 0 0.2rem rgba(14, 77, 170, 0.2);
}

/* ------------------------------------------------------------------ */
/* Cartes, tableaux, pagination                                       */
/* ------------------------------------------------------------------ */

.card,
.box {
    border-top: 3px solid var(--bcj-blue);
}

.table thead th {
    color: var(--bcj-blue-dark);
    border-bottom: 2px solid var(--bcj-blue);
}

.page-item.active .page-link {
    background-color: var(--bcj-blue);
    border-color: var(--bcj-blue);
}

.page-link {
    color: var(--bcj-blue);
}

/* Alertes : rappel de la nature par un liseret a gauche (pas que la couleur). */
.alert {
    border-left-width: 4px;
}

/* ------------------------------------------------------------------ */
/* Aides des champs de formulaire (bulle flottante)                   */
/* ------------------------------------------------------------------ */

/*
 * Le conseil n'apparait qu'en cas de besoin : une icone info discrete est
 * affichee sous le champ ; le texte d'aide s'affiche en bulle flottante au
 * survol de la souris ou au focus clavier. Ainsi le formulaire reste epure.
 * (La vue admin::form.help-block est surchargee pour produire ce markup.)
 */
.help-block.bcj-help {
    position: relative;
    display: inline-flex;
    align-items: center;
    margin-top: 0.3rem;
    color: var(--bcj-blue);
    cursor: help;
    line-height: 1;
}

.help-block.bcj-help > i {
    font-size: 1.05rem;
    color: var(--bcj-blue);
}

.help-block.bcj-help:focus {
    outline: 2px solid var(--bcj-blue);
    outline-offset: 2px;
    border-radius: 3px;
}

/* La bulle : masquee par defaut, revelee au survol / focus. */
.bcj-help__bubble {
    position: absolute;
    left: 0;
    top: calc(100% + 7px);
    z-index: 1080;
    width: max-content;
    max-width: 320px;
    padding: 0.6rem 0.8rem;
    background: var(--bcj-blue-dark);
    color: #fff;
    font-size: 0.85rem;
    line-height: 1.45;
    border-radius: 6px;
    box-shadow: 0 6px 20px rgba(8, 35, 79, 0.28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-3px);
    transition: opacity 0.12s ease, transform 0.12s ease, visibility 0.12s;
    pointer-events: none;
    white-space: normal;
}

/* Petite fleche pointant vers l'icone. */
.bcj-help__bubble::before {
    content: "";
    position: absolute;
    left: 11px;
    bottom: 100%;
    border: 6px solid transparent;
    border-bottom-color: var(--bcj-blue-dark);
}

.help-block.bcj-help:hover .bcj-help__bubble,
.help-block.bcj-help:focus .bcj-help__bubble,
.help-block.bcj-help:focus-within .bcj-help__bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.bcj-help__bubble a {
    color: #cfe0ff;
    text-decoration: underline;
}

/* ------------------------------------------------------------------ */
/* Apercu de l'article (modale)                                       */
/* ------------------------------------------------------------------ */

.oa-ck5-actions {
    text-align: right;
    margin-bottom: 0.5rem;
}

.bcj-preview-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 4vh 16px;
    background: rgba(8, 35, 79, 0.55);
    overflow-y: auto;
}

.bcj-preview-overlay[hidden] {
    display: none;
}

.bcj-preview {
    width: 100%;
    max-width: 820px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.bcj-preview__bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem;
    background: var(--bcj-gradient);
    color: #fff;
}

.bcj-preview__tag {
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    font-size: 0.8rem;
}

.bcj-preview__close {
    background: transparent;
    border: 0;
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.3rem;
}

.bcj-preview__body {
    padding: 1.5rem 1.8rem 2rem;
}

.bcj-preview__title {
    margin: 0 0 1rem;
    font-size: 1.8rem;
    color: var(--bcj-blue-dark);
}

.bcj-preview__content {
    color: #1f2937;
    line-height: 1.6;
}

.bcj-preview__content h2 {
    font-size: 1.4rem;
    margin: 1.2rem 0 0.6rem;
}

.bcj-preview__content h3 {
    font-size: 1.2rem;
    margin: 1rem 0 0.5rem;
}

.bcj-preview__content h4 {
    font-size: 1.05rem;
    margin: 0.9rem 0 0.5rem;
}

.bcj-preview__content p {
    margin: 0 0 0.8rem;
}

.bcj-preview__content ul,
.bcj-preview__content ol {
    margin: 0 0 0.8rem 1.4rem;
}

.bcj-preview__content blockquote {
    margin: 0 0 0.8rem;
    padding: 0.4rem 1rem;
    border-left: 3px solid var(--bcj-pink);
    color: #475569;
    font-style: italic;
}

.bcj-preview__content a {
    color: var(--bcj-blue);
    text-decoration: underline;
}

/* Champ technique masque : l'URL de l'image existante n'est la que pour
   l'apercu (lue par le JS), pas pour l'utilisateur. On masque sa ligne. */
.form-group:has(.bcj-current-thumb) {
    display: none;
}

/* Media (image / video) de l'apercu. */
.bcj-preview__media {
    margin: 0 0 1.2rem;
}

.bcj-preview__image {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 6px;
}

/* Video en ratio 16:9 responsive. */
.bcj-preview__video {
    position: relative;
    padding-top: 56.25%;
}

.bcj-preview__video iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 6px;
}

/* ------------------------------------------------------------------ */
/* Modale de confirmation (charte du club, centree)                   */
/* ------------------------------------------------------------------ */

.bcj-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(8, 35, 79, 0.55);
}

.bcj-modal-overlay[hidden] {
    display: none;
}

.bcj-modal {
    width: 100%;
    max-width: 460px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
    overflow: hidden;
}

.bcj-modal__bar {
    padding: 0.8rem 1.1rem;
    background: var(--bcj-gradient);
    color: #fff;
    font-weight: 700;
}

.bcj-modal__body {
    padding: 1.2rem 1.1rem;
    color: #1f2937;
    line-height: 1.5;
}

.bcj-modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.6rem;
    padding: 0 1.1rem 1.1rem;
}

/* ------------------------------------------------------------------ */
/* Ecran de connexion                                                 */
/* ------------------------------------------------------------------ */

body.bg-light {
    background: var(--bcj-gradient) !important;
    min-height: 100vh;
}

body.bg-light h1 a {
    color: #fff !important;
    font-weight: 700;
}

body.bg-light .bg-body {
    border-top: 4px solid var(--bcj-blue);
}
