/* ═══════════════════════════════════════════════════════════════
   Clinique Mots et Gestes — Questionnaire Popup Widget
   Self-contained styles, prefixed with .cmg- to avoid conflicts
═══════════════════════════════════════════════════════════════ */

/* ── Overlay ─────────────────────────────────────────────────── */
.cmg-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.cmg-overlay.cmg-visible { opacity: 1; }
.cmg-overlay.cmg-hidden  { pointer-events: none; }

/* ── Modal card ──────────────────────────────────────────────── */
.cmg-modal {
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  transform: translateY(20px) scale(0.98);
  transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.22s ease;
  opacity: 0;
  scrollbar-width: none;
}
.cmg-modal::-webkit-scrollbar { display: none; }
.cmg-overlay.cmg-visible .cmg-modal {
  transform: translateY(0) scale(1);
  opacity: 1;
}

/* ── Header ──────────────────────────────────────────────────── */
.cmg-header {
  background: #2A9D8F;
  border-radius: 16px 16px 0 0;
  padding: 28px 36px 24px;
  position: relative;
}
.cmg-header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cmg-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.18);
  border-radius: 20px;
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  font-family: 'IBM Plex Sans', sans-serif;
}
.cmg-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.18);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  flex-shrink: 0;
}
.cmg-close:hover { background: rgba(255,255,255,0.3); }
.cmg-close svg { width: 16px; height: 16px; }

.cmg-header h2 {
  color: #ffffff;
  font-size: 20px;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 6px;
  font-family: 'IBM Plex Sans', sans-serif;
}
.cmg-header p {
  color: rgba(255,255,255,0.8);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
  font-family: 'IBM Plex Sans', sans-serif;
}

/* ── Progress bar ────────────────────────────────────────────── */
.cmg-progress-track {
  height: 5px;
  background: rgba(255,255,255,0.25);
  border-radius: 3px;
  margin-top: 16px;
  overflow: hidden;
}
.cmg-progress-fill {
  height: 100%;
  background: #ffffff;
  border-radius: 3px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  width: 0%;
}

/* ── Body ────────────────────────────────────────────────────── */
.cmg-body {
  padding: 28px 36px;
}

/* ── Step label ──────────────────────────────────────────────── */
.cmg-step-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #2A9D8F;
  margin-bottom: 10px;
  font-family: 'IBM Plex Sans', sans-serif;
}

/* ── Question text ───────────────────────────────────────────── */
.cmg-question {
  font-size: 17px;
  font-weight: 600;
  color: #1A3D3A;
  line-height: 1.45;
  margin: 0 0 20px;
  font-family: 'IBM Plex Sans', sans-serif;
}

/* ── Options ─────────────────────────────────────────────────── */
.cmg-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.cmg-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: 10px;
  border: 1.5px solid #DDE8E7;
  background: #F7FAFA;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: #1A3D3A;
  text-align: left;
  width: 100%;
}
.cmg-option:hover {
  border-color: #2A9D8F;
  background: #EEF8F7;
  transform: translateX(2px);
}
.cmg-option.cmg-selected {
  border-color: #2A9D8F;
  background: #EEF8F7;
}
.cmg-option-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid #DDE8E7;
  flex-shrink: 0;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}
.cmg-option.cmg-selected .cmg-option-dot {
  border-color: #2A9D8F;
  background: #2A9D8F;
}
.cmg-option.cmg-selected .cmg-option-dot::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: #ffffff;
}

/* ── Email step ──────────────────────────────────────────────── */
.cmg-info-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #E8F5F4;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
}
.cmg-info-banner svg { flex-shrink: 0; margin-top: 1px; }
.cmg-info-banner p {
  font-size: 13px;
  color: #1F7A6E;
  line-height: 1.45;
  margin: 0;
  font-family: 'IBM Plex Sans', sans-serif;
}

.cmg-field-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #1A3D3A;
  margin-bottom: 6px;
  margin-top: 16px;
  font-family: 'IBM Plex Sans', sans-serif;
}
.cmg-field-label:first-child { margin-top: 0; }

.cmg-input {
  width: 100%;
  height: 46px;
  padding: 0 14px 0 40px;
  border: 1.5px solid #DDE8E7;
  border-radius: 8px;
  font-size: 14px;
  font-family: 'IBM Plex Sans', sans-serif;
  color: #1A3D3A;
  background: #ffffff;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}
.cmg-input:focus {
  outline: none;
  border-color: #2A9D8F;
  box-shadow: 0 0 0 3px rgba(42,157,143,0.12);
}
.cmg-input-wrap {
  position: relative;
}
.cmg-input-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: #9AC8C4;
  pointer-events: none;
  display: flex;
}
.cmg-input-icon svg { width: 16px; height: 16px; }

.cmg-lang-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.cmg-lang-label {
  font-size: 13px;
  font-weight: 600;
  color: #1A3D3A;
  font-family: 'IBM Plex Sans', sans-serif;
}
.cmg-lang-btn {
  padding: 7px 14px;
  border-radius: 6px;
  border: 1.5px solid #DDE8E7;
  background: #F7FAFA;
  font-size: 13px;
  font-weight: 600;
  color: #6B9997;
  cursor: pointer;
  transition: all 0.15s;
  font-family: 'IBM Plex Sans', sans-serif;
}
.cmg-lang-btn.cmg-active {
  background: #2A9D8F;
  border-color: #2A9D8F;
  color: #ffffff;
}

