/* =========================================================
   1. Variables globales
   ========================================================= */

:root {
  --bg: #0b1220;
  --card: #101a2f;
  --text: #e8eefc;
  --muted: #a7b2cf;
  --accent: #4ee1a0;
  --link: #8fb5ff;
  --border: rgba(255,255,255,0.10);
}


/* =========================================================
   2. Base générale
   ========================================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(78,225,160,0.12), transparent 60%),
    radial-gradient(900px 500px at 80% 20%, rgba(143,181,255,0.12), transparent 60%),
    var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: inherit;
}

.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.muted {
  color: var(--muted);
}

.small-muted {
  color: var(--muted);
  font-size: 0.88rem;
}


/* =========================================================
   3. Layout global
   ========================================================= */

.wrap {
  max-width: 780px;
  margin: 0 auto;
  padding: 18px;
}


/* =========================================================
   4. Header / navigation
   ========================================================= */

.topbar {
  position: sticky;
  top: 0;
  background: rgba(11,18,32,0.95);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
}

.topbar .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 0.2px;
}

.nav {
  display: flex;
  gap: 14px;
}

.navlink {
  color: var(--muted);
  text-decoration: none;
}

.navlink:hover {
  color: var(--text);
}


/* =========================================================
   5. Composants réutilisables
   ========================================================= */

.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  margin: 14px 0;
}

.title {
  margin: 10px 0 8px;
}

.title a {
  color: var(--text);
  text-decoration: none;
}

.title a:hover {
  color: var(--link);
}

.kicker {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.3px;
}

.excerpt {
  margin: 0 0 10px;
  color: var(--muted);
}

.excerpt.big {
  font-size: 1.1rem;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 10px;
}

.source {
  color: var(--link);
  text-decoration: none;
  font-weight: 600;
}

.source:hover {
  text-decoration: underline;
}

.source-lang {
  font-size: 0.82rem;
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 10px;
}

.bigsource {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 10px;
  background: rgba(78,225,160,0.12);
  border: 1px solid rgba(78,225,160,0.25);
  color: #8fffcf;
  font-weight: 600;
  text-decoration: none;
}

.bigsource:hover {
  background: rgba(78,225,160,0.18);
}

.list {
  margin-top: 10px;
}

.row {
  padding: 14px 6px;
  border-bottom: 1px solid var(--border);
}

.rowtitle {
  margin: 0 0 6px;
  font-size: 1.05rem;
}

.rowtitle a {
  color: var(--text);
  text-decoration: none;
}

.rowtitle a:hover {
  color: var(--link);
}

.rowmeta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}


/* =========================================================
   6. Hero
   ========================================================= */

.hero {
  padding: 40px 0 18px;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
}

.hero-label {
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.lead {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 70ch;
}

.home-intro {
  max-width: 100ch;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 0.96rem;
  line-height: 1.65;
}


/* =========================================================
   7. Page accueil
   ========================================================= */

.daily-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.daily-article {
  padding: 26px;
  position: relative;
}

.daily-article:not(:last-child)::after {
  content: "";
  position: absolute;
  bottom: -12px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255,255,255,0.08),
    transparent
  );
}

.article-index {
  font-size: 0.72rem;
  opacity: 0.7;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.article-category {
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
  font-weight: 700;
}

.daily-title {
  margin: 18px 0 10px;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
}

.daily-summary {
  max-width: 100ch;
  line-height: 1.85;
  font-size: 1.08rem;
  white-space: pre-line;
}

.daily-source {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}


/* =========================================================
   8. Page article
   ========================================================= */

.article .title {
  font-size: clamp(26px, 3.5vw, 40px);
  line-height: 1.15;
}


/* =========================================================
   8b. Archives
   ========================================================= */

.archive-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.archive-card {
  display: block;
  padding: 24px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.14s ease, border-color 0.14s ease, box-shadow 0.14s ease;
}

.archive-card:hover {
  transform: translateY(-2px);
  background: #f2fbf7;
  border-color: rgba(0, 166, 178, 0.28);
  box-shadow: 0 18px 40px rgba(38, 56, 79, 0.10);
}

.archive-date {
  margin: 0 0 12px;
  font-size: 1.45rem;
  line-height: 1.2;
}

.archive-title-list {
  margin: 0 0 18px;
  padding-left: 1.2rem;
  color: var(--text);
}

.archive-title-list li {
  margin: 7px 0;
}

.archive-nav {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}

.archive-nav .source {
  color: var(--accent);
}

.archive-disclaimer {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.6;
}


/* =========================================================
   9. Page mentions légales
   ========================================================= */

.legal-page a,
.legal-page a:visited {
  color: inherit;
  text-decoration: none;
}

.legal-page a:hover {
  text-decoration: underline;
}

.legal-page li {
  margin: 8px 0;
  color: #34475f;
}


/* =========================================================
   10. Footer
   ========================================================= */

.footer {
  padding-bottom: 30px;
  text-align: center;
}

.footer .muted {
  padding-bottom: 20px;
}

.footer a,
.footer a:visited {
  color: inherit;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}


/* =========================================================
   11. Admin final
   ========================================================= */

.admin-toolbar,
.admin-topbar {
  margin-bottom: 16px;
}

.toolbar-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}

