/* ============================================================
   Typographie pages legales/politiques uniquement
   Reduit les tailles trop grosses des titres sur les pages
   contenant .mil-legal-content (privacy, terms, charte-ia,
   accessibilite, cookies, sources, gouvernance-rp,
   droit-explication-ia, mentions-legales).
   N'affecte PAS les autres pages (homepage, blog, services).
   Ratios 2026 best practice : h1 36px / h2 24px / h3 20px / p 16px
   ============================================================ */

/* --- H1 banner page legale (cible via :has() pour scope au body) --- */
body:has(.mil-legal-content) .mil-banner h1,
body:has(.mil-legal-content) .mil-banner .mil-h1,
body:has(.mil-legal-content) .mil-inner-banner h1,
body:has(.mil-legal-content) .mil-inner-banner .mil-h1 {
    font-size: 3rem !important;        /* 48px desktop */
    line-height: 1.2 !important;
    font-weight: 500 !important;
}

/* --- H2 contenu legal --- */
.mil-legal-content h2 {
    font-size: 2.25rem !important;     /* 36px desktop */
    line-height: 1.3 !important;
    font-weight: 500 !important;
    margin-top: 2rem !important;
    margin-bottom: 1rem !important;
}

/* --- H3 contenu legal --- */
.mil-legal-content h3 {
    font-size: 1.625rem !important;    /* 26px desktop */
    line-height: 1.4 !important;
    font-weight: 500 !important;
    margin-top: 1.5rem !important;
    margin-bottom: 0.75rem !important;
}

/* --- H4 contenu legal (rarement utilise mais coherent) --- */
.mil-legal-content h4 {
    font-size: 1.125rem !important;      /* 18px desktop */
    line-height: 1.4 !important;
    font-weight: 600 !important;
    margin-top: 1.25rem !important;
    margin-bottom: 0.5rem !important;
}

/* --- Paragraphes contenu legal --- */
.mil-legal-content p {
    font-size: 1rem !important;          /* 16px */
    line-height: 1.6 !important;
}

/* --- Listes contenu legal --- */
.mil-legal-content ul,
.mil-legal-content ol {
    font-size: 1rem !important;
    line-height: 1.6 !important;
}

.mil-legal-content li {
    font-size: 1rem !important;
    line-height: 1.6 !important;
}

/* ============================================================
   Mobile (max-width: 768px) : reduction supplementaire ~10-15%
   ============================================================ */
@media (max-width: 768px) {
    body:has(.mil-legal-content) .mil-banner h1,
    body:has(.mil-legal-content) .mil-banner .mil-h1,
    body:has(.mil-legal-content) .mil-inner-banner h1,
    body:has(.mil-legal-content) .mil-inner-banner .mil-h1 {
        font-size: 2.25rem !important;    /* 36px mobile */
        line-height: 1.2 !important;
    }

    .mil-legal-content h2 {
        font-size: 1.875rem !important;   /* 30px mobile */
    }

    .mil-legal-content h3 {
        font-size: 1.375rem !important;   /* 22px mobile */
    }

    .mil-legal-content h4 {
        font-size: 1rem !important;      /* 16px mobile */
    }
}

/* ============================================================
   Fallback navigateurs sans :has() (Firefox <121, vieux Safari)
   On retombe sur des selecteurs directs : si la page contient
   .mil-legal-content (donc page legale), on suppose que le
   .mil-banner ou .mil-inner-banner precede. On cible alors
   les sections sœurs via combinator general.
   ============================================================ */
@supports not selector(:has(*)) {
    /* Si :has() pas supporte, on applique directement aux h1 dans
       toute section banner sur les pages dont la page legale a
       deja .mil-legal-content. On utilise un selecteur de class
       sur main pour scope mais comme fallback minimal, on cible
       toute page contenant legal-content via une class wrapper.
       Solution : ajouter manuellement la class .legal-page-active
       sur body ou laisser le rendu natif (titres restent gros sur
       Firefox <121). En 2026 les browsers majeurs supportent :has()
       (Chrome 105+, Safari 15.4+, Firefox 121+). */
    .mil-legal-content h2 { font-size: 1.5rem !important; }
    .mil-legal-content h3 { font-size: 1.25rem !important; }
}



