/* =========================================================
   ADMIN — mise en page du formulaire uniquement.
   Les polices et la couleur orange viennent de style.css ; le reste des
   couleurs est défini ci-dessous. Depuis le passage au thème clair, les
   anciennes couleurs (crème semi-transparent) devenaient invisibles sur
   le fond crème : on utilise donc des couleurs pleines, bien contrastées.
   ========================================================= */

.admin-body {
  /* Couleurs propres à l'admin (contraste vérifié sur fond crème) */
  --a-ink: #091b20;       /* texte principal */
  --a-soft: #3f565c;      /* texte secondaire (aides, explications) */
  --a-line: #cbbf9c;      /* traits et bordures */
  --a-card: #fbf7ec;      /* fond des cartes, plus clair que la page */
  --a-field: #ffffff;     /* fond des champs */
  --a-green: #4f6b3a;     /* vert foncé : titres, liens, succès */
  --a-red: #b23a1f;       /* erreurs, suppression */
  --a-orange: #c4571a;    /* boutons principaux */
  --a-orange-dark: #a34812;

  max-width: 820px;
  margin: 0 auto;
  padding: 3rem 1.5rem 6rem;
  color: var(--a-ink);
}

.admin-back {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--a-green);
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
}

.admin-back:hover {
  text-decoration: underline;
}

.admin-title {
  font-size: 2.4rem;
  line-height: 1.1;
  margin-bottom: 0.8rem;
}

.admin-intro {
  color: var(--a-soft);
  margin-bottom: 2rem;
  font-size: 1rem;
  line-height: 1.65;
  max-width: 62ch;
}

.admin-intro code,
.admin-panel code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: rgba(9, 27, 32, 0.07);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

/* --- Cartes (une par section) ------------------------------------------ */
.admin-panel {
  border: 1px solid var(--a-line);
  border-radius: 14px;
  padding: 1.8rem;
  margin-bottom: 2rem;
  background: var(--a-card);
  box-shadow: 0 10px 28px -16px rgba(9, 27, 32, 0.25);
}

.admin-panel h2 {
  font-size: 1.45rem;
  line-height: 1.2;
  margin-bottom: 1.2rem;
  padding-bottom: 0.7rem;
  border-bottom: 1px solid var(--a-line);
  color: var(--a-ink);
}

/* Sous-titres d'un formulaire : petites capitales vertes, bien repérables */
.admin-panel h3.admin-subheading,
.admin-subheading {
  margin: 2rem 0 1rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--a-line);
  font-family: var(--font-texte);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--a-green);
}

.admin-panel .admin-intro {
  margin-bottom: 1.4rem;
}

/* --- Champs ------------------------------------------------------------ */
.field {
  margin-bottom: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.field label {
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--a-ink);
}

.field input,
.field select,
.field textarea,
.bloc-corps textarea {
  font-family: var(--font-texte);
  font-size: 1rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1.5px solid #b3a780;
  background: var(--a-field);
  color: var(--a-ink);
  width: 100%;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.bloc-corps textarea:focus {
  outline: none;
  border-color: var(--a-orange);
  box-shadow: 0 0 0 3px rgba(196, 87, 26, 0.22);
}

.field textarea,
.bloc-corps textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

/* Boutons « Choisir un fichier » des champs photo */
input[type="file"]::file-selector-button {
  font-family: var(--font-texte);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 0.45rem 0.9rem;
  margin-right: 0.8rem;
  border-radius: 6px;
  border: 1.5px solid var(--a-ink);
  background: transparent;
  color: var(--a-ink);
  cursor: pointer;
}

input[type="file"]::file-selector-button:hover {
  background: rgba(9, 27, 32, 0.08);
}

.field input[type="file"] {
  background: transparent;
  border: 1.5px dashed #b3a780;
  font-size: 0.9rem;
}

.field-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.field-row .field {
  flex: 1 1 200px;
}

.id-preview {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--a-soft);
}

#id-preview {
  color: var(--a-green);
}

/* --- Boutons ----------------------------------------------------------- */
button {
  font-family: var(--font-texte);
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
  border-radius: 8px;
  padding: 0.75rem 1.4rem;
  background: var(--a-orange);
  color: #ffffff;
  font-size: 1rem;
  margin-right: 0.6rem;
  margin-top: 0.4rem;
  transition: background-color 0.15s, border-color 0.15s;
}

button:hover:not(:disabled) {
  background: var(--a-orange-dark);
}

button:focus-visible {
  outline: 3px solid rgba(196, 87, 26, 0.4);
  outline-offset: 2px;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--a-ink);
  border-color: var(--a-ink);
  font-weight: 700;
  font-size: 0.92rem;
  padding: 0.6rem 1.1rem;
}

.btn-secondary:hover:not(:disabled) {
  background: rgba(9, 27, 32, 0.08);
}

