/* ============================================================
   Administration — Dune · Cartomancie & Tarologie
   Thème clair (tokens SPEC §3) — Cormorant Garamond + Jost
   ============================================================ */

:root {
  --paper: #FAF7F0;
  --paper-2: #F3EDE0;
  --surface: #FFFFFF;
  --ink: #2B2620;
  --ink-soft: #4E463B;
  --muted: #6E6657;
  --gold: #A87E3F;
  --gold-deep: #86622E;
  --gold-pale: #E9DCC3;
  --line: rgba(134, 98, 46, 0.30);
  --line-soft: rgba(43, 38, 32, 0.12);
  --shadow: 0 12px 34px rgba(43, 38, 32, 0.10);
  --shadow-soft: 0 4px 16px rgba(43, 38, 32, 0.05);
  --danger: #8C3B2E;
  --danger-soft: #F6E7E1;
  --radius: 14px;
  --font-title: "Cormorant Garamond", Georgia, serif;
  --font-body: "Jost", system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink-soft);
  background: var(--paper);
}

/* Leçon du projet : ne jamais laisser un display auteur écraser [hidden] */
[hidden] { display: none !important; }

img { max-width: 100%; display: block; }

h1, h2, h3 {
  margin: 0;
  font-family: var(--font-title);
  font-weight: 600;
  line-height: 1.15;
  color: var(--ink);
}

p { margin: 0; }

a { color: var(--gold-deep); }

button, input, textarea { font: inherit; color: inherit; }

:focus-visible {
  outline: 2px solid var(--gold-deep);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

/* ---------- Écran d'attente ---------- */

.boot {
  min-height: 100vh;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 15px;
  letter-spacing: 0.04em;
}

.boot-star { color: var(--gold); }

/* ---------- Écran de connexion ---------- */

.login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: var(--surface);
}

.login-card {
  width: min(400px, 100%);
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
  text-align: center;
}

.login-kicker {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.login-brand {
  margin-top: 8px;
  font-size: 52px;
  font-style: italic;
  font-weight: 500;
  color: var(--gold);
}

.login-sub {
  margin-top: 2px;
  margin-bottom: 26px;
  font-size: 14px;
  letter-spacing: 0.10em;
  color: var(--muted);
}

.login-message {
  margin-bottom: 18px;
  padding: 11px 14px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14.5px;
  text-align: left;
}

.login-card form {
  display: grid;
  gap: 18px;
  text-align: left;
}

.login-back {
  margin-top: 22px;
  font-size: 14px;
}

.login-back a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 10px;
  color: var(--muted);
  text-decoration: none;
}

.login-back a:hover { color: var(--gold-deep); text-decoration: underline; }

/* ---------- Champs de formulaire ---------- */

.field { display: grid; gap: 6px; }

.field > label {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink);
}

input[type="text"],
input[type="email"],
input[type="url"],
input[type="date"],
input[type="password"],
textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  color: var(--ink);
  transition: border-color 0.2s ease-out, box-shadow 0.2s ease-out;
}

textarea { resize: vertical; line-height: 1.55; }

input[type="text"]:focus,
input[type="email"]:focus,
input[type="url"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
textarea:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-pale);
}

.field-help {
  font-size: 13px;
  color: var(--muted);
}

input[type="file"] {
  width: 100%;
  color: var(--muted);
  font-size: 14px;
}

input[type="file"]::file-selector-button {
  margin-right: 12px;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-soft);
  font: inherit;
  font-size: 14.5px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.18s ease-out;
}

input[type="file"]::file-selector-button:hover { background: var(--paper-2); }

