/* ═══════════════════════════════════════════════════
   Tunnel Crédit — Frontend CSS
   Tous les sélecteurs sont préfixés .tc- → zéro conflit
═══════════════════════════════════════════════════ */

/* ── Reset interne ── */
.tc-tunnel *,
.tc-tunnel *::before,
.tc-tunnel *::after {
  box-sizing: border-box;
}

/* ── Variables ── */
.tc-tunnel {
  --tc-primary:     #1a3a5c;
  --tc-accent:      #0d6efd;
  --tc-success:     #198754;
  --tc-warning:     #e67e22;
  --tc-danger:      #dc3545;
  --tc-light:       #f4f7fb;
  --tc-border:      #dce3ed;
  --tc-text:        #2c3e50;
  --tc-muted:       #6c7a8d;
  --tc-radius:      12px;
  --tc-shadow:      0 6px 32px rgba(0,0,0,.09);
  --tc-font:        'Segoe UI', system-ui, -apple-system, sans-serif;

  font-family: var(--tc-font);
  color: var(--tc-text);
  max-width: 860px;
  margin: 0 auto;
  padding: 20px 12px 40px;
  width: 100%;
}

/* ── Barre de progression ── */
.tc-progress-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 28px;
  gap: 0;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 4px 0 8px;
  -webkit-overflow-scrolling: touch;
}

.tc-progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.tc-step-circle {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--tc-border);
  color: var(--tc-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  transition: background .3s, color .3s, transform .2s;
  border: 3px solid var(--tc-border);
}

.tc-progress-step span {
  font-size: 10px;
  color: var(--tc-muted);
  font-weight: 500;
  transition: color .3s;
  white-space: nowrap;
}

.tc-step-active .tc-step-circle {
  background: var(--tc-accent);
  color: #fff;
  border-color: var(--tc-accent);
  transform: scale(1.1);
}
.tc-step-active span { color: var(--tc-accent); font-weight: 700; }

.tc-step-done .tc-step-circle {
  background: var(--tc-success);
  color: #fff;
  border-color: var(--tc-success);
}
.tc-step-done span { color: var(--tc-success); }

.tc-progress-line {
  flex: 1;
  height: 3px;
  background: var(--tc-border);
  min-width: 16px;
  max-width: 60px;
  margin-bottom: 20px;
  transition: background .4s;
}
.tc-progress-line.tc-done { background: var(--tc-success); }

/* ── Carte ── */
.tc-card {
  background: #fff;
  border-radius: var(--tc-radius);
  box-shadow: var(--tc-shadow);
  padding: 28px 32px;
  border: 1px solid var(--tc-border);
  width: 100%;
}

@media (max-width: 600px) {
  .tc-card { padding: 20px 16px; border-radius: 8px; }
}
@media (max-width: 380px) {
  .tc-card { padding: 16px 12px; }
}

.tc-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
  padding-bottom: 18px;
  border-bottom: 2px solid var(--tc-light);
  flex-wrap: wrap;
}
.tc-icon {
  font-size: 32px;
  line-height: 1;
  flex-shrink: 0;
}
.tc-card-title {
  margin: 0 0 4px !important;
  font-size: 20px !important;
  color: var(--tc-primary) !important;
  font-weight: 700 !important;
  line-height: 1.3 !important;
}
.tc-card-subtitle {
  margin: 0 !important;
  font-size: 13px !important;
  color: var(--tc-muted) !important;
}
@media (max-width: 420px) {
  .tc-card-title { font-size: 17px !important; }
  .tc-icon { font-size: 26px; }
}

/* ── Grille de champs ── */
.tc-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}
@media (max-width: 560px) {
  .tc-form-grid { grid-template-columns: 1fr; gap: 14px; }
}

.tc-field { display: flex; flex-direction: column; gap: 5px; }
.tc-field-full { grid-column: 1 / -1; }

.tc-label {
  font-size: 13px !important;
  font-weight: 600 !important;
  color: var(--tc-primary) !important;
  margin: 0 !important;
}
.tc-required { color: var(--tc-danger); margin-left: 2px; }

.tc-input {
  width: 100% !important;
  padding: 11px 14px !important;
  border: 1.5px solid var(--tc-border) !important;
  border-radius: 8px !important;
  font-size: 15px !important;
  color: var(--tc-text) !important;
  background: var(--tc-light) !important;
  transition: border-color .2s, box-shadow .2s !important;
  outline: none !important;
  box-shadow: none !important;
  font-family: var(--tc-font) !important;
}
.tc-input:focus {
  border-color: var(--tc-accent) !important;
  background: #fff !important;
  box-shadow: 0 0 0 3px rgba(13,110,253,.13) !important;
}
.tc-input.tc-input-error {
  border-color: var(--tc-danger) !important;
}
.tc-textarea { resize: vertical !important; min-height: 72px !important; }

.tc-hint {
  font-size: 12px;
  color: var(--tc-muted);
}
.tc-error {
  font-size: 12px;
  color: var(--tc-danger);
  min-height: 16px;
  display: block;
}

/* ── Résultats simulateur ── */
.tc-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--tc-light);
  border-radius: 10px;
  border: 1px solid var(--tc-border);
}

