/* Rotary District 9101 — back-office */
:root { --r-blue: #17458F; --r-night: #0C2340; --r-gold: #F7A81B; --r-sky: #EAF1FA; --r-line: #E3E7ED; }
body.admin { background: #F4F6F9; font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; font-size: .95rem; }
.admin-shell { display: flex; min-height: 100vh; }

/* ---------- Barre latérale ----------
   Bootstrap rend « .offcanvas-lg » transparent sur grand écran : le fond bleu nuit est donc forcé. */
.admin-sidebar,
.admin-sidebar.offcanvas-lg { width: 270px; flex: 0 0 270px; background-color: var(--r-night) !important; color: #fff; }
@media (min-width: 992px) {
    .admin-sidebar.offcanvas-lg { display: block; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
}
.admin-brand { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: 1rem 1.1rem; border-bottom: 1px solid rgba(255,255,255,.08); }
.admin-brand img { height: auto; max-height: 38px; max-width: 150px; background: #fff; border-radius: 6px; padding: 3px 6px; }
.admin-brand span { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--r-gold); font-weight: 700; white-space: nowrap; }
.admin-nav { width: 100%; padding: .8rem .6rem 2rem; display: flex; flex-direction: column; }
.admin-nav a { display: flex; align-items: center; gap: .65rem; color: rgba(255,255,255,.85); padding: .5rem .75rem; border-radius: 8px; text-decoration: none; font-size: .9rem; }
.admin-nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.admin-nav a.active { background: var(--r-blue); color: #fff; }
.admin-nav a i { font-size: 1.05rem; width: 1.2rem; }
.admin-nav-title { font-size: .7rem; text-transform: uppercase; letter-spacing: .1em; color: rgba(255,255,255,.5); padding: 1rem .75rem .3rem; }

/* ---------- Zone principale ---------- */
.admin-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.admin-topbar { display: flex; align-items: center; gap: 1rem; padding: .75rem 1.5rem; background: #fff; border-bottom: 1px solid var(--r-line); position: sticky; top: 0; z-index: 1000; }
.admin-title { font-weight: 700; font-size: 1.1rem; color: var(--r-night); }
.admin-content { padding: 1.5rem; max-width: 1400px; width: 100%; }
.admin-card { border: 0; border-radius: 12px; box-shadow: 0 1px 3px rgba(12,35,64,.08); }
.admin-card .card-header { border-bottom: 1px solid var(--r-line); }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; margin-bottom: 1.2rem; }
.page-actions h1 { font-size: 1.4rem; margin: 0; color: var(--r-night); }

/* ---------- Tableau de bord ---------- */
.kpi { background: #fff; border-radius: 12px; padding: 1.1rem 1.2rem; box-shadow: 0 1px 3px rgba(12,35,64,.08); display: flex; gap: 1rem; align-items: center; height: 100%; }
.kpi i { font-size: 1.6rem; color: var(--r-blue); background: var(--r-sky); width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; }
.kpi strong { display: block; font-size: 1.6rem; line-height: 1.1; color: var(--r-night); }
.kpi span { font-size: .82rem; color: #5B6675; }
.kpi.warn i { color: #9A6700; background: #FFF4D6; }
.mandate-banner { background: linear-gradient(135deg, var(--r-night), var(--r-blue)); color: #fff; border-radius: 12px; padding: 1.3rem 1.5rem; }
.mandate-banner .badge { background: var(--r-gold); color: var(--r-night); }

/* ---------- Tableaux et médias ---------- */
.table-admin { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(12,35,64,.08); margin-bottom: 0; }
.table-admin th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: #5B6675; background: #F8FAFC; font-weight: 600; }
.table-admin td { vertical-align: middle; }
.thumb-sm { width: 56px; height: 42px; object-fit: cover; border-radius: 6px; background: var(--r-sky); }
.avatar-sm { width: 44px; height: 44px; object-fit: cover; border-radius: 50%; background: var(--r-sky); }
.image-input-preview { width: 120px; height: 90px; object-fit: cover; border-radius: 8px; border: 1px solid var(--r-line); }
.media-tile { position: relative; border-radius: 10px; overflow: hidden; background: var(--r-sky); aspect-ratio: 4/3; }
.media-tile img { width: 100%; height: 100%; object-fit: cover; }
.media-tile .media-icon { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; color: var(--r-blue); text-decoration: none; padding: .5rem; text-align: center; }
.media-tile .media-icon i { font-size: 2rem; }
.media-tile .media-icon small { font-size: .75rem; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.media-tile-action { position: absolute; top: .4rem; right: .4rem; }
.media-tile.is-cover { outline: 3px solid var(--r-gold); }

/* ---------- Connexion ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, var(--r-night), var(--r-blue)); padding: 1rem; }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 16px; padding: 2rem; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.login-card img { height: 48px; }

/* ---------- Passation, droits, divers ---------- */
.handover-step { background: #fff; border-radius: 12px; padding: 1.3rem; box-shadow: 0 1px 3px rgba(12,35,64,.08); height: 100%; border-top: 4px solid var(--r-blue); }
.handover-step.out { border-top-color: #6c757d; }
.handover-step.in { border-top-color: var(--r-gold); }
.matrix th, .matrix td { text-align: center; }
.matrix td:first-child, .matrix th:first-child { text-align: left; }
.tox-tinymce { border-radius: 8px !important; }
.validation-summary-valid { display: none; }

/* ---------- Vidéos (aperçus dans l'administration) ---------- */
.video-thumb { position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: #0C2340; color: #fff; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; }
.video-facebook { background: linear-gradient(135deg, #1877F2, #0B4FB3); }
.video-tiktok { background: linear-gradient(135deg, #111 55%, #25F4EE 140%), #111; }
.video-youtube { background: #c4302b; }
.video-vimeo { background: linear-gradient(135deg, #1AB7EA, #0D7FA6); }
.video-brand { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 3rem; opacity: .4; }
.video-badge { position: absolute; left: .5rem; bottom: .5rem; padding: .15rem .5rem; border-radius: 999px; background: rgba(0, 0, 0, .65); font-size: .75rem; font-weight: 600; }

/* ---------- Assistant IA ---------- */
.ai-bar { border-left: 4px solid #17458f; }
.ai-chat-log { height: 52vh; min-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: .75rem; background: #f7f8fb; }
.ai-msg { max-width: 85%; padding: .65rem .9rem; border-radius: .75rem; line-height: 1.5; }
.ai-msg p { margin-bottom: .4rem; }
.ai-msg p:last-child, .ai-msg ul:last-child { margin-bottom: 0; }
.ai-msg ul { padding-left: 1.2rem; margin-bottom: .4rem; }
.ai-msg-bot { align-self: flex-start; background: #fff; border: 1px solid #e3e6ee; }
.ai-msg-user { align-self: flex-end; background: #17458f; color: #fff; }
.ai-msg-error { border-color: #dc3545; color: #b02a37; }
.ai-chat-form textarea { resize: vertical; }
.ai-batch-log { max-height: 240px; overflow-y: auto; }
