/* CMS photos Weventures — interface des gérants. Couleurs reprises du site
   (src/assets/css/main.css) ; police système pour rester léger. */
:root {
  --bg: #ffffff;
  --bg-2: #f2f7f3;
  --line: #dfe7e2;
  --ink: #223028;
  --muted: #5d6b63;
  --accent: #1b76a2;
  --accent-dk: #145a7c;
  --accent-soft: #e7f4fb;
  --green: #2f8a55;
  --green-soft: #e6f4ec;
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --danger: #b3261e;
  --danger-soft: #fdecea;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(34, 48, 40, .08), 0 4px 16px rgba(34, 48, 40, .06);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg-2);
  color: var(--ink);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
img { max-width: 100%; display: block; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* ---- Barre du haut ------------------------------------------------------- */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.bar__brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 1.05rem; }
.bar__brand b { color: var(--accent); }
.bar__nav { display: flex; align-items: center; gap: 8px; }

/* ---- Boutons ------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid transparent; border-radius: 10px;
  background: var(--accent); color: #fff;
  font: inherit; font-weight: 600; text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: var(--accent-dk); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { background: var(--bg-2); }
.btn--danger { background: var(--danger); }
.btn--danger:hover { background: #8c1d17; }
.btn--small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn--big { min-height: 52px; padding: 0 24px; font-size: 1.05rem; }
.badge {
  display: inline-grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; background: #fff; color: var(--accent);
  font-size: .8rem; font-weight: 700;
}

/* ---- Mise en page -------------------------------------------------------- */
.main { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; outline: none; }
.loading { color: var(--muted); }
.lead { color: var(--muted); margin: 6px 0 20px; }
.back { display: inline-block; margin-bottom: 12px; text-decoration: none; }
.back::before { content: "← "; }
.section { margin-top: 32px; }
.section > h2 { margin-bottom: 12px; }

.notice {
  margin: 16px 0; padding: 12px 16px;
  border-radius: var(--radius);
  background: var(--accent-soft);
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px;
}
.notice p { margin: 0; flex: 1 1 260px; }
.notice--warn { background: var(--warn-soft); color: var(--warn); }
.notice--ok { background: var(--green-soft); color: var(--green); }
.notice--danger { background: var(--danger-soft); color: var(--danger); }
.notice pre { flex-basis: 100%; overflow: auto; max-height: 240px; font-size: .8rem; background: #fff; padding: 8px; border-radius: 8px; color: var(--ink); }

/* ---- Connexion ----------------------------------------------------------- */
.login {
  max-width: 380px; margin: 10vh auto 0; padding: 28px 24px;
  background: var(--bg); border-radius: 16px; box-shadow: var(--shadow);
}
.login img { margin-bottom: 16px; }
.login h1 { margin-bottom: 20px; }
.field { display: grid; gap: 6px; margin-bottom: 16px; }
.field label { font-weight: 600; }
.field input {
  min-height: 48px; padding: 0 12px;
  border: 1px solid #b9c7bf; border-radius: 10px;
  font: inherit; background: #fff; color: var(--ink);
}
.login .btn { width: 100%; }
.form-error { color: var(--danger); margin: 0 0 12px; }

/* ---- Liste des séries ---------------------------------------------------- */
.search { width: 100%; max-width: 420px; min-height: 46px; padding: 0 14px; border: 1px solid #b9c7bf; border-radius: 10px; font: inherit; background: #fff; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column;
  background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow);
  color: var(--ink); text-decoration: none; overflow: hidden;
}
.card:hover .card__title { color: var(--accent); }
.card__img { aspect-ratio: 4 / 3; background: #dfe7e2; object-fit: cover; width: 100%; height: auto; }
.card__img--empty { display: grid; place-items: center; color: var(--muted); font-size: .9rem; }
.card__body { padding: 10px 12px 12px; display: grid; gap: 2px; }
.card__title { font-weight: 600; }
.card__meta { color: var(--muted); font-size: .88rem; }
.chip { justify-self: start; margin-top: 4px; padding: 1px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: .8rem; font-weight: 600; }

/* ---- Une série ----------------------------------------------------------- */
.set-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.set-kind { color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: .78rem; font-weight: 700; }
.notes { margin: 8px 0 0; padding-left: 20px; color: var(--muted); }

.drop {
  display: grid; justify-items: center; gap: 4px;
  position: relative;
  margin: 20px 0; padding: 22px 16px;
  border: 2px dashed #9fb4a8; border-radius: var(--radius);
  background: var(--bg); text-align: center;
}
.drop.is-over { border-color: var(--accent); background: var(--accent-soft); }
.drop p { margin: 8px 0 0; color: var(--muted); font-size: .9rem; }
.drop:focus-within { outline: 3px solid var(--accent); outline-offset: 2px; }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.queue { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 6px; }
.queue li {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px;
  padding: 8px 12px; border-radius: 10px; background: var(--bg); font-size: .92rem;
}
.queue progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--accent); }
.queue .is-ok { color: var(--green); }
.queue .is-err { color: var(--danger); grid-column: 1 / -1; } /* message long : sur sa propre ligne */
.queue__name { overflow-wrap: anywhere; }

