/* CoinAdoptionScore - Backtest module styles (v2) */

.bt-header {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
  padding: 0.9rem 1rem;
  text-align: center;
}
.bt-header .bt-brand {
  color: #bfdbfe;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 0.35rem 0;
}
.bt-header h1 {
  color: #ffffff;
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0;
  line-height: 1.25;
}
.bt-header .bt-subtitle {
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 600;
  margin: 0.15rem 0 0.6rem 0;
}
.bt-header nav {
  display: flex;
  justify-content: center;
  gap: 1rem;
}
.bt-header nav a {
  color: #dbeafe;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
}
.bt-header nav a:hover { background: rgba(255,255,255,0.12); }

.backtest-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.25rem 1rem;
}

.bt-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  margin-bottom: 1.25rem;
}
.bt-card h2 {
  font-size: 1rem;
  margin: 0 0 0.75rem 0;
  color: #1e3a8a;
}

.bt-rate-corner {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: #94a3b8;
}
.bt-rate-corner select {
  font-size: 0.78rem;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  color: #64748b;
  background: white;
}

/* --- Paramètres (montant + date) --- */
.bt-params-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}
@media (max-width: 640px) {
  .bt-params-grid { grid-template-columns: 1fr; }
}
@media (min-width: 641px) {
  /* Centre le champ montant + ses boutons rapides comme un seul bloc, pour qu'ils
     soient alignes entre eux (au lieu que les boutons soient centres sur toute la
     largeur de colonne pendant que le champ reste cale a gauche) */
  .bt-params-grid > div:first-child {
    display: flex;
    flex-direction: column;
    align-items: center;
  }
}

.bt-field-label {
  display: block;
  font-weight: 700;
  font-size: 0.9rem;
  color: #334155;
  margin-bottom: 0.4rem;
}

.bt-amount-row {
  display: flex;
  gap: 0.5rem;
}
#btAmount {
  flex: 1;
  max-width: 200px;
  font-size: 1.15rem;
  font-weight: 700;
  padding: 0.55rem 0.7rem;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  color: #1e3a8a;
}
#btAmount:focus { outline: none; border-color: #3b82f6; }

#btCurrency {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 0.55rem 0.6rem;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  background: white;
  color: #1e3a8a;
}

.bt-quick-btns {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 0.5rem;
  flex-wrap: wrap;
}
.bt-quick-btn {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  border: 1.5px solid #93c5fd;
  background: white;
  color: #1e3a8a;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.bt-quick-btn:hover { background: #eff6ff; }
.bt-quick-btn.active { background: #1e3a8a; color: white; border-color: #1e3a8a; }

/* --- Date --- */
.bt-date-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
  justify-content: center;
}
@media (max-width: 640px) {
  #btStartDate { order: -1; flex-basis: 100%; margin-bottom: 0.4rem; }
  .bt-step-btn { flex: 1 1 auto; min-width: 0; padding: 0.5rem 0.3rem; font-size: 0.68rem; }
}
#btStartDate {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
  padding: 0.5rem 0.6rem;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  color: #1e3a8a;
}
#btStartDate:focus { outline: none; border-color: #3b82f6; }

.bt-step-btn {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 8px;
  border: 1.5px solid #cbd5e1;
  background: white;
  font-size: 0.75rem;
  font-weight: 700;
  color: #334155;
  cursor: pointer;
}
.bt-step-btn:hover { background: #f1f5f9; }

/* --- Allocation --- */
.bt-alloc-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.7rem;
}

