/* ============================================================
   FCBB v1.1 - Styles du panneau d'administration
   ============================================================ */

:root {
  --fcbb-red: #c8102e;
  --fcbb-dark-red: #8f0b20;
  --fcbb-blue: #0033a0;
  --fcbb-dark-blue: #071d49;
  --fcbb-yellow: #f4c430;
  --fcbb-light: #f7f8fb;
  --fcbb-border: #d9deea;

  --gm: var(--fcbb-red);
  --gd: var(--fcbb-dark-blue);
  --gl: var(--fcbb-yellow);
  --gp: #fff4f6;
  --gb: var(--fcbb-border);
  --bg: var(--fcbb-light);
  --tx: #1f2937;
  --ts: #4b5563;
  --tm: #6b7280;
  --sidebar-w: 230px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: "Open Sans", Arial, sans-serif; background: var(--bg); color: var(--tx); display: flex; min-height: 100vh; }

/* === SIDEBAR ================================================ */
.admin-sidebar {
  width: var(--sidebar-w);
  background: var(--gd);
  min-height: 100vh;
  position: fixed;
  top: 0; left: 0;
  display: flex;
  flex-direction: column;
  padding: 0 0 2rem;
  z-index: 100;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px;
  padding: 1.4rem 1.2rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
  margin-bottom: 1.2rem;
}
.sidebar-brand img { width: 40px; height: 40px; object-fit: contain; }
.sidebar-brand span { font-family: "Nunito", sans-serif; font-weight: 900; font-size: .95rem; color: #fff; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 0 .8rem; flex: 1; }
.sidebar-nav a {
  color: rgba(255,255,255,.65); text-decoration: none; font-size: .85rem; font-weight: 600;
  padding: 9px 12px; border-radius: 8px; transition: background .2s, color .2s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.sidebar-nav a.active { background: var(--gm); color: #fff; }
.sidebar-sep { height: 1px; background: rgba(255,255,255,.1); margin: .8rem 0; }
.logout-link { color: rgba(255,100,80,.8) !important; }
.logout-link:hover { background: rgba(255,80,60,.15) !important; color: #ff6b5b !important; }

/* === MAIN CONTENT =========================================== */
.admin-main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 2rem;
  max-width: calc(100vw - var(--sidebar-w));
}

.admin-topbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1.8rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--gb);
}
.admin-topbar h2 { font-family: "Nunito", sans-serif; font-weight: 900; font-size: 1.5rem; color: var(--gd); }
.admin-topbar span { font-size: .85rem; color: var(--ts); }

/* === CARTES STATS =========================================== */
.admin-cards { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-bottom: 1.5rem; }
.admin-card {
  background: #fff; border: 1px solid var(--gb); border-radius: 12px;
  padding: 1.2rem 1.4rem; display: flex; align-items: center; gap: 1rem;
  box-shadow: 0 2px 10px rgba(60,120,20,.07);
  position: relative;
}
.ac-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.ac-num   { font-family: "Nunito", sans-serif; font-weight: 900; font-size: 1.6rem; color: var(--gm); line-height: 1; }
.ac-label { font-size: .75rem; color: var(--tm); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }

/* === PANEL ================================================== */
.admin-panel {
  background: #fff; border: 1px solid var(--gb); border-radius: 14px;
  padding: 1.5rem 1.8rem; box-shadow: 0 2px 12px rgba(60,120,20,.06);
  margin-bottom: 1.5rem;
}
.admin-panel h3 { font-family: "Nunito", sans-serif; font-weight: 800; font-size: 1.05rem; color: var(--tx); margin-bottom: 1.2rem; }

.panel-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.panel-header h3 { margin: 0; }

/* Grid 2 colonnes */
.admin-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }

