/* =====================================================================
   Judo Club Ippon — interface d'administration
   ===================================================================== */

:root {
  --navy: #14284f;
  --navy-deep: #0d1c39;
  --yellow: #ffd400;
  --red: #e5231d;
  --red-soft: #fdecec;
  --paper: #f2f1ee;
  --accent-100: #e6e9f1;
  --accent-200: #c8d0e0;
  --accent-300: #9fadc7;
  --accent-400: #6d81a5;
  --ink-soft: #4a525e;
  --ink-muted: #5b6472;
  --green: #157347;
  --green-soft: #e6f4ec;
  --amber: #92610a;
  --amber-soft: #fdf3dc;

  --font-title: 'Bricolage Grotesque', system-ui, -apple-system, sans-serif;
  --font-body: 'Barlow', system-ui, -apple-system, sans-serif;
}

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

body {
  margin: 0;
  background: var(--paper);
  color: #15181c;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--font-title); margin: 0; letter-spacing: -.02em; }

:focus-visible { outline: 3px solid var(--yellow); outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 1080px; margin-inline: auto; padding: 0 24px 96px; }

/* -------------------------------------------------------------- En-tête */

.admin-header { background: var(--navy); color: #fff; }
.admin-header__inner {
  max-width: 1080px; margin-inline: auto; padding: 16px 24px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.admin-header__mark { background: #fff; padding: 6px 10px; border-radius: 14px; flex: none; }
.admin-header__mark img { height: 30px; width: auto; }
.admin-header__title { font-size: 18px; font-weight: 700; line-height: 1.2; }
.admin-header__sub { font-size: 13px; color: var(--accent-300); }
.admin-header__actions { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--font-title); font-weight: 700; font-size: 15px;
  padding: 11px 20px; border-radius: 999px;
  border: 1.5px solid transparent; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  text-decoration: none; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--yellow { background: var(--yellow); color: var(--navy); }
.btn--yellow:hover:not(:disabled) { background: #ffe14d; }
.btn--navy { background: var(--navy); color: #fff; }
.btn--navy:hover:not(:disabled) { background: var(--navy-deep); }
.btn--light { background: rgba(255, 255, 255, .14); color: #fff; }
.btn--light:hover:not(:disabled) { background: rgba(255, 255, 255, .24); }
.btn--outline { background: transparent; color: var(--navy); border-color: var(--accent-200); }
.btn--outline:hover:not(:disabled) { border-color: var(--navy); }
.btn--danger { background: transparent; color: var(--red); border-color: #f3c9c7; }
.btn--danger:hover:not(:disabled) { background: var(--red-soft); }
.btn--sm { font-size: 14px; padding: 8px 15px; }

/* --------------------------------------------------------------- Statut */

.status {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  border-radius: 18px; padding: 14px 20px; margin: 24px 0;
  font-size: 15px;
}
.status--clean { background: var(--green-soft); color: var(--green); }
.status--dirty { background: var(--amber-soft); color: var(--amber); }
.status strong { font-family: var(--font-title); }
.status__spacer { flex: 1; }

/* --------------------------------------------------------------- Onglets */

.tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  border-bottom: 1.5px solid var(--accent-200);
  margin-bottom: 26px;
}
.tab {
  font-family: var(--font-title); font-weight: 700; font-size: 16px;
  background: none; border: 0; cursor: pointer;
  padding: 12px 18px; color: var(--ink-muted);
  border-bottom: 3px solid transparent; margin-bottom: -1.5px;
}
.tab:hover { color: var(--navy); }
.tab[aria-selected="true"] { color: var(--navy); border-bottom-color: var(--yellow); }
.tab__count {
  display: inline-block; margin-left: 7px;
  background: var(--accent-100); color: var(--navy);
  font-size: 12px; padding: 2px 9px; border-radius: 999px;
}

.panel[hidden] { display: none; }

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 18px;
}
.panel-head h2 { font-size: 26px; color: var(--navy); }
.panel-head p { margin: 4px 0 0; font-size: 15px; color: var(--ink-muted); max-width: 62ch; }

/* --------------------------------------------------------------- Listes */

.items { display: flex; flex-direction: column; gap: 12px; }

.item {
  background: #fff; border-radius: 20px; padding: 14px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: 0 2px 12px rgba(13, 28, 57, .07);
}
.item__thumb {
  flex: none; width: 66px; height: 88px; border-radius: 12px;
  background: var(--accent-100); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.item__thumb img { width: 100%; height: 100%; object-fit: cover; }
.item__thumb--wide { width: 112px; height: 70px; }
.item__thumb span { font-size: 11px; color: var(--accent-400); text-align: center; padding: 4px; }

.item__body { flex: 1; min-width: 0; }
.item__title { font-family: var(--font-title); font-weight: 700; font-size: 18px; color: var(--navy); }
.item__meta { font-size: 14px; color: var(--ink-soft); margin-top: 3px; }
.item__badge {
  display: inline-block; font-family: var(--font-title); font-size: 12px;
  padding: 3px 10px; border-radius: 999px; margin-left: 8px;
}
.item__badge--soon { background: var(--yellow); color: var(--navy); }
.item__badge--past { background: var(--accent-100); color: var(--accent-400); }

.item__actions { display: flex; gap: 8px; flex: none; flex-wrap: wrap; justify-content: flex-end; }

.empty {
  background: #fff; border: 1.5px dashed var(--accent-300);
  border-radius: 20px; padding: 32px; text-align: center;
  color: var(--ink-muted);
}
.empty strong { display: block; font-family: var(--font-title); font-size: 19px; color: var(--navy); margin-bottom: 6px; }

/* -------------------------------------------------------------- Réglages */

.card {
  background: #fff; border-radius: 22px; padding: 26px;
  box-shadow: 0 2px 12px rgba(13, 28, 57, .07);
}
.card + .card { margin-top: 16px; }
.card h3 {
  font-size: 20px; color: var(--navy); margin-bottom: 6px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* Distingue d'un coup d'œil ce qui va sur le site de ce qui reste chez vous. */
.pill {
  font-family: var(--font-body); font-size: 12px; font-weight: 600;
  padding: 4px 11px; border-radius: 999px; white-space: nowrap;
}
.pill--site { background: var(--green-soft); color: var(--green); }
.pill--archive { background: var(--amber-soft); color: var(--amber); }
.card p.hint { margin: 0 0 16px; font-size: 15px; color: var(--ink-muted); }

.meter { height: 10px; border-radius: 999px; background: var(--accent-100); overflow: hidden; margin: 10px 0 8px; }
.meter__fill { height: 100%; background: var(--green); transition: width .25s, background .25s; }
.meter__fill.is-warn { background: #d99400; }
.meter__fill.is-over { background: var(--red); }

ol.steps { margin: 0; padding-left: 20px; font-size: 15px; color: var(--ink-soft); }
ol.steps li { margin-bottom: 8px; }
code {
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .92em; background: var(--accent-100); color: var(--navy);
  padding: 2px 6px; border-radius: 6px;
}

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

.dialog {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6, 13, 27, .58);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 24px; overflow-y: auto;
}
.dialog[hidden] { display: none; }

.dialog__box {
  background: var(--paper); border-radius: 26px;
  width: 100%; max-width: 700px; margin: auto;
  box-shadow: 0 30px 70px rgba(6, 13, 27, .4);
  overflow: hidden;
}
.dialog__head {
  background: var(--navy); color: #fff;
  padding: 18px 26px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.dialog__head h2 { font-size: 21px; }
.dialog__close {
  width: 38px; height: 38px; flex: none; border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .14); color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.dialog__close:hover { background: rgba(255, 255, 255, .26); }
.dialog__body { padding: 26px; }
.dialog__foot {
  padding: 18px 26px; background: #fff;
  border-top: 1px solid var(--accent-200);
  display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap;
}

.field { margin-bottom: 18px; }
.field > label {
  display: block; font-family: var(--font-title); font-weight: 700;
  font-size: 14px; color: var(--navy); margin-bottom: 6px;
}
.field .hint { font-size: 13px; color: var(--ink-muted); margin: 6px 0 0; }

.field input[type="text"],
.field input[type="date"],
.field input[type="url"],
.field select,
.field textarea {
  width: 100%; font-family: var(--font-body); font-size: 16px;
  padding: 11px 14px; border: 1.5px solid var(--accent-200);
  border-radius: 14px; background: #fff; color: #15181c;
}
.field textarea { min-height: 120px; resize: vertical; line-height: 1.55; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--navy); outline: none;
}
.field input[aria-invalid="true"] { border-color: var(--red); }

.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.error-msg { color: var(--red); font-size: 14px; margin: 6px 0 0; font-weight: 600; }

/* Zone image */
.imagebox {
  border: 1.5px dashed var(--accent-300); border-radius: 18px;
  background: #fff; padding: 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.imagebox.is-drag { border-color: var(--navy); background: var(--accent-100); }
.imagebox__preview {
  flex: none; width: 92px; height: 122px; border-radius: 12px;
  background: var(--accent-100); overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.imagebox__preview img { width: 100%; height: 100%; object-fit: cover; }
.imagebox__preview span { font-size: 11px; color: var(--accent-400); text-align: center; padding: 6px; }
.imagebox__preview--wide { width: 140px; height: 90px; }
.imagebox__side { flex: 1; min-width: 180px; }
.imagebox__side p { margin: 0 0 10px; font-size: 14px; color: var(--ink-muted); }
.imagebox__buttons { display: flex; gap: 8px; flex-wrap: wrap; }
input[type="file"] { display: none; }

/* --------------------------------------- Démarrage / connexion / setup */

.boot {
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; color: var(--ink-muted);
}
.boot__spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--accent-200); border-top-color: var(--navy);
  animation: boot-spin .8s linear infinite;
}
@keyframes boot-spin { to { transform: rotate(360deg); } }

.gate {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.gate__box {
  background: #fff; border-radius: 26px; padding: 34px;
  width: 100%; max-width: 480px;
  box-shadow: 0 24px 60px rgba(13, 28, 57, .16);
}
#screen-setup .gate__box { max-width: 620px; }

.gate__mark {
  display: inline-block; background: #fff;
  border: 1.5px solid var(--accent-100);
  padding: 8px 12px; border-radius: 16px; margin-bottom: 20px;
}
.gate__mark img { height: 34px; width: auto; }

.gate__box h1 { font-size: 26px; color: var(--navy); margin-bottom: 8px; line-height: 1.15; }
.gate__lead { margin: 0 0 24px; font-size: 15px; color: var(--ink-muted); }
.gate__submit { width: 100%; margin-top: 4px; }
.gate__link {
  display: block; margin: 14px auto 0;
  background: none; border: 0; cursor: pointer;
  font-family: var(--font-body); font-size: 14px;
  color: var(--ink-muted); text-decoration: underline;
}
.gate__link:hover { color: var(--navy); }
.gate__foot { margin: 22px 0 0; font-size: 14px; color: var(--ink-muted); }

#screen-setup .steps { margin-bottom: 4px; }

/* ------------------------------------------------------- Liste clé/valeur */

ul.kv { list-style: none; margin: 0; padding: 0; font-size: 15px; }
ul.kv li {
  display: flex; gap: 12px; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--accent-100);
}
ul.kv li:last-child { border-bottom: 0; }
ul.kv b { font-family: var(--font-title); color: var(--navy); min-width: 150px; }
ul.kv span { color: var(--ink-soft); word-break: break-all; }

.dialog__progress {
  margin-right: auto; align-self: center;
  font-size: 14px; color: var(--ink-muted);
}

.item.is-busy { opacity: .5; pointer-events: none; }

.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  background: var(--navy); color: #fff;
  font-family: var(--font-title); font-weight: 700; font-size: 15px;
  padding: 14px 24px; border-radius: 999px; z-index: 200;
  box-shadow: 0 14px 34px rgba(6, 13, 27, .35);
}
.toast[hidden] { display: none; }

@media (max-width: 700px) {
  .admin-header__actions { margin-left: 0; width: 100%; }
  .item { flex-wrap: wrap; }
  .item__body { flex-basis: calc(100% - 82px); }
  .item__actions { width: 100%; justify-content: flex-start; }
  .field-row { grid-template-columns: 1fr; }
  .dialog { padding: 0; }
  .dialog__box { border-radius: 0; min-height: 100%; }
}
