/* ============================================================
   TURTLE SIMULATOR — Axiom Capital
   Inherits tokens from index.css → global.css.
   Purple accent for turtle brand identity.
   ============================================================ */

.simulator-container { max-width: 100%; margin: 0; padding: 0 0 var(--space-section); }

/* ─── Hero ──────────────────────────────────────────────── */
.simulator-header {
    position: relative;
    text-align: center;
    padding: var(--space-section) 2rem;
    color: #fff;
    overflow: hidden;
    background: var(--gradient-hero);
}

.simulator-header-bg {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(139,92,246,0.1), transparent 60%);
    pointer-events: none;
}

.simulator-header-bg::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(139,92,246,0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(139,92,246,0.04) 1px, transparent 1px);
    background-size: 60px 60px;
}

.simulator-header-inner {
    position: relative;
    z-index: 1;
    max-width: 720px;
    margin: 0 auto;
}

.simulator-eyebrow {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #c4b5fd;
    margin: 0 0 1rem;
    display: block;
}

.simulator-header h1 {
    font-size: clamp(2rem, 5vw, 3rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: #fff;
    margin: 0 0 1rem;
}

.simulator-header h1 span {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.simulator-lead {
    font-size: 1.05rem;
    line-height: 1.7;
    color: #cbd5e1;
    margin: 0 0 1.75rem;
}

.simulator-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    justify-content: center;
}

.simulator-badge {
    background: rgba(139,92,246,0.12);
    color: #c4b5fd;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.825rem;
    font-weight: 600;
    border: 1px solid rgba(139,92,246,0.25);
}

/* ─── Content wrappers ──────────────────────────────────── */
.presets,
.form-grid,
.results-panel {
    max-width: 1100px;
    margin-left: auto;
    margin-right: auto;
}

/* ─── Presets ───────────────────────────────────────────── */
.presets {
    margin: var(--space-block) auto 2rem;
    padding: 0 2rem;
    text-align: center;
}

.presets h3 {
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 1rem;
}

.preset-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
}

.preset-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.55rem 1.15rem;
    border-radius: var(--radius-pill);
    font-size: 0.875rem;
    font-weight: 600;
    font-family: inherit;
    background: var(--bg-elevated);
    color: var(--text-muted);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: background var(--ease), color var(--ease), border-color var(--ease), transform var(--ease);
    white-space: nowrap;
}

.preset-btn:hover {
    background: rgba(139,92,246,0.12);
    color: #c4b5fd;
    border-color: rgba(139,92,246,0.35);
    transform: translateY(-1px);
}

/* ─── Form ─────────────────────────────────────────────── */
.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    margin: 0 2rem;
    margin-left: auto;
    margin-right: auto;
    max-width: 1100px;
}

.form-group { position: relative; }

.form-grid label {
    display: block;
    font-size: 0.825rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.form-grid input,
.form-grid select {
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    transition: border-color var(--ease), box-shadow var(--ease);
}

.form-grid input:focus,
.form-grid select:focus {
    outline: none;
    border-color: var(--accent-purple);
    box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

.form-grid input[type="date"] {
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    color-scheme: dark;
}

.form-grid input[type="date"]::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.55;
    filter: invert(1);
    transition: opacity var(--ease);
}

.form-grid input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }

.form-grid small {
    display: block;
    font-size: 0.78rem;
    color: var(--text-subtle);
    margin-top: 0.4rem;
    line-height: 1.5;
}