/* === TABLEAUX =============================================== */
.admin-table { width: 100%; border-collapse: collapse; font-size: .84rem; }
.admin-table th { text-align: left; padding: 10px 12px; font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--tm); border-bottom: 2px solid var(--gb); }
.admin-table td { padding: 11px 12px; border-bottom: 1px solid #f0f5ec; color: var(--tx); }
.admin-table tr:last-child td { border-bottom: none; }
.admin-table tr:hover td { background: #f8fcf6; }
.row-unread td { font-weight: 700; }
.table-actions { display: flex; gap: .4rem; }

/* Affichage du tri possible sur les articles des actualités */
.admin-table th a {
    color: inherit;
    text-decoration: none;
    display: block;
    font-weight: bold;
}

.admin-table th a:hover {
    text-decoration: underline;
}

.admin-table th a:visited {
    color: inherit;
}

/* === BADGES ================================================= */
.badge-unread { background: #fee2e2; color: #c0392b; font-size: .7rem; font-weight: 700; padding: 2px 8px; border-radius: 100px; position: absolute; top: 10px; right: 10px; }
.badge-unread-pill { background: #fee2e2; color: #c0392b; font-size: .75rem; font-weight: 700; padding: 3px 9px; border-radius: 100px; }
.badge-read { color: var(--tm); font-size: .78rem; }

/* === BOUTONS ================================================ */
.btn-admin-primary {
  background: var(--gm); color: #fff; border: none; border-radius: 8px;
  padding: 10px 22px; font-weight: 700; font-size: .85rem; cursor: pointer;
  transition: background .2s; text-decoration: none; display: inline-block;
}
.btn-admin-primary:hover { background: var(--gd); }

.btn-admin-secondary {
  background: #fff; color: var(--ts); border: 1.5px solid var(--gb); border-radius: 8px;
  padding: 10px 20px; font-weight: 600; font-size: .85rem; cursor: pointer;
  transition: border-color .2s; text-decoration: none; display: inline-block;
}
.btn-admin-secondary:hover { border-color: var(--gm); }

.btn-admin-sm {
  background: var(--gp); color: var(--gd); border: 1px solid var(--gb); border-radius: 6px;
  padding: 5px 11px; font-size: .75rem; font-weight: 700; cursor: pointer;
  text-decoration: none; transition: background .2s;
  white-space: nowrap;
}
.btn-admin-sm:hover { background: var(--gb); }
.btn-toggle { background: #fff5cc; color: #7a6000; border-color: #e0cc88; }
.btn-toggle:hover { background: #ffe97a; }
.btn-danger { background: #fdecea; color: #c0392b; border-color: #f5c6cb; }
.btn-danger:hover { background: #f5c6cb; }

/* === FORMULAIRES ADMIN ====================================== */
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--tm); margin-bottom: .4rem; }
.form-group input,
.form-group textarea,
.form-group select {
  width: 100%; background: #f8fcf6; border: 1.5px solid var(--gb); border-radius: 8px;
  padding: 9px 12px; color: var(--tx); font-family: "Open Sans", Arial, sans-serif;
  font-size: .88rem; outline: none; transition: border-color .2s;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus { border-color: var(--gm); box-shadow: 0 0 0 3px rgba(92,186,46,.1); }
.form-group textarea { resize: vertical; min-height: 80px; }

/* === ALERTES ================================================ */
.alert { padding: 12px 16px; border-radius: 8px; font-size: .88rem; font-weight: 600; margin-bottom: 1.2rem; }
.alert-error { background: #fdecea; color: #c0392b; border: 1px solid #f5c6cb; }
.alert-ok    { background: #eaf6e2; color: var(--gd); border: 1px solid var(--gb); }

/* === SHORTCUTS ============================================== */
.admin-shortcuts { display: grid; grid-template-columns: repeat(4,1fr); gap: 1rem; margin-top: 1.5rem; }
.shortcut-card {
  background: #fff; border: 1.5px solid var(--gb); border-radius: 12px;
  padding: 1.2rem; text-align: center; font-size: .85rem; font-weight: 700;
  color: var(--gd); text-decoration: none; transition: border-color .2s, transform .2s, box-shadow .2s;
  display: flex; flex-direction: column; align-items: center; gap: .5rem;
}
.shortcut-card span { font-size: 1.5rem; }
.shortcut-card:hover { border-color: var(--gm); transform: translateY(-2px); box-shadow: 0 6px 18px rgba(60,120,20,.1); }

/* === PAGE LOGIN ============================================= */
body.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.login-wrap { background: #fff; border: 1px solid var(--gb); border-radius: 16px; padding: 2.5rem 2rem; width: 100%; max-width: 400px; box-shadow: 0 8px 32px rgba(60,120,20,.1); }
.login-logo { text-align: center; margin-bottom: 2rem; }
.login-logo img { width: 72px; margin-bottom: .8rem; }
.login-logo h1 { font-family: "Nunito", sans-serif; font-weight: 900; font-size: 1.8rem; color: var(--gd); }
.login-logo p { font-size: .85rem; color: var(--tm); margin-top: .3rem; }

/* === RESPONSIVE ============================================= */
@media (max-width: 1100px) {
  .admin-cards { grid-template-columns: repeat(2,1fr); }
  .admin-shortcuts { grid-template-columns: repeat(2,1fr); }
  .admin-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .admin-sidebar { display: none; }
  .admin-main { margin-left: 0; max-width: 100vw; }
  .admin-cards { grid-template-columns: 1fr; }
  .admin-shortcuts { grid-template-columns: 1fr; }
}
/* ==========================================================
   VIDEOS ADMIN
   Mise en page du module de gestion des vidéos
   ========================================================== */

/* Header principal de page -------------------------------- */

.admin-page-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 24px;
}

.admin-page-header h1 {
  margin-bottom: 6px;
}

.admin-subtitle {
  margin: 0;
  color: #666;
  font-size: 0.95rem;
}

/* Header des sections ------------------------------------- */

.admin-section-header {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;

  margin-bottom: 20px;
  padding-bottom: 12px;

  border-bottom: 1px solid #e5e5e5;
}

.admin-section-header h2 {
  margin: 0 0 8px 0;
  text-align: left;
}

.admin-section-header p {
  margin: 0;

  color: #666;
  font-size: 0.92rem;
  line-height: 1.4;

  max-width: none;
}

/* Formulaire ---------------------------------------------- */

.admin-form {
  width: 100%;

  display: flex;
  flex-direction: column;
  gap: 20px;

  margin-top: 28px;

  /* respiration visuelle sous le titre */
  padding-left: 38px;
}

/* Layout grille du formulaire */

.form-grid {
  display: grid;
  gap: 18px;
}

.form-grid.two-columns {
  display: grid;

  grid-template-columns:
    minmax(320px, 1fr)
    minmax(320px, 1fr);

  column-gap: 28px;
  row-gap: 18px;

  width: 100%;
}

/* Champs formulaire */

.form-field {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  column-gap: 18px;
  align-items: center;
}

.form-field.full-width {
  grid-column: 1 / -1;
}

.form-field label {
  text-align: right;
  font-weight: 600;
  color: #333;
}

.form-field input,
.form-field select,
.form-field textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d4d4d4;
  border-radius: 8px;
  font-size: 0.95rem;
}

.form-field textarea {
  resize: vertical;
}

.form-field.full-width .media-input-row,
.form-field.full-width textarea,
.form-field.full-width .field-help {
  grid-column: 2;
}

/* Checkbox ------------------------------------------------ */

.checkbox-field {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;

  padding-bottom: 12px;
}

.checkbox-field label {
  display: inline-flex;
  align-items: center;
  gap: 10px;

  font-weight: 500;

  white-space: nowrap;
}

/* Actions formulaire -------------------------------------- */

.form-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.form-actions.right {
  justify-content: flex-end;
}

/* Tableau vidéos ------------------------------------------ */

.actions-cell {
  white-space: nowrap;
}

/* Responsive ---------------------------------------------- */

@media (max-width: 900px) {

  .form-grid.two-columns {
    grid-template-columns: 1fr;
  }

  .form-field {
    grid-template-columns: 1fr;
  }

  .form-field label {
    text-align: left;
  }

  .form-field.full-width .media-input-row,
  .form-field.full-width textarea,
  .form-field.full-width .field-help {
    grid-column: 1;
  }

  .form-actions.right {
    justify-content: stretch;
  }

  .form-actions.right button,
  .form-actions.right a {
    width: 100%;
    text-align: center;
  }
}

/* Panel spécifique aux pages de gestion -------------------- */

.admin-panel {
  background: #fff;
  border: 1px solid var(--gb);
  border-radius: 12px;
  padding: 1.6rem 1.8rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 10px rgba(60,120,20,.07);
}

/* ==========================================================
   MEDIA PICKER
   Sélecteur de vidéos / posters
   ========================================================== */

.media-picker-page {
  background: var(--bg);
  padding: 2rem;
}

.media-picker {
  max-width: 1100px;
  margin: 0 auto;
}

.media-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 1.5rem;
}

/* Un fichier = une ligne ---------------------------------- */

.media-item {
  width: 100%;

  display: flex;
  flex-direction: column;
  align-items: flex-start;

  padding: 14px 16px;

  background: #fff;
  border: 1px solid var(--gb);
  border-radius: 12px;

  cursor: pointer;
  transition:
    border-color .2s,
    transform .15s,
    box-shadow .2s;
}

.media-item:hover {
  border-color: var(--gm);
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(60,120,20,.08);
}

.media-name {
  font-weight: 700;
  color: var(--gd);
}

.media-path {
  margin-top: 4px;
  font-size: .85rem;
  color: var(--tm);
  word-break: break-word;
}

/* Aide champs media --------------------------------------- */

.media-input-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.media-input-row input {
  flex: 1;
}

.field-help {
  margin-top: 6px;
  display: block;
  color: var(--tm);
  font-size: .82rem;
}
/* Ligne media large (vidéo / poster) ---------------------- */

.media-input-row-wide {
  width: 100%;

  display: grid;
  grid-template-columns:
    minmax(620px, 1fr)
    auto
    auto;

  gap: 12px;
  align-items: center;
}

.media-input-row-wide input[type="text"] {
  min-width: 0;
}

.media-input-row-wide .btn-admin-secondary {
  white-space: nowrap;
}

@media (max-width: 900px) {

  .media-input-row-wide {
    grid-template-columns: 1fr;
  }

}

/* Journal génération vidéos ------------------------------- */

.admin-log-view {
  margin-top: 1rem;
  max-height: 360px;
  overflow: auto;

  background: #101614;
  color: #d7f7d0;

  border-radius: 10px;
  padding: 1rem;

  font-size: .82rem;
  line-height: 1.45;

  white-space: pre-wrap;
}

/* CKEditor dropdowns au-dessus des panneaux admin */
.ck.ck-balloon-panel,
.ck.ck-dropdown__panel {
    z-index: 999999 !important;
}

.ck.ck-editor,
.ck.ck-editor__main,
.ck.ck-content {
    overflow: visible !important;
}

.admin-panel {
    overflow: visible !important;
}

.ck-content .text-align-right {
    text-align: right;
}

.ck-content .text-align-center {
    text-align: center;
}

.ck-content .text-align-left {
    text-align: left;
}

.ck-content .text-align-justify {
    text-align: justify;
}

/* ==========================================================
   CKEDITOR
   Isolation de l'éditeur WYSIWYG
   ========================================================== */

.ck,
.ck *,
.ck *::before,
.ck *::after {
  box-sizing: initial;
}

.ck.ck-editor {
  width: 100%;
}

.ck.ck-editor__editable {
  min-height: 320px;
  padding: 1rem;
}

.ck.ck-toolbar {
  padding: 4px;
}

.ck.ck-dropdown__panel,
.ck.ck-balloon-panel {
  z-index: 999999;
}