.admin-toolbar label,
.admin-topbar label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

.admin-toolbar input,
.admin-toolbar select,
.admin-topbar input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.admin-toolbar option {
  color: #111;
  background: #fff;
}

.toolbar-actions {
  display: flex;
  align-items: end;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  position: sticky;
  top: 60px;
  z-index: 20;
  background: rgba(11,18,32,0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
}

.slot-status {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.slot-pill {
  min-width: 42px;
  height: 42px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  border: 1px solid var(--border);
}

.slot-missing {
  background: rgba(220, 38, 38, 0.18);
  color: #ffb4b4;
}

.slot-ok {
  background: rgba(34, 197, 94, 0.18);
  color: #b4f3c8;
}

.x-post-box {
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(255,255,255,0.03);
}

.x-post-box label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
}

.x-post-box textarea {
  width: 100%;
  min-height: 150px;
  margin-bottom: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  resize: vertical;
}

.admin-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.admin-card {
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.admin-card.preselected {
  border-color: rgba(78,225,160,0.45);
  box-shadow: 0 0 0 1px rgba(78,225,160,0.12);
}

.admin-card.final-selected {
  border-color: rgba(143,181,255,0.45);
  box-shadow: 0 0 0 1px rgba(143,181,255,0.15);
}

.admin-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.badges,
.card-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.admin-title {
  margin-top: 0;
}

.admin-body {
  display: grid;
  grid-template-columns: 1.8fr 260px;
  gap: 18px;
  align-items: start;
}

.summary-label {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.summary-text,
.content-text {
  white-space: pre-wrap;
  line-height: 1.6;
}

.content-details {
  margin-top: 14px;
}

.content-details summary {
  cursor: pointer;
  color: var(--link);
  font-weight: 600;
}

.content-text {
  margin-top: 10px;
  max-height: 240px;
  overflow: auto;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.03);
  color: var(--muted);
}

.admin-actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: stretch;
}

.preselect-btn,
.pos-btn {
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 700;
}

.preselect-btn.active {
  background: rgba(78,225,160,0.16);
  border-color: rgba(78,225,160,0.35);
}

.position-buttons {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.pos-btn.active {
  background: rgba(143,181,255,0.18);
  border-color: rgba(143,181,255,0.35);
}

.badge-scrap {
  background: rgba(34, 197, 94, 0.14);
  color: #b4f3c8;
}

.badge-excerpt {
  background: rgba(255,255,255,0.06);
  color: var(--muted);
}

.badge-published {
  background: rgba(245, 158, 11, 0.16);
  color: #ffd89a;
}


/* =========================================================
   12. Admin Draft
   ========================================================= */

/* Page plus large et plus compacte uniquement pour admin_draft */
body:has(.admin-draft-page) .wrap {
  max-width: 1200px;
  padding-top: 10px;
}

/* Fallback / base de page */
.admin-draft-page {
  width: 100%;
}

/* Hero compact pour l'écran de tri */
body:has(.admin-draft-page) .hero {
  padding: 22px 0 14px;
}

body:has(.admin-draft-page) .hero h1 {
  margin: 0 0 6px;
  font-size: clamp(24px, 3vw, 34px);
}

body:has(.admin-draft-page) .hero .lead {
  margin: 0;
  font-size: 0.95rem;
}

/* Barre de filtres */
.admin-draft-toolbar {
  margin-bottom: 10px;
}

.card.admin-draft-toolbar {
  padding: 12px 14px;
}

.admin-draft-toolbar-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.admin-draft-toolbar label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.86rem;
  color: var(--muted);
}

.admin-draft-toolbar input,
.admin-draft-toolbar select {
  width: 100%;
  padding: 9px 11px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
}

.admin-draft-toolbar option {
  color: #111;
  background: #fff;
}

.admin-draft-toolbar-actions {
  display: flex;
  align-items: end;
}

/* Barre de sélection */
.admin-draft-topbar {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
  position: sticky;
  top: 60px;
  z-index: 20;
  margin-bottom: 14px;
  padding: 12px 14px;
  background: rgba(11,18,32,0.92);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
}

.admin-draft-topbar-left,
.admin-draft-topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.admin-draft-selection-counter {
  min-width: 132px;
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.04);
  font-weight: 800;
  text-align: center;
}