/* ─── Primary button (purple variant) ──────────────────── */
.simulator-container .btn-primary {
    grid-column: 1 / -1;
    justify-self: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-width: 240px;
    padding: 0.85rem 2.25rem;
    margin-top: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: inherit;
    background: linear-gradient(135deg, #7c3aed 0%, #8b5cf6 100%);
    color: #fff;
    border: 1px solid rgba(139,92,246,0.45);
    border-radius: var(--radius-md);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(124,58,237,0.25);
    transition: opacity var(--ease), transform var(--ease), box-shadow var(--ease);
}

.simulator-container .btn-primary:hover {
    opacity: 0.92;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(124,58,237,0.35);
    color: #fff;
}

.simulator-container .btn-primary:active { transform: translateY(0); }

/* ─── Results Panel ────────────────────────────────────── */
.results-panel {
    margin: var(--space-block) 2rem 0;
    margin-left: auto;
    margin-right: auto;
    max-width: 1100px;
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2.25rem;
    min-height: 280px;
}

.results-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 280px;
    color: var(--accent-purple);
    gap: 1rem;
    text-align: center;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-visual {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 0.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-visual i {
    font-size: 3rem;
    color: var(--accent-purple);
    animation: spin 1.4s linear infinite;
}

.turtle-emoji {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(40%, -50%);
    font-size: 2.2rem;
    animation: turtleBounce 1.4s ease-in-out infinite;
}

@keyframes turtleBounce {
    0%, 100% { transform: translate(40%, -50%) translateY(0); }
    50%      { transform: translate(40%, -50%) translateY(-10px); }
}

.loading-text { font-size: 1.1rem; font-weight: 700; color: var(--text-primary); }
.loading-sub  { font-size: 0.875rem; color: var(--text-muted); max-width: 360px; }

#results-content h3 {
    font-size: 1.25rem;
    color: var(--text-primary);
    margin: 0 0 1.25rem;
    font-weight: 700;
}

#results-pre { display: none; }

/* ─── Executive summary banner ─────────────────────────── */
.results-summary {
    background: linear-gradient(135deg, rgba(139,92,246,0.08) 0%, rgba(124,58,237,0.04) 100%);
    border: 1px solid rgba(139,92,246,0.25);
    border-radius: var(--radius-lg);
    padding: 1.75rem 2rem;
    margin-bottom: 1.75rem;
}

.results-summary-head { margin-bottom: 1rem; }

.results-summary-eyebrow {
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #c4b5fd;
    margin: 0 0 0.25rem;
}

.results-summary-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    letter-spacing: -0.01em;
}