/* --- Messages ---------------------------------------------------------- */
.status-line {
  margin-top: 1rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.status-line.is-error {
  color: var(--a-red);
}

.status-line.is-success {
  color: var(--a-green);
}

.error-list {
  color: var(--a-red);
  margin: 1rem 0 0;
  padding: 0.8rem 1rem 0.8rem 2rem;
  border: 1px solid var(--a-red);
  border-radius: 8px;
  background: rgba(178, 58, 31, 0.07);
  font-size: 0.92rem;
  font-weight: 600;
}

.hidden {
  display: none !important;
}

/* --- Liste "Voyages existants" ---------------------------------------- */
.voyage-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.voyage-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0.2rem;
  border-bottom: 1px solid var(--a-line);
  font-size: 1.1rem;
  font-weight: 700;
}

.voyage-list-item:last-child {
  border-bottom: none;
}

.voyage-list-empty {
  color: var(--a-soft);
  font-size: 0.95rem;
  padding: 0.5rem 0;
}

.voyage-delete-btn {
  background: transparent;
  color: var(--a-red);
  border-color: var(--a-red);
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  margin: 0;
}

.voyage-delete-btn:hover:not(:disabled) {
  background: rgba(178, 58, 31, 0.1);
}

/* Boutons d'une ligne de la liste : article / voir / supprimer */
.voyage-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.6rem;
}

.voyage-article-btn {
  padding: 0.45rem 0.9rem;
  font-size: 0.85rem;
  margin: 0;
}

.voyage-view-link {
  color: var(--a-green);
  font-size: 0.88rem;
  font-weight: 700;
}

/* --- Éditeur d'article ------------------------------------------------ */
.article-subheading {
  font-family: var(--font-texte);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--a-green);
  margin: 2rem 0 0.9rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--a-line);
}

/* Un emplacement photo : miniature + choix du fichier */
.slot {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 0;
}

.slot-thumb {
  flex: 0 0 54px;
  height: 72px;                      /* même proportion 3:4 que sur le site */
  border-radius: 6px;
  overflow: hidden;
  background: #e7ddbf;
  border: 1px solid var(--a-line);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--a-soft);
}

.slot-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.slot-info {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
  font-size: 0.88rem;
}

.slot-info input[type="file"] {
  max-width: 100%;
  font-size: 0.85rem;
}

.slot-label {
  overflow-wrap: anywhere;
  font-weight: 600;
}

.slot-label.is-empty {
  color: var(--a-red);
}

/* Une ligne de la galerie / un bloc, avec ses boutons ↑ ↓ ✕ */
.row-item {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--a-line);
}

.row-item--bloc {
  align-items: flex-start;
}

/* Numéro de la ligne dans un petit rond vert */
.row-num {
  flex: 0 0 1.8rem;
  height: 1.8rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--a-green);
  color: #ffffff;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.row-item > .slot,
.bloc-corps {
  flex: 1 1 auto;
}

.bloc-corps {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-width: 0;
}

.row-controls {
  display: flex;
  gap: 0.35rem;
  flex: 0 0 auto;
}

.icon-btn {
  background: var(--a-field);
  color: var(--a-ink);
  border: 1.5px solid #b3a780;
  padding: 0.35rem 0.65rem;
  font-size: 1rem;
  font-weight: 700;
  margin: 0;
  line-height: 1;
}

.icon-btn:hover:not(:disabled) {
  background: var(--a-field);
  border-color: var(--a-orange);
  color: var(--a-orange-dark);
}

#article-galerie-add,
#article-bloc-add {
  margin-top: 0.9rem;
}

/* Compteur de photos : rouge tant que le minimum n'est pas atteint, puis vert */
.photo-count {
  display: block;
  width: fit-content;
  margin-top: 1.6rem;
  padding: 0.5rem 0.9rem;
  border: 1.5px solid currentColor;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--a-red);
}

.photo-count.is-ok {
  color: var(--a-green);
}

.article-actions {
  margin-top: 1.4rem;
}

@media (max-width: 560px) {
  .admin-panel { padding: 1.2rem; }
  .admin-title { font-size: 2rem; }
  .voyage-list-item { flex-wrap: wrap; }
  .row-item { flex-wrap: wrap; }
  .row-controls { margin-left: 2.7rem; }
}

/* Zone de dépôt de la galerie (glisser des photos ou un dossier) */
.dropzone {
  border: 2px dashed #7f9569;
  border-radius: 10px;
  background: rgba(79, 107, 58, 0.07);
  color: var(--a-ink);
  padding: 1.5rem 1rem;
  text-align: center;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  margin-bottom: 0.8rem;
  transition: border-color 0.2s, background-color 0.2s, color 0.2s;
}

.dropzone-hint {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--a-soft);
}

/* .is-over = des fichiers sont en train d'être survolés */
.dropzone:hover,
.dropzone:focus-visible,
.dropzone.is-over {
  border-color: var(--a-orange);
  background-color: rgba(196, 87, 26, 0.09);
  color: var(--a-orange-dark);
  outline: none;
}

/* Liens dans les messages (ex : « Voir la page d'accueil ») */
.status-line a {
  color: var(--a-green);
  font-weight: 700;
}
