/* ============================================================
   comparateur.css — Design CalculQC-natif
   Inspiré de .post, .tool-card, .chip, .callout du site
   CalculQC.ca — 2026
   ============================================================ */

/* ── Layout principal ── */
.cmp-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 32px;
  align-items: start;
  padding-block: 24px 80px;
}
@media (max-width: 960px) {
  .cmp-layout {
    grid-template-columns: 1fr;
    gap: 24px;
    padding-block: 16px 60px;
  }
}

/* ── Sidebar ── */
.cmp-sidebar {
  position: sticky;
  top: 90px;
  background: #fff;
  border: 1.5px solid var(--line, #dde5f2);
  border-radius: 20px;
  padding: 20px 18px;
}
.cmp-sidebar h3 {
  font-size: .75rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted, #4a5873);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line, #dde5f2);
}
.cmp-sidebar-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cmp-sidebar-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: .88rem;
  color: var(--text, #33405a);
  font-weight: 500;
  transition: background .15s, color .15s;
  cursor: pointer;
  text-decoration: none;
}
.cmp-sidebar-links a:hover {
  background: var(--tint, #f3f6fc);
  color: var(--link, #003DA5);
}
.cmp-sidebar-links a.active {
  background: var(--tint-2, #e7eefb);
  color: var(--link, #003DA5);
  font-weight: 700;
}
.cmp-badge-tag {
  background: var(--tint-2, #e7eefb);
  color: var(--link, #003DA5);
  font-size: .68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  flex-shrink: 0;
}
@media (max-width: 960px) {
  .cmp-sidebar {
    position: static;
    border-radius: 16px;
    padding: 16px;
  }
  .cmp-sidebar-links {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px;
  }
  .cmp-sidebar-links a {
    background: var(--tint, #f3f6fc);
    border: 1px solid var(--line, #dde5f2);
    padding: 8px 14px;
    font-size: .84rem;
  }
  .cmp-sidebar-editorial {
    display: none;
  }
}

/* ── Tabs catégories (chips style CalculQC) ── */
.cmp-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 26px;
  padding-bottom: 4px;
}
.cmp-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 999px;
  border: 1.5px solid var(--line, #dde5f2);
  background: #fff;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text, #33405a);
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.cmp-tab:hover {
  border-color: var(--blue, #003DA5);
  color: var(--blue, #003DA5);
  background: var(--tint, #f3f6fc);
}
.cmp-tab.active {
  background: var(--blue, #003DA5);
  border-color: var(--blue, #003DA5);
  color: #fff;
  box-shadow: 0 4px 14px rgba(0, 61, 165, 0.22);
}
@media (max-width: 768px) {
  .cmp-tabs {
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 18px;
    padding-bottom: 4px;
  }
  .cmp-tab {
    padding: 8px 14px;
    font-size: .84rem;
  }
}

/* ── Compteur résultats ── */
.cmp-count {
  font-size: .9rem;
  color: var(--muted, #4a5873);
  margin-bottom: 16px;
}
.cmp-count strong { color: var(--ink, #0a1633); }

/* ── En-tête de section (simple, style CalculQC) ── */
.cmp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px;
  margin: 32px 0 10px;
}
.cmp-section-header:first-child { margin-top: 0; }
.cmp-section-title-text {
  font-size: .78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--link, #003DA5);
}
.cmp-section-count {
  font-size: .78rem;
  font-weight: 600;
  color: var(--muted, #4a5873);
  background: var(--tint, #f3f6fc);
  padding: 3px 10px;
  border-radius: 999px;
}

/* ── Grille cartes produits ── */
.cmp-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ── Carte produit (style .post CalculQC) ── */
.cmp-card {
  background: var(--tint, #f3f6fc);
  border-radius: 24px;
  padding: 24px 28px;
  transition: transform .2s, box-shadow .2s, background .2s;
  border: 1.5px solid transparent;
}
.cmp-card:hover {
  transform: translateY(-3px);
  background: #fff;
  box-shadow: 0 16px 40px rgba(0, 61, 165, 0.08);
  border-color: var(--line, #dde5f2);
}

/* ── Layout interne : logo | info | CTA ── */
.cmp-card-top {
  display: grid;
  grid-template-columns: 60px 1fr auto;
  gap: 20px;
  align-items: start;
}
.cmp-card-content {
  min-width: 0; /* Évite tout débordement dans CSS Grid */
}

/* ── Logo / Icône produit ── */
.cmp-card-logo {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -.01em;
  flex-shrink: 0;
  user-select: none;
}
.logo-koho        { background: #2c2d35; }
.logo-compare     { background: var(--blue, #003DA5); }
.logo-neo         { background: #0f172a; }
.logo-prets       { background: #0369a1; }
.logo-desjardins  { background: #00874e; }
.logo-rbc         { background: #0051a5; }
.logo-td          { background: #008a00; }
.logo-bmo         { background: #0079c1; }
.logo-scotia      { background: #ec111a; }
.logo-bnc         { background: #e4002b; }
.logo-cibc        { background: #97022e; }
.logo-tangerine   { background: #ea7024; }
.logo-simplii     { background: #e71d36; }
.logo-eqbank      { background: #ff5000; }
.logo-wealthsimple{ background: #1e1e1e; }

/* ── Badge (style .post .tag) ── */
.cmp-badge {
  display: inline-block;
  font-size: .7rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .07em;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.cmp-badge-exclusive { background: #fff; color: var(--link, #003DA5); }
.cmp-badge-sponsored { background: #fff; color: var(--link, #003DA5); }
.cmp-badge-featured  { background: #fef3c7; color: #92400e; }

/* ── Titre et sous-titre ── */
.cmp-title {
  font-size: 1.08rem;
  font-weight: 800;
  color: var(--ink, #0a1633);
  margin-bottom: 4px;
  line-height: 1.3;
}
.cmp-tagline {
  font-size: .9rem;
  color: var(--muted, #4a5873);
  margin-bottom: 14px;
  line-height: 1.5;
  font-weight: 400;
}

/* ── Métriques clés (en ligne) ── */
.cmp-metrics-grid {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.cmp-metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.cmp-metric-lbl {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted, #4a5873);
}
.cmp-metric-val {
  font-size: .97rem;
  font-weight: 800;
  color: var(--ink, #0a1633);
}
.cmp-metric-val.highlight { color: var(--blue, #003DA5); }

/* ── Puces avantages ── */
.cmp-perks {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}
.cmp-perk-item {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  font-size: .88rem;
  color: var(--text, #33405a);
  line-height: 1.4;
}
.cmp-perk-icon {
  color: var(--blue, #003DA5);
  font-weight: 800;
  flex-shrink: 0;
  line-height: 1.4;
}

/* ── Accordéon détails ── */
.cmp-details {
  border: 1.5px solid var(--line, #dde5f2);
  border-radius: 14px;
  margin-top: 14px;
  overflow: hidden;
  background: #fff;
}
.cmp-details summary {
  padding: 13px 18px;
  font-size: .88rem;
  font-weight: 700;
  color: var(--ink, #0a1633);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.cmp-details summary::-webkit-details-marker { display: none; }
.cmp-details summary::after {
  content: '▾';
  color: var(--muted, #4a5873);
  font-size: .8rem;
  transition: transform .2s;
}
.cmp-details[open] summary::after { transform: rotate(180deg); }
.cmp-details-body {
  padding: 0 18px 16px;
  font-size: .88rem;
  color: var(--text, #33405a);
  line-height: 1.6;
  border-top: 1px solid var(--line, #dde5f2);
}
.cmp-details-body p { margin: 10px 0 6px; }
.cmp-details-body ul { padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.cmp-details-body li { line-height: 1.5; }
.cmp-details-note {
  font-size: .78rem;
  color: var(--faint, #8899bb);
  margin-top: 10px;
  font-style: italic;
}

/* ── Zone actions (CTA + comparaison) ── */
.cmp-card-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
}

/* ── Bouton CTA (identique à .btn-primary du site) ── */
.cmp-cta-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  background: var(--blue, #003DA5);
  color: #fff !important;
  text-decoration: none !important;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 700;
  transition: background .2s, transform .2s;
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0, 61, 165, 0.2);
  cursor: pointer;
  border: none;
}
.cmp-cta-btn:hover {
  background: #002f8a;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 61, 165, 0.3);
}

/* ── Label checkbox comparaison ── */
.cmp-compare-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  color: var(--muted, #4a5873);
  cursor: pointer;
  user-select: none;
}
.cmp-checkbox { accent-color: var(--blue, #003DA5); cursor: pointer; }

/* ── Mention commerciale ── */
.cmp-commercial-text {
  display: block;
  font-size: .72rem;
  color: var(--faint, #8899bb);
  text-align: right;
}

/* ── Responsive cartes produits (placé APRÈS les règles de base pour préserver la cascade) ── */
@media (max-width: 900px) {
  .cmp-card {
    padding: 20px 18px;
    border-radius: 18px;
  }
  .cmp-card-top {
    grid-template-columns: 52px 1fr;
    gap: 16px;
  }
  .cmp-card-logo {
    width: 52px;
    height: 52px;
    font-size: 1rem;
    border-radius: 14px;
  }
  .cmp-card-actions {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding-top: 14px;
    margin-top: 6px;
    border-top: 1px solid var(--line, #dde5f2);
  }
  .cmp-commercial-text {
    text-align: left;
  }
}

@media (max-width: 540px) {
  .cmp-card {
    padding: 16px 14px;
    border-radius: 16px;
  }
  .cmp-card-top {
    grid-template-columns: 44px 1fr;
    gap: 12px;
  }
  .cmp-card-logo {
    width: 44px;
    height: 44px;
    font-size: .92rem;
    border-radius: 12px;
  }
  .cmp-badge {
    font-size: .68rem;
    padding: 3px 10px;
    line-height: 1.25;
    white-space: normal;
  }
  .cmp-title {
    font-size: 1.02rem;
    word-break: break-word;
  }
  .cmp-tagline {
    font-size: .85rem;
    margin-bottom: 12px;
  }
  .cmp-metrics-grid {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 10px 12px !important;
  }
  .cmp-metric-lbl {
    font-size: .65rem;
  }
  .cmp-metric-val {
    font-size: .92rem;
  }
  .cmp-perks {
    gap: 6px;
    font-size: .84rem;
  }
  .cmp-card-actions {
    flex-direction: column-reverse !important;
    align-items: stretch !important;
    gap: 10px !important;
  }
  .cmp-cta-btn {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 12px 16px !important;
    font-size: .9rem !important;
  }
  .cmp-compare-label {
    justify-content: center !important;
    width: 100% !important;
    padding: 8px 12px !important;
    background: #fff;
    border: 1.5px solid var(--line, #dde5f2);
    border-radius: 10px;
  }
  .cmp-commercial-text {
    text-align: center !important;
  }
}

/* ── Transparence footer (style .callout CalculQC) ── */
.cmp-transparency {
  background: var(--tint, #f3f6fc);
  border-left: 4px solid var(--blue, #003DA5);
  border-radius: 0 20px 20px 0;
  padding: 20px 24px;
  margin-top: 32px;
  font-size: .88rem;
  color: var(--text, #33405a);
  line-height: 1.6;
}
.cmp-transparency a { color: var(--link, #003DA5); font-weight: 600; }

/* ── Liens éditoriaux & guides sur mobile ── */
.cmp-editorial-bottom {
  display: none;
  margin-top: 32px;
  background: #fff;
  border: 1.5px solid var(--line, #dde5f2);
  border-radius: 18px;
  padding: 20px;
}
.cmp-editorial-bottom h3 {
  font-size: .8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted, #4a5873);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line, #dde5f2);
}
.cmp-editorial-bottom ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.cmp-editorial-bottom ul:last-child {
  margin-bottom: 0;
}
.cmp-editorial-bottom a {
  color: var(--link, #003DA5);
  font-size: .88rem;
  text-decoration: none;
  font-weight: 600;
}
.cmp-editorial-bottom a:hover {
  text-decoration: underline;
}
@media (max-width: 960px) {
  .cmp-editorial-bottom {
    display: block;
  }
}

/* ── Barre de comparaison flottante (style CalculQC) ── */
.cmp-floating-bar {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: #fff;
  border: 1.5px solid var(--line, #dde5f2);
  border-radius: 999px;
  padding: 10px 16px 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: 0 14px 40px rgba(10, 22, 51, 0.18);
  z-index: 900;
  transition: transform .3s cubic-bezier(0.16, 1, 0.3, 1), opacity .3s;
  opacity: 0;
  pointer-events: none;
}
.cmp-floating-bar.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.cmp-floating-text {
  font-size: .88rem;
  font-weight: 600;
  color: var(--ink, #0a1633);
}
.cmp-floating-text strong {
  color: var(--blue, #003DA5);
  font-size: 1rem;
}
.cmp-floating-btn {
  background: var(--blue, #003DA5);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 700;
  font-size: .88rem;
  cursor: pointer;
  transition: background .2s, transform .15s;
}
.cmp-floating-btn:hover {
  background: #002f8a;
  transform: translateY(-1px);
}
.cmp-floating-clear {
  background: transparent;
  border: none;
  color: var(--muted, #4a5873);
  font-size: .82rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 4px 8px;
}
.cmp-floating-clear:hover {
  color: var(--ink, #0a1633);
}

@media (max-width: 640px) {
  .cmp-floating-bar {
    left: 12px;
    right: 12px;
    bottom: 16px;
    width: auto;
    max-width: calc(100% - 24px);
    transform: translateY(120px);
    padding: 10px 14px;
    border-radius: 16px;
    gap: 10px;
    justify-content: space-between;
  }
  .cmp-floating-bar.active {
    transform: translateY(0);
  }
  .cmp-floating-text {
    font-size: .82rem;
    line-height: 1.25;
  }
  .cmp-floating-btn {
    padding: 9px 14px;
    font-size: .82rem;
    white-space: nowrap;
  }
  .cmp-floating-clear {
    font-size: .78rem;
    padding: 4px;
  }
}

/* ── Modal de comparaison côte à côte CalculQC ── */
.cmp-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 51, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.cmp-modal-overlay.open { display: flex; }

.cmp-modal-box {
  background: #fff;
  border-radius: 24px;
  padding: 30px;
  max-width: 980px;
  width: 95vw;
  max-height: 88vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 60px rgba(10, 22, 51, 0.22);
}

.cmp-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: var(--tint, #f3f6fc);
  border: 1px solid var(--line, #dde5f2);
  border-radius: 999px;
  width: 38px;
  height: 38px;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--ink, #0a1633);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  z-index: 10;
}
.cmp-modal-close:hover {
  background: var(--tint-2, #e7eefb);
  border-color: var(--blue, #003DA5);
  color: var(--blue, #003DA5);
}

/* ── Astuce de défilement horizontal sur mobile ── */
.cmp-modal-scroll-tip {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--blue, #003DA5);
  background: var(--tint-2, #e7eefb);
  border: 1px solid #bfdbfe;
  padding: 8px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}
@media (max-width: 768px) {
  .cmp-modal-scroll-tip {
    display: flex;
  }
}

/* ── Wrapper défilant du tableau comparatif ── */
.cmp-modal-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1.5px solid var(--line, #dde5f2);
  border-radius: 16px;
  background: #fff;
  margin-top: 10px;
}

/* ── Table modal ── */
.cmp-modal-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .86rem;
  color: var(--text, #33405a);
}
.cmp-modal-table th,
.cmp-modal-table td {
  padding: 12px 16px;
  vertical-align: top;
  border-bottom: 1px solid var(--line, #dde5f2);
  border-right: 1px solid var(--line, #dde5f2);
  line-height: 1.5;
}
.cmp-modal-table tr th:last-child,
.cmp-modal-table tr td:last-child {
  border-right: none;
}
.cmp-modal-table th {
  background: var(--tint, #f3f6fc);
  color: var(--ink, #0a1633);
  font-weight: 800;
  font-size: .86rem;
  border-bottom: 2px solid var(--line, #dde5f2);
}

/* Colonne Critères fixe (sticky left) */
.cmp-modal-table th:first-child,
.cmp-modal-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  width: 140px;
  min-width: 140px;
  max-width: 140px;
  font-weight: 700;
  color: var(--ink, #0a1633);
  background: #fff;
  box-shadow: 3px 0 8px rgba(10, 22, 51, 0.05);
}
.cmp-modal-table th:first-child {
  background: var(--tint, #f3f6fc);
  z-index: 4;
}

/* Colonnes produits */
.cmp-modal-table th:not(:first-child),
.cmp-modal-table td:not(:first-child) {
  min-width: 200px;
  max-width: 280px;
  background: #fff;
}
.cmp-modal-table th:not(:first-child) {
  background: var(--tint, #f3f6fc);
}
.cmp-modal-table tr:last-child td {
  border-bottom: none;
}

/* En-tête produit dans la table */
.cmp-col-header {
  position: relative;
}
.cmp-col-title-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}
.cmp-col-name {
  font-size: .92rem;
  font-weight: 800;
  color: var(--ink, #0a1633);
  line-height: 1.35;
}
.cmp-col-remove {
  background: #fff;
  border: 1px solid var(--line, #dde5f2);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: .72rem;
  font-weight: 600;
  color: var(--muted, #4a5873);
  cursor: pointer;
  transition: all .15s;
}
.cmp-col-remove:hover {
  background: #fee2e2;
  border-color: #fca5a5;
  color: #b91c1c;
}

/* Lignes intérieures du comparateur */
.cmp-modal-metric-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}
.cmp-modal-metric-item:last-child {
  margin-bottom: 0;
}
.cmp-modal-metric-lbl {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted, #4a5873);
}
.cmp-modal-metric-val {
  font-size: .92rem;
  font-weight: 800;
  color: var(--ink, #0a1633);
}
.cmp-modal-perk-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: .84rem;
  margin-bottom: 6px;
  line-height: 1.4;
}
.cmp-modal-perk-item:last-child {
  margin-bottom: 0;
}
.cmp-modal-perk-icon {
  color: var(--blue, #003DA5);
  font-weight: 800;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .cmp-modal-overlay {
    padding: 10px;
  }
  .cmp-modal-box {
    padding: 22px 14px 18px;
    border-radius: 18px;
    max-height: 90vh;
    width: 100%;
  }
  .cmp-modal-close {
    top: 12px;
    right: 12px;
    width: 32px;
    height: 32px;
    font-size: .95rem;
  }
  .cmp-modal-table th:first-child,
  .cmp-modal-table td:first-child {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
    padding: 10px 12px;
  }
  .cmp-modal-table th:not(:first-child),
  .cmp-modal-table td:not(:first-child) {
    min-width: 175px;
    max-width: 220px;
    padding: 10px 12px;
  }
}
