/* ============================================================
   Projet BDN — Feuille de style principale
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --primary:      var(--color-brand, #1a5276);
    --primary-dark: var(--color-brand-dark, #154360);
    --primary-light:var(--color-brand-light, #2980b9);
    --success:      #1e8449;
    --warning:      #b7770d;
    --danger:       #922b21;
    --gray-100:     #f5f6fa;
    --gray-200:     #eaecf0;
    --gray-400:     #adb5bd;
    --gray-600:     #6c757d;
    --gray-800:     #333;
    --white:        #ffffff;
    --radius:       6px;
    --shadow:       0 2px 8px rgba(0,0,0,.1);
    --shadow-lg:    0 4px 20px rgba(0,0,0,.12);
    --font:         'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ── Reset de base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
/* Ne pas écraser le shell LLBMG, le back-office, l'éditeur ni l'aperçu BDN. */
body:not(.page-rubrique):not(.admin-body):not(.editor-page):not(.bdn-display-page):not(.page-home) *,
body:not(.page-rubrique):not(.admin-body):not(.editor-page):not(.bdn-display-page):not(.page-home) *::before,
body:not(.page-rubrique):not(.admin-body):not(.editor-page):not(.bdn-display-page):not(.page-home) *::after {
    margin: 0;
    padding: 0;
}
body:not(.page-rubrique):not(.admin-body):not(.editor-page):not(.bdn-display-page):not(.page-home) {
    font-family: var(--font);
    color: var(--gray-800);
    background: var(--gray-100);
    line-height: 1.6;
}
body:not(.page-rubrique):not(.admin-body):not(.editor-page):not(.bdn-display-page):not(.page-home) a { color: var(--primary); text-decoration: none; }
body:not(.page-rubrique):not(.admin-body):not(.editor-page):not(.bdn-display-page):not(.page-home) a:hover { text-decoration: underline; }
body:not(.page-rubrique):not(.admin-body):not(.editor-page):not(.bdn-display-page):not(.page-home) img { max-width: 100%; height: auto; }
.bdn-article img,
.bdn-empty img,
.bdn-header img,
.popup-box img { max-width: 100%; height: auto; }

/* ── Utilitaires ───────────────────────────────────────────── */
.hidden            { display: none !important; }
.text-center       { text-align: center; }
.text-muted        { color: var(--gray-600); }
.mt-2              { margin-top: .75rem; }
.mt-4              { margin-top: 1.5rem; }
.mb-4              { margin-bottom: 1.5rem; }
.py-4              { padding-top: 1.5rem; padding-bottom: 1.5rem; }
.table-responsive  { overflow-x: auto; }

/* ── Boutons ───────────────────────────────────────────────── */
.btn {
    display: inline-block;
    padding: .45rem 1rem;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: .875rem;
    font-weight: 600;
    line-height: 1.4;
    transition: opacity .15s, background .15s;
    white-space: nowrap;
}
.btn:hover { opacity: .88; text-decoration: none; }
.btn-primary   { background: var(--primary);       color: var(--white); }
.btn-secondary { background: #5d6d7e;              color: var(--white); }
.btn-success   { background: var(--success);       color: var(--white); }
.btn-warning   { background: var(--warning);       color: var(--white); }
.btn-danger    { background: var(--danger);        color: var(--white); }
.btn-outline   { background: transparent; border: 1.5px solid var(--primary); color: var(--primary); }
.btn-outline:hover { background: var(--primary); color: var(--white); }
.btn-block     { width: 100%; text-align: center; }
.btn-sm        { padding: .25rem .6rem; font-size: .8rem; }
.btn-icon      { padding: .25rem .5rem; background: var(--gray-200); color: var(--gray-800); border: none; }
.btn-outline-white {
    background: transparent;
    border: 1.5px solid rgba(255,255,255,.6);
    color: rgba(255,255,255,.9);
}
.btn-outline-white:hover { background: rgba(255,255,255,.15); color: var(--white); }

.btn-add-block {
    width: 100%; padding: .75rem; background: transparent;
    border: 2px dashed var(--primary-light); color: var(--primary);
    border-radius: var(--radius); font-size: 1rem; font-weight: 600;
    cursor: pointer; transition: background .15s;
}
.btn-add-block:hover { background: #eaf4fb; }

/* ── Alertes ───────────────────────────────────────────────── */
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; font-size: .9rem; }
.alert-error   { background: #fde8e8; color: #c0392b; border-left: 4px solid #c0392b; }
.alert-success { background: #d4efdf; color: #1e8449; border-left: 4px solid #1e8449; }

/* ── Formulaires ───────────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; margin-bottom: .3rem; font-weight: 600; font-size: .875rem; }
.form-control {
    width: 100%; padding: .45rem .75rem;
    border: 1.5px solid var(--gray-200); border-radius: var(--radius);
    font-size: .9rem; font-family: var(--font);
    transition: border-color .15s;
}
.form-control:focus { outline: none; border-color: var(--primary-light); }
input[type="color"] {
    width: 36px; height: 36px; padding: 2px;
    border: 1.5px solid var(--gray-200); border-radius: var(--radius); cursor: pointer;
}
.text-colors-row { display: flex; gap: 1.2rem; align-items: center; flex-wrap: wrap; }
.color-label-inline { display: flex; flex-direction: column; align-items: center; gap: .25rem;
    font-size: .78rem; color: var(--gray-600); font-weight: 600; }
.subtitle-toolbar {
    display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
    margin-top: .55rem;
}
.subtitle-size-select { width: auto; min-width: 8.5rem; padding: .35rem .55rem; }
.fmt-toggle {
    width: 36px; height: 34px; padding: 0;
    border: 1.5px solid var(--gray-200); border-radius: var(--radius);
    background: #fff; color: var(--gray-700); font-weight: 800; cursor: pointer;
    font-size: .95rem;
}
.fmt-toggle.is-on { background: var(--primary); color: #fff; border-color: var(--primary); }
.subtitle-color-lab { flex-direction: row; gap: .4rem; }
.edition-controls { background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 8px; padding: .85rem 1rem; }
.edition-toggle { display: flex; align-items: center; gap: .5rem; font-weight: 700; color: var(--gray-700); cursor: pointer; }
.edition-date-wrap { margin-top: .75rem; }
.edition-format-row { margin-bottom: .7rem; flex-direction: column; align-items: flex-start; gap: .35rem; }
#edition-label-wrap { margin-top: .65rem; }
.edition-date-hint { margin: .45rem 0 0; font-size: .82rem; color: var(--gray-600); }
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
    display: inline-block; padding: .2rem .55rem;
    border-radius: 20px; font-size: .75rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .04em;
}
.badge-draft     { background: #e8ecef; color: #5d6d7e; }
.badge-published { background: #d4efdf; color: #1e8449; }
.badge-archived  { background: #f0f0f0; color: #888; }
.badge-notif     { background: #d4efdf; color: #1e8449; }

/* ╔══════════════════════════════════════════════════════════╗
   ║  NAVBAR (pages admin)                                   ║
   ╚══════════════════════════════════════════════════════════╝ */
.navbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--primary); color: var(--white);
    padding: 0 1.5rem; height: 56px;
    position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.nav-brand a { color: var(--white); font-weight: 700; font-size: 1.1rem; }
.nav-links { display: flex; gap: .5rem; align-items: center; }
.nav-links a { color: rgba(255,255,255,.85); padding: .35rem .75rem; border-radius: var(--radius); font-size: .875rem; }
.nav-links a:hover { background: rgba(255,255,255,.15); text-decoration: none; color: var(--white); }
.btn-nav-logout {
    background: rgba(255,255,255,.15); color: var(--white) !important;
    padding: .35rem .75rem; border-radius: var(--radius); font-size: .875rem;
}
.btn-nav-logout:hover { background: rgba(255,255,255,.3) !important; }
.nav-username { color: rgba(255,255,255,.9); font-size: .875rem; padding: .35rem .5rem; font-weight: 600; }

/* ── Contenu principal (admin) ─────────────────────────────── */
.main-content { max-width: 1100px; margin: 0 auto; padding: 1.5rem; }

/* ── Pied de page admin ────────────────────────────────────── */
.admin-footer {
    text-align: center; padding: 1rem; color: var(--gray-600);
    font-size: .8rem; margin-top: 2rem;
    border-top: 1px solid var(--gray-200);
}

/* ╔══════════════════════════════════════════════════════════╗
   ║  PAGE DE CONNEXION                                      ║
   ╚══════════════════════════════════════════════════════════╝ */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--gray-100); }