/* ---------- Boutons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 20px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: none;
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition:
    transform 0.18s ease-out,
    background-color 0.18s ease-out,
    color 0.18s ease-out,
    border-color 0.18s ease-out,
    box-shadow 0.18s ease-out;
}

.btn:hover:not(:disabled) { transform: translateY(-1px); }

.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary {
  background: var(--gold-deep);
  color: #FFFFFF;
  box-shadow: 0 6px 18px rgba(134, 98, 46, 0.25);
}

.btn-primary:hover:not(:disabled) { background: #75551F; }

.btn-ghost {
  border-color: var(--line);
  color: var(--ink-soft);
}

.btn-ghost:hover:not(:disabled) { background: var(--paper-2); }

.btn-danger-ghost { color: var(--danger); }

.btn-danger-ghost:hover:not(:disabled) { background: var(--danger-soft); }

.btn-add {
  border: 1px dashed var(--gold);
  color: var(--gold-deep);
  justify-self: start;
}

.btn-add:hover:not(:disabled) { background: rgba(233, 220, 195, 0.35); }

.btn-add::before { content: "+"; font-size: 17px; line-height: 1; }

.btn-block { width: 100%; }

.btn-icon {
  width: 44px;
  min-width: 44px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
}

/* ---------- Structure de l'application ---------- */

.app {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 30px;
  padding: 30px 18px 22px;
  background: var(--paper-2);
  border-right: 1px solid var(--line-soft);
}

.sidebar-kicker {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.sidebar-title {
  font-family: var(--font-title);
  font-size: 38px;
  font-style: italic;
  font-weight: 500;
  line-height: 1.05;
  color: var(--gold);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-btn {
  display: flex;
  align-items: center;
  min-height: 47px;
  padding: 0 16px;
  border: none;
  border-radius: 12px;
  background: none;
  color: var(--ink-soft);
  font-size: 15.5px;
  text-align: left;
  cursor: pointer;
  transition: background-color 0.18s ease-out, color 0.18s ease-out;
}

.nav-btn::before {
  content: "✦";
  margin-right: 10px;
  font-size: 10px;
  color: var(--gold);
  opacity: 0;
  transition: opacity 0.18s ease-out;
}

.nav-btn:hover { background: rgba(255, 255, 255, 0.7); }

.nav-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  box-shadow: var(--shadow-soft);
}

.nav-btn.is-active::before { opacity: 1; }

.sidebar-foot {
  margin-top: auto;
  font-size: 14px;
}

.sidebar-foot a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 8px;
  color: var(--muted);
  text-decoration: none;
}

.sidebar-foot a:hover { color: var(--gold-deep); text-decoration: underline; }

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ---------- Barre d'enregistrement sticky ---------- */

.savebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  flex-wrap: wrap;
  padding: 13px 32px;
  background: rgba(250, 247, 240, 0.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line-soft);
}

.savebar-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.savebar-status.is-dirty { color: var(--gold-deep); font-weight: 500; }

.status-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--line-soft);
  transition: background-color 0.18s ease-out;
}

.savebar-status.is-dirty .status-dot { background: var(--gold); }

.savebar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ---------- Contenu des panneaux ---------- */

.content {
  width: 100%;
  max-width: 940px;
  padding: 38px 32px 90px;
}

.panel > h2 { font-size: 34px; }

.panel-lead {
  margin: 10px 0 28px;
  max-width: 62ch;
  color: var(--muted);
}

/* ---------- Accordéons (Textes du site) ---------- */

.acc {
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.acc[open] { box-shadow: var(--shadow); }

.acc-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  transition: background-color 0.18s ease-out;
}

.acc-summary::-webkit-details-marker { display: none; }

.acc-summary:hover { background: var(--paper); }

.acc-title {
  font-family: var(--font-title);
  font-size: 23px;
  font-weight: 600;
  color: var(--ink);
}

.acc-chevron {
  flex: none;
  width: 9px;
  height: 9px;
  margin-right: 5px;
  border-right: 1.6px solid var(--gold-deep);
  border-bottom: 1.6px solid var(--gold-deep);
  transform: rotate(45deg);
  transition: transform 0.2s ease-out;
}

.acc[open] .acc-chevron { transform: rotate(-135deg); }

.acc-body {
  display: grid;
  gap: 18px;
  padding: 20px;
  border-top: 1px solid var(--line-soft);
}

.block-note {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--paper-2);
  font-size: 13.5px;
  color: var(--muted);
}

/* ---------- Groupes & listes éditables ---------- */

