/**
 * Styles pour le comparateur d'assurance vie
 */

/* Variables CSS */
:root {
  --primary-color: #5469d4;
  --primary-hover: #4a5bc7;
  --secondary-color: #f5f7fa;
  --text-color: #1a1f36;
  --text-light: #4f566b;
  --success-color: #32d296;
  --warning-color: #faa05a;
  --danger-color: #f74b4b;
  --border-color: #e3e8ee;
  --border-radius: 12px;
  --box-shadow: 0 4px 12px rgba(50, 50, 93, 0.11), 0 1px 5px rgba(0, 0, 0, 0.08);
  --transition: all 0.2s ease;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --finnews-color: #ff1053;
}

/* Base */
.comparateur-assurance-vie {
  font-family: var(--font-family);
  color: var(--text-color);
  max-width: 1300px;
  margin: 0 auto;
  padding: 20px;
}

/* Filtres */
.comparateur-filters {
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  margin-bottom: 30px;
  padding: 25px;
}

.filters-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 30px;
  align-items: center;
}

.filter-group {
  flex: 1;
  min-width: 200px;
}

.filter-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 600;
  color: var(--text-color);
  font-size: 14px;
  letter-spacing: 0.3px;
}

.select-filter-container {
  position: relative;
  border-radius: var(--border-radius);
  background-color: var(--secondary-color);
  transition: var(--transition);
}

.select-filter-container:hover {
  box-shadow: 0 0 0 2px rgba(84, 105, 212, 0.2);
}

.select-filter {
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 16px;
  color: var(--text-color);
  background-color: transparent;
  transition: var(--transition);
  appearance: none;
  cursor: pointer;
}

.select-filter:focus {
  outline: none;
}

.select-filter-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--text-light);
}

/* Styles pour les logos de banques dans le filtre */
.bank-logo-option {
  width: 16px;
  height: 16px;
  margin-right: 8px;
  vertical-align: middle;
  border-radius: 50%;
  object-fit: cover;
}

.bank-logo-option-container {
  display: inline-flex;
  align-items: center;
  margin-right: 5px;
}

.selected-bank-logo {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  z-index: 2;
}

/* Fix for select options with logos */
select.select-filter option {
  display: flex;
  align-items: center;
  padding: 5px;
}

select.select-filter option img {
  margin-right: 8px;
}

/* Ajuster le padding du select pour laisser de la place au logo */
.select-filter-container .selected-bank-logo + .select-filter {
  padding-left: 40px;
}

/* Tableau de comparaison */
.comparateur-table-container {
  overflow-x: auto;
  background-color: white;
  border-radius: var(--border-radius);
  box-shadow: var(--box-shadow);
  -webkit-overflow-scrolling: touch;
}

.comparateur-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 15px;
}

.comparateur-table th,
.comparateur-table td {
  padding: 16px 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
}

.comparateur-table th {
  background-color: var(--secondary-color);
  font-weight: 600;
  color: var(--text-color);
  position: sticky;
  top: 0;
  z-index: 10;
  white-space: normal;
  font-size: 14px;
  text-align: center;
}

.comparateur-table tr:last-child td {
  border-bottom: none;
}

/* Lignes alternées et hover */
.comparateur-table tbody tr:nth-child(even) {
  background-color: rgba(245, 247, 250, 0.5);
}

.comparateur-table tbody tr:nth-child(odd) {
  background-color: white;
}

.comparateur-table tbody tr:hover {
  background-color: rgba(245, 247, 250, 0.8);
}

/* Colonnes */
.product-col {
  width: 25%;
  min-width: 220px;
  text-align: left !important;
}

.product-title, .product-bank {
  text-align: left !important;
}

.taux-col {
  font-weight: 600;
  width: 120px;
  text-align: center;
}

.frais-col {
  width: 100px;
  text-align: center;
}

.montant-col {
  width: 120px;
  text-align: center;
}

.options-col {
  width: 120px;
  text-align: center;
}

.action-col {
  width: 100px;
  text-align: center;
}

/* Informations produit */
.product-info {
  display: flex;
  align-items: center;
  text-align: left;
}

.product-logo {
  flex: 0 0 42px;
  margin-right: 15px;
}

.product-logo img {
  max-width: 42px;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.product-details {
  flex: 1;
  text-align: left;
}

.product-title {
  margin: 0 0 5px;
  font-size: 16px;
  font-weight: 600;
  text-align: left;
}

.product-bank {
  color: var(--text-light);
  font-size: 14px;
  display: flex;
  align-items: center;
  text-align: left;
}

.bank-logo-small {
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border-radius: 50%;
  object-fit: cover;
}

/* Icônes */
.icon-check {
  color: var(--success-color);
  font-weight: bold;
  font-size: 18px;
}

.icon-cross {
  color: var(--danger-color);
  font-weight: bold;
  font-size: 18px;
}

/* Icônes d'information */

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #e0e0e0;
  color: var(--text-color);
  font-size: 14px;
  cursor: help;
  position: relative;
  transition: var(--transition);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid #d0d0d0;
}