.results-summary-headline {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.results-summary-pnl { display: flex; flex-direction: column; gap: 0.25rem; }

.results-summary-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.results-summary-value {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    color: var(--text-primary);
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
}

.results-summary-value.positive { color: var(--accent-green); }
.results-summary-value.negative { color: var(--accent-red); }

.results-summary-sub {
    font-size: 0.875rem;
    color: var(--text-muted);
    font-weight: 500;
}

.results-verdict {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    border: 1px solid var(--border);
    background: var(--bg-elevated);
    color: var(--text-muted);
}

.results-verdict.is-positive { background: rgba(16,185,129,0.12); color: #6ee7b7; border-color: rgba(16,185,129,0.3); }
.results-verdict.is-negative { background: rgba(239,68,68,0.12);  color: #fca5a5; border-color: rgba(239,68,68,0.3); }
.results-verdict.is-neutral  { background: rgba(148,163,184,0.12); color: #cbd5e1; border-color: rgba(148,163,184,0.3); }

.results-summary-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.run-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    padding: 0.35rem 0.75rem;
    border-radius: var(--radius-pill);
    font-size: 0.78rem;
}

.run-pill-label {
    color: var(--text-subtle);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.7rem;
}

.run-pill-value {
    color: var(--text-primary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

#no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 240px;
    color: var(--text-subtle);
    text-align: center;
    padding: 3rem 1rem;
}

#no-results i { font-size: 3rem; opacity: 0.35; margin-bottom: 1rem; color: var(--accent-purple); }
#no-results p { margin: 0; font-size: 0.95rem; max-width: 380px; }

/* ─── Metric Cards ─────────────────────────────────────── */
.metrics-big {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    text-align: center;
    transition: border-color var(--ease), transform var(--ease), box-shadow var(--ease);
}

.metric-card:hover {
    transform: translateY(-3px);
    border-color: rgba(139,92,246,0.3);
    box-shadow: 0 4px 16px rgba(139,92,246,0.1);
}

.metric-card span {
    display: block;
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.metric-card strong {
    display: block;
    font-size: 1.85rem;
    font-weight: 800;
    line-height: 1.1;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.metric-card.pnl-card { position: relative; }
.metric-card.pnl-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: linear-gradient(135deg, rgba(139,92,246,0.06), transparent 60%);
    pointer-events: none;
}

#final-pnl.positive { color: var(--accent-green); }
#final-pnl.negative { color: var(--accent-red); }

/* ─── Charts ───────────────────────────────────────────── */
.chart-wrapper {
    position: relative;
    height: 260px;
    width: 100%;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.chart-wrapper-price {
    min-height: 420px;
    overflow: hidden;
    background: var(--bg-base);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.25rem 0.5rem;
}

.chart-wrapper-price-inner { height: 360px; width: 100%; overflow: hidden; position: relative; }
.chart-wrapper-price-inner canvas { display: block; width: 100% !important; max-width: 100%; }

.chart-wrapper-price .chart-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.35rem;
    text-align: center;
}

.chart-wrapper-price .chart-legend-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-align: center;
    margin: 0 0 0.75rem;
}

/* ─── Trade Log Table ──────────────────────────────────── */
.trades-log-wrapper {
    margin: 1.5rem 0;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    border: 1px solid var(--border);
}

.trades-log-wrapper .chart-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
}

.trades-log-scroll { overflow-x: auto; max-height: 360px; overflow-y: auto; }

.trades-log {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
    color: var(--text-primary);
}

.trades-log th {
    text-align: left;
    padding: 0.55rem 0.75rem;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    position: sticky;
    top: 0;
    background: var(--bg-elevated);
    z-index: 1;
}

.trades-log td {
    padding: 0.55rem 0.75rem;
    border-bottom: 1px solid var(--border);
    font-variant-numeric: tabular-nums;
}

.trades-log tbody tr:nth-child(even) { background: rgba(255,255,255,0.015); }
.trades-log tbody tr:hover { background: rgba(139,92,246,0.06); }
.trades-log .pnl-cell.positive { color: var(--accent-green); font-weight: 700; }
.trades-log .pnl-cell.negative { color: var(--accent-red); font-weight: 700; }

/* ─── Tooltip ──────────────────────────────────────────── */
.turtle-trade-tooltip {
    position: fixed;
    z-index: 9999;
    padding: 10px 12px;
    max-width: 300px;
    background: rgba(8,13,26,0.96);
    color: var(--text-primary);
    border: 1px solid rgba(139,92,246,0.25);
    border-radius: var(--radius-sm);
    font-size: 12px;
    line-height: 1.5;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, visibility 0.15s ease;
    box-shadow: var(--shadow-md);
}

.turtle-trade-tooltip-title { font-weight: 700; color: #a78bfa; margin-bottom: 5px; font-size: 13px; }
.turtle-trade-tooltip-line  { margin-bottom: 2px; }
.turtle-trade-tooltip-line:last-child { margin-bottom: 0; }

.raw-details { display: none; }

/* ─── Summary Panel ────────────────────────────────────── */
.summary-panel {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.summary-row { display: flex; justify-content: space-between; font-size: 0.925rem; color: var(--text-primary); }
.summary-row span { font-weight: 500; color: var(--text-muted); }
.summary-row strong { font-weight: 600; }

#summary-status.positive { color: var(--accent-green); }
#summary-status.negative { color: var(--accent-red); }

/* ─── Responsive ───────────────────────────────────────── */
@media (max-width: 768px) {
    .simulator-header { padding: 4rem 1.25rem 3.5rem; }
    .form-grid { padding: 1.5rem 1.25rem; margin: 0 1rem; }
    .results-panel { padding: 1.5rem 1.25rem; margin: var(--space-block) 1rem 0; }
    .presets { padding: 0 1rem; }
    .simulator-container .btn-primary { min-width: 100%; }
    .chart-wrapper-price { padding: 0.75rem 0.5rem 0; }
}
