/* ==========================================================================
   Window Portal Network — le portail de gestion
   Violet : c'est le module Portal. L'interface reste volontairement plate
   et calme — quelqu'un l'ouvre entre deux services, pas pour l'admirer.
   ========================================================================== */

* { box-sizing: border-box; }

/* L'attribut `hidden` doit l'emporter sur tout `display` posé ensuite.
   Sans cette règle, `.connexion { display: flex }` rend visible un élément
   pourtant marqué `hidden`, et l'écran de connexion ne disparaît jamais. */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--wpn-fond);
  color: var(--wpn-ancre);
  font-family: var(--police-texte);
  font-size: 16px;
  line-height: var(--interligne-normal);
  -webkit-font-smoothing: antialiased;
}

/* ==========================================================================
   Connexion
   ========================================================================== */

.connexion {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: var(--espace-6);
  background: var(--wpn-violet-800);
}
.connexion-carte {
  background: #fff; border-radius: var(--rayon-xl);
  padding: var(--espace-12) var(--espace-8);
  width: 100%; max-width: 420px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.3);
}
.connexion-logo { width: 54px; height: auto; display: block; margin-bottom: var(--espace-6); }
.connexion-carte h1 {
  font-family: var(--police-titre); font-weight: var(--graisse-noire);
  font-size: var(--texte-2xl); margin: 0 0 var(--espace-2);
  letter-spacing: -0.02em;
}
.connexion-carte > p {
  color: var(--wpn-neutre-500); margin: 0 0 var(--espace-8);
  font-size: var(--texte-sm);
}
.connexion-carte label {
  display: block; font-size: var(--texte-sm);
  font-weight: var(--graisse-moyenne); margin-bottom: var(--espace-2);
}
.connexion-carte input {
  width: 100%; padding: 14px 16px;
  border: 1.5px solid var(--wpn-neutre-100); border-radius: var(--rayon-md);
  font-family: var(--police-texte); font-size: var(--texte-base);
  background: var(--wpn-neutre-50);
}
.connexion-carte input:focus {
  outline: none; border-color: var(--wpn-violet-800);
  background: #fff;
}
.erreur {
  color: #B3261E; font-size: var(--texte-sm);
  margin: var(--espace-3) 0 0;
}
.btn-plein {
  width: 100%; margin-top: var(--espace-6);
  padding: 14px; border: 0; border-radius: var(--rayon-md);
  background: var(--wpn-violet-800); color: #fff;
  font-family: var(--police-ui); font-size: var(--texte-base);
  font-weight: var(--graisse-moyenne); cursor: pointer;
}
.btn-plein:hover { background: var(--wpn-violet-700); }
.connexion-note {
  margin: var(--espace-8) 0 0; padding-top: var(--espace-6);
  border-top: 1px solid var(--wpn-neutre-100);
  font-size: var(--texte-sm); color: var(--wpn-neutre-500);
}

/* ==========================================================================
   Structure du portail
   ========================================================================== */

.portail { display: flex; min-height: 100vh; }

.cote {
  width: 250px; flex-shrink: 0;
  background: var(--wpn-violet-800); color: #fff;
  padding: var(--espace-6);
  display: flex; flex-direction: column;
}
.cote-marque {
  display: flex; align-items: center; gap: var(--espace-3);
  margin-bottom: var(--espace-12);
}
.cote-marque svg { width: 30px; height: auto; }
.cote-marque span {
  font-weight: var(--graisse-grasse); font-size: var(--texte-sm);
}