/* ============================================================
   Tableaux pages legales - design moderne 2026
   Cible : .mil-legal-content table (privacy, cookies,
   gouvernance-rp, trust-center)
   ============================================================ */

/* --- Reset des bordures Bootstrap par defaut --- */
.mil-legal-content table,
.mil-legal-content table.table,
.mil-legal-content table.table-bordered,
.mil-legal-content table.table-striped,
.mil-legal-content table.table-sm,
.mil-legal-content table.mil-table-legal {
  border: 0 !important;
  border-collapse: separate !important;
  border-spacing: 0 !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  margin-top: 2rem !important;
  margin-bottom: 2rem !important;
  width: 100% !important;
  background: #ffffff;
}

/* --- En-tetes de colonnes (thead th) --- */
.mil-legal-content table thead th,
.mil-legal-content table.table thead th,
.mil-legal-content table.table-bordered thead th,
.mil-legal-content table.table-sm thead th {
  background: #0170B9 !important;
  color: #ffffff !important;
  font-weight: 600 !important;
  padding: 14px 18px !important;
  font-size: 0.95rem !important;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  text-align: left !important;
  vertical-align: middle !important;
  border: 0 !important;
  white-space: nowrap;
  position: relative;
}

/* Separateur subtil entre les colonnes du header */
.mil-legal-content table thead th + th::before {
  content: "";
  position: absolute;
  left: 0;
  top: 25%;
  height: 50%;
  width: 1px;
  background: rgba(255, 255, 255, 0.2);
}

/* --- Cellules du corps (tbody td) --- */
.mil-legal-content table tbody td,
.mil-legal-content table.table tbody td,
.mil-legal-content table.table-bordered tbody td,
.mil-legal-content table.table-sm tbody td,
.mil-legal-content table.table-striped tbody td {
  padding: 14px 18px !important;
  font-size: 0.9375rem !important;
  line-height: 1.6 !important;
  vertical-align: top !important;
  border-bottom: 1px solid #e5e7eb !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-top: 0 !important;
  color: #374151;
  background: transparent;
  transition: background-color 0.15s ease;
}

/* --- En-tetes de lignes (tbody th) --- */
.mil-legal-content table tbody th,
.mil-legal-content table.table tbody th,
.mil-legal-content table.table-bordered tbody th,
.mil-legal-content table.table-sm tbody th {
  font-weight: 600 !important;
  color: #1f2937 !important;
  background: #f9fafb !important;
  padding: 14px 18px !important;
  font-size: 0.9375rem !important;
  line-height: 1.6 !important;
  vertical-align: top !important;
  border-bottom: 1px solid #e5e7eb !important;
  border-left: 0 !important;
  border-right: 0 !important;
  border-top: 0 !important;
  transition: background-color 0.15s ease;
}

/* --- Alternance de couleur (zebra) --- */
.mil-legal-content table tbody tr:nth-child(even) td,
.mil-legal-content table.table-striped tbody tr:nth-child(even) td,
.mil-legal-content table.table-striped tbody tr:nth-child(odd) td {
  background: transparent !important;
}

.mil-legal-content table tbody tr:nth-child(even) td {
  background: #f9fafb !important;
}

.mil-legal-content table tbody tr:nth-child(odd) td {
  background: #ffffff !important;
}

/* Zebra pour les en-tetes de ligne aussi */
.mil-legal-content table tbody tr:nth-child(even) th {
  background: #f3f4f6 !important;
}

/* --- Survol de ligne (hover) --- */
.mil-legal-content table tbody tr:hover td,
.mil-legal-content table tbody tr:hover th {
  background: #eff6ff !important;
}

