/* =====================================================================
   components.css — Fenêtres (bottom-sheets), formulaires, boutons, toasts.
   ===================================================================== */

/* ---------- Overlay + fenêtre coulissante (bottom sheet) ---------- */
.overlay{
  position:fixed; inset:0; background:rgba(18,22,33,.45); z-index:50;
  display:flex; align-items:flex-end; justify-content:center;
  opacity:0; transition:opacity .18s ease;
}
.overlay.is-open{ opacity:1; }
@media(min-width:680px){ .overlay{ align-items:center; } }

.sheet{
  width:100%; max-width:560px; background:var(--surface);
  border-radius:var(--radius-lg) var(--radius-lg) 0 0;
  max-height:92vh; overflow:auto;
  transform:translateY(18px); transition:transform .2s ease;
  padding-bottom: calc(16px + var(--safe-bottom));
}
.overlay.is-open .sheet{ transform:none; }
@media(min-width:680px){ .sheet{ border-radius:var(--radius-lg); } }

.sheet__grip{ width:42px; height:5px; border-radius:3px; background:var(--line-strong); margin:10px auto 4px; }
.sheet__head{
  display:flex; align-items:center; justify-content:space-between;
  padding:8px 16px 8px; position:sticky; top:0; background:var(--surface); z-index:1;
}
.sheet__title{ font-size:16px; font-weight:800; }
.sheet__close{ border:none; background:var(--bg); width:34px; height:34px; border-radius:50%; font-size:16px; cursor:pointer; }
.sheet__body{ padding:6px 16px 16px; }

/* ---------- Formulaires ---------- */
.field{ margin-bottom:14px; }
.field__label{ display:block; font-size:12.5px; font-weight:700; color:var(--muted); margin-bottom:6px; }
.input,.textarea{
  width:100%; border:1px solid var(--line-strong); border-radius:12px; padding:12px;
  font-size:16px; color:var(--ink); background:var(--surface); font-family:inherit;
}
.textarea{ min-height:130px; resize:vertical; line-height:1.5; }
.input:focus,.textarea:focus{ outline:none; border-color:var(--primary); box-shadow:0 0 0 3px var(--primary-soft); }

/* Choix du type (segmenté) — 2 par ligne, passe à la ligne s'il y a plus de 2 types.
   « flex:0 1 » (et non « 1 1 ») : un type seul sur la dernière ligne garde la même
   largeur que les autres au lieu de s'étirer sur toute la largeur. */
.seg{ display:flex; flex-wrap:wrap; gap:8px; }
.seg__opt{
  flex:0 1 calc(50% - 4px); min-width:120px;
  display:flex; align-items:center; justify-content:center; gap:8px;
  height:48px; border-radius:12px; border:2px solid var(--line); background:var(--surface);
  font-weight:700; font-size:14px; cursor:pointer; color:var(--ink);
}
.seg__opt[aria-pressed="true"]{ border-color:var(--c); background:var(--cb); }
.seg__dot{ width:12px; height:12px; border-radius:4px; }

