/* =========================================================
   STYLE GLOBAL — Projet "Explique-moi ce fichier tableur"
   Source : Word (sobriété, lisibilité, modifiable facilement)
   Rôle : présentation UNIQUEMENT
   ========================================================= */

/* ---------- RESET MINIMAL ---------- */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #f6f7f9;
  color: #1f2937;
  line-height: 1.5;
}

/* ---------- LAYOUT ---------- */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
}

section {
  background: #ffffff;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ---------- TITRES ---------- */
h2 {
  margin-top: 0;
  font-size: 1.4rem;
  padding-bottom: 6px;
}

h3 {
  font-size: 1.1rem;
  margin-top: 18px;
}

/* ---------- TEXTES ---------- */
p {
  margin: 10px 0;
}

ul {
  padding-left: 20px;
}

li {
  margin-bottom: 6px;
}

/* ---------- STATUS BAR ---------- */
#statusBar {
  width: 100%;
  padding: 10px 16px;
  font-size: 0.95rem;
  border-bottom: 1px solid #e5e7eb;
}

.status-idle {
  background: #eef2ff;
}

.status-loading {
  background: #fff7ed;
}

.status-done {
  background: #ecfdf5;
}

.status-error {
  background: #fef2f2;
  color: #991b1b;
}

.status-locked {
  background: #fef3c7;
}

/* ---------- TABLE COMPATIBILITÉ ---------- */
.compatibility-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.compatibility-table th,
.compatibility-table td {
  border: 1px solid #e5e7eb;
  padding: 8px 10px;
  text-align: left;
  font-size: 0.9rem;
}

.compatibility-table th {
  background: #f3f4f6;
  font-weight: 600;
}

/* ---------- BLOCS PAYANTS (VISUEL SEUL) ---------- */
.locked {
  opacity: 0.5;
  pointer-events: none;
}

.locked::after {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #92400e;
}

/* 🔓 EXCEPTION : Compatibilité des outils ne doit JAMAIS être voilée */
#compatibility.locked {
  opacity: 1 !important;
  pointer-events: auto !important;
}

#compatibility.locked::after {
  display: none !important;
}

/* ---------- FOOTER ---------- */
footer {
  text-align: center;
  font-size: 0.8rem;
  color: #6b7280;
  padding: 20px;
}

/* ============================
   PREMIUM — ÉTAT DÉBLOQUÉ
   ============================ */

.premium-unlocked .locked {
  opacity: 1;
  filter: none;
  pointer-events: auto;
}

.premium-badge {
  margin-top: 8px;
  font-size: 0.9em;
  color: #0a7d3b;
}
/* ============================
   MODAL CGV / CONTACT / LEGAL
   ============================ */

.modal {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;      /* centrage vertical */
  justify-content: center;  /* centrage horizontal */
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
}

.modal-content {
  position: relative;
  background: #ffffff;
  width: 90%;
  max-width: 800px;
  max-height: 90vh;

  /* IMPORTANT : on enlève le centrage par marge */
  margin: 0;

  border-radius: 8px;
  padding: 24px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: none;
  background: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #374151;
}

.modal-close:hover {
  color: #000000;
}

/* ============================
   SÉLECTEUR DE LANGUE — SAFE
   ============================ */

#languageSwitch {
  padding: 10px 16px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
}

/* Select basique, sans custom */
#lang-select {
  font-size: 0.9rem;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #111827;
}

/* ============================
   TEXTE BLOQUÉ (PAYWALL)
   ============================ */

.locked-text {
  font-style: italic;
  color: #6b7280;
  margin-top: 8px;
}

/* ============================
   COMPATIBILITÉ — BLOCS
   ============================ */

.compat-block {
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.compat-block.success {
  background: #ecfdf5;
  color: #065f46;
}

.compat-block.warning {
  background: #fff7ed;
  color: #92400e;
}

.compat-block.error {
  background: #fef2f2;
  color: #991b1b;
}

.compat-block.danger {
  background: #fef2f2;
  color: #991b1b;
}

/* ============================
   BOUTON PDF
   ============================ */

.pdf-btn {
  margin-top: 12px;
  padding: 8px 14px;
  font-size: 0.9rem;
  border-radius: 6px;
  border: none;
  background: #1e40af;
  color: #ffffff;
  cursor: pointer;
}

.pdf-btn:hover {
  background: #1d4ed8;
}

/* ============================
   BOUTON CODE D'ACCÈS
   ============================ */

.code-btn {
  margin-top: 8px;
  margin-left: 8px;
  padding: 6px 14px;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1px solid #94a3b8;
  background: #f1f5f9;
  color: #475569;
  cursor: pointer;
  transition: background 0.2s;
}

.code-btn:hover {
  background: #e2e8f0;
  border-color: #64748b;
}

#code-input-area {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

#code-input {
  padding: 8px 12px;
  font-size: 0.95rem;
  border-radius: 6px;
  border: 2px solid #cbd5e1;
  background: #ffffff;
  color: #1e293b;
  width: 200px;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-family: monospace;
}