.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); gap: 14px; }
.grid > .empty { grid-column: 1 / -1; }
.tile {
  position: relative; display: flex; flex-direction: column;
  background: var(--bg); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
}
.tile[draggable="true"] { cursor: grab; }
.tile.is-dragging { opacity: .4; }
.tile.is-target { outline: 3px solid var(--accent); }
.tile__img { aspect-ratio: 4 / 3; width: 100%; height: auto; object-fit: cover; background: #dfe7e2; }
.tile__rank {
  position: absolute; top: 8px; left: 8px;
  min-width: 28px; height: 28px; padding: 0 8px; border-radius: 14px;
  display: grid; place-items: center;
  background: rgba(34, 48, 40, .78); color: #fff; font-weight: 700; font-size: .85rem;
}
.tile__rank--cover { background: var(--accent); }
.tile__new { position: absolute; top: 8px; right: 8px; padding: 2px 8px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); font-size: .75rem; font-weight: 700; }
.tile__uses { margin: 0; padding: 8px 12px 0; list-style: none; display: grid; gap: 4px; font-size: .82rem; color: var(--accent-dk); }
.tile__uses li::before { content: "◆ "; color: var(--accent); }
.tile__actions { margin-top: auto; padding: 10px 8px 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.tile__actions .btn { flex: 1 1 auto; min-height: 38px; padding: 0 8px; font-size: .85rem; }
.icon-btn { flex: 0 0 auto !important; width: 40px; }

.empty { padding: 32px 16px; text-align: center; color: var(--muted); background: var(--bg); border-radius: var(--radius); }

/* ---- Publication --------------------------------------------------------- */
.changes { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 8px; }
.changes li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 10px 14px; background: var(--bg); border-radius: 10px; }
.changes small { color: var(--muted); }
.steps { color: var(--muted); }
.history { width: 100%; border-collapse: collapse; background: var(--bg); border-radius: var(--radius); overflow: hidden; font-size: .92rem; }
.history th, .history td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
.history th { background: var(--bg-2); font-weight: 600; }
.live { color: var(--green); font-weight: 700; }
.table-wrap { overflow-x: auto; }

/* ---- Messages ------------------------------------------------------------ */
.toast {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 10px;
  background: var(--ink); color: #fff; box-shadow: var(--shadow); z-index: 20;
}
.toast--err { background: var(--danger); }

@media (max-width: 600px) {
  h1 { font-size: 1.35rem; }
  /* Deux photos par ligne : une série de 50 photos reste parcourable au pouce. */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile__uses { padding: 6px 8px 0; font-size: .76rem; }
  .tile__actions { padding: 8px 6px 6px; gap: 4px; }
  .tile__actions .btn { min-height: 40px; font-size: .8rem; }
  .tile__actions [data-cover], .tile__actions [data-remove] { flex-basis: 100%; }
  .tile__rank { top: 6px; left: 6px; font-size: .75rem; }
  .bar__brand span { display: none; }
  .main { padding-top: 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .card, .tile { transition: box-shadow .15s ease, transform .15s ease; }
  .card:hover { transform: translateY(-2px); }
}
.notice ul { flex-basis: 100%; margin: 0; padding-left: 20px; }
