/* CRC Simulateur de prêt. Toutes les règles sont préfixées pour ne pas heurter Elementor ni le thème. */

.crc-sim {
  --crc-sim-accent: #4f72b8;
  --crc-sim-ink: #1d2433;
  --crc-sim-muted: #5c6474;
  --crc-sim-line: #d9dee8;
  --crc-sim-field: #ffffff;
  --crc-sim-soft: #f3f5f9;
  box-sizing: border-box;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px;
  color: var(--crc-sim-ink);
  font-family: inherit;
  font-size: 16px;
  line-height: 1.5;
}

.crc-sim *,
.crc-sim *::before,
.crc-sim *::after { box-sizing: border-box; }

.crc-sim [hidden] { display: none !important; }



.crc-sim__form {
  padding: 28px 24px;
  border: 1px solid var(--crc-sim-line);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 6px 24px rgba(20, 30, 50, 0.06);
}

.crc-sim__row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 12px 20px;
  margin-bottom: 16px;
}

.crc-sim__label {
  text-align: right;
  font-weight: 500;
}

.crc-sim__control {
  display: flex;
  align-items: stretch;
  width: 100%;
  max-width: 320px;
}

.crc-sim__control--pair {
  align-items: center;
  gap: 8px;
}

.crc-sim__control input,
.crc-sim__control select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #b9c1d0;
  border-radius: 6px;
  background: var(--crc-sim-field);
  color: var(--crc-sim-ink);
  font: inherit;
}

.crc-sim__control--pair select { width: auto; flex: 1 1 0; }

.crc-sim__control--suffix input {
  border-radius: 6px 0 0 6px;
  border-right: none;
}

.crc-sim__suffix {
  display: inline-flex;
  align-items: center;
  min-width: 72px;
  justify-content: center;
  padding: 0 10px;
  border: 1px solid #b9c1d0;
  border-radius: 0 6px 6px 0;
  background: var(--crc-sim-soft);
  color: var(--crc-sim-muted);
  font-size: 0.9em;
  white-space: nowrap;
}

.crc-sim__control input:focus-visible,
.crc-sim__control select:focus-visible,
.crc-sim__submit:focus-visible,
.crc-sim__details summary:focus-visible {
  outline: 3px solid rgba(79, 114, 184, 0.45);
  outline-offset: 2px;
}

.crc-sim__amp {
  font-weight: 700;
}

.crc-sim__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.crc-sim__actions {
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.crc-sim__submit {
  min-width: 160px;
  min-height: 46px;
  padding: 10px 28px;
  border: none;
  border-radius: 6px;
  background: var(--crc-sim-accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s ease;
}

.crc-sim__submit:hover { filter: brightness(0.92); }

.crc-sim__error {
  margin: 16px 0 0;
  padding: 12px 16px;
  border-left: 4px solid #b3261e;
  border-radius: 4px;
  background: #fdecea;
  color: #7a1b15;
}

.crc-sim__result {
  margin-top: 24px;
  padding: 24px;
  border: 1px solid var(--crc-sim-line);
  border-radius: 10px;
  background: #fff;
}

.crc-sim__headline {
  margin: 0 0 16px;
  font-size: 1.15rem;
  text-align: center;
}

.crc-sim__headline strong {
  color: var(--crc-sim-accent);
  font-size: 1.3em;
  white-space: nowrap;
}

.crc-sim__stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin: 0;
}

.crc-sim__stats > div {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--crc-sim-soft);
}

.crc-sim__stats dt {
  color: var(--crc-sim-muted);
  font-size: 0.85em;
}

.crc-sim__stats dd {
  margin: 2px 0 0;
  font-weight: 700;
  white-space: nowrap;
}

.crc-sim__note {
  margin: 14px 0 0;
  color: var(--crc-sim-muted);
  font-size: 0.9em;
  text-align: center;
}

.crc-sim__details {
  margin-top: 20px;
  border: 1px solid var(--crc-sim-line);
  border-radius: 10px;
  background: #fff;
}

.crc-sim__details summary {
  padding: 14px 18px;
  cursor: pointer;
  color: var(--crc-sim-accent);
  font-weight: 700;
}

.crc-sim__table-wrap {
  max-height: 480px;
  overflow: auto;
  padding: 0 12px 12px;
}

.crc-sim__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92em;
}

.crc-sim__table th,
.crc-sim__table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--crc-sim-line);
  text-align: right;
  white-space: nowrap;
}

.crc-sim__table th:first-child,
.crc-sim__table td:first-child { text-align: left; }

.crc-sim__table thead th {
  position: sticky;
  top: 0;
  background: #fff;
  color: var(--crc-sim-muted);
  font-weight: 600;
}

@media (max-width: 640px) {
  .crc-sim__form { padding: 20px 16px; }
  .crc-sim__row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .crc-sim__label { text-align: left; }
  .crc-sim__control { max-width: none; }
}

/* ---------- Onglets ---------- */

.crc-sim__tabs {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 20px;
  padding: 0;
}

.crc-sim__tab {
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--crc-sim-line);
  border-radius: 999px;
  background: #fff;
  color: var(--crc-sim-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.crc-sim__tab[aria-selected="true"] {
  background: var(--crc-sim-accent);
  border-color: var(--crc-sim-accent);
  color: #fff;
}

.crc-sim__tab:focus-visible {
  outline: 3px solid rgba(79, 114, 184, 0.45);
  outline-offset: 2px;
}

.crc-sim__panel[hidden] { display: none !important; }

/* ---------- Comparateur ---------- */

.crc-sim__offers {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.crc-sim__offer {
  margin: 0;
  padding: 16px 18px;
  border: 1px solid var(--crc-sim-line);
  border-radius: 8px;
  background: var(--crc-sim-soft);
}

.crc-sim__offer legend {
  padding: 0 6px;
  color: var(--crc-sim-accent);
  font-weight: 700;
}

.crc-sim__stack {
  display: block;
  margin-bottom: 12px;
}

.crc-sim__stack-label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}

.crc-sim__stack > .crc-sim__control {
  max-width: none;
  margin-top: 6px;
}

.crc-sim__table--compare th[scope="row"] {
  text-align: left;
  color: var(--crc-sim-muted);
  font-weight: 500;
}

.crc-sim .crc-sim__table--compare {
  margin-top: 8px;
}

.crc-sim__panel .crc-sim__result .crc-sim__table {
  margin-top: 16px;
}

@media (max-width: 640px) {
  .crc-sim__tab { flex: 1 1 100%; }
}

/* Filet de sécurité : si le thème a enveloppé un select (select2), on garde le select visible et stylé par nous. */
.crc-sim .select2-container { display: none !important; }
.crc-sim select.select2-hidden-accessible {
  position: static !important;
  clip: auto !important;
  width: 100% !important;
  height: auto !important;
  overflow: visible !important;
  margin: 0 !important;
  padding: 8px 12px !important;
  opacity: 1 !important;
}
.crc-sim__control--pair select.select2-hidden-accessible { width: auto !important; flex: 1 1 0 !important; }