.admin-draft-selection-counter.is-active {
  background: rgba(78,225,160,0.12);
  border-color: rgba(78,225,160,0.25);
  color: #8fffcf;
}

.admin-draft-selection-counter.is-high {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(245, 158, 11, 0.28);
  color: #ffd89a;
}

/* Grille de cartes */
.admin-draft-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 12px;
  align-items: start;
}

/* Carte compacte : hauteur naturelle, plus d'ancien bouton en bas */
.admin-draft-card {
  height: auto;
  min-height: 0;
  align-self: start;
  padding: 8px 10px;
  cursor: pointer;
  transition:
    background 0.14s ease,
    border-color 0.14s ease,
    box-shadow 0.14s ease;
}

body:has(.admin-draft-page) .admin-draft-card:hover {
  border-color: rgba(143,181,255,0.28);
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.075),
    rgba(255,255,255,0.035)
  );
}

body:has(.admin-draft-page) .admin-draft-card.is-selected {
  border-color: rgba(78,225,160,0.70);
  background: linear-gradient(
    180deg,
    rgba(78,225,160,0.22),
    rgba(78,225,160,0.08)
  );
  box-shadow:
    0 0 0 1px rgba(78,225,160,0.22),
    0 8px 24px rgba(0,0,0,0.22);
}

body:has(.admin-draft-page) .admin-draft-card.is-selected:hover {
  border-color: rgba(78,225,160,0.85);
  background: linear-gradient(
    180deg,
    rgba(78,225,160,0.26),
    rgba(78,225,160,0.10)
  );
}

.admin-draft-card-inner {
  height: auto;
  min-height: 0;
  display: block;
}

/* Ligne score / label / langue / date / source */
.admin-draft-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: nowrap;
  margin-bottom: 5px;
}

.admin-draft-card-head .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 0;
}

.admin-draft-card-head .source {
  line-height: 1;
  font-size: 0.88rem;
  white-space: nowrap;
}