.info-icon:hover {
  transform: translateY(-2px);
  background-color: #e9ecf0;
}

.info-icon i {
  font-size: 14px;
}

/* Styles spécifiques pour Safari */
.safari .info-icon {
  background-color: #e0e0e0;
  border: 1px solid #d0d0d0;
}

/* Simple text symbols for Safari compatibility */
.info-icon-text {
  font-weight: bold;
  font-size: 12px;
}

/* Tooltips pour les icônes d'information */
.tooltip-popup {
  position: absolute;
  z-index: 1000;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  max-width: 220px;
  text-align: center;
  pointer-events: none;
  box-shadow: 0 5px 10px rgba(0,0,0,0.2);
  top: 0;
  left: 0;
  transform: translate(-50%, -100%);
  margin-top: -8px;
  white-space: normal;
  line-height: 1.4;
}

.tooltip-popup:after {
  content: '';
  position: absolute;
  bottom: -5px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 6px solid rgba(0, 0, 0, 0.8);
}


/* Boutons */
.btn-details {
  background-color: var(--secondary-color);
  color: var(--text-color);
  border: none;
  border-radius: var(--border-radius);
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}

.btn-details:hover {
  background-color: #e9ecf0;
  transform: translateY(-2px);
}

.btn-small {
  padding: 6px 12px;
  font-size: 12px;
  margin-top: 5px;
}

/* Container pour les boutons d'action */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

/* Le choix de Finnews badge */
.finnews-choice-badge {
  background-color: var(--finnews-color);
  color: white;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 50px;
  display: inline-block;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(255, 16, 83, 0.3);
  position: relative;
  margin: 0 auto;
}

/* Tooltip pour le badge Finnews */
.finnews-tooltip {
  display: none;
  position: absolute;
  z-index: 100;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 8px;
  width: 220px;
  padding: 8px 12px;
  background-color: rgba(0, 0, 0, 0.8);
  color: white;
  font-size: 12px;
  border-radius: 4px;
  text-align: center;
}

.finnews-choice-badge:hover + .finnews-tooltip {
  display: block;
}

/* Style pour l'offre sponsorisée / recommandée */
.product-sponsored {
  position: relative;
  background-color: rgba(255, 16, 83, 0.04);
  border: 1px solid var(--finnews-color);
  border-left: 4px solid var(--finnews-color);
  box-shadow: 0 2px 10px rgba(255, 16, 83, 0.1);
}

/* Modal pour les détails */
.product-details-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 999999;
  opacity: 0;
  transition: opacity 0.3s ease;
  padding: 0;
  margin: 0;
}

.product-details-modal.active {
  opacity: 1;
}

.modal-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
}

.modal-content {
  position: relative;
  background-color: white;
  width: 90%;
  max-width: 900px;
  margin: auto;
  border-radius: var(--border-radius);
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
  z-index: 9999999;
  max-height: 90vh;
  overflow-y: auto;
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 28px;
  font-weight: bold;
  color: var(--text-light);
  cursor: pointer;
  z-index: 10000000; /* Valeur augmentée pour être au-dessus de tout */
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #f5f5f5;
  border-radius: 50%;
  transition: var(--transition);
}

.close-modal:hover {
  background-color: #e0e0e0;
  color: var(--text-color);
}

.modal-loading {
  text-align: center;
  padding: 30px;
  color: var(--text-light);
}

/* Détails du produit */
.product-detail-header {
  position: relative;
  margin-bottom: 30px;
  padding-top: 40px; /* Espace pour le badge */
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.product-detail-logo {
  display: none; /* Masquer complètement le logo */
  margin-right: 15px;
}

.product-detail-info {
  flex: 1;
}

.product-detail-title {
  margin: 0 0 5px;
  font-size: 26px;
  font-weight: 600;
}

.product-detail-bank {
  color: var(--text-light);
  font-size: 16px;
  display: flex;
  align-items: center;
}

.product-detail-badge {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  text-align: center;
  margin: 0 0 15px 0;
  z-index: 100;
}

.product-detail-sections {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 25px;
  margin-bottom: 30px;
}

.detail-section {
  background-color: var(--secondary-color);
  border-radius: var(--border-radius);
  padding: 20px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

.section-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
}

.section-icon {
  font-size: 20px;
  color: var(--text-light);
}

.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.detail-item {
  display: flex;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}

.detail-item:last-child {
  border-bottom: none;
}

.detail-label {
  color: var(--text-light);
  font-weight: 500;
}

.detail-value {
  font-weight: 600;
}

.detail-text {
  margin-top: 20px;
}

.detail-text h4 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}