/* --- Derniere ligne : pas de bordure basse (le border-radius suffit) --- */
.mil-legal-content table tbody tr:last-child td,
.mil-legal-content table tbody tr:last-child th {
  border-bottom: 0 !important;
}

/* --- Legende (caption) --- */
.mil-legal-content table caption {
  caption-side: top;
  font-weight: 600;
  color: #1f2937;
  padding: 0 0 0.75rem 0;
  font-size: 1rem;
  text-align: left;
}

/* --- Desactivation du style Bootstrap .table-bordered --- */
.mil-legal-content table.table-bordered > :not(caption) > * > * {
  border-width: 0 !important;
}

.mil-legal-content table.table-bordered > :not(caption) > * {
  border-width: 0 !important;
}

/* --- Desactivation des box-shadow Bootstrap --- */
.mil-legal-content table.table > :not(caption) > * > * {
  box-shadow: none !important;
}

/* --- Wrapper de defilement si present --- */
.mil-legal-content .table-responsive,
.mil-legal-content .table-responsive-legal {
  border-radius: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.04);
  margin-top: 2rem;
  margin-bottom: 2rem;
  background: #ffffff;
}

.mil-legal-content .table-responsive table,
.mil-legal-content .table-responsive-legal table {
  box-shadow: none !important;
  border-radius: 0 !important;
  margin-top: 0 !important;
  margin-bottom: 0 !important;
}

/* ============================================================
   Responsive mobile - defilement horizontal + densite adaptee
   ============================================================ */
@media (max-width: 768px) {

  .mil-legal-content table,
  .mil-legal-content table.table,
  .mil-legal-content table.table-bordered,
  .mil-legal-content table.table-sm {
    display: block !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    max-width: 100% !important;
  }

  .mil-legal-content table tbody td,
  .mil-legal-content table tbody th,
  .mil-legal-content table.table-sm tbody td,
  .mil-legal-content table.table-sm tbody th {
    padding: 10px 12px !important;
    font-size: 0.875rem !important;
  }

  .mil-legal-content table thead th,
  .mil-legal-content table.table-sm thead th {
    padding: 10px 12px !important;
    font-size: 0.8125rem !important;
  }

  .mil-legal-content table td,
  .mil-legal-content table th {
    white-space: normal !important;
    min-width: 120px;
  }

  .mil-legal-content table td:first-child,
  .mil-legal-content table th:first-child {
    min-width: 150px;
  }

  .mil-legal-content table {
    margin-top: 1.5rem !important;
    margin-bottom: 1.5rem !important;
  }
}

/* ============================================================
   Tres petits ecrans (< 480px)
   ============================================================ */
@media (max-width: 480px) {

  .mil-legal-content table tbody td,
  .mil-legal-content table tbody th {
    padding: 8px 10px !important;
    font-size: 0.8125rem !important;
    line-height: 1.5 !important;
  }

  .mil-legal-content table thead th {
    padding: 8px 10px !important;
    font-size: 0.75rem !important;
    letter-spacing: 0.02em;
  }

  .mil-legal-content table td:first-child,
  .mil-legal-content table th:first-child {
    min-width: 130px;
  }

  .mil-legal-content table {
    border-radius: 8px !important;
  }

  .mil-legal-content .table-responsive,
  .mil-legal-content .table-responsive-legal {
    border-radius: 8px;
  }
}

/* ============================================================
   Impression
   ============================================================ */
@media print {

  .mil-legal-content table,
  .mil-legal-content table.table {
    box-shadow: none !important;
    border: 1px solid #d1d5db !important;
    border-radius: 0 !important;
    page-break-inside: avoid;
  }

  .mil-legal-content table thead th {
    background: #0170B9 !important;
    color: #ffffff !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .mil-legal-content table tbody tr:hover td,
  .mil-legal-content table tbody tr:hover th {
    background: transparent !important;
  }

  .mil-legal-content table tbody td,
  .mil-legal-content table tbody th {
    border-bottom: 1px solid #d1d5db !important;
    font-size: 0.8125rem !important;
    padding: 8px 10px !important;
  }
}
