/* ========================================================== */
/* FM Portal – Entraide Ponctualité                            */
/* Styles v0.6.0 — intégration thème Astra + pop-up confirmation */
/* ========================================================== */

/* ── Variables fallback (utilisent les couleurs Astra si présentes) ── */
.fm-entraide,
.fm-entraide-take,
.fm-gen-wrap {
  --fme-primary: var(--ast-global-color-1, #76c0a5);
  --fme-primary-hover: var(--ast-global-color-0, #eb9f6e);
  --fme-text: var(--ast-global-color-2, #0F172A);
  --fme-muted: var(--ast-global-color-3, #454F5E);
  --fme-bg: var(--ast-global-color-5, #FFFFFF);
  --fme-soft: var(--ast-global-color-6, #F9F0C8);
  --fme-border: rgba(15, 23, 42, 0.12);
  --fme-radius: 12px;
  --fme-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--fme-text);
}

.fm-entraide *,
.fm-entraide-take *,
.fm-gen-wrap * { box-sizing: border-box; }

/* ── Formulaire signalement retard (wrapper transparent) ── */
.fm-entraide {
  display: block;
  width: 100%;
}

.fm-entraide-row { margin-top: 16px; }
.fm-entraide-row:first-child { margin-top: 0; }

.fm-entraide-label {
  display: block;
  font-family: 'Lexend', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--fme-text);
  margin-bottom: 6px;
}

.fm-entraide-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--fme-muted);
}

.fm-entraide-input {
  width: 100%;
  max-width: 100%;
  padding: 14px 16px;
  font-size: 1.2rem;
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: center;
  border: 2px solid var(--fme-border);
  border-radius: var(--fme-radius);
  background: #fff;
  color: var(--fme-text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.fm-entraide-input:focus {
  outline: none;
  border-color: var(--fme-primary);
  box-shadow: 0 0 0 3px rgba(118, 192, 165, 0.25);
}

/* ── Boutons retard estimé (tactile mobile) ── */
.fm-entraide-chips {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 6px;
}
.fm-entraide-chip {
  appearance: none;
  border: 2px solid var(--fme-border);
  background: #fff;
  color: var(--fme-text);
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1rem;
  padding: 12px 8px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.fm-entraide-chip:hover {
  border-color: var(--fme-primary);
  color: var(--fme-primary);
}
.fm-entraide-chip.is-selected {
  background: var(--fme-primary);
  border-color: var(--fme-primary);
  color: #fff;
}

/* ── Consentement (case à cocher) ── */
.fm-entraide-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 16px;
  font-size: 0.9rem;
  line-height: 1.45;
  color: var(--fme-muted);
}
.fm-entraide-consent input[type=checkbox] {
  flex: 0 0 auto;
  margin-top: 3px;
  width: 18px;
  height: 18px;
  accent-color: var(--fme-primary);
}

/* ── Bouton submit principal ── */
.fm-entraide-submit {
  appearance: none;
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 16px 20px;
  background: var(--fme-primary);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.05rem;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease;
  box-shadow: 0 4px 14px rgba(118, 192, 165, 0.35);
}
.fm-entraide-submit:hover,
.fm-entraide-submit:focus-visible {
  background: var(--fme-primary-hover);
  outline: none;
  transform: translateY(-1px);
}
.fm-entraide-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Zone statut inline (erreurs) ── */
.fm-entraide-status {
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.9rem;
  display: none;
}
.fm-entraide-status.is-error {
  display: block;
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.25);
  color: rgb(153, 27, 27);
}

/* ── Page prise en charge relais ── */
.fm-entraide-take {
  display: block;
  width: 100%;
}

.fm-entraide-take-context {
  background: var(--fme-soft);
  border-radius: var(--fme-radius);
  padding: 16px 18px;
  margin-bottom: 18px;
  border-left: 4px solid var(--fme-primary);
}
.fm-entraide-take-context p { margin: 0; color: var(--fme-text); font-size: 0.95rem; }

/* ============================================================ */
/* POP-UP DE CONFIRMATION (modal overlay)                       */
/* ============================================================ */
.fm-entraide-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
  z-index: 99999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.fm-entraide-modal.is-open {
  display: flex;
  opacity: 1;
}

.fm-entraide-modal__panel {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: 18px;
  padding: 32px 28px 28px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
  text-align: center;
  transform: translateY(20px);
  transition: transform 0.25s ease;
  font-family: 'DM Sans', sans-serif;
}
.fm-entraide-modal.is-open .fm-entraide-modal__panel {
  transform: translateY(0);
}

.fm-entraide-modal__icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--fme-primary, #76c0a5);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  font-size: 36px;
  font-weight: 700;
  box-shadow: 0 6px 24px rgba(118, 192, 165, 0.4);
}
.fm-entraide-modal__icon.is-warn {
  background: var(--fme-primary-hover, #eb9f6e);
  box-shadow: 0 6px 24px rgba(235, 159, 110, 0.4);
}

.fm-entraide-modal__title {
  font-family: 'Lexend', sans-serif;
  font-weight: 700;
  font-size: 1.35rem;
  margin: 0 0 10px;
  color: var(--fme-text, #0F172A);
}
.fm-entraide-modal__text {
  margin: 0 0 8px;
  color: var(--fme-muted, #454F5E);
  font-size: 0.95rem;
  line-height: 1.5;
}
.fm-entraide-modal__text strong { color: var(--fme-text, #0F172A); }

.fm-entraide-modal__hint {
  margin-top: 18px;
  padding: 12px 14px;
  background: var(--fme-soft, #F9F0C8);
  border-radius: 10px;
  font-size: 0.85rem;
  color: var(--fme-text, #0F172A);
  line-height: 1.45;
  text-align: left;
}
.fm-entraide-modal__hint strong { display: block; margin-bottom: 4px; }

.fm-entraide-modal__close {
  appearance: none;
  display: inline-block;
  margin-top: 22px;
  padding: 12px 28px;
  background: var(--fme-text, #0F172A);
  color: #fff;
  border: 0;
  border-radius: 999px;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease;
}
.fm-entraide-modal__close:hover,
.fm-entraide-modal__close:focus-visible {
  background: var(--fme-primary-hover, #eb9f6e);
  outline: none;
}

/* Compatibilité avec l'ancien rendu (.fm-entraide-card) */
.fm-entraide-card {
  background: #fff;
  border: 1px solid var(--fme-border, rgba(0, 0, 0, 0.12));
  border-radius: var(--fme-radius, 12px);
  padding: 18px;
  max-width: 100%;
}
.fm-entraide-card h3 { margin-top: 0; font-family: 'Lexend', sans-serif; }
.fm-entraide-muted { color: var(--fme-muted, #454F5E); }
.fm-entraide-checkbox { display: flex; gap: 8px; align-items: flex-start; margin-top: 10px; }

/* Mobile-first sous 480px */
@media (max-width: 480px) {
  .fm-entraide-chips { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fm-entraide-modal__panel { padding: 24px 20px 20px; }
}