/* Interrupteur (publié ?) */
.toggle{ display:flex; align-items:center; gap:10px; font-size:14px; font-weight:600; cursor:pointer; }
.switch{ position:relative; width:50px; height:30px; flex:none; }
.switch input{ opacity:0; width:0; height:0; }
.switch__track{ position:absolute; inset:0; background:var(--line-strong); border-radius:999px; transition:.18s; }
.switch__track::before{ content:""; position:absolute; width:24px; height:24px; left:3px; top:3px; background:#fff; border-radius:50%; transition:.18s; box-shadow:var(--shadow-1); }
.switch input:checked + .switch__track{ background:var(--ok); }
.switch input:checked + .switch__track::before{ transform:translateX(20px); }

/* Choix de photo */
.photo-pick{ display:flex; gap:12px; align-items:center; }
.photo-pick__preview{ width:84px; height:84px; border-radius:12px; object-fit:cover; background:var(--bg); border:1px solid var(--line); flex:none; }
.photo-pick__btns{ display:flex; flex-direction:column; gap:8px; min-width:0; }

/* Choix MULTI-photos (éditeur) : miniatures avec retrait + définir couverture */
.photos-pick{ display:flex; flex-wrap:wrap; gap:8px; }
.photos-pick__empty{ font-size:13px; color:var(--muted); padding:6px 0; }
.photo-thumb{ position:relative; width:84px; height:84px; border-radius:12px; overflow:hidden; background:var(--bg); border:1px solid var(--line); flex:none; }
.photo-thumb.is-cover{ border-color:var(--primary); box-shadow:0 0 0 2px var(--primary-soft); }
.photo-thumb__img{ width:100%; height:100%; object-fit:cover; }
.photo-thumb__cover{ position:absolute; left:0; right:0; bottom:0; background:var(--primary); color:#fff; font-size:9.5px; font-weight:800; text-align:center; padding:1px 0; }
.photo-thumb__x{ position:absolute; top:2px; right:2px; width:20px; height:20px; border:none; border-radius:50%; background:rgba(18,22,33,.6); color:#fff; font-size:11px; font-weight:900; line-height:1; cursor:pointer; display:grid; place-items:center; padding:0; }
.photo-thumb__x:active{ transform:scale(.9); }
.photo-thumb__star{ position:absolute; top:2px; left:2px; width:20px; height:20px; border:none; border-radius:50%; background:rgba(18,22,33,.6); color:#FFD24A; font-size:12px; line-height:1; cursor:pointer; display:grid; place-items:center; padding:0; }
.photo-thumb__star:active{ transform:scale(.9); }
.photo-thumb__x:disabled, .photo-thumb__star:disabled{ opacity:.45; cursor:not-allowed; }

/* ---------- Boutons ---------- */
.btn{
  height:50px; padding:0 18px; border-radius:12px; border:none; cursor:pointer;
  font-size:15px; font-weight:700; display:inline-flex; align-items:center; justify-content:center; gap:8px;
}
.btn--primary{ background:var(--primary); color:#fff; }
.btn--ghost{ background:var(--bg); color:var(--ink); }
.btn--block{ width:100%; }
.btn:active{ transform:scale(.98); }
.actions{ display:flex; gap:10px; margin-top:6px; }
.actions .btn{ flex:1; }

/* Champs DÉSACTIVÉS dans une fenêtre (ex. article validé ouvert en lecture seule) : nettement grisés,
   non cliquables. Le bouton « Supprimer » n'est jamais désactivé, il reste donc actif. */
.sheet input:disabled, .sheet textarea:disabled, .sheet select:disabled, .sheet button:disabled{ opacity:.5; cursor:not-allowed; }
.sheet .input:disabled, .sheet .textarea:disabled{ opacity:1; background:var(--bg); color:var(--muted); }
.sheet .seg__opt:disabled{ background:var(--bg); border-color:var(--line); color:var(--muted); }
.sheet .switch input:disabled + .switch__track{ opacity:.5; }

/* Chip (étiquette de type) */
.chip{ display:inline-flex; align-items:center; gap:6px; height:26px; padding:0 11px; border-radius:999px; font-size:12px; font-weight:700; color:#fff; }

/* ---------- Liste "À planifier" ---------- */
.alert-item{ display:flex; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
.alert-item__thumb{ width:54px; height:54px; border-radius:10px; object-fit:cover; flex:none; background:var(--bg); }
.alert-item__body{ flex:1; min-width:0; }
.alert-item__txt{ font-size:13px; color:var(--ink); display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; margin:6px 0 8px; }
.alert-item__row{ display:flex; gap:8px; align-items:center; }
.alert-item__row .input{ height:44px; padding:8px 10px; }
.empty{ text-align:center; color:var(--muted); padding:30px 10px; font-size:14px; }

/* ---------- Détail d'une publication ---------- */
.post{ padding:14px 0; border-bottom:1px solid var(--line); }
.post:last-child{ border-bottom:none; }
.post__top{ display:flex; gap:8px; align-items:center; margin-bottom:10px; }
.post__img{ width:100%; max-height:340px; object-fit:cover; border-radius:12px; background:var(--bg); margin-bottom:10px; }
.post__text{ font-size:14.5px; line-height:1.55; white-space:pre-wrap; }
.post__meta{ font-size:12px; color:var(--muted); margin-top:8px; }

/* ---------- Suppression : maintenir le bouton appuyé ----------
   Volontairement ROUGE (et non vert « marque ») : c'est une action destructrice. */
.btn.holddel{ position:relative; overflow:hidden; background:var(--danger-bg); color:var(--danger-dark); border:none; }
.holddel__fill{ position:absolute; inset:0; background:var(--danger); width:0%; z-index:0; }
.holddel__lbl{ position:relative; z-index:1; pointer-events:none; }
.holddel.is-armed .holddel__lbl{ color:#fff; }

/* ---------- Toasts (messages furtifs) ---------- */
.toast-root{ position:fixed; left:0; right:0; bottom: calc(88px + var(--safe-bottom)); z-index:80; display:flex; flex-direction:column; align-items:center; gap:8px; pointer-events:none; }
.toast{ background:var(--ink); color:#fff; padding:11px 16px; border-radius:12px; font-size:13.5px; box-shadow:var(--shadow-2); max-width:90%; opacity:0; transform:translateY(8px); transition:.2s; }
.toast.is-show{ opacity:1; transform:none; }

/* ---------- Glisser-déposer : couche + calendrier de dépôt ---------- */
body.is-dragging{ overflow:hidden; -webkit-user-select:none; user-select:none; }

.draglayer{ position:fixed; inset:0; z-index:9999; background:rgba(18,22,33,.38); pointer-events:none; }

.drag-ghost2{
  position:fixed; z-index:10000; transform:translate(-50%,-130%);
  width:170px; max-width:62vw; display:flex; gap:8px; align-items:center;
  background:#fff; border-radius:12px; box-shadow:var(--shadow-3); padding:7px; pointer-events:none;
}
.drag-ghost2__img{ width:38px; height:38px; border-radius:8px; object-fit:cover; flex:none; background:var(--bg); }
.drag-ghost2__txt{ font-size:11px; line-height:1.2; overflow:hidden; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; }

.dropcal{
  position:fixed; left:50%; bottom:0; transform:translateX(-50%);
  width:100%; max-width:480px; pointer-events:auto;
  background:var(--surface); border-radius:18px 18px 0 0; box-shadow:var(--shadow-3);
  padding:10px 10px calc(12px + var(--safe-bottom));
}
.dropcal__head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.dropcal__title{ font-size:14px; font-weight:800; text-transform:capitalize; }
.dropcal__arrow{ width:50px; height:42px; border-radius:11px; border:1px solid var(--line); background:var(--surface); font-size:24px; line-height:1; cursor:pointer; display:grid; place-items:center; }
.dropcal__arrow.hot{ background:var(--primary); color:#fff; border-color:var(--primary); }
.dropcal__wd{ display:grid; grid-template-columns:repeat(7,1fr); gap:3px; margin-bottom:3px; }
.dropcal__wd>div{ text-align:center; font-size:10px; font-weight:700; color:var(--muted); }
.dropcal__grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:3px; }
.dropcal__day{ position:relative; aspect-ratio:1/1; display:grid; place-items:center; font-size:13px; font-weight:600; border-radius:10px; background:var(--bg); color:var(--ink); }
.dropcal__day.is-out{ background:transparent; }
.dropcal__day.is-today{ outline:2px solid var(--primary); outline-offset:-2px; }
.dropcal__day.is-current{ box-shadow:inset 0 0 0 2px var(--primary-soft); }
.dropcal__day.drop-hot{ background:var(--primary); color:#fff; transform:scale(1.08); }
.dropcal__dot{ position:absolute; bottom:5px; width:5px; height:5px; border-radius:50%; background:var(--muted); }
.dropcal__day.drop-hot .dropcal__dot{ background:#fff; }
.dropcal__hint{ text-align:center; font-size:11px; color:var(--muted); margin-top:9px; }

/* Poignée glissable dans « À planifier » */
.alert-grab{ display:flex; gap:12px; align-items:center; flex:1; min-width:0; touch-action:pan-y; cursor:grab; }
.alert-cal{ flex:none; width:44px; height:44px; border-radius:10px; border:1px solid var(--line); background:var(--surface); font-size:18px; cursor:pointer; }
.alert-cal:active{ transform:scale(.94); }