fieldset {
  margin: 0;
  padding: 0;
  border: none;
  min-width: 0;
}

legend {
  float: left;
  width: 100%;
  padding: 0;
  margin: 0 0 10px;
  font-family: var(--font-title);
  font-size: 19px;
  font-style: italic;
  font-weight: 600;
  color: var(--gold-deep);
}

.subgroups { display: grid; gap: 14px; }

.subgroup {
  display: grid;
  gap: 14px;
  padding: 16px 16px 18px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}

.list-group { display: grid; gap: 12px; }

.list-rows { display: grid; gap: 8px; }

.list-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-row input { flex: 1; min-width: 0; }

.list-items { display: grid; gap: 12px; }

.list-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}

.list-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.list-card-title {
  font-family: var(--font-title);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}

/* ---------- Actualités ---------- */

.actus-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.actus-count { font-size: 14.5px; color: var(--muted); }

.actus-list { display: grid; gap: 14px; }

.actu-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.actu-thumb {
  width: 132px;
  height: 94px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
}

.actu-thumb-empty {
  display: grid;
  place-items: center;
  background: var(--paper-2);
  color: var(--gold);
  font-size: 19px;
}

.actu-body {
  display: grid;
  gap: 5px;
  align-content: start;
}

.actu-date {
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-deep);
}

.actu-title { font-size: 21px; }

.actu-excerpt { font-size: 14.5px; color: var(--muted); }

.actu-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

/* ---------- Éditeur d'actualité ---------- */

.news-form {
  display: grid;
  gap: 18px;
  padding: 26px 24px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.editor-title { font-size: 27px; }

.form-error {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 14.5px;
}

.image-block {
  display: grid;
  gap: 12px;
  padding: 16px;
  background: var(--paper);
  border: 1px solid var(--line-soft);
  border-radius: 12px;
}

.img-preview {
  max-width: 300px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
}

.img-none {
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
}

.upload-status { min-height: 1.3em; }

.image-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

/* ---------- Panneau Images ---------- */

.image-card {
  display: grid;
  gap: 16px;
  padding: 26px 24px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

.image-card > h3 { font-size: 24px; }

.img-portrait { max-width: 260px; }

/* ---------- Panneau Réseaux sociaux ---------- */

.social-card {
  display: grid;
  gap: 16px;
  padding: 26px 24px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
}

/* ---------- Toasts ---------- */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  display: grid;
  gap: 10px;
  width: min(380px, calc(100vw - 32px));
}

.toast {
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--gold);
  border-radius: 12px;
  font-size: 14.5px;
  color: var(--ink-soft);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.25s ease-out, transform 0.25s ease-out;
}

.toast.visible { opacity: 1; transform: none; }

.toast-error {
  border-left-color: var(--danger);
  color: var(--danger);
}

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

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }

  .sidebar {
    position: static;
    height: auto;
    gap: 14px;
    padding: 18px 16px 8px;
    border-right: none;
    border-bottom: 1px solid var(--line-soft);
  }

  .sidebar-brand {
    display: flex;
    align-items: baseline;
    gap: 12px;
  }

  .sidebar-title { font-size: 30px; }

  .sidebar-nav {
    flex-direction: row;
    overflow-x: auto;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
  }

  .nav-btn { flex: none; white-space: nowrap; }

  .sidebar-foot { display: none; }

  .savebar { padding: 12px 16px; }

  .content { padding: 26px 16px 80px; }

  .panel > h2 { font-size: 30px; }

  .actu-card { grid-template-columns: 1fr; }

  .actu-thumb { width: 100%; height: 150px; }

  .actu-thumb-empty { height: 72px; }
}

@media (max-width: 480px) {
  .panel > h2 { font-size: 27px; }

  .savebar-actions { width: 100%; }

  .savebar-actions .btn { flex: 1; padding: 0 12px; }

  .login-card { padding: 32px 22px 28px; }

  .acc-body { padding: 16px 14px; }

  .news-form { padding: 20px 14px; }

  .image-card, .social-card { padding: 20px 14px; }
}

/* ---------- Mouvement réduit : tout couper ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