/* Langue sans pastille dans admin_draft */
.admin-draft-page .source-lang {
  border: none;
  background: transparent;
  padding: 0;
  border-radius: 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

/* Raison de tri : information principale */
.admin-draft-reason {
  margin-bottom: 4px;
  line-height: 1.2;
}

.admin-draft-page .reason-text {
  color: #8fffcf;
  font-size: 0.92rem;
  line-height: 1.2;
  font-weight: 500;
}

/* Titre original : information secondaire, une seule ligne */
.admin-draft-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.2;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Checkbox conservée pour le POST, mais invisible */
.admin-draft-checkbox {
  display: none;
}

/* =========================================================
   13. Responsive
   ========================================================= */

@media (max-width: 980px) {
  .admin-draft-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  .toolbar-grid,
  .admin-body {
    grid-template-columns: 1fr;
  }

  .position-buttons {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

/* Petit ajustement mobile pour éviter que catégorie et index se marchent dessus */
@media (max-width: 520px) {
  .daily-article {
    padding: 52px 22px 26px;
  }

  .article-category {
    left: 22px;
    max-width: calc(100% - 130px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .article-index {
    right: 22px;
  }
}

/* =========================================================
   14. Thème clair public
   ========================================================= */

:root {
  --bg: #fff8eb;
  --card: #ffffff;
  --text: #26384f;
  --muted: #6d7d8c;
  --accent: #00a6b2;
  --link: #0b63ce;
  --border: rgba(38, 56, 79, 0.14);

  --brand-blue: #004aad;
  --title-blue: #0b4fa8;
  --accent-soft: #e9f8f9;
  --shadow-soft: 0 14px 34px rgba(38, 56, 79, 0.07);
}

/* Fond uni, doux, sans halo décoratif */
body {
  background: var(--bg);
  color: var(--text);
}

/* Largeur confortable */
.wrap {
  max-width: 820px;
}

/* Header légèrement différencié */
.topbar {
  background: rgba(255, 241, 214, 0.96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(38, 56, 79, 0.10);
}

.brand {
  color: var(--brand-blue);
}

.navlink {
  color: var(--muted);
}

.navlink:hover {
  color: var(--brand-blue);
}

/* Hero */
.hero {
  padding: 52px 0 26px;
}

.hero-label {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.13em;
}

.hero h1 {
  color: var(--brand-blue);
  letter-spacing: -0.035em;
}

.lead {
  color: var(--muted);
  font-size: 1.08rem;
}

/* Cartes : simple, propre, lisible */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
}

/* Articles du jour */
.daily-list {
  gap: 20px;
}

/* Carte : on réserve de l'espace en haut pour catégorie + index */
.daily-article {
  padding: 42px 30px 30px;
  position: relative;
}

.daily-article:not(:last-child)::after {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(38, 56, 79, 0.10),
    transparent
  );
}

/* Index en haut à droite */
.article-index {
  position: absolute;
  top: 21px;
  right: 30px;

  color: var(--muted);
  opacity: 0.75;
  margin-bottom: 0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Catégorie en haut à gauche */
.article-category {
  position: absolute;
  top: 18px;
  left: 30px;

  display: inline-block;
  margin-bottom: 0;
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
}

.daily-title {
  color: var(--title-blue);
  letter-spacing: -0.025em;
}

.daily-summary {
  color: #34475f;
  line-height: 1.82;
}

/* Bouton source */
.bigsource {
  background: var(--accent-soft);
  border: 1px solid rgba(0, 166, 178, 0.24);
  color: #007985;
  border-radius: 999px;
}

.bigsource:hover {
  background: #dff5f6;
  border-color: rgba(0, 166, 178, 0.34);
  text-decoration: none;
}

/* Langue source légèrement accentuée */
.source-lang {
  background: #ffffff;
  color: var(--muted);
  border-color: rgba(38, 56, 79, 0.12);
  font-weight: 700;
}

/* Liens secondaires */
.source {
  color: var(--link);
}

.title a:hover,
.rowtitle a:hover {
  color: var(--link);
}

/* Page article */
.article .title {
  color: var(--title-blue);
}

.excerpt,
.excerpt.big {
  color: var(--muted);
}

.content {
  color: #34475f;
  line-height: 1.75;
}

/* Mentions légales */
.legal-page h1,
.legal-page h2 {
  color: var(--brand-blue);
}

.legal-page p {
  color: #34475f;
}

/* Footer */
.footer {
  color: var(--muted);
}

.footer a:hover {
  color: var(--accent);
}

/* =========================================================
   15. Conservation d'un admin sombre
   ========================================================= */

body:has(#publishForm),
body:has(.admin-draft-page) {
  --bg: #0b1220;
  --card: #101a2f;
  --text: #e8eefc;
  --muted: #a7b2cf;
  --accent: #4ee1a0;
  --link: #8fb5ff;
  --border: rgba(255,255,255,0.10);
  color: var(--text);
}

/* Admin final : on conserve le fond sombre avec halos */
body:has(#publishForm) {
  background:
    radial-gradient(1200px 600px at 20% 0%, rgba(78,225,160,0.12), transparent 60%),
    radial-gradient(900px 500px at 80% 20%, rgba(143,181,255,0.12), transparent 60%),
    var(--bg);
}

/* Admin Draft : fond uni pour lecture rapide */
body:has(.admin-draft-page) {
  background: #0b1220;
}

body:has(#publishForm) .topbar,
body:has(.admin-draft-page) .topbar {
  background: rgba(11,18,32,0.95);
  border-bottom: 1px solid var(--border);
}

body:has(#publishForm) .card,
body:has(.admin-draft-page) .card {
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid var(--border);
  box-shadow: none;
}

body:has(#publishForm) .bigsource,
body:has(.admin-draft-page) .bigsource {
  background: rgba(78,225,160,0.12);
  border: 1px solid rgba(78,225,160,0.25);
  color: #8fffcf;
  border-radius: 10px;
}