.bt-asset-btn {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 128px;
  flex-shrink: 0;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  border: 2px solid transparent;
  background: white;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
  transition: opacity 0.15s;
}
.bt-asset-btn .bt-icon { width: 22px; height: 22px; flex-shrink: 0; }
.bt-asset-btn.bt-off {
  opacity: 0.4;
  background: #e2e8f0;
}
.bt-asset-btn[data-asset="EUR"]    { color: #15803d; border-color: #86efac; }
.bt-asset-btn[data-asset="GOLD"]   { color: #b45309; border-color: #fcd34d; }
.bt-asset-btn[data-asset="SILVER"] { color: #475569; border-color: #cbd5e1; }
.bt-asset-btn[data-asset="BTC"]    { color: #c2410c; border-color: #fdba74; }
.bt-asset-btn[data-asset="XMR"]    { color: #b91c1c; border-color: #fca5a5; }

.bt-alloc-row input[type="range"] {
  max-width: 260px;
  width: 100%;
}
.bt-alloc-row .bt-pct {
  width: 44px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  cursor: pointer;
  border-radius: 6px;
  padding: 0.1rem 0.2rem;
}
.bt-alloc-row .bt-pct:hover { background: #f1f5f9; }

.bt-lock-btn {
  border: none;
  background: none;
  font-size: 0.9rem;
  cursor: pointer;
  opacity: 0.3;
  filter: grayscale(1);
  padding: 0.1rem 0.2rem;
  flex-shrink: 0;
}
.bt-lock-btn:hover { opacity: 0.6; }
.bt-lock-btn.locked { opacity: 1; filter: none; }
.bt-lock-btn:disabled { cursor: not-allowed; opacity: 0.15; }

.bt-pct-popover {
  position: fixed;
  display: none;
  align-items: center;
  gap: 0.3rem;
  background: white;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  padding: 0.4rem;
  z-index: 10000;
}
.bt-pct-popover.active { display: flex; }
.bt-pct-popover button {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  color: #1e3a8a;
}
.bt-pct-popover button:hover { background: #eff6ff; }
.bt-pct-popover input {
  width: 52px;
  text-align: center;
  font-weight: 700;
  padding: 0.3rem;
  border: 1.5px solid #cbd5e1;
  border-radius: 6px;
}

.bt-total-warning {
  color: #b45309;
  font-weight: 600;
  font-size: 0.85rem;
  min-height: 1.1rem;
  margin-bottom: 0.5rem;
}

/* --- Actifs sélectionnés (au-dessus des résultats) --- */
.bt-selected-assets {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.5rem;
}
.bt-selected-assets span { display: inline-flex; }

.bt-launch-notice {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 8px;
  padding: 0.5rem 0.8rem;
  font-size: 0.8rem;
  text-align: center;
  margin-bottom: 0.75rem;
}

.bt-results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.bt-result-box {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 0.85rem;
  text-align: center;
}
.bt-result-box .value { font-size: 1.4rem; font-weight: 700; color: #1e3a8a; }
.bt-result-box.positive .value { color: #16a34a; }
.bt-result-box.negative .value { color: #dc2626; }
.bt-result-box .label {
  font-size: 0.75rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.bt-chart-wrap {
  position: relative;
  height: 360px;
}

.bt-chart-controls {
  display: flex;
  justify-content: flex-start;
  gap: 0.5rem;
  margin-top: 0.35rem;
}
.bt-log-btn {
  font-size: 0.72rem;
  color: #94a3b8;
  background: none;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.15rem 0.55rem;
  cursor: pointer;
}
.bt-log-btn.active { background: #1e3a8a; color: white; border-color: #1e3a8a; }

.bt-toggle-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  font-size: 1rem;
  margin-top: 1rem;
}
.bt-toggle-row label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  color: #334155;
}
.bt-toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  cursor: pointer;
  accent-color: #1e3a8a;
}

.bt-freedom-box {
  margin-top: 1.25rem;
  background: linear-gradient(135deg, #ede9fe 0%, #eff6ff 100%);
  border: 1px solid #c4b5fd;
  border-radius: 12px;
  padding: 1rem 1.25rem;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #3730a3;
  text-align: center;
}
.bt-freedom-box strong { color: #4c1d95; }
.bt-freedom-box .fd-date {
  font-size: 1.3rem;
  font-weight: 800;
  color: #4c1d95;
}
.bt-freedom-box .fd-caption {
  display: block;
  margin-top: 0.4rem;
  font-size: 0.75rem;
  font-style: italic;
  color: #6d28d9;
  opacity: 0.85;
}

.bt-freedom-input-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1.25rem;
  font-size: 0.82rem;
  color: #64748b;
}
.bt-freedom-input-row label { font-weight: 600; }
.bt-freedom-input-row input[type="number"] {
  width: 80px;
  text-align: center;
  font-weight: 700;
  padding: 0.3rem;
  border: 1.5px solid #c4b5fd;
  border-radius: 6px;
  color: #4c1d95;
}
.bt-freedom-hint { font-style: italic; opacity: 0.8; }

.bt-presets button {
  margin-right: 0.4rem;
  margin-bottom: 0.4rem;
  padding: 0.35rem 0.8rem;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  background: white;
  cursor: pointer;
}
.bt-presets button:hover { background: #eff6ff; }

.bt-primary-btn {
  background: linear-gradient(135deg, #1e3a8a 0%, #3b82f6 100%);
  color: white;
  border: none;
  padding: 0.7rem 1.4rem;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
}

.bt-note-italic {
  font-size: 0.82rem;
  font-style: italic;
  color: #64748b;
  margin: 0 0 0.6rem 0;
}

.bt-disclaimer {
  font-size: 0.76rem;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  margin: 0.9rem 0 0 0;
  line-height: 1.4;
}

.bt-footer {
  text-align: center;
  font-size: 0.72rem;
  color: #94a3b8;
  padding: 1rem 1rem 2rem;
  border-top: 1px solid #e2e8f0;
  margin-top: 1rem;
}

.bt-compare-row {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.bt-compare-row .bt-result-box { flex: 1; }
.bt-vs {
  align-self: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #94a3b8;
  background: #f1f5f9;
  border-radius: 999px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.bt-result-box .sub-value {
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 0.15rem;
}
.bt-result-box.positive .sub-value { color: #16a34a; }
.bt-result-box.negative .sub-value { color: #dc2626; }

.bt-diff-box {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.92rem;
  font-weight: 600;
  color: #1e3a8a;
  margin-bottom: 1.25rem;
}
.bt-diff-box.negative { background: #fef2f2; border-color: #fecaca; color: #991b1b; }

.bt-loading-indicator {
  font-size: 0.85rem;
  color: #1e3a8a;
  font-weight: 600;
  margin-top: 0.5rem;
  display: none;
}
.bt-loading-indicator.active { display: block; }

.bt-debug-btn {
  position: fixed;
  bottom: 10px;
  right: 10px;
  z-index: 9999;
  font-size: 0.7rem;
  color: #cbd5e1;
  background: rgba(255,255,255,0.7);
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  opacity: 0.6;
}
.bt-debug-btn:hover { opacity: 1; }

.bt-debug-panel {
  position: fixed;
  bottom: 40px;
  right: 10px;
  left: 10px;
  max-height: 40vh;
  overflow-y: auto;
  background: #0f172a;
  color: #e2e8f0;
  font-family: monospace;
  font-size: 0.72rem;
  padding: 0.6rem;
  border-radius: 8px;
  z-index: 9999;
  display: none;
  white-space: pre-wrap;
  word-break: break-all;
}
.bt-debug-panel.active { display: block; }
.bt-debug-panel .err-line { color: #fca5a5; border-bottom: 1px solid #334155; padding: 0.2rem 0; }
.bt-debug-panel .log-line { color: #94a3b8; border-bottom: 1px solid #1e293b; padding: 0.2rem 0; }