.login-container { width: 100%; max-width: 420px; padding: 1rem; }
.login-box {
    background: var(--white); border-radius: 10px;
    box-shadow: var(--shadow-lg); padding: 2.5rem 2rem; text-align: center;
}
.login-logo { font-size: 3rem; margin-bottom: .5rem; }
.login-box h1 { font-size: 1.3rem; color: var(--primary); margin-bottom: .2rem; }
.login-box h2 { font-size: 1rem; color: var(--gray-600); font-weight: 400; margin-bottom: 1.5rem; }
.login-box .form-group { text-align: left; }
.login-box input { padding: .6rem .9rem; }

/* ╔══════════════════════════════════════════════════════════╗
   ║  DASHBOARD                                              ║
   ╚══════════════════════════════════════════════════════════╝ */
.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 1.5rem;
}
.page-header h1 { font-size: 1.6rem; color: var(--primary); }

/* Stats grid */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem; margin-bottom: 1.5rem;
}
.stat-card {
    background: var(--white); border-radius: var(--radius); padding: 1.25rem;
    text-align: center; box-shadow: var(--shadow);
    border-top: 3px solid var(--primary);
}
.stat-card.stat-published { border-top-color: var(--success); }
.stat-card.stat-draft     { border-top-color: var(--gray-400); }
.stat-card.stat-archived  { border-top-color: var(--gray-600); }
.stat-number { display: block; font-size: 2rem; font-weight: 700; color: var(--primary); }
.stat-label  { font-size: .8rem; color: var(--gray-600); text-transform: uppercase; letter-spacing: .05em; }

