/* ============================================================
   TABLEAU COMPARATIF — VERSION ÉTENDUE
   Base : votre CSS existant (#5d8b9e + accordéons mobile)
   Ajouts : en-têtes groupés 2 niveaux, bandeaux catégorie,
            sous-titres, fusion cellules (colspan)
   ============================================================ */

/* --- Structure globale --- */
table.insurance-table tbody {
  border-left: 1px solid #eee;
  border-right: 1px solid #eee;
}

.insurance-module {
  margin: 1rem 0;
}

.table-title {
  margin-bottom: 20px;
  color: #333;
  text-align: center;
}

.table-conditions {
  font-size: 0.85rem;
  margin: 1rem 0 0 0;
}

.table-conditions p {
  margin: 0 0 0.4rem;
}

.table-conditions p:last-child {
  margin-bottom: 0;
}

/* Icônes */
.icon-check {
  width: 22px;
  height: 22px;
  color: #5d8b9e;
  display: inline-block;
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1;
}

.icon-empty {
  width: 16px;
  height: 16px;
  opacity: 0.5;
  display: inline-block;
  color: #9ca3af;
}

/* =========================================
   VUE DESKTOP (Tableau)
   ========================================= */
.insurance-desktop-view {
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.insurance-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

/* === En-têtes === */
.insurance-table th {
  background-color: #5d8b9e;
  color: #ffffff;
  padding: 20px 15px;
  text-align: center;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.9rem;

  border-top: 1px solid #eee;
  border-left: 1px solid #eee;
  border-right: 1px solid #eee;
}

/* Première cellule d'en-tête (libellé "Garanties" par défaut) */
.insurance-table th.guarantee-header {
  background-color: transparent;
  border: none;
  color: #333;
  border-bottom: 1px solid #eee;
}

/* En-tête supérieur (groupe regroupant plusieurs colonnes) */
.insurance-table th.group-header {
  background-color: #4a7282;
  font-size: 0.95rem;
  border-bottom: 1px solid #eee;
}

/* Colonnes mises en avant */
.insurance-table th.is-featured {
  background-color: #d4a017;
}

/* === Corps du tableau === */

/* Libellé de la ligne (colonne de gauche) */
.insurance-table td.guarantee-name {
  padding: 15px 20px;
  color: #444;
  border-bottom: 1px solid #eee;
  font-weight: 500;
  width: 30%;
  background: #fff;
  border-left: 1px solid #eee;
  border-top: 1px solid #eee;
}

.insurance-table td.guarantee-name.is-bold {
  font-weight: 700;
}

/* Cellule de valeur */
.insurance-table td.guarantee-value {
  text-align: center;
  vertical-align: middle;
  padding: 15px;
  background-color: #f8fbfa;
  border-left: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

.insurance-table td.guarantee-value.is-featured {
  background-color: #fef9e7;
}

.text-value {
  font-size: 0.9rem;
  font-weight: 600;
  color: #5d8b9e;
}

/* === Bandeau de catégorie (titre coloré pleine largeur) === */
.insurance-table tr.category-row td {
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  padding: 12px 20px;
  letter-spacing: 0.02em;
  border-left: 1px solid #eee;
  border-right: 1px solid #eee;
  border-bottom: 1px solid rgba(0, 0, 0, 0.15);
  text-align: left;
}

/* === Sous-titre (gras italique pleine largeur) === */
.insurance-table tr.subtitle-row td {
  background: #f3f4f6;
  font-weight: 700;
  font-style: italic;
  padding: 10px 20px;
  color: #1f2937;
  border-left: 1px solid #eee;
  border-right: 1px solid #eee;
  border-bottom: 1px solid #eee;
  text-align: left;
}

/* VUE MOBILE CACHÉE PAR DÉFAUT */
.insurance-mobile-view {
  display: none;
}

/* =========================================
   VUE MOBILE (Accordéons par formule)
   ========================================= */
@media (max-width: 1024px) {
  .insurance-desktop-view {
    display: none;
  }

  .insurance-mobile-view {
    display: block;
  }

  /* Le conteneur utilise flexbox pour gérer l'espacement */
  .insurance-accordion-container {
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  /* Le style de "carte" est appliqué à chaque élément */
  .accordion-item {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    border: 1px solid #eee;
  }

  .accordion-header {
    width: 100%;
    padding: 18px 20px;
    background-color: #5d8b9e;
    color: #fff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: none;
    cursor: pointer;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    transition: background 0.3s ease;
    font-size: 0.95rem;
  }

  /* Groupe affiché en petit au-dessus du nom de colonne */
  .accordion-header .header-group {
    display: block;
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.85;
    text-transform: uppercase;
    margin-bottom: 2px;
    letter-spacing: 0.05em;
  }

  .accordion-header.active {
    background-color: #4a7282;
  }

  .accordion-header.is-featured {
    background-color: #d4a017;
  }

  .accordion-header.is-featured.active {
    background-color: #b8881a;
  }

  .accordion-icon {
    position: relative;
    width: 14px;
    height: 14px;
    flex-shrink: 0;
    margin-left: 10px;
  }

  .accordion-icon::before,
  .accordion-icon::after {
    content: "";
    position: absolute;
    background: #fff;
    transition: transform 0.3s ease;
  }

  .accordion-icon::before {
    top: 6px;
    left: 0;
    width: 14px;
    height: 2px;
  }

  .accordion-icon::after {
    top: 0;
    left: 6px;
    width: 2px;
    height: 14px;
  }

  .accordion-header.active .accordion-icon::after {
    transform: rotate(90deg);
    opacity: 0;
  }

  .accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background: #f8fbfa;
  }

  /* Bandeau de catégorie dans l'accordéon */
  .mobile-category-banner {
    padding: 10px 20px;
    color: #fff;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.02em;
  }

  /* Sous-titre dans l'accordéon */
  .mobile-subtitle {
    padding: 8px 20px;
    background: #e5e7eb;
    font-weight: 700;
    font-style: italic;
    font-size: 0.85rem;
    color: #1f2937;
  }

  .mobile-guarantee-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #eaeaea;
    gap: 15px;
  }

  .mobile-guarantee-row:last-child {
    border-bottom: none;
  }

  .mobile-g-name {
    font-size: 0.9rem;
    color: #444;
    flex: 1;
    padding-right: 15px;
  }

  .mobile-g-name.is-bold {
    font-weight: 700;
  }

  .mobile-g-value {
    text-align: right;
    flex-shrink: 0;
  }
}