/* ═══════════════════════════════════════════════════════════════
   CMS TET Bâtiment : design system
   DA reprise du site (« Douceur ») : courbes larges, grands rayons,
   Bebas Neue pour les titres, Montserrat pour tout le reste,
   turquoise rare et précieux. Mobile-first : tout est pensé au pouce
   d'abord, la mise en page se déploie ensuite sur grand écran.
   ═══════════════════════════════════════════════════════════════ */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --teal: #6cc4e8;
  --anthra: #3c444c;
  --ink: #14161c;
  --muted: #6a6e78;
  --page: #e5eef5;
  --surface: #fff;
  --line: #e7e8ee;
  --danger: #b4453c;
  --ok: #2f7d5f;

  --r-s: 12px;
  --r-m: 18px;
  --r-l: 26px;
  --pad: clamp(14px, 4vw, 22px);
  --ombre: 0 6px 20px rgba(18, 28, 55, 0.06);
  --ombre-h: 0 12px 30px rgba(18, 28, 55, 0.10);
  --bebas: 'Bebas Neue', 'Montserrat', sans-serif;
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Montserrat', system-ui, sans-serif;
  background: var(--page);
  color: var(--ink);
  line-height: 1.6;
  overflow-x: hidden;
  padding-bottom: 96px; /* place pour la barre d'enregistrement en mobile */
}
img { display: block; max-width: 100%; }
a { color: inherit; }
button, input, textarea, select { font: inherit; color: inherit; }

.cms-skip {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 0 0 var(--r-s) 0;
}
.cms-skip:focus { left: 0; }

/* ── En-tête ─────────────────────────────────────────────── */
.cms-top {
  background: var(--anthra); color: #fff;
  padding: 14px var(--pad);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-radius: 0 0 var(--r-l) var(--r-l);
}
.cms-marque { text-decoration: none; display: block; min-height: 44px; }
.cms-marque-nom { display: block; font-family: var(--bebas); font-size: 1.5rem; letter-spacing: 0.02em; line-height: 1.1; }
.cms-marque-sous { display: block; font-size: 0.66rem; letter-spacing: 0.2em; text-transform: uppercase; color: rgba(255,255,255,0.62); }
.cms-top-actions { display: flex; align-items: center; gap: 8px; }
.cms-voir, .cms-sortir {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px;
  border-radius: var(--r-s); text-decoration: none;
  font-size: 0.82rem; font-weight: 600;
  border: 1px solid rgba(255,255,255,0.28); color: #fff;
  transition: background 0.2s;
}
.cms-voir:hover, .cms-sortir:hover { background: rgba(255,255,255,0.12); }
.cms-sortir { border-color: transparent; color: rgba(255,255,255,0.72); }

/* ── Navigation : rangée défilante en mobile, colonne fixe en desktop ── */
.cms-nav {
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  padding: 14px var(--pad) 4px;
}
.cms-nav::-webkit-scrollbar { display: none; }
.cms-nav-a {
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
  min-height: 46px; padding: 0 16px; border-radius: var(--r-m);
  background: var(--surface); border: 1px solid var(--line);
  text-decoration: none; font-size: 0.86rem; font-weight: 600; color: var(--anthra);
  box-shadow: var(--ombre); transition: transform 0.2s, border-color 0.2s;
}
.cms-nav-a svg { width: 18px; height: 18px; flex-shrink: 0; }
.cms-nav-a:hover { transform: translateY(-1px); }
.cms-nav-a.est-actif { background: var(--anthra); border-color: var(--anthra); color: #fff; }

/* ── Contenu ─────────────────────────────────────────────── */
.cms-main { padding: var(--pad); max-width: 1180px; margin: 0 auto; }

.cms-titre {
  font-family: var(--bebas); font-weight: 400; text-transform: uppercase;
  font-size: clamp(1.9rem, 7vw, 2.8rem); line-height: 1; letter-spacing: 0.01em;
  margin-bottom: 6px;
}
.cms-sous { color: var(--muted); font-size: 0.95rem; margin-bottom: 22px; max-width: 60ch; }

/* Carte = un bloc de contenu du site */
.cms-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: clamp(16px, 4vw, 26px); box-shadow: var(--ombre); margin-bottom: 16px;
}
.cms-card > h2 {
  font-family: var(--bebas); font-weight: 400; text-transform: uppercase;
  font-size: 1.5rem; line-height: 1.05; letter-spacing: 0.01em; color: var(--ink);
  margin-bottom: 4px;
}
.cms-card > .cms-aide { margin-bottom: 18px; }
.cms-aide { color: var(--muted); font-size: 0.84rem; line-height: 1.6; }