.cote-onglets { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.onglet {
  text-align: left; padding: 12px 14px;
  background: transparent; border: 0; border-radius: var(--rayon-md);
  color: rgba(255,255,255,0.72);
  font-family: var(--police-ui); font-size: var(--texte-base);
  font-weight: var(--graisse-moyenne); cursor: pointer;
}
.onglet:hover { background: rgba(255,255,255,0.08); color: #fff; }
.onglet.actif { background: rgba(255,255,255,0.16); color: #fff; }

.cote-pied {
  padding-top: var(--espace-6);
  border-top: 1px solid rgba(255,255,255,0.14);
  font-size: var(--texte-sm);
}
.cote-pied a { color: rgba(255,255,255,0.72); text-decoration: none; }
.cote-pied a:hover { color: #fff; }

.principal { flex: 1; min-width: 0; padding: var(--espace-8); }

.barre {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--espace-6); flex-wrap: wrap;
  margin-bottom: var(--espace-8);
  padding-bottom: var(--espace-6);
  border-bottom: 1px solid var(--wpn-neutre-100);
}
.barre h2 {
  font-family: var(--police-titre); font-weight: var(--graisse-noire);
  font-size: var(--texte-2xl); margin: 0 0 var(--espace-1);
  letter-spacing: -0.02em;
}
.barre-sous { margin: 0; color: var(--wpn-neutre-500); font-size: var(--texte-sm); }

.btn-publier {
  padding: 12px 24px; border: 0; border-radius: var(--rayon-md);
  background: var(--wpn-ancre); color: #fff;
  font-family: var(--police-ui); font-size: var(--texte-base);
  font-weight: var(--graisse-moyenne); cursor: pointer;
  white-space: nowrap;
}
.btn-publier:hover { background: var(--wpn-violet-800); }
.btn-publier.modifie { background: var(--wpn-violet-800); }
.btn-publier:disabled { opacity: 0.6; cursor: default; }

/* ==========================================================================
   Panneaux
   ========================================================================== */

.panneau { display: none; }
.panneau.actif { display: block; }

.liste-items { display: flex; flex-direction: column; gap: var(--espace-4); }

.carte, .item-edit {
  background: #fff; border: 1px solid var(--wpn-neutre-100);
  border-radius: var(--rayon-lg); padding: var(--espace-6);
}

.item-edit { display: grid; gap: var(--espace-4); }
.item-rangee {
  display: grid; grid-template-columns: 1fr 130px auto;
  gap: var(--espace-4); align-items: end;
}
@media (max-width: 640px) {
  .item-rangee { grid-template-columns: 1fr; }
}

.champ { display: block; }
.champ-nom {
  display: block; font-size: var(--texte-sm);
  font-weight: var(--graisse-moyenne); margin-bottom: var(--espace-2);
}
.champ-aide {
  display: block; font-size: var(--texte-xs);
  color: var(--wpn-neutre-400); margin-top: var(--espace-2);
}
.champ input, .champ textarea, .item-edit input {
  width: 100%; padding: 11px 14px;
  border: 1.5px solid var(--wpn-neutre-100); border-radius: var(--rayon-md);
  font-family: var(--police-texte); font-size: var(--texte-base);
  background: var(--wpn-neutre-50); color: var(--wpn-ancre);
}
.champ textarea { resize: vertical; line-height: 1.5; }
.champ input:focus, .champ textarea:focus, .item-edit input:focus {
  outline: none; border-color: var(--wpn-violet-800); background: #fff;
}

.btn-retirer {
  padding: 11px 16px; border-radius: var(--rayon-md);
  background: transparent; border: 1.5px solid var(--wpn-neutre-100);
  color: var(--wpn-neutre-500);
  font-family: var(--police-ui); font-size: var(--texte-sm);
  cursor: pointer; white-space: nowrap;
}
.btn-retirer:hover { border-color: #B3261E; color: #B3261E; }

.btn-ajouter {
  margin-top: var(--espace-4);
  padding: 13px 22px; border-radius: var(--rayon-md);
  background: transparent; border: 1.5px dashed var(--wpn-neutre-200);
  color: var(--wpn-neutre-500);
  font-family: var(--police-ui); font-size: var(--texte-base);
  font-weight: var(--graisse-moyenne); cursor: pointer; width: 100%;
}
.btn-ajouter:hover {
  border-color: var(--wpn-violet-800); color: var(--wpn-violet-800);
  border-style: solid;
}

/* --- Heures --- */

.heures { display: flex; flex-direction: column; gap: var(--espace-3); }
.heure-rangee {
  display: grid; grid-template-columns: 120px 1fr;
  gap: var(--espace-4); align-items: center;
}
.heure-jour { font-weight: var(--graisse-moyenne); font-size: var(--texte-sm); }
.heure-rangee input {
  padding: 10px 14px;
  border: 1.5px solid var(--wpn-neutre-100); border-radius: var(--rayon-md);
  font-family: var(--police-texte); font-size: var(--texte-base);
  background: var(--wpn-neutre-50); width: 100%;
}
.heure-rangee input:focus {
  outline: none; border-color: var(--wpn-violet-800); background: #fff;
}

/* --- Dépôt de photo --- */

.depot {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--espace-2); text-align: center;
  padding: var(--espace-12) var(--espace-6);
  border: 1.5px dashed var(--wpn-neutre-200); border-radius: var(--rayon-md);
  background: var(--wpn-neutre-50);
  color: var(--wpn-neutre-500); font-size: var(--texte-sm);
  cursor: pointer;
}
.depot:hover { border-color: var(--wpn-violet-800); }
/* Karl demande que chaque champ d'image affiche les dimensions attendues. */
.depot-dim {
  font-family: var(--police-mono, monospace);
  font-size: var(--texte-xs); color: var(--wpn-neutre-400);
}

/* ==========================================================================
   Confirmation
   ========================================================================== */

.toast {
  position: fixed; left: 50%; bottom: 28px;
  transform: translateX(-50%);
  background: var(--wpn-ancre); color: #fff;
  padding: 14px 26px; border-radius: var(--rayon-md);
  font-size: var(--texte-sm); font-weight: var(--graisse-moyenne);
  box-shadow: var(--ombre-lg); z-index: 100;
  display: flex; align-items: center; gap: var(--espace-3);
}
.toast::before {
  content: ""; width: 9px; height: 9px;
  background: var(--wpn-jaune-400); border-radius: 2px;
  transform: rotate(45deg);
}

/* ==========================================================================
   Téléphone
   ========================================================================== */

@media (max-width: 820px) {
  .portail { flex-direction: column; }
  .cote {
    width: 100%; flex-direction: row; align-items: center;
    gap: var(--espace-4); padding: var(--espace-4);
    overflow-x: auto;
  }
  .cote-marque { margin: 0; flex-shrink: 0; }
  .cote-marque span { display: none; }
  .cote-onglets { flex-direction: row; flex: 1; }
  .onglet { white-space: nowrap; padding: 9px 13px; font-size: var(--texte-sm); }
  .cote-pied { display: none; }
  .principal { padding: var(--espace-6) var(--espace-4); }
  .barre { flex-direction: column; }
  .btn-publier { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
