/* ============================================================================
   Word-HTML — interface outil
   Modèle UX : outil d'abord (iLovePDF) — zone géante, un bouton par action,
   états visibles (survol, glisser, chargé, en cours, succès, erreur).
   La couleur d'accent vient de l'outil : --wh-accent (posée par le JS depuis
   data-tool-color), repli sur le teal du thème.
   ========================================================================== */

.wh-tool-container {
  --wh-accent: #16404b;
  --wh-accent-soft: rgba(22, 64, 75, .08);
  --wh-ink: #1c2b33;
  --wh-muted: #5c6b73;
  --wh-line: #e3e8ec;
  --wh-bg: #ffffff;
  --wh-ok: #1e9e5a;
  --wh-err: #d64545;
  max-width: 860px;
  margin: 0 auto;
  font-family: inherit;
  color: var(--wh-ink);
}

/* ── Compteur / limite ─────────────────────────────────────────────────── */
.wh-rate-limit {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.wh-rate-limit > span,
.wh-remaining {
  display: inline-block;
  font-size: 13px;
  color: var(--wh-muted);
  background: var(--wh-accent-soft);
  border-radius: 999px;
  padding: 6px 14px;
}
.wh-limit-reached {
  text-align: center;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  padding: 22px;
}
.wh-limit-reached p { margin: 0 0 12px; font-weight: 600; }

/* ── Zone de dépôt ─────────────────────────────────────────────────────── */
.wh-input-area { position: relative; }
.wh-dropzone {
  position: relative;
  min-height: 300px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #fafcfd, #f4f8fa);
  border: 2px dashed #c9d6dd;
  border-radius: 20px;
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.wh-dropzone:hover { border-color: var(--wh-accent); background: #f7fbfc; }
.wh-dropzone.wh-dropzone-active {
  border-color: var(--wh-accent);
  background: var(--wh-accent-soft);
  transform: scale(1.005);
}
.wh-dropzone-content { text-align: center; padding: 44px 24px; }
.wh-dropzone-icon {
  width: 84px; height: 84px;
  margin: 0 auto 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--wh-accent);
  color: #fff;
  border-radius: 22px;
  box-shadow: 0 10px 24px -10px var(--wh-accent);
}
.wh-dropzone-icon svg { width: 38px; height: 38px; }
.wh-dropzone-text { font-size: 18px; font-weight: 600; margin: 0 0 6px; }
.wh-dropzone-browse {
  color: var(--wh-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.wh-dropzone-hint { font-size: 13px; color: var(--wh-muted); margin: 0; }
.wh-file-input { display: none; }

/* Gros bouton de sélection façon iLovePDF, injecté par le JS */
.wh-select-cta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--wh-accent);
  color: #fff;
  font-size: 19px;
  font-weight: 700;
  border: 0;
  border-radius: 14px;
  padding: 18px 34px;
  margin-bottom: 14px;
  cursor: pointer;
  box-shadow: 0 14px 30px -12px var(--wh-accent);
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.wh-select-cta:hover { transform: translateY(-1px); filter: brightness(1.06); }
.wh-select-cta:active { transform: translateY(0); }

/* ── Fichiers chargés ──────────────────────────────────────────────────── */
.wh-file-list { display: grid; gap: 10px; margin-top: 4px; }
.wh-file-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--wh-bg);
  border: 1px solid var(--wh-line);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: 0 2px 10px rgba(16, 42, 51, .05);
}
.wh-file-item .wh-file-icon {
  width: 42px; height: 42px; flex: 0 0 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--wh-accent-soft);
  color: var(--wh-accent);
  border-radius: 10px;
  font-weight: 700; font-size: 11px; text-transform: uppercase;
}
.wh-file-item .wh-file-meta { flex: 1; min-width: 0; }
.wh-file-item .wh-file-name {
  font-weight: 600; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wh-file-item .wh-file-size { font-size: 12px; color: var(--wh-muted); }
.wh-file-item .wh-file-remove {
  border: 0; background: none; cursor: pointer;
  color: var(--wh-muted); font-size: 18px; line-height: 1;
  padding: 6px; border-radius: 8px;
}
.wh-file-item .wh-file-remove:hover { color: var(--wh-err); background: #fdf1f1; }

/* ── Saisie texte ──────────────────────────────────────────────────────── */
.wh-text-input {
  width: 100%;
  min-height: 260px;
  font: inherit;
  font-size: 15px;
  line-height: 1.6;
  color: var(--wh-ink);
  background: var(--wh-bg);
  border: 1.5px solid var(--wh-line);
  border-radius: 16px;
  padding: 18px 20px;
  resize: vertical;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.wh-text-input:focus {
  outline: none;
  border-color: var(--wh-accent);
  box-shadow: 0 0 0 4px var(--wh-accent-soft);
}
.wh-text-input::placeholder { color: #9fb0b8; }

/* ── Bouton d'action principal ─────────────────────────────────────────── */
.wh-action-area { margin-top: 18px; text-align: center; }
.wh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 13px;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, filter .15s ease, background .15s ease;
}
.wh-btn:disabled { opacity: .45; cursor: not-allowed; transform: none !important; box-shadow: none !important; }
.wh-btn-convert {
  min-width: 260px;
  background: var(--wh-accent);
  color: #fff;
  font-size: 18px;
  padding: 17px 38px;
  box-shadow: 0 14px 30px -12px var(--wh-accent);
}
.wh-btn-convert:not(:disabled):hover { transform: translateY(-1px); filter: brightness(1.07); }
.wh-btn-secondary {
  background: #eef3f5;
  color: var(--wh-ink);
  font-size: 15px;
  padding: 12px 22px;
}
.wh-btn-secondary:hover { background: #e2eaee; }
.wh-btn-download {
  background: var(--wh-ok);
  color: #fff;
  font-size: 17px;
  padding: 15px 32px;
  box-shadow: 0 12px 26px -12px var(--wh-ok);
}
.wh-btn-download:hover { transform: translateY(-1px); filter: brightness(1.05); }
.wh-btn-premium {
  background: linear-gradient(135deg, #f59e0b, #ef4444);
  color: #fff;
  padding: 12px 22px;
  font-size: 15px;
}
.wh-spinner { animation: wh-rot 1s linear infinite; }
@keyframes wh-rot { to { transform: rotate(360deg); } }

/* ── Résultat ──────────────────────────────────────────────────────────── */
.wh-result-area {
  margin-top: 22px;
  background: var(--wh-bg);
  border: 1px solid var(--wh-line);
  border-radius: 20px;
  padding: 26px;
  box-shadow: 0 18px 44px -22px rgba(16, 42, 51, .25);
  animation: wh-pop .25s ease;
}
@keyframes wh-pop { from { opacity: 0; transform: translateY(8px); } }
.wh-result-header {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  margin-bottom: 16px;
}
.wh-result-icon {
  width: 40px; height: 40px; flex: 0 0 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: #e7f6ee; color: var(--wh-ok);
  border-radius: 50%; font-size: 20px; font-weight: 700;
}
.wh-result-title { font-size: 19px; font-weight: 700; }
.wh-result-content {
  max-height: 320px;
  overflow: auto;
  background: #f7fafb;
  border: 1px solid var(--wh-line);
  border-radius: 12px;
  padding: 14px 16px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.wh-result-content:empty { display: none; }
.wh-result-actions {
  display: flex; flex-wrap: wrap; gap: 10px; justify-content: center;
  margin-top: 16px;
}

/* Nudge fidélisation après succès (newsletter + favoris) */
.wh-retention {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px 14px;
  background: var(--wh-accent-soft);
  border-radius: 12px;
  padding: 12px 16px;
  font-size: 13.5px;
  color: var(--wh-ink);
}
.wh-retention kbd {
  font-family: inherit;
  background: #fff;
  border: 1px solid var(--wh-line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 700;
}
.wh-retention a { color: var(--wh-accent); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

/* ── Erreur ────────────────────────────────────────────────────────────── */
.wh-error-area { margin-top: 16px; }
.wh-error-content {
  background: #fdf1f1;
  border: 1px solid #f5c6c6;
  color: #9b2c2c;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 14.5px;
  text-align: center;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .wh-dropzone { min-height: 230px; border-radius: 16px; }
  .wh-dropzone-icon { width: 64px; height: 64px; border-radius: 16px; }
  .wh-btn-convert { width: 100%; }
  .wh-result-actions .wh-btn { flex: 1 1 100%; }
}

/* ── Niveau de compression ──────────────────────────────────────────── */
.wh-options { margin: 18px 0 4px; }
.wh-options-label {
  display: block; margin: 0 0 9px;
  font-size: 12px; font-weight: 700; letter-spacing: .05em;
  text-transform: uppercase; color: #7b8797;
}
.wh-options-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wh-option {
  position: relative; display: flex; flex-direction: column; gap: 3px;
  padding: 13px 14px; cursor: pointer;
  border: 1.5px solid #e2e6ea; border-radius: 11px; background: #fff;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.wh-option:hover { border-color: #c6ced6; }
.wh-option input { position: absolute; opacity: 0; pointer-events: none; }
.wh-option:has(input:checked) {
  border-color: var(--wh-accent, #EE6C4D);
  background: var(--wh-accent-soft, rgba(238,108,77,.08));
  box-shadow: 0 0 0 3px var(--wh-accent-soft, rgba(238,108,77,.10));
}
.wh-option-nom { font-size: 14.5px; font-weight: 700; color: #1a2332; }
.wh-option-desc { font-size: 12.5px; line-height: 1.35; color: #6b7684; }
@media (max-width: 620px) {
  .wh-options-row { grid-template-columns: 1fr; }
  .wh-option { flex-direction: row; align-items: baseline; gap: 8px; }
}

/* ── Retour du visiteur apres conversion ─────────────────────────────────
   Discret : il doit se remarquer sans voler la vedette au resultat. */
.wh-avis {
  margin: 18px 0 0;
  padding: 14px 16px;
  background: #FDF8F0;
  border: 1px solid #ece6dc;
  border-radius: 12px;
}
.wh-avis-question { margin: 0 0 10px; font-size: 14.5px; font-weight: 600; color: #1a2332; }
.wh-avis-boutons { display: flex; gap: 8px; }
.wh-avis-btn, .wh-avis-envoi {
  padding: 7px 18px; border-radius: 8px; cursor: pointer;
  border: 1px solid #d9d2c6; background: #fff;
  font: inherit; font-size: 14px; font-weight: 600; color: #1a2332;
  transition: border-color .15s, background .15s;
}
.wh-avis-btn:hover, .wh-avis-envoi:hover { border-color: #EE6C4D; color: #EE6C4D; }
.wh-avis-envoi { background: #16404b; border-color: #16404b; color: #fff; }
.wh-avis-envoi:hover { background: #1a5a6b; border-color: #1a5a6b; color: #fff; }
.wh-avis-texte {
  width: 100%; margin: 0 0 10px; padding: 9px 11px;
  border: 1px solid #d9d2c6; border-radius: 8px;
  font: inherit; font-size: 14px; resize: vertical;
}
.wh-avis-texte:focus { outline: none; border-color: #EE6C4D; }
.wh-avis-merci { margin: 0; font-size: 14.5px; color: #4a5568; }

/* ── Detecteur IA : rendu visuel ─────────────────────────────────────────
   Les barres en caracteres etaient lisibles par un developpeur, pas par un
   visiteur venu savoir si son texte passe pour une IA. */
.wh-det {
  text-align: left; font-size: 15px; color: #1a2332;
  /* La zone de resultat est en chasse fixe pour afficher du code : le rendu du
     detecteur, lui, est du texte courant. */
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
}
.wh-det--court p { margin: 0 0 6px; }

.wh-det-tete { display: flex; align-items: center; gap: 22px; margin: 0 0 22px; }
.wh-det-jauge { position: relative; flex: 0 0 120px; width: 120px; height: 120px; }
.wh-det-score {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 34px; font-weight: 800; letter-spacing: -0.02em;
}
.wh-det-titre { margin: 0 0 6px; font-size: 19px; font-weight: 700; line-height: 1.25; }
.wh-det-sous { margin: 0; font-size: 14px; line-height: 1.5; color: #5a6675; }

.wh-det-indices { list-style: none; margin: 0 0 20px; padding: 0; }
.wh-det-indice {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px 34px 92px;
  align-items: center; gap: 12px;
  padding: 9px 0; border-top: 1px solid #f0eae0;
}
.wh-det-nom { font-size: 14.5px; }
.wh-det-barre { height: 8px; border-radius: 999px; background: #f0eae0; overflow: hidden; }
.wh-det-barre > span { display: block; height: 100%; border-radius: 999px; }
.wh-det-val { font-size: 14px; font-weight: 700; text-align: right; }
.wh-det-mesure { font-size: 12.5px; color: #8b94a0; text-align: right; }
.wh-det-indice--absent .wh-det-hors {
  grid-column: 2 / -1; font-size: 12.5px; color: #8b94a0; text-align: right;
}

.wh-det-avert {
  margin: 0; padding: 13px 15px;
  background: #FDF8F0; border: 1px solid #f0e9dd; border-radius: 10px;
  font-size: 13.5px; line-height: 1.55; color: #5a6675;
}

@media (max-width: 640px) {
  .wh-det-tete { flex-direction: column; align-items: flex-start; gap: 14px; }
  .wh-det-indice { grid-template-columns: minmax(0, 1fr) 60px; row-gap: 4px; }
  .wh-det-mesure, .wh-det-indice--absent .wh-det-hors { grid-column: 1 / -1; text-align: left; }
  .wh-det-barre { grid-column: 1 / -1; }
}