/* ── Champs ──────────────────────────────────────────────── */
.cms-champ { margin-bottom: 16px; }
.cms-champ > label {
  display: block; margin-bottom: 6px;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--muted);
}
.cms-champ input[type=text], .cms-champ input[type=url], .cms-champ input[type=email],
.cms-champ input[type=tel], .cms-champ input[type=password], .cms-champ textarea, .cms-champ select {
  width: 100%; min-height: 48px; padding: 12px 14px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--r-s);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.cms-champ textarea { min-height: 120px; resize: vertical; line-height: 1.7; }
.cms-champ input:focus, .cms-champ textarea:focus, .cms-champ select:focus {
  outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(108, 196, 232, 0.22);
}
.cms-champ .cms-aide { margin-top: 6px; }
.cms-duo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 16px; }

/* ── Boutons ─────────────────────────────────────────────── */
.cms-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: var(--r-m);
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  font-size: 0.88rem; font-weight: 600; cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}
.cms-btn:hover { background: var(--page); transform: translateY(-1px); }
.cms-btn-primaire { background: var(--anthra); border-color: var(--anthra); color: #fff; }
.cms-btn-primaire:hover { background: var(--ink); }
.cms-btn-danger { background: #fff; border-color: rgba(180, 69, 60, 0.4); color: var(--danger); }
.cms-btn-danger:hover { background: rgba(180, 69, 60, 0.06); }
.cms-btn-petit { min-height: 40px; padding: 0 14px; font-size: 0.8rem; border-radius: var(--r-s); }
.cms-btn[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; }

/* ── Listes réordonnables (prestations, avis, questions, chantiers) ── */
.cms-item {
  border: 1px solid var(--line); border-radius: var(--r-m);
  padding: clamp(14px, 3vw, 18px); margin-bottom: 12px; background: #fff;
}
.cms-item-tete {
  display: flex; align-items: center; gap: 10px; margin-bottom: 12px;
}
.cms-item-num {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: 50%;
  background: var(--page); color: var(--anthra);
  display: grid; place-items: center; font-size: 0.78rem; font-weight: 700;
}
.cms-item-titre { flex: 1; min-width: 0; font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cms-item-outils { display: flex; gap: 6px; flex-shrink: 0; }
.cms-ico-btn {
  width: 40px; height: 40px; border-radius: var(--r-s);
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; transition: color 0.2s, border-color 0.2s;
}
.cms-ico-btn svg { width: 17px; height: 17px; }
.cms-ico-btn:hover { color: var(--ink); border-color: var(--anthra); }
.cms-ico-btn.est-danger:hover { color: var(--danger); border-color: rgba(180, 69, 60, 0.5); }
.cms-ico-btn[disabled] { opacity: 0.35; cursor: not-allowed; }

.cms-ajouter {
  width: 100%; min-height: 52px; border-radius: var(--r-m);
  border: 1.5px dashed var(--line); background: transparent; color: var(--anthra);
  font-weight: 600; cursor: pointer; transition: border-color 0.2s, background 0.2s;
}
.cms-ajouter:hover { border-color: var(--teal); background: rgba(108, 196, 232, 0.06); }

/* ── Photos ──────────────────────────────────────────────── */
.cms-photo { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.cms-photo-apercu {
  width: 108px; height: 108px; flex-shrink: 0;
  border-radius: var(--r-m); overflow: hidden; background: var(--page); border: 1px solid var(--line);
}
.cms-photo-apercu img { width: 100%; height: 100%; object-fit: cover; }
.cms-photo-vide { display: grid; place-items: center; color: var(--muted); font-size: 0.7rem; text-align: center; padding: 8px; }
.cms-photo-actions { flex: 1; min-width: 190px; display: flex; flex-direction: column; gap: 8px; }

/* ── Barre d'enregistrement ──────────────────────────────── */
.cms-barre {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px var(--pad); padding-bottom: max(12px, env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96); backdrop-filter: blur(8px);
  border-top: 1px solid var(--line); border-radius: var(--r-l) var(--r-l) 0 0;
}
.cms-barre .cms-btn-primaire { flex: 1; max-width: 260px; }
.cms-barre-etat { font-size: 0.78rem; color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cms-barre.est-modifie { border-top-color: var(--teal); }
.cms-barre.est-modifie .cms-barre-etat { color: var(--ink); font-weight: 600; }

/* ── Toasts ──────────────────────────────────────────────── */
.cms-toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 92px; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(460px, calc(100vw - 24px)); }
.cms-toast {
  background: var(--anthra); color: #fff; border-radius: var(--r-m);
  padding: 13px 16px; font-size: 0.88rem; box-shadow: var(--ombre-h);
  animation: toastEntre 0.25s ease-out;
}
.cms-toast.est-ok { background: var(--ok); }
.cms-toast.est-erreur { background: var(--danger); }
@keyframes toastEntre { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── Modale maison (jamais window.confirm) ──────────────── */
.cms-modal { position: fixed; inset: 0; z-index: 80; background: rgba(20, 22, 28, 0.5); display: grid; place-items: center; padding: 18px; }
.cms-modal[hidden] { display: none; }
.cms-modal-boite { background: #fff; border-radius: var(--r-l); padding: clamp(20px, 5vw, 30px); width: min(430px, 100%); box-shadow: var(--ombre-h); }
.cms-modal-boite h2 { font-family: var(--bebas); font-weight: 400; text-transform: uppercase; font-size: 1.5rem; line-height: 1.1; margin-bottom: 8px; }
.cms-modal-boite p { color: var(--muted); font-size: 0.92rem; margin-bottom: 20px; }
.cms-modal-actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }

/* ── Grandes tuiles du tableau de bord ──────────────────── */
.cms-tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.cms-tuile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px; text-decoration: none; box-shadow: var(--ombre); transition: transform 0.2s, border-color 0.2s; }
.cms-tuile:hover { transform: translateY(-2px); border-color: var(--teal); }
.cms-tuile-n { display: block; font-family: var(--bebas); font-size: 2.4rem; line-height: 1; color: var(--ink); }
.cms-tuile-l { display: block; margin-top: 4px; font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

/* ── Connexion ───────────────────────────────────────────── */
.cms-login { min-height: 100svh; display: grid; place-items: center; padding: 20px; background: var(--page); }
.cms-login-boite { background: #fff; border-radius: var(--r-l); padding: clamp(24px, 6vw, 40px); width: min(420px, 100%); box-shadow: var(--ombre-h); text-align: center; }
.cms-login-boite .cms-titre { margin-bottom: 4px; }
.cms-erreur { background: rgba(180, 69, 60, 0.08); border: 1px solid rgba(180, 69, 60, 0.28); color: var(--danger); border-radius: var(--r-s); padding: 11px 14px; font-size: 0.86rem; margin-bottom: 16px; text-align: left; }

/* ── Vide ────────────────────────────────────────────────── */
.cms-vide { text-align: center; padding: clamp(28px, 8vw, 52px) 20px; color: var(--muted); }
.cms-vide h3 { font-family: var(--bebas); font-weight: 400; text-transform: uppercase; font-size: 1.4rem; color: var(--ink); margin-bottom: 6px; }

/* ═══ Grand écran ═══ */
@media (min-width: 760px) {
  .cms-duo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  body { padding-bottom: 0; }
  .cms-barre {
    position: sticky; top: 0; bottom: auto; margin-bottom: 18px;
    border-top: none; border-bottom: 1px solid var(--line);
    border-radius: 0 0 var(--r-l) var(--r-l);
  }
  .cms-toasts { bottom: 24px; }
}

@media (min-width: 1060px) {
  .cms-nav { padding-left: 0; padding-right: 0; max-width: 1180px; margin: 0 auto; }
  .cms-nav-a { font-size: 0.9rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

/* Sur telephone, le nom du site et les deux liens de la barre se serrent pour
   tenir dans la largeur. (Le bouton « Demande à BassinWebFlow » qui y logeait
   aussi a ete retire le 10/10/2026 avec les tickets.) */
@media (max-width: 560px) {
  .cms-top { gap: 8px; }
  .cms-top-actions { gap: 6px; }
  .cms-voir, .cms-sortir { padding: 0 11px; font-size: 0.78rem; white-space: nowrap; }
  .cms-marque-nom { font-size: 1.25rem; }
}
