/* ==== Calendrier Éditorial — feuille de style ==== */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #2563eb;
  --primary-fonce: #1d4ed8;
  --primary-clair: #e0ecff;
  --fond: #f4f6fb;
  --carte: #ffffff;
  --texte: #0f172a;
  --texte-secondaire: #64748b;
  --bordure: #e2e8f0;
  --erreur: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --info: #0891b2;
  --rayon: 12px;
  --ombre: 0 1px 3px rgba(15, 23, 42, 0.08);
  --statut-planifiee: #2563eb;
  --statut-envoyee: #d97706;
  --statut-publiee: #16a34a;
  --statut-erreur: #dc2626;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--fond);
  color: var(--texte);
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Page login standalone ---------- */
.page-login {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px;
  background: linear-gradient(135deg, #1e3a8a, #2563eb 60%, #38bdf8);
}
.carte-login {
  background: #fff; padding: 32px; border-radius: 16px;
  box-shadow: 0 18px 40px rgba(0,0,0,0.25); width: 100%; max-width: 380px;
}
.carte-login h1 { font-size: 1.35rem; margin-bottom: 4px; }
.carte-login .sous-titre { color: var(--texte-secondaire); margin-bottom: 20px; font-size: 0.9rem; }
.pied-login { text-align: center; color: var(--texte-secondaire); font-size: 0.8rem; margin-top: 16px; }

/* ---------- En-tête ---------- */
.entete {
  background: linear-gradient(135deg, #1e3a8a, var(--primary));
  color: #fff; padding: 24px 16px 28px;
}
.entete .entete-interne { max-width: 1200px; margin: 0 auto; display:flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap;}
.entete h1 { font-size: 1.4rem; }
.entete .sous-titre { opacity: 0.85; font-size: 0.95rem; }
.entete .session { display: flex; align-items: center; gap: 12px; font-size: 0.9rem; }
.entete .session strong { font-weight: 600; }

/* ---------- Conteneur ---------- */
.conteneur {
  max-width: 1200px; margin: -16px auto 32px; padding: 0 16px;
}

/* ---------- Onglets ---------- */
.barre-onglets {
  display: flex; gap: 4px;
  background: var(--carte); border-radius: var(--rayon);
  padding: 6px; box-shadow: var(--ombre); margin-bottom: 16px; flex-wrap: wrap;
}
.barre-onglets button {
  flex: 1; min-width: 120px;
  background: none; border: none; padding: 10px 12px;
  font-size: 0.95rem; font-weight: 600; color: var(--texte-secondaire);
  cursor: pointer; border-radius: 8px; transition: background 0.15s, color 0.15s;
}
.barre-onglets button:hover { background: #f1f5f9; }
.barre-onglets button.onglet-actif { background: var(--primary); color: #fff; }

/* ---------- Carte générique ---------- */
.carte {
  background: var(--carte); border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 20px; margin-bottom: 20px;
}
.carte h2 { font-size: 1.05rem; margin-bottom: 14px; }
.carte h3 { font-size: 0.95rem; margin-bottom: 10px; color: var(--texte-secondaire); text-transform: uppercase; letter-spacing: 0.05em; }

/* ---------- Form / grille ---------- */
.grille { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.grille-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px 16px; }
.pleine-largeur { grid-column: 1 / -1; }

.champ { margin-bottom: 12px; }
.champ label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 4px; }
.obligatoire { color: var(--erreur); }

input[type="text"], input[type="url"], input[type="password"], input[type="date"], input[type="time"], input[type="number"], textarea, select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--bordure);
  border-radius: 8px; font-size: 0.95rem; font-family: inherit; background: #fff; color: var(--texte);
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}
textarea { resize: vertical; min-height: 80px; }

/* ---------- Boutons ---------- */
.btn-principal {
  background: var(--primary); color: #fff; border: none;
  border-radius: 8px; padding: 10px 16px; font-size: 0.95rem;
  font-weight: 600; cursor: pointer; transition: background 0.15s;
}
.btn-principal:hover { background: var(--primary-fonce); }
.btn-principal:disabled { opacity: 0.6; cursor: wait; }

.btn-secondaire {
  background: var(--primary-clair); color: var(--primary-fonce);
  border: 1px solid #b6d2ff; border-radius: 8px;
  padding: 8px 14px; font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.btn-secondaire:hover { background: #c7dcfb; }

.btn-lien {
  background: none; border: none; color: var(--primary);
  font-size: 0.85rem; font-weight: 600; cursor: pointer; padding: 4px 6px;
}
.btn-lien:hover { text-decoration: underline; }

.boutons-action { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Tableaux ---------- */
.tableau { width: 100%; border-collapse: collapse; font-size: 0.9rem; margin-top: 8px; }
.tableau th, .tableau td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--bordure); vertical-align: top; }
.tableau th { background: #f8fafc; font-weight: 600; color: var(--texte-secondaire); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em; }
.tableau tr:hover td { background: #fafbfc; }
.tableau .col-actions { text-align: right; white-space: nowrap; }

.bouton-petit {
  background: none; border: 1px solid var(--bordure);
  border-radius: 6px; padding: 4px 10px; font-size: 0.85rem;
  color: var(--texte-secondaire); cursor: pointer; margin-left: 4px;
}
.bouton-petit:hover { background: #f1f5f9; }
.bouton-petit.danger { color: var(--erreur); border-color: #f5c6c2; }
.bouton-petit.danger:hover { background: #fdeceb; }
.bouton-petit.ok { color: var(--ok); border-color: #bbf7d0; }
.bouton-petit.ok:hover { background: #f0fdf4; }

/* ---------- Badges statut ---------- */
.badge {
  display: inline-block; padding: 2px 8px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: #fff;
}
.badge.planifiee { background: var(--statut-planifiee); }
.badge.envoyee   { background: var(--statut-envoyee); }
.badge.publiee   { background: var(--statut-publiee); }
.badge.erreur    { background: var(--statut-erreur); }

/* Badge pour les publications dont les médias ont été purgés par la politique
   de rétention. On garde un ton neutre / grisé pour ne pas le confondre avec
   un statut. */
.badge-purged {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 500;
  color: #555;
  background: #f0f0f0;
  border: 1px dashed #bbb;
  font-style: italic;
}

/* ---------- Erreurs / messages ---------- */
.erreur-cache { display: none; }
.erreur {
  margin-top: 12px; background: #fef2f2; color: var(--erreur);
  border: 1px solid #fecaca; border-radius: 8px; padding: 10px 12px; font-size: 0.9rem; white-space: pre-wrap;
}
.message-ok { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; border-radius: 8px; padding: 8px 12px; font-size: 0.9rem; }
.message-info { background: #ecfeff; color: var(--info); border: 1px solid #a5f3fc; border-radius: 8px; padding: 8px 12px; font-size: 0.9rem; }
.ecran-cache { display: none !important; }

/* ---------- Modales ---------- */
.modale-cache { display: none !important; }
.modale[aria-modal="true"] {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto;
}
.modale-contenu {
  background: var(--carte); border-radius: var(--rayon);
  padding: 22px; max-width: 640px; width: 100%; max-height: calc(100vh - 32px);
  overflow-y: auto; box-shadow: 0 18px 40px rgba(0,0,0,0.25);
}
.modale-contenu h2 { margin-bottom: 14px; padding-right: 30px; }
.modale-fermer {
  position: absolute; top: 14px; right: 18px; background: none; border: none;
  font-size: 1.4rem; color: var(--texte-secondaire); cursor: pointer; line-height: 1;
}
.modale-fermer:hover { color: var(--erreur); }

/* ---------- Filtres ---------- */
.filtres { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; }
.filtres .champ { margin-bottom: 0; min-width: 140px; }
.filtres .champ label { font-size: 0.75rem; }

/* ---------- Calendrier ---------- */
.calendrier {
  background: var(--carte); border-radius: var(--rayon);
  box-shadow: var(--ombre); padding: 16px; margin-bottom: 20px;
}
.calendrier .fc { font-size: 0.9rem; }
.calendrier .fc .fc-toolbar-title { font-size: 1.1rem; }
.calendrier .fc .fc-button {
  background: var(--primary-clair); color: var(--primary-fonce);
  border: 1px solid #b6d2ff; border-radius: 6px;
  padding: 4px 12px; font-size: 0.85rem; font-weight: 600;
  text-transform: capitalize;
}
.calendrier .fc .fc-button-primary:not(:disabled):hover { background: #c7dcfb; }
.calendrier .fc .fc-button-primary:not(:disabled).fc-button-active,
.calendrier .fc .fc-button-primary:not(:disabled):active { background: var(--primary); color: #fff; }
.calendrier .fc-event { border-radius: 4px; border: none; padding: 2px 4px; font-size: 0.8rem; cursor: pointer; }
.calendrier .fc-event.planifiee { background: var(--statut-planifiee); color: #fff; }
.calendrier .fc-event.envoyee   { background: var(--statut-envoyee);   color: #fff; }
.calendrier .fc-event.publiee   { background: var(--statut-publiee);   color: #fff; }
.calendrier .fc-event.erreur    { background: var(--statut-erreur);    color: #fff; }
.calendrier .fc-daygrid-day-frame { min-height: 80px; }

/* ---------- Pied ---------- */
.pied { text-align: center; color: var(--texte-secondaire); font-size: 0.8rem; padding: 12px; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .grille, .grille-3 { grid-template-columns: 1fr; }
  .entete h1 { font-size: 1.2rem; }
  .carte { padding: 14px; }
  .barre-onglets button { font-size: 0.85rem; padding: 8px; }
}

/* ---------- Image preview ---------- */
.apercu-image {
 margin-top: 8px; max-width: 220px; max-height: 220px;
 border-radius: 8px; border: 1px solid var(--bordure); display: block;
}

.liste-medias { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.liste-medias .mitem {
 position: relative; width: 110px;
 border: 1px solid var(--bordure); border-radius: 8px; overflow: hidden;
 background: var(--fond-secondaire);
 display: flex; flex-direction: column; align-items: stretch; font-size: 11px;
}
.liste-medias .mitem img,
.liste-medias .mitem video {
 width: 100%; height: 80px; object-fit: cover; background: #000; display: block;
}
.liste-medias .mitem .badge-video {
 position: absolute; top: 4px; left: 4px;
 background: rgba(0,0,0,0.75); color: #fff; padding: 2px 6px;
 border-radius: 6px; font-size: 12px;
}
.liste-medias .mitem .badge-type {
 position: absolute; top: 4px; right: 4px;
 background: var(--accent); color: #fff; padding: 1px 5px;
 border-radius: 6px; font-size: 10px; text-transform: uppercase;
}
.liste-medias .mitem .mitem-foot {
 padding: 4px 6px; display: flex; justify-content: space-between;
 align-items: center; gap: 4px; min-height: 22px;
}
.liste-medias .mitem .mitem-foot button {
 background: var(--erreur); color: #fff; border: 0; border-radius: 4px;
 padding: 2px 6px; cursor: pointer; font-size: 10px;
}

/* ---------- Compteur / ligne d'info ---------- */
.ligne-info { font-size: 0.85rem; color: var(--texte-secondaire); margin-bottom: 10px; }
.ligne-info strong { color: var(--texte); }

/* ---------- Loading ---------- */
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--bordure); border-top-color: var(--primary);
  border-radius: 50%; animation: rotation 0.8s linear infinite;
  vertical-align: -2px; margin-right: 6px;
}
@keyframes rotation { to { transform: rotate(360deg); } }

/* ---------- Détail publication ---------- */
.detail-pub .label { font-weight: 600; color: var(--texte-secondaire); display: inline-block; min-width: 110px; }
.detail-pub p { margin-bottom: 6px; }
.detail-pub .contenu { white-space: pre-wrap; background: #f8fafc; padding: 10px; border-radius: 8px; border: 1px solid var(--bordure); }