.cmg-consent-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
}
.cmg-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: 1.5px solid #DDE8E7;
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background: #ffffff;
  transition: all 0.15s;
}
.cmg-checkbox:checked {
  background: #2A9D8F;
  border-color: #2A9D8F;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 6l3 3 5-5' stroke='white' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
}
.cmg-consent-text {
  font-size: 12px;
  color: #6B9997;
  line-height: 1.5;
  font-family: 'IBM Plex Sans', sans-serif;
}

/* ── Result step ─────────────────────────────────────────────── */
.cmg-result-header {
  background: #1F7A6E;
  border-radius: 16px 16px 0 0;
  padding: 36px;
  text-align: center;
}
.cmg-result-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  color: #ffffff;
}
.cmg-result-header h2 {
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 6px;
  font-family: 'IBM Plex Sans', sans-serif;
}
.cmg-result-header p {
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  margin: 0;
  font-family: 'IBM Plex Sans', sans-serif;
}

.cmg-score-card {
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
}
.cmg-score-card svg { flex-shrink: 0; margin-top: 2px; }
.cmg-score-card-content {}
.cmg-score-badge {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 5px;
  font-family: 'IBM Plex Sans', sans-serif;
}
.cmg-score-desc {
  font-size: 13px;
  color: #4A6B68;
  line-height: 1.55;
  font-family: 'IBM Plex Sans', sans-serif;
}

.cmg-steps-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  color: #9AC8C4;
  margin-bottom: 10px;
  font-family: 'IBM Plex Sans', sans-serif;
}
.cmg-next-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}
.cmg-step-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #F7FAFA;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 13px;
  color: #1A3D3A;
  line-height: 1.4;
  font-family: 'IBM Plex Sans', sans-serif;
}
.cmg-step-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #2A9D8F;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: 'IBM Plex Sans', sans-serif;
}

.cmg-disclaimer {
  font-size: 11px;
  color: #9AC8C4;
  text-align: center;
  font-family: 'IBM Plex Sans', sans-serif;
  margin-top: 4px;
}

/* ── Footer (navigation) ─────────────────────────────────────── */
.cmg-footer {
  padding: 16px 36px 20px;
  border-top: 1px solid #E8F0EF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.cmg-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 22px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  font-family: 'IBM Plex Sans', sans-serif;
  text-decoration: none;
}
.cmg-btn svg { width: 15px; height: 15px; }

.cmg-btn-secondary {
  background: #F7FAFA;
  color: #2A9D8F;
  border: 1.5px solid #DDE8E7;
}
.cmg-btn-secondary:hover { background: #EEF8F7; border-color: #2A9D8F; }

.cmg-btn-primary {
  background: #2A9D8F;
  color: #ffffff;
}
.cmg-btn-primary:hover { background: #248C7F; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(42,157,143,0.3); }
.cmg-btn-primary:disabled { opacity: 0.6; cursor: not-allowed; transform: none; box-shadow: none; }

.cmg-btn-full {
  width: 100%;
  justify-content: center;
  padding: 14px 24px;
  font-size: 15px;
  font-weight: 700;
  border-radius: 10px;
  margin-top: 8px;
}

/* ── Trigger button (floating) ───────────────────────────────── */
.cmg-trigger {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 9998;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 22px;
  background: #2A9D8F;
  color: #ffffff;
  border: none;
  border-radius: 50px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(42,157,143,0.45);
  transition: all 0.2s;
  font-family: 'IBM Plex Sans', sans-serif;
  animation: cmg-pulse 3s infinite;
}
.cmg-trigger:hover {
  background: #248C7F;
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(42,157,143,0.5);
  animation: none;
}
.cmg-trigger svg { width: 18px; height: 18px; }

@keyframes cmg-pulse {
  0%, 100% { box-shadow: 0 6px 24px rgba(42,157,143,0.45); }
  50%       { box-shadow: 0 6px 32px rgba(42,157,143,0.7), 0 0 0 8px rgba(42,157,143,0.08); }
}

/* ── Loading spinner ─────────────────────────────────────────── */
.cmg-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: cmg-spin 0.7s linear infinite;
}
@keyframes cmg-spin { to { transform: rotate(360deg); } }

/* ── Error message ───────────────────────────────────────────── */
.cmg-error {
  font-size: 13px;
  color: #E63946;
  background: #FFF0F0;
  border-radius: 8px;
  padding: 10px 14px;
  margin-top: 12px;
  font-family: 'IBM Plex Sans', sans-serif;
  display: none;
}
.cmg-error.cmg-visible { display: block; }

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 560px) {
  .cmg-header,
  .cmg-body,
  .cmg-footer { padding-left: 20px; padding-right: 20px; }
  .cmg-result-header { padding: 28px 20px; }
  .cmg-trigger { bottom: 16px; right: 16px; font-size: 13px; padding: 11px 18px; }
}