/* Tablette paysage / petits desktops */
@media (max-width: 720px) {
  .tc-results {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
}

/* Mobile portrait */
@media (max-width: 420px) {
  .tc-results {
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 12px;
  }
}

/* Très petits écrans */
@media (max-width: 320px) {
  .tc-results {
    grid-template-columns: 1fr;
  }
}

.tc-result-card {
  background: #fff;
  border-radius: 8px;
  padding: 12px 10px;
  border: 1.5px solid var(--tc-border);
  text-align: center;
  transition: transform .15s, box-shadow .15s;
  min-width: 0;
}
.tc-result-card:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,.08); }

.tc-result-primary {
  border-color: var(--tc-accent);
  background: linear-gradient(135deg, #e8f4fd, #f0f8ff);
}
.tc-result-frais {
  border-color: var(--tc-warning);
  background: #fffbf0;
}

.tc-result-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--tc-muted);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 5px;
  line-height: 1.3;
}
.tc-result-value {
  font-size: 15px;
  font-weight: 800;
  color: var(--tc-primary);
  word-break: break-word;
  line-height: 1.2;
}
@media (max-width: 420px) {
  .tc-result-value { font-size: 13px; }
  .tc-result-label { font-size: 9px; }
}
.tc-result-primary .tc-result-value { color: var(--tc-accent); }
.tc-result-frais .tc-result-value { color: var(--tc-warning); }

/* ── Boutons ── */
.tc-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--tc-border);
  flex-wrap: wrap;
}

@media (max-width: 420px) {
  .tc-actions { flex-direction: column-reverse; }
  .tc-actions .tc-btn { width: 100%; justify-content: center; }
}

.tc-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all .2s;
  font-family: var(--tc-font);
  line-height: 1;
  white-space: nowrap;
}
.tc-btn-primary {
  background: var(--tc-accent);
  color: #fff;
  border-color: var(--tc-accent);
}
.tc-btn-primary:hover { background: #0b5ed7; border-color: #0b5ed7; transform: translateY(-1px); }

.tc-btn-secondary {
  background: #fff;
  color: var(--tc-primary);
  border-color: var(--tc-border);
}
.tc-btn-secondary:hover { background: var(--tc-light); border-color: var(--tc-primary); }

.tc-btn-success {
  background: var(--tc-success);
  color: #fff;
  border-color: var(--tc-success);
  font-size: 16px;
  padding: 14px 32px;
}
.tc-btn-success:hover { background: #146c43; transform: translateY(-1px); }
.tc-btn-success:disabled { opacity: .65; cursor: not-allowed; transform: none; }

/* ── Récapitulatif ── */
.tc-recap-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}
@media (max-width: 560px) {
  .tc-recap-grid { grid-template-columns: 1fr; gap: 16px; }
}

.tc-recap-title {
  font-size: 15px !important;
  font-weight: 700 !important;
  color: var(--tc-primary) !important;
  margin: 0 0 12px !important;
  padding-bottom: 8px !important;
  border-bottom: 2px solid var(--tc-accent) !important;
}

.tc-recap-table .tc-recap-row {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px solid var(--tc-border);
  font-size: 14px;
  gap: 8px;
}
.tc-recap-table .tc-recap-row:last-child { border-bottom: none; }
.tc-recap-row-key {
  color: var(--tc-muted);
  font-size: 13px;
  flex-shrink: 0;
}
.tc-recap-row-val {
  font-weight: 600;
  color: var(--tc-text);
  text-align: right;
  word-break: break-word;
}

.tc-global-error {
  text-align: center;
  font-size: 14px;
  margin-top: 12px;
  min-height: 18px;
}

/* ── Confirmation ── */
.tc-success-card {
  text-align: center;
  padding: 40px 28px !important;
}
@media (max-width: 420px) {
  .tc-success-card { padding: 28px 16px !important; }
}
.tc-success-icon {
  font-size: 64px;
  margin-bottom: 16px;
  line-height: 1;
}
.tc-success-title {
  font-size: 28px !important;
  font-weight: 800 !important;
  color: var(--tc-success) !important;
  margin: 0 0 12px !important;
}
.tc-success-msg {
  font-size: 16px;
  color: var(--tc-text);
  margin-bottom: 24px;
}
.tc-ref-box {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  background: var(--tc-light);
  border: 2px dashed var(--tc-accent);
  border-radius: 10px;
  padding: 16px 32px;
  margin: 0 auto 24px;
}
.tc-ref-label {
  font-size: 12px;
  color: var(--tc-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-bottom: 4px;
}
.tc-ref-value {
  font-size: 22px;
  font-weight: 800;
  color: var(--tc-accent);
  letter-spacing: 2px;
}
.tc-success-sub {
  font-size: 14px;
  color: var(--tc-muted);
  line-height: 1.7;
}

/* ── Utilitaires ── */
.tc-hidden { display: none !important; }
.tc-step { animation: tcFadeIn .3s ease; }
@keyframes tcFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.tc-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: tcSpin .7s linear infinite;
}
@keyframes tcSpin { to { transform: rotate(360deg); } }