#code-input::placeholder {
  color: #94a3b8;
}

#code-input:focus {
  outline: none;
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

#code-validate-btn {
  padding: 8px 14px;
  font-size: 0.85rem;
  border-radius: 6px;
  border: none;
  background: #16a34a;
  color: #ffffff;
  cursor: pointer;
}

#code-validate-btn:hover {
  background: #15803d;
}

#code-cancel-btn {
  padding: 8px 12px;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #64748b;
  cursor: pointer;
}

#code-cancel-btn:hover {
  background: #f1f5f9;
}

.code-message {
  width: 100%;
  margin: 4px 0 0 0;
  font-size: 0.8rem;
  min-height: 1.2em;
}

.code-message.error {
  color: #dc2626;
}

.code-message.success {
  color: #16a34a;
}

/* ============================
   PART 5 — FICHE RÉFLEXE
   ============================ */

#part5 {
  background: #ffffff;   /* même blanc que les autres sections */
  border-left: none;     /* supprime le bord bleu */
}

#part5 h2 {
  font-size: 1.3rem;
  margin-bottom: 12px;
}

/* Contenu fiche réflexe */
#part5-content {
  font-size: 1rem;
  line-height: 1.6;
}

/* Blocs internes (CONSULTER / METTRE À JOUR / SI ÇA MERDE) */
#part5-content .reflex-block {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 6px;
}

/* Codes couleur pédagogiques */
#part5-content .reflex-consult {
  background: #ecfeff;   /* vert/bleu clair */
  border-left: 4px solid #0ea5e9;
}

#part5-content .reflex-update {
  background: #fff7ed;   /* orange clair */
  border-left: 4px solid #f97316;
}

#part5-content .reflex-error {
  background: #fef2f2;   /* rouge clair */
  border-left: 4px solid #ef4444;
}

/* Cellules Excel mises en avant */
#part5-content .cell {
  font-weight: 600;
  background: #e5e7eb;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: monospace;
}

/* Bouton PDF spécifique fiche réflexe */
#part5-pdf-btn {
  margin-top: 12px;
}

section:empty {
  display: none;
}

/* Exception : on ne masque jamais une section premium “vide”
   (sinon tes titres disparaissent en état débloqué) */
#part5:empty,
#part2-paid:empty,
#functional:empty,
#technical:empty,
#automation:empty {
  display: block;
}

/* ============================
   IMPRESSION — FICHE RÉFLEXE
   ============================ */
@media print {
  body {
    background: white;
  }

  /* On cache tout */
  main section {
    display: none;
  }

  /* Sauf la fiche réflexe */
  #part5 {
    display: block;
    box-shadow: none;
    border: none;
    padding: 0;
  }

  #part5 h2 {
    font-size: 18pt;
  }

  #part5-content {
    font-size: 12pt;
  }

  #part5-pdf-btn {
    display: none;
  }

}

/* ============================
   STYLES GÉNÉRAUX (hors print)
   ============================ */

.analysis-page {
  max-width: 1100px;
  margin: auto;
  padding: 24px;
}

.card {
  background: #fff;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 24px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.card-info {
  border-left: none;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.summary-card.danger {
  border-left: 6px solid #ef4444;
}

.zones-table {
  width: 100%;
  border-collapse: collapse;
}

.zones-table th,
.zones-table td {
  padding: 10px;
  border-bottom: 1px solid #eee;
}

/* ============================
   ÉTAT VERROUILLÉ — voile visuel
   ============================ */

.locked {
  position: relative;
  pointer-events: none;
}

/* voile visuel sans baisser l opacité du texte */
.locked::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 8px;
}

/* le texte reste lisible au-dessus du voile */
.locked .locked-text {
  position: relative;
  z-index: 1;
  opacity: 1;
}

.lock-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
}

.unlock-btn {
  padding: 10px 18px;
  border-radius: 6px;
}

/* =========================================
   FIX : suppression du trait gris compatibilité
   ========================================= */

#compatibility {
  border: none !important;
  padding: 0 !important;
  margin-top: 0 !important;
}

/* =========================================
   FIX : retirer le trait sous le titre Compatibilité
   ========================================= */

#compatibility h2 {
  border-bottom: none !important;
  padding-bottom: 0 !important;
}
