/* Backtesting Page Styles */

.backtest-header {
    padding: 4rem 0 2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    margin-bottom: 3rem;
}

.back-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    color: #888;
    text-decoration: none;
    font-size: 0.9rem;
    transition: color 0.3s ease;
}

.back-link:hover {
    color: #7c3aed;
}

.backtest-header h1 {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: #fff;
}

.backtest-header .subtitle {
    color: #999;
    font-size: 1.1rem;
}

/* Sections */
.backtest-section {
    margin-bottom: 4rem;
    padding: 2rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
}

.backtest-section h2 {
    font-size: 1.8rem;
    margin-bottom: 1.5rem;
    color: #fff;
}

.backtest-section p {
    color: #bbb;
    line-height: 1.7;
    margin-bottom: 1rem;
}

.backtest-section ol {
    color: #bbb;
    padding-left: 2rem;
}

.backtest-section ol li {
    margin-bottom: 1.5rem;
    line-height: 1.7;
}

.backtest-section ul {
    color: #bbb;
    padding-left: 2rem;
}

.backtest-section ul li {
    margin-bottom: 0.8rem;
    line-height: 1.6;
}

.backtest-section strong {
    color: #fff;
}

.backtest-section a {
    color: #7c3aed;
    text-decoration: none;
}

.backtest-section a:hover {
    text-decoration: underline;
}

/* Code */
code {
    background: rgba(124, 58, 237, 0.1);
    border: 1px solid rgba(124, 58, 237, 0.3);
    color: #c4b5fd;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
}

.code-block {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
    overflow-x: auto;
}

.code-block code {
    background: none;
    border: none;
    color: #a5f3fc;
    padding: 0;
    display: block;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.code-block p {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

/* Tables */
.params-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1.5rem 0;
}

.params-table thead {
    background: rgba(124, 58, 237, 0.1);
    border-bottom: 1px solid rgba(124, 58, 237, 0.3);
}

.params-table th {
    padding: 1rem;
    text-align: left;
    color: #fff;
    font-weight: 600;
}

.params-table td {
    padding: 0.8rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #bbb;
}

.params-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.05);
}

.params-table code {
    background: rgba(124, 58, 237, 0.15);
    border: none;
}

/* Strategy Cards */
.strategy-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.strategy-card {
    padding: 1.5rem;
    background: rgba(124, 58, 237, 0.05);
    border: 1px solid rgba(124, 58, 237, 0.2);
    border-radius: 8px;
    transition: all 0.3s ease;
}

.strategy-card:hover {
    background: rgba(124, 58, 237, 0.1);
    border-color: rgba(124, 58, 237, 0.4);
    transform: translateY(-2px);
}

.strategy-card h3 {
    color: #a5f3fc;
    margin-bottom: 0.8rem;
}

.strategy-card p {
    color: #aaa;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Example Box */
.example-box {
    background: rgba(34, 197, 94, 0.05);
    border: 1px solid rgba(34, 197, 94, 0.2);
    border-radius: 8px;
    padding: 1.5rem;
    margin: 1.5rem 0;
}

.example-box p {
    color: #aaa;
    margin-bottom: 1rem;
}

.example-box hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 1rem 0;
}

.trade-sequence {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
    padding: 1rem;
    margin: 1rem 0;
}

.trade {
    padding: 0.6rem;
    color: #a5f3fc;
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.trade:last-child {
    margin-bottom: 0;
}

/* Results Grid */
.results-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.result-card {
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    text-align: center;
}

.result-card h3 {
    color: #fff;
    margin-bottom: 0.8rem;
}

.result-card p {
    color: #999;
    font-size: 0.9rem;
    margin-bottom: 0.5rem;
}

.metric-good {
    color: #22c55e !important;
}

.metric-bad {
    color: #ef4444 !important;
}

/* Analysis Cards */
.analysis-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.analysis-card {
    padding: 1.5rem;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 8px;
}

.analysis-card h4 {
    color: #60a5fa;
    margin-bottom: 0.8rem;
}

.analysis-card p {
    color: #aaa;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Highlight Section */
.highlight {
    background: rgba(239, 68, 68, 0.05) !important;
    border: 1px solid rgba(239, 68, 68, 0.2) !important;
}

.highlight ul li {
    color: #ddd;
}

/* Results Summary Cards */
.results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.summary-card {
    padding: 1.5rem;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.summary-card h3 {
    color: #fff;
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
}

.summary-card .metric {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.8rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #aaa;
}

.summary-card .metric:last-child {
    border-bottom: none;
}

.summary-card .metric .label {
    font-size: 0.9rem;
    color: #999;
}

.summary-card .metric .value {
    font-weight: 600;
    font-size: 1.05rem;
    color: #fff;
}

/* Charts Container */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
    margin: 2rem 0;
}

.chart-wrapper {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    padding: 1.5rem;
}

.chart-wrapper h3 {
    color: #fff;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

/* Backtest Metrics Table */
.backtest-metrics-table {
    width: 100%;
    border-collapse: collapse;
    margin: 2rem 0;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 8px;
    overflow: hidden;
}

.backtest-metrics-table thead {
    background: rgba(124, 58, 237, 0.15);
    border-bottom: 2px solid rgba(124, 58, 237, 0.3);
}

.backtest-metrics-table th {
    padding: 1.2rem;
    text-align: left;
    color: #fff;
    font-weight: 600;
    font-size: 0.95rem;
}

.backtest-metrics-table td {
    padding: 1rem 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    color: #bbb;
}

.backtest-metrics-table tbody tr:hover {
    background: rgba(124, 58, 237, 0.05);
}

.backtest-metrics-table tbody tr:nth-child(odd) {
    background: rgba(124, 58, 237, 0.02);
}

.backtest-metrics-table strong {
    color: #fff;
}

/* Insights Box */
.insights-box {
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 8px;
    padding: 2rem;
    margin: 2rem 0;
}

.insights-box h3 {
    color: #10b981;
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.insights-box ul {
    list-style: none;
    padding: 0;
}

.insights-box li {
    padding: 0.8rem 0;
    color: #bbb;
    border-bottom: 1px solid rgba(16, 185, 129, 0.1);
    line-height: 1.6;
}

.insights-box li:last-child {
    border-bottom: none;
}

.insights-box strong {
    color: #10b981;
}

/* Responsive */
@media (max-width: 768px) {
    .backtest-header h1 {
        font-size: 1.8rem;
    }

    .backtest-section {
        padding: 1.5rem;
        margin-bottom: 2rem;
    }

    .params-table {
        font-size: 0.85rem;
    }

    .params-table th,
    .params-table td {
        padding: 0.6rem;
    }

    .strategy-cards,
    .results-grid,
    .analysis-cards,
    .results-summary,
    .charts-container {
        grid-template-columns: 1fr;
    }

    .backtest-metrics-table {
        font-size: 0.85rem;
    }

    .backtest-metrics-table th,
    .backtest-metrics-table td {
        padding: 0.8rem;
    }

    .insights-box {
        padding: 1.5rem;
    }
}