/* Cards */
.card { background: var(--white); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header {
    background: var(--gray-100); padding: .85rem 1.25rem;
    border-bottom: 1px solid var(--gray-200);
    display: flex; align-items: center; justify-content: space-between;
}
.card-header h2 { font-size: 1rem; margin: 0; }
.card-body { padding: 1.25rem; }

/* Current week card */
.current-week-card .week-badge {
    font-size: .85rem; color: var(--primary);
    background: #eaf4fb; padding: .2rem .6rem; border-radius: 20px;
}
.current-bdn-info { font-size: 1rem; margin-bottom: .75rem; display: flex; align-items: center; gap: .5rem; }
.action-buttons { display: flex; gap: .5rem; flex-wrap: wrap; }

/* Table BDN */
.bdn-table { width: 100%; border-collapse: collapse; font-size: .875rem; }
.bdn-table th, .bdn-table td { padding: .6rem .8rem; border-bottom: 1px solid var(--gray-200); text-align: left; }
.bdn-table th { background: var(--gray-100); font-weight: 700; color: var(--gray-600); font-size: .8rem; text-transform: uppercase; }
.bdn-table tbody tr:hover { background: #f8f9fb; }
.td-title { font-weight: 600; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-actions { display: flex; gap: .3rem; flex-wrap: nowrap; }

/* ╔══════════════════════════════════════════════════════════╗
   ║  ÉDITEUR BDN                                            ║
   ╚══════════════════════════════════════════════════════════╝ */
.editor-page { background: #e8edf2; min-height: 100vh; }

/* Barre supérieure */
.editor-topbar {
    position: sticky; top: 0; z-index: 200;
    display: flex; align-items: center; gap: 1rem;
    background: var(--primary-dark); color: var(--white);
    padding: .6rem 1.25rem; box-shadow: 0 2px 8px rgba(0,0,0,.25);
    flex-wrap: wrap;
}
.editor-topbar-left { display: flex; align-items: center; gap: .75rem; flex: 1 1 250px; }
.editor-topbar-center {
    display: flex; align-items: center; gap: .75rem;
    font-size: .85rem; flex: 1 1 300px; flex-wrap: wrap;
}
.editor-topbar-center label { display: flex; align-items: center; gap: .3rem; color: rgba(255,255,255,.85); }
.editor-topbar-center input[type="number"],
.editor-topbar-center input[type="date"] {
    padding: .3rem .5rem; border: 1px solid rgba(255,255,255,.3);
    border-radius: var(--radius); background: rgba(255,255,255,.1);
    color: var(--white); font-size: .85rem;
}
.editor-topbar-right { display: flex; align-items: center; gap: .5rem; }
.editor-title-input {
    background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.25);
    color: var(--white); padding: .35rem .75rem; border-radius: var(--radius);
    font-size: 1rem; font-weight: 600; width: 260px; max-width: 100%;
}
.editor-title-input::placeholder { color: rgba(255,255,255,.5); }
.editor-title-input:focus { outline: none; background: rgba(255,255,255,.2); }
.btn-back { color: rgba(255,255,255,.8); font-size: .875rem; white-space: nowrap; }
.btn-back:hover { color: var(--white); text-decoration: none; }
.save-status { font-size: .8rem; color: rgba(255,255,255,.7); min-width: 100px; }

/* Canvas éditeur */
body.editor-page .editor-canvas {
    max-width: 900px;
    width: 100%;
    margin: 1.5rem auto 0;
    padding: 0 1rem 3rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    box-sizing: border-box;
}

/* Section BDN générique */
.bdn-section {
    background: var(--white); border-radius: var(--radius);
    box-shadow: var(--shadow); overflow: hidden;
}
.section-label {
    background: var(--primary); color: var(--white);
    font-size: .75rem; font-weight: 700; letter-spacing: .06em;
    padding: .4rem 1rem; text-transform: uppercase;
}
.section-label-row {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--primary); padding: .4rem 1rem;
}
.section-label-row .section-label { background: transparent; padding: 0; }
.block-controls { display: flex; gap: .25rem; }

/* Contrôles de section */
.section-controls { padding: 1.25rem; }
.controls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 640px) { .controls-grid { grid-template-columns: 1fr; } }

.control-group { margin-bottom: 1rem; }
.control-group > label:first-child {
    display: block; font-weight: 700; font-size: 1rem;
    margin-bottom: .45rem; color: var(--primary-dark, #154360);
}
.radio-label { display: inline-flex; align-items: center; gap: .3rem; font-size: .875rem; cursor: pointer; margin-right: .5rem; }

/* Picker de fond */
.bg-picker { display: flex; align-items: center; flex-wrap: wrap; gap: .5rem; }

/* Zone d'upload */
.file-upload-zone { }
.file-name-display { font-size: .8rem; color: var(--gray-600); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden-file-input { display: none; }

/* Zone Quill */
.quill-editor-zone { border: 1.5px solid var(--gray-200); border-radius: var(--radius); min-height: 160px; }
.quill-editor-zone .ql-toolbar { border-bottom: 1px solid var(--gray-200); flex-wrap: wrap; }
.quill-editor-zone .ql-container { min-height: 120px; font-family: var(--font); font-size: .9rem; }
.quill-editor-zone .ql-editor { line-height: 1.4; }
.quill-editor-zone .ql-editor p { margin: 0 0 .35rem; }

/* Liste de fichiers joints */
.block-files-list { margin-top: .5rem; display: flex; flex-direction: column; gap: .3rem; }
.attached-file-item {
    display: flex; align-items: center; gap: .5rem;
    padding: .35rem .6rem; background: var(--gray-100);
    border-radius: var(--radius); font-size: .85rem;
}
.attached-file-item .file-remove {
    margin-left: auto; background: transparent; border: none;
    cursor: pointer; color: var(--danger); font-size: 1rem; line-height: 1;
}

/* Label de section avec sélecteur de police intégré */
.control-label-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: .4rem;
}
.control-label-row label { margin-bottom: 0; font-weight: 700; font-size: 1rem; color: var(--primary-dark, #154360); }
.control-label-row .font-hint { font-size: .78rem; color: var(--gray-600); margin-right: .3rem; font-weight: 600; }

/* Petit sélecteur de police (dans les blocs) */
.font-select-sm {
    padding: .25rem .5rem;
    border: 1.5px solid var(--gray-200); border-radius: var(--radius);
    font-size: .78rem; min-width: 130px; max-width: 175px; cursor: pointer;
    background: var(--white); color: var(--gray-800);
}
.font-select-sm:focus { outline: none; border-color: var(--primary-light); }

/* Zone "Ajouter un bloc" */
.add-block-area { padding: 0; }

/* Aperçu du header — variantes logo */
.header-preview {
    position: relative;
    padding: 1.5rem 8rem 1.5rem 2rem;
    min-height: 90px;
    display: flex; align-items: center; gap: 1.25rem;
}
.header-preview.logo-left   { flex-direction: row; text-align: left; }
.header-preview.logo-center { flex-direction: column; align-items: center; text-align: center; gap: .6rem; }
.header-preview-logo { max-height: 70px; max-width: 160px; border-radius: 4px; }
.header-preview-text .preview-title { color: var(--white); font-size: 1.4rem; font-weight: 700; margin: 0 0 .2rem; }
.header-preview-text .preview-subtitle { margin: 0 0 .2rem; }
.header-preview-text .preview-date { color: rgba(255,255,255,.85); font-size: .9rem; margin: 0; }

/* ╔══════════════════════════════════════════════════════════╗
   ║  PAGE D'AFFICHAGE BDN (public)                          ║
   ╚══════════════════════════════════════════════════════════╝ */
.bdn-display-page { background: var(--gray-100); }

/* Barre de navigation publique */
.bdn-nav-bar {
    background: var(--primary); color: var(--white);
    padding: 0 1.5rem; position: sticky; top: 0; z-index: 100;
    box-shadow: 0 2px 6px rgba(0,0,0,.15);
}
.bdn-nav-inner {
    max-width: 1000px; margin: 0 auto; height: 54px;
    display: flex; align-items: center; gap: 1rem;
}
.bdn-nav-brand {
    font-weight: 700; font-size: 1rem; white-space: nowrap;
    color: var(--white); text-decoration: none; flex-shrink: 0;
}
.bdn-nav-brand:hover { opacity: .88; text-decoration: none; }
.bdn-nav-edition {
    flex: 1; font-size: .82rem; color: rgba(255,255,255,.78);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-align: center;
}
.bdn-nav-right { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.bdn-admin-link {
    color: rgba(255,255,255,.7); font-size: .8rem; white-space: nowrap;
    padding: .25rem .6rem; border: 1px solid rgba(255,255,255,.3); border-radius: var(--radius);
}
.bdn-admin-link:hover { color: var(--white); background: rgba(255,255,255,.15); text-decoration: none; }

/* Article BDN — container de cartes */
.bdn-article {
    max-width: 100%; margin: 1.5rem 0 0;
    padding: 0 0 2rem;
    display: flex; flex-direction: column; gap: 1.25rem;
    min-width: 0; overflow-x: hidden;
}

/* Carte Header */
.bdn-header {
    position: relative;
    background: var(--primary);
    padding: 2rem 8.5rem 2rem 2.5rem;
    border-radius: 14px;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    min-width: 0;
}
.bdn-header--image,
.bdn-footer--image {
    background-color: var(--color-brand, var(--primary));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.bdn-header--themed,
.bdn-footer--themed {
    background: linear-gradient(135deg, var(--color-brand-dark, #182848) 0%, var(--color-brand-light, #4b6cb7) 100%);
}
/* Logo à gauche (défaut) */
.bdn-header.logo-left .bdn-header-inner {
    display: flex; flex-direction: row;
    align-items: center; gap: 1.5rem; text-align: left;
}
/* Logo centré */
.bdn-header.logo-center .bdn-header-inner {
    display: flex; flex-direction: column;
    align-items: center; text-align: center; gap: .75rem;
}
.bdn-header-inner { display: flex; align-items: center; gap: 1.5rem; }
.bdn-logo-img { max-height: 90px; max-width: 200px; border-radius: 4px; }
.bdn-main-title  { color: var(--white); font-size: 1.8rem; margin: 0 0 .3rem; }
.bdn-subtitle    { color: rgba(255,255,255,.85); margin: 0 0 .2rem; }
.bdn-pub-date    { color: rgba(255,255,255,.7); font-size: .9rem; margin: 0; }

.bdn-week-label {
    position: absolute;
    top: .85rem;
    right: 1.15rem;
    z-index: 2;
    font-size: .82rem;
    font-weight: 700;
    letter-spacing: .03em;
    color: #fff;
    background: rgba(0, 0, 0, .28);
    border: 1px solid rgba(255, 255, 255, .28);
    padding: .28rem .75rem;
    border-radius: 999px;
    white-space: nowrap;
    line-height: 1.3;
    pointer-events: none;
}

/* Cartes Contenu */
.bdn-content { display: contents; }
.bdn-block {
    padding: 2rem 2.5rem;
    background: var(--white);
    border-radius: 14px;
    border: 1.5px solid color-mix(in srgb, var(--color-brand, var(--primary)) 32%, #d8dee8);
    box-shadow: 0 2px 10px color-mix(in srgb, var(--color-brand, var(--primary)) 10%, transparent);
    overflow-x: hidden; min-width: 0;
}
.page-rubrique .bdn-article {
    overflow-x: visible;
}
.bdn-block-title {
    font-size: 1.2rem; color: var(--primary);
    margin: 0 0 1rem; padding-bottom: .5rem;
    border-bottom: 2px solid var(--primary-light);
}
.bdn-block-text { font-size: .95rem; line-height: 1.4; color: var(--gray-800); overflow-wrap: break-word; word-break: break-word; min-width: 0; }
.bdn-block-text p { margin: 0 0 .35rem; line-height: 1.4; }
.bdn-block-text li { line-height: 1.4; }
.bdn-block-text h1, .bdn-block-text h2, .bdn-block-text h3 { color: var(--primary); margin: .7rem 0 .35rem; }
.bdn-block-text ul, .bdn-block-text ol { padding-left: 1.5rem; margin: 0 0 .4rem; }
.page-rubrique .bdn-block-text p,
.page-rubrique .bdn-block-text li {
    line-height: 1.4;
    margin-bottom: .35rem;
    font-size: inherit;
    color: inherit;
}
.bdn-block-text a { color: var(--primary-light); }
.bdn-block-text hr.bdn-separator,
.ql-editor hr.bdn-separator {
    display: block;
    border: none;
    width: 100%;
    margin: 1.1rem 0;
}
.bdn-block-text a[href*="zoom.us"],
.bdn-block-text a[href*="zoom.com"],
.ql-editor a[href*="zoom.us"],
.ql-editor a[href*="zoom.com"] {
    display: inline-block;
    background: linear-gradient(135deg, var(--color-brand-dark, #182848) 0%, var(--color-brand-light, #4b6cb7) 100%);
    color: #fff !important;
    padding: .55rem 1.15rem;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 700;
    font-size: .9rem;
    line-height: 1.3;
    box-shadow: 0 2px 8px color-mix(in srgb, var(--color-brand-dark, #182848) 28%, transparent);
}
.bdn-block-text a[href*="zoom.us"]:hover,
.bdn-block-text a[href*="zoom.com"]:hover,
.ql-editor a[href*="zoom.us"]:hover,
.ql-editor a[href*="zoom.com"]:hover {
    background: var(--color-brand, #3E5B9B);
    color: #fff !important;
    text-decoration: none;
}

/* Pièces jointes */
.bdn-attachments { margin-top: 1.25rem; padding-top: 1rem; border-top: 1px dashed var(--gray-200); }
.attachments-title { font-size: .85rem; color: var(--gray-600); margin: 0 0 .5rem; font-weight: 600; }
.attachments-list { list-style: none; display: flex; flex-direction: column; gap: .4rem; }
.attachment-item { }
.attachment-link {
    display: inline-flex; align-items: center; gap: .4rem;
    padding: .35rem .75rem; border: 1px solid var(--gray-200);
    border-radius: var(--radius); font-size: .875rem;
    transition: background .15s;
}
.attachment-link:hover { background: var(--gray-100); text-decoration: none; }

/* Lecteurs audio / vidéo intégrés */
.bdn-media-audio,
.bdn-media-video { margin-top: 1.25rem; display: flex; flex-direction: column; gap: .75rem; }
.bdn-audio-player { width: 100%; max-width: 480px; display: block; }
.bdn-video-player { width: 100%; max-width: 640px; height: auto; display: block; border-radius: var(--radius); background: #000; }
.attachment-size { color: var(--gray-400); font-size: .8rem; }

/* Carte Footer */
.bdn-footer {
    background: var(--primary);
    padding: 1.5rem 2.5rem;
    border-radius: 14px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.bdn-footer-inner { }
.bdn-footer-text { color: #fff; font-size: .95rem; font-weight: 500; line-height: 1.4; overflow-wrap: break-word; word-break: break-word; }
.bdn-footer-text p,
.bdn-footer-text span { margin: 0; color: #fff; line-height: 1.4; }
.bdn-footer-text a { color: #fff; text-decoration: underline; }
.page-rubrique .bdn-footer .bdn-footer-text,
.page-rubrique .bdn-footer .bdn-footer-text p,
.page-rubrique .bdn-footer .bdn-footer-text span,
.page-rubrique .bdn-footer .bdn-footer-text a {
  color: #fff;
  line-height: 1.4;
}

/* Aucun BDN */
.bdn-empty { display: flex; align-items: center; justify-content: center; min-height: 70vh; }
.bdn-empty-inner { text-align: center; padding: 2rem; }
.bdn-empty-icon { font-size: 4rem; margin-bottom: 1rem; }
.bdn-empty h1 { color: var(--primary); margin-bottom: .5rem; }
.bdn-empty p { color: var(--gray-600); }
.bdn-no-content { padding: 2rem 2.5rem; color: var(--gray-600); }

/* ── Bandeau de prévisualisation ───────────────────────────── */
.preview-banner {
    position: sticky; top: 0; z-index: 200;
    background: #7d3c98;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.preview-banner-inner {
    width: 1280px;
    max-width: calc(100% - 36px);
    margin: 0 auto;
    display: flex; align-items: center; justify-content: space-between;
    padding: .6rem 0; gap: 1rem; flex-wrap: wrap;
}
.preview-banner-left  { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.preview-banner-right { display: flex; align-items: center; gap: .5rem; }
.preview-eye   { font-size: 1.1rem; }
.preview-info  { color: rgba(255,255,255,.75); font-size: .82rem; }
.preview-banner strong { color: #fff; font-size: .9rem; }

/* Cadre aperçu = largeur réelle du BDN sur le site (site-main 1280 px + carte) */
body.bdn-display-page {
    --color-brand: #3E5B9B;
    --color-brand-light: #4b6cb7;
    --color-brand-dark: #182848;
    --primary: var(--color-brand);
    --primary-light: var(--color-brand-light);
    --primary-dark: var(--color-brand-dark);
    background: #eef1f6;
    margin: 0;
    min-height: 100vh;
}
.bdn-preview-shell {
    display: block;
    width: 1280px;
    max-width: calc(100% - 36px);
    margin: 1.25rem auto 2rem;
    background: #fff;
    border: 2px solid color-mix(in srgb, var(--color-brand) 25%, transparent);
    border-radius: 16px;
    box-shadow: 0 4px 24px color-mix(in srgb, var(--color-brand) 12%, transparent);
    padding: 36px 40px 28px;
    box-sizing: border-box;
}
body.bdn-display-page .bdn-article {
    max-width: 100%;
    margin: 0;
    padding: 0;
}

/* ╔══════════════════════════════════════════════════════════╗
   ║  POPUP INFORMATION URGENTE                              ║
   ╚══════════════════════════════════════════════════════════╝ */
.popup-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.55);
    z-index: 4000;
    display: none;
    align-items: center; justify-content: center;
    padding: 1rem;
}
.popup-box {
    background: var(--white);
    border-radius: 14px;
    max-width: 660px; width: 100%;
    max-height: 85vh; overflow-y: auto;
    box-shadow: 0 12px 48px rgba(0,0,0,.35);
}
.popup-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid var(--gray-200);
    position: sticky; top: 0; background: var(--white);
    border-radius: 14px 14px 0 0;
}
.popup-title { font-size: 1.05rem; font-weight: 700; color: var(--primary); }
.popup-close {
    background: var(--gray-100); border: none; cursor: pointer;
    width: 30px; height: 30px; border-radius: 50%;
    font-size: 1rem; line-height: 1; display: flex; align-items: center; justify-content: center;
    color: var(--gray-600); transition: background .15s;
}
.popup-close:hover { background: var(--gray-200); }
.popup-content {
    padding: 1.5rem;
    font-size: .95rem; line-height: 1.4;
}
.popup-content p  { margin: 0 0 .35rem; }
.popup-content h1,
.popup-content h2,
.popup-content h3 { color: var(--primary); margin: 1rem 0 .5rem; }
.popup-content ul,
.popup-content ol { padding-left: 1.5rem; margin-bottom: .75rem; }

/* ── Popup : bordure animée + zoom avant (overrides) ────────── */
.popup-overlay { align-items: center; }

/* Wrapper portant la bordure tournante */
.popup-border-wrap {
    position: relative;
    padding: 6px;
    border-radius: 20px;
    overflow: hidden;
    max-width: 660px;
    width: min(660px, 100%);
    flex: 0 1 660px;
    box-shadow: 0 12px 48px rgba(0,0,0,.45);
    opacity: 0;
    transform: scale(.88);
}
.popup-overlay.is-open .popup-border-wrap {
    animation: popup-in .4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.popup-border-wrap::before {
    content: '';
    position: absolute;
    inset: -50%;
    background: conic-gradient(from 0deg, #8b5cf6, #06b6d4, #f97316, #06b6d4, #8b5cf6);
    animation: border-spin 3.5s linear infinite;
}
@keyframes border-spin { to { transform: rotate(360deg); } }

/* Boîte intérieure : fond blanc positionné au-dessus de la bordure */
.popup-box {
    position: relative;
    z-index: 1;
    background: var(--white);
    border-radius: 14px;
    max-width: unset; width: unset;
    max-height: 82vh; overflow-y: auto;
    box-shadow: none;
    animation: none;
}

/* Titre centré (plus de bouton × à droite) */
.popup-header { justify-content: center; position: relative; padding: 1.2rem 5.5rem 1.2rem 1.5rem; }
.popup-close  { display: none; }
.popup-box img.popup-logo,
.popup-header .popup-logo {
    position: absolute;
    top: 100%;
    right: .55rem;
    transform: translateY(-50%);
    height: 62px;
    width: 62px;
    max-width: 62px;
    max-height: 62px;
    object-fit: contain;
    display: block;
    z-index: 3;
}

/* Zoom avant prononcé avec léger rebond */
@keyframes popup-in {
    from { transform: scale(.88); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* ── Compte à rebours dans le popup ─────────────────────────── */
.popup-countdown {
    text-align: center;
    font-size: 3rem;
    font-weight: 900;
    letter-spacing: .04em;
    line-height: 1;
    padding: 1.1rem 1.5rem .2rem;
    background: linear-gradient(135deg, #8b5cf6, #06b6d4);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.popup-countdown-sub {
    text-align: center;
    font-size: .95rem;
    font-weight: 600;
    color: var(--gray-600);
    padding-bottom: .75rem;
    letter-spacing: .01em;
    text-transform: none;
}

/* ── Dropdown archives ───────────────────────────────────────── */
.bdn-archive-wrap { position: relative; }

.bdn-archive-btn {
    display: flex; align-items: center; gap: .3rem;
    background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.3);
    color: var(--white); border-radius: var(--radius);
    padding: .28rem .7rem; font-size: .8rem; cursor: pointer;
    transition: background .15s;
}
.bdn-archive-btn:hover,
.bdn-archive-btn.active { background: rgba(255,255,255,.28); }
.bdn-caret { font-size: .65rem; transition: transform .2s; }
.bdn-archive-btn.active .bdn-caret { transform: rotate(180deg); }

.bdn-archive-panel {
    display: none;
    position: absolute; right: 0; top: calc(100% + 10px);
    width: 300px; max-height: 420px;
    background: var(--white); border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.22);
    overflow-y: auto; z-index: 200;
    animation: arc-panel-in .18s ease;
}
.bdn-archive-panel.open { display: block; }
@keyframes arc-panel-in { from { opacity:0; transform:translateY(-6px); } to { opacity:1; transform:translateY(0); } }

.bdn-archive-panel-inner { padding: .5rem 0; }

.bdn-arc-year-group { margin-bottom: .25rem; }
.bdn-arc-year-label {
    font-size: .7rem; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--gray-400);
    padding: .5rem 1rem .25rem;
}

.bdn-arc-item {
    display: flex; align-items: center; gap: .5rem;
    padding: .45rem 1rem; text-decoration: none;
    transition: background .12s;
}
.bdn-arc-item:hover { background: var(--gray-100); text-decoration: none; }
.bdn-arc-item.bdn-arc-current { background: #eef2ff; }
.bdn-arc-item.bdn-arc-current .bdn-arc-week { color: var(--primary); }

.bdn-arc-week {
    font-size: .72rem; font-weight: 700; color: var(--gray-500);
    white-space: nowrap; min-width: 52px;
}
.bdn-arc-title {
    flex: 1; font-size: .82rem; color: var(--gray-800);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bdn-arc-date {
    font-size: .72rem; color: var(--gray-400); white-space: nowrap;
}

/* ── Filtre année (select) + pagination dashboard ────────────── */
.year-select {
    padding: .3rem .7rem; border-radius: var(--radius); font-size: .85rem;
    border: 1.5px solid var(--gray-200); background: var(--white);
    color: var(--gray-800); cursor: pointer; min-width: 90px;
}
.year-select:focus { outline: none; border-color: var(--primary-light); }

.pagination {
    display: flex; align-items: center; gap: .3rem;
    margin-top: 1.1rem; flex-wrap: wrap;
}
.page-btn {
    min-width: 34px; height: 34px; padding: 0 .5rem;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: var(--radius); font-size: .85rem;
    text-decoration: none; background: var(--gray-100);
    color: var(--gray-700); border: 1px solid var(--gray-200);
    transition: all .15s;
}
.page-btn:hover { background: var(--gray-200); text-decoration: none; }
.page-btn.active {
    background: var(--primary); color: var(--white);
    border-color: var(--primary); font-weight: 700; cursor: default;
}
.page-ellipsis {
    padding: 0 .3rem; color: var(--gray-400); font-size: .85rem;
    line-height: 34px;
}
.page-info {
    margin-left: auto; font-size: .78rem; color: var(--gray-400);
}

/* Lien inscription sous le formulaire de connexion */
.login-register-link {
    margin-top: 1rem; text-align: center;
    font-size: .85rem; color: var(--gray-500);
}
.login-register-link a { color: var(--primary); }

/* ── Alignement / taille Quill — rendu hors éditeur ──────────────────────── */
.ql-align-center  { text-align: center;  }
.ql-align-right   { text-align: right;   }
.ql-align-justify { text-align: justify; }
.ql-size-small { font-size: .75em; }
.ql-size-large { font-size: 1.5em; }
.ql-size-huge  { font-size: 2.5em; }

/* Barre Quill : libellés taille en français */
body.editor-page .ql-snow .ql-picker.ql-size {
    width: 98px;
}
body.editor-page .ql-snow .ql-picker.ql-size .ql-picker-label::before,
body.editor-page .ql-snow .ql-picker.ql-size .ql-picker-item::before {
    content: 'Normal';
}
body.editor-page .ql-snow .ql-picker.ql-size .ql-picker-label[data-value=small]::before,
body.editor-page .ql-snow .ql-picker.ql-size .ql-picker-item[data-value=small]::before {
    content: 'Petit';
}
body.editor-page .ql-snow .ql-picker.ql-size .ql-picker-label[data-value=large]::before,
body.editor-page .ql-snow .ql-picker.ql-size .ql-picker-item[data-value=large]::before {
    content: 'Grand';
}
body.editor-page .ql-snow .ql-picker.ql-size .ql-picker-label[data-value=huge]::before,
body.editor-page .ql-snow .ql-picker.ql-size .ql-picker-item[data-value=huge]::before {
    content: 'Très grand';
}

/* Modale de publication (remplace confirm() du navigateur) */
.bdn-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 4000;
    background: rgba(15, 23, 42, .55);
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.bdn-modal-overlay.is-open { display: flex; }
.bdn-modal {
    background: #fff;
    border-radius: 16px;
    width: 440px;
    max-width: 100%;
    box-shadow: 0 24px 64px rgba(0,0,0,.28);
    overflow: hidden;
}
.bdn-modal-header {
    padding: 1rem 1.35rem;
    font-weight: 700;
    font-size: 1.05rem;
    color: #fff;
    background: linear-gradient(135deg, var(--primary-light, #2980b9), var(--primary-dark, #154360));
}
.bdn-modal-header.is-success { background: linear-gradient(135deg, #16a34a, #15803d); }
.bdn-modal-header.is-error   { background: linear-gradient(135deg, #dc2626, #b91c1c); }
.bdn-modal-body {
    padding: 1.25rem 1.35rem 1rem;
    font-size: .95rem;
    color: var(--gray-800);
    line-height: 1.55;
}
.bdn-modal-body p { margin: 0 0 .6rem; }
.bdn-modal-note { font-size: .82rem; color: var(--gray-600); }
.bdn-modal-footer {
    padding: .9rem 1.35rem;
    display: flex;
    justify-content: flex-end;
    gap: .6rem;
    border-top: 1px solid var(--gray-200);
    background: #f8fafc;
}

/* ── Image dans un bloc — éditeur ────────────────────────────────────────── */
.block-image-zone {
    display: flex; flex-direction: column; gap: .5rem;
}
.block-image-wrap {
    display: flex; flex-direction: column; gap: .4rem;
}
.block-image-thumb {
    max-height: 90px; max-width: 100%; border-radius: 4px;
    border: 1px solid var(--border); object-fit: contain;
}
.block-image-opts {
    display: flex; flex-direction: column; gap: .35rem;
}
.img-opt-row {
    display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
}
.img-opt-label {
    font-size: .82rem; color: var(--gray-500); min-width: 120px;
}
.img-pos-group { display: flex; gap: .3rem; }
.block-img-pos-btn {
    padding: .2rem .55rem; font-size: .78rem;
    background: var(--bg-secondary); border: 1px solid var(--border);
    border-radius: 4px; cursor: pointer; transition: background .15s;
}
.block-img-pos-btn.active {
    background: var(--primary); color: #fff; border-color: var(--primary);
}
.img-opt-hint {
    font-size: .78rem; color: var(--gray-400); font-style: italic;
}
.block-img-width-range,
.block-img-radius-range {
    flex: 1; min-width: 80px; max-width: 140px; accent-color: var(--primary);
}

.block-insert-zone {
    display: flex; flex-direction: column; gap: .5rem;
}
.block-insert-zone .form-control {
    flex: 1; min-width: 180px;
}
.block-sep-style {
    padding: .25rem .5rem;
    border: 1px solid var(--border, #dde3f0);
    border-radius: 4px;
    font-size: .85rem;
    background: #fff;
}
.block-sep-size {
    flex: 1; min-width: 80px; max-width: 140px; accent-color: var(--primary);
}
.block-sep-color {
    width: 42px; height: 32px; padding: 0; border: 1px solid var(--border, #dde3f0);
    border-radius: 4px; background: #fff; cursor: pointer;
}

/* ── Image dans un bloc — affichage public/aperçu ────────────────────────── */
.bdn-block-text img {
    max-width: 100%; height: auto;
}
.bdn-block-text::after { content: ''; display: table; clear: both; }
.bdn-block-img-wrap img {
    max-width: 100%; height: auto;
}
.bdn-img-float::after { content: ''; display: table; clear: both; }

/* Clearfix pour les images flottantes dans l'éditeur Quill */
.ql-editor::after { content: ''; display: table; clear: both; }
/* Indiquer qu'une image est sélectionnable/modifiable */
.ql-editor img { cursor: pointer; transition: outline .1s; }
.ql-editor img:hover { outline: 2px dashed var(--primary); }

/* ╔══════════════════════════════════════════════════════════╗
   ║  RESPONSIVE MOBILE                                      ║
   ╚══════════════════════════════════════════════════════════╝ */
@media (max-width: 640px) {

    /* ── Barre de nav publique ─────────────────────────────── */
    .bdn-nav-bar { padding: 0 .75rem; }
    .bdn-nav-inner {
        height: auto; min-height: 48px;
        flex-wrap: wrap; padding: .4rem 0; gap: .4rem;
    }
    .bdn-nav-edition { font-size: .72rem; min-width: 0; }
    .bdn-nav-right   { gap: .3rem; }
    .bdn-admin-link  { font-size: .72rem; padding: .2rem .4rem; }

    /* ── Nav locale (llbmg/bdn.php) ───────────────────────── */
    .bdn-nav-local { flex-wrap: wrap; gap: .4rem; padding: .5rem .75rem; }

    /* ── Article BDN ───────────────────────────────────────── */
    .bdn-nav-local { margin: .75rem 12px 0; }
    .bdn-article { gap: .75rem; margin: .75rem 12px; padding-bottom: 1rem; }
    body.bdn-display-page .bdn-article { margin: 0; padding: 0; }
    .bdn-preview-shell {
        padding: 16px 14px 20px;
        border-radius: 10px;
        max-width: calc(100% - 16px);
        margin: .75rem auto 1.25rem;
    }
    .preview-banner-inner {
        max-width: calc(100% - 16px);
        padding: .5rem 0;
    }

    /* ── Carte Header ──────────────────────────────────────── */
    .bdn-header { padding: 2.4rem 1rem 1.25rem; border-radius: 10px; }
    .header-preview { padding: 2.2rem 1rem 1.15rem; }
    .bdn-week-label {
        top: .5rem;
        right: .7rem;
        font-size: .72rem;
        padding: .18rem .55rem;
    }
    .bdn-header-inner,
    .bdn-header.logo-left .bdn-header-inner { flex-direction: column; align-items: flex-start; gap: .6rem; }
    .bdn-header.logo-center .bdn-header-inner { align-items: center; }
    .bdn-logo-img  { max-height: 56px; max-width: 130px; }
    .bdn-main-title { font-size: 1.3rem; }
    .bdn-pub-date   { font-size: .8rem; }

    /* ── Cartes Contenu ────────────────────────────────────── */
    .bdn-block { padding: 1.25rem 1rem; border-radius: 10px; }
    .bdn-block-title { font-size: 1.05rem; }
    .bdn-block-text  { font-size: .9rem; }

    /* ── Carte Footer ──────────────────────────────────────── */
    .bdn-footer { padding: 1.1rem 1rem; border-radius: 10px; }

    /* ── Popup ─────────────────────────────────────────────── */
    .popup-border-wrap { margin: .5rem; }
    .popup-box  { max-height: 90vh; }
    .popup-header { padding: 1.05rem 4.2rem 1.05rem 1rem; }
    .popup-box img.popup-logo,
    .popup-header .popup-logo {
        height: 48px;
        width: 48px;
        max-height: 48px;
        max-width: 48px;
        top: 100%;
        right: .4rem;
        transform: translateY(-50%);
    }
    .popup-content { padding: 1rem; font-size: .9rem; }

    /* ── Barre d'aperçu admin ──────────────────────────────── */
    .preview-info { display: none; }

    /* ── Topbar éditeur ────────────────────────────────────── */
    .editor-topbar { padding: .45rem .75rem; gap: .5rem; }
    .editor-title-input { width: 160px; font-size: .9rem; }
    .editor-topbar-center { gap: .4rem; }
    .editor-topbar-right  { gap: .3rem; flex-wrap: wrap; }
    .save-status { min-width: 0; }
}