.detail-text p {
  margin: 0;
  color: var(--text-light);
  line-height: 1.5;
}

/* Message "Aucun produit" */
.no-products {
  text-align: center;
  padding: 50px 20px;
  color: var(--text-light);
}

/* Section texte additionnelle pour les détails */
.product-detail-text-section {
  margin-top: 30px;
  padding: 20px;
  background-color: var(--secondary-color);
  border-radius: var(--border-radius);
}

.detail-text-content {
  line-height: 1.6;
  color: var(--text-color);
}

.text-section-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-color);
}

/* Gestion des valeurs vides */
.empty-value {
  color: var(--text-light);
  font-style: italic;
}

/* Responsive */
@media (max-width: 992px) {
  .comparateur-table th {
    font-size: 13px;
    padding: 12px 8px;
  }
  
  .product-detail-sections {
    grid-template-columns: 1fr;
  }
  
  .finnews-choice-badge {
    font-size: 12px;
    padding: 6px 12px;
  }
}

@media (max-width: 768px) {
  .comparateur-table {
    font-size: 14px;
  }
  
  .comparateur-table th, 
  .comparateur-table td {
    padding: 12px 5px;
    font-size: 13px;
  }
  
  .comparateur-table th {
    font-size: 11px;
    line-height: 1.2;
  }
  
  .taux-eleve, .taux-moyen, .taux-faible {
    color: var(--success-color); /* Vert pour tous les taux */
    font-weight: bold;
    font-size: 16px;
  }

  .detail-value.taux-eleve, .detail-value.taux-moyen, .detail-value.taux-faible {
    color: var(--success-color); /* Vert pour tous les taux */
  }
  
  .action-col {
    width: auto;
  }
  
  .btn-details {
    padding: 8px 12px;
    font-size: 13px;
  }
  
  .modal-content {
    padding: 20px 15px;
  }

  .product-detail-badge {
    margin: 10px auto 0;
  }
}

@media (max-width: 576px) {
  .comparateur-table {
    min-width: 800px; /* Assure une largeur minimale pour permettre le défilement */
  }
  
  .comparateur-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    position: relative;
  }
  
  .comparateur-table-container::after {
    content: "";
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 20px;
    background: linear-gradient(to right, transparent, rgba(255,255,255,0.7));
    pointer-events: none;
  }
  
  .comparateur-filters {
    padding: 15px;
  }
  
  .filters-inner {
    flex-direction: column;
    gap: 15px;
  }
  
  .filter-group {
    width: 100%;
  }
  
  .product-logo {
    flex: 0 0 32px;
  }
  
  .product-logo img {
    max-width: 32px;
  }
  
  .product-title {
    font-size: 14px;
  }
  
  .comparateur-table th, 
  .comparateur-table td {
    padding: 8px 4px;
    font-size: 11px;
  }

  .comparateur-table th {
    font-size: 9px;
  }
}

@media screen and (max-width: 480px) {
  .finnews-choice-badge {
    font-size: 11px;
    padding: 4px 8px;
    width: 100%;
    text-align: center;
  }
}

/* Option Finnews dans le filtre de tri */
option.finnews-option {
  background-color: var(--finnews-color) !important;
  color: white !important;
  font-weight: 700 !important; /* J'utilise 700 au lieu de 600 pour un effet plus visible */
  padding: 8px !important;
}

/* Également cibler par sélecteur d'attribut pour plus de compatibilité */
#filtre-trier option[value="finnews_choice"] {
  background-color: var(--finnews-color) !important;
  color: white !important;
  font-weight: 700 !important;
}

/* Amélioration de l'affichage du conteneur quand "Le choix de Finnews" est sélectionné */
.select-filter-container.finnews-highlighting {
  border: 3px solid var(--finnews-color);
  box-shadow: 0 0 8px rgba(255, 16, 83, 0.4);
  transition: all 0.3s ease;
}

/* Ajoute un badge "Finnews" à côté du texte quand le conteneur est surligné */
.select-filter-container.finnews-highlighting::before {
  content: "★";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--finnews-color);
  font-size: 16px;
  z-index: 10;
}

/* Ajuste le padding du select pour faire place à l'icône */
.select-filter-container.finnews-highlighting .select-filter {
  padding-left: 32px;
  font-weight: 600;
}

/* Style pour la liste déroulante */
.select-filter-container.finnews-highlighting .select-filter:focus {
  color: var(--finnews-color);
}