/* ============================================
   Backtesting Engine Page Specific Styles
   ============================================ */

/* Hero Section */
.be-hero {
    position: relative;
    padding: var(--spacing-xl) 0;
    min-height: 80vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    background-color: var(--bg-primary);
}

.be-hero-background {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(180deg, rgba(6, 14, 24, 0.95) 0%, rgba(6, 14, 24, 0.9) 60%, var(--bg-primary) 100%),
        radial-gradient(circle at 15% 20%, rgba(162, 207, 255, 0.28), transparent 55%),
        radial-gradient(circle at 85% 25%, rgba(56, 239, 125, 0.18), transparent 60%);
    opacity: 1;
}

.be-hero-content {
    position: relative;
    z-index: 1;
    text-align: center;
    max-width: 900px;
    animation: fadeInUp 0.8s ease;
}

.be-hero-label {
    display: inline-block;
    font-size: 0.8rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--accent-ice);
    margin-bottom: var(--spacing-sm);
}

.be-hero-title {
    font-family: var(--font-headings);
    font-size: 3.5rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.02em;
}

.be-hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
    line-height: 1.6;
}

.be-hero-buttons {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    flex-wrap: wrap;
}

/* Content Sections */
.be-section {
    padding: var(--spacing-xl) 0;
    background-color: var(--bg-primary);
}

.be-section:nth-child(odd) {
    background-color: var(--bg-surface);
}

.be-section-header {
    text-align: center;
    margin-bottom: var(--spacing-lg);
}

.be-section-header h2 {
    font-family: var(--font-headings);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-xs);
}

.be-section-header p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    max-width: 700px;
    margin: 0 auto;
}

.be-section-content {
    max-width: 100%;
    margin: 0 auto;
}

.be-intro .be-section-content {
    max-width: 100%;
}

.be-section-content h2 {
    font-family: var(--font-headings);
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-md);
}

.be-section-content p {
    font-size: 1.05rem;
    line-height: 1.8;
    color: var(--text-secondary);
    margin-bottom: var(--spacing-md);
}

/* List Styles */
.be-list {
    list-style: none;
    padding: 0;
    margin: var(--spacing-md) 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.be-list li {
    padding: 0;
    background-color: transparent;
    border-left: none;
    border-radius: 0;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Pipeline Section */
.be-pipeline {
    display: grid;
    /* show one pipeline step per row (full width) to avoid compact multi-column layout */
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.be-pipeline-step {
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: all var(--transition-smooth);
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.be-pipeline-step:hover {
    border-color: var(--accent-ice);
    box-shadow: 0 0 30px rgba(162, 207, 255, 0.15);
    transform: translateY(-5px);
}

.be-step-number {
    font-family: var(--font-headings);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-ice);
    background-color: rgba(162, 207, 255, 0.1);
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}

.be-step-content h4 {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
}

.be-step-content p {
    margin: 0;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.be-pipeline-arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--accent-ice);
    grid-column: auto;
}

@media (max-width: 768px) {
    .be-pipeline-arrow {
        display: none;
    }
}

/* Architecture Grid */
.be-architecture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.be-arch-card {
    background-color: var(--bg-surface);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: all var(--transition-smooth);
}

.be-arch-card:hover {
    border-color: var(--accent-ice);
    box-shadow: 0 0 20px rgba(162, 207, 255, 0.1);
}

.be-arch-card h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    color: var(--accent-ice);
}

.be-arch-card p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Strategy Section */
.be-strategy-problem {
    margin: var(--spacing-lg) 0;
}

.be-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.be-comparison-item {
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    border-left: 4px solid var(--border-color);
}

.be-comparison-item.be-bad {
    background-color: rgba(220, 38, 38, 0.05);
    border-left-color: #dc2626;
}

.be-comparison-item.be-good {
    background-color: rgba(34, 197, 94, 0.05);
    border-left-color: #22c55e;
}

.be-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
}

.be-badge-bad {
    background-color: rgba(220, 38, 38, 0.2);
    color: #dc2626;
}

.be-badge-good {
    background-color: rgba(34, 197, 94, 0.2);
    color: #22c55e;
}

/* Layers */
.be-layer {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-md);
    background-color: rgba(162, 207, 255, 0.05);
    border-left: 3px solid var(--accent-ice);
    border-radius: var(--radius-md);
}

.be-layer-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: var(--spacing-sm);
    color: var(--accent-ice);
}

.be-layer-desc {
    color: var(--text-secondary);
    margin-bottom: var(--spacing-sm);
}

/* Tables */
.be-features-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-md) 0;
    background-color: var(--bg-primary);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.be-features-table thead {
    background-color: var(--bg-surface);
}

.be-features-table th {
    padding: var(--spacing-sm);
    text-align: left;
    font-weight: 600;
    color: var(--accent-ice);
    border-bottom: 2px solid var(--border-color);
}

.be-features-table td {
    padding: var(--spacing-sm);
    border-bottom: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.be-features-table tbody tr:hover {
    background-color: var(--bg-surface);
}

/* Strategy Groups */
.be-strategy-groups {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.be-strategy-group {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    transition: all var(--transition-smooth);
}

.be-strategy-group:hover {
    border-color: var(--accent-ice);
    box-shadow: 0 0 15px rgba(162, 207, 255, 0.1);
}

.be-strategy-group h5 {
    margin: 0 0 var(--spacing-xs) 0;
    font-size: 1rem;
    font-weight: 600;
}

.be-strategy-group p {
    margin: var(--spacing-xs) 0;
    font-size: 0.9rem;
}

/* Scoring Example */
.be-scoring-example {
    margin: var(--spacing-lg) 0;
    padding: var(--spacing-lg) 0;
    border-top: 2px solid var(--border-color);
    border-bottom: 2px solid var(--border-color);
}

.be-scoring-example h3 {
    margin-top: 0;
    margin-bottom: var(--spacing-md);
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--accent-ice);
}

/* Code Blocks */
.be-code-block {
    background-color: var(--bg-surface);
    border: 2px solid var(--accent-ice);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    overflow-x: auto;
    margin: var(--spacing-lg) 0;
    font-family: var(--font-monospace);
    font-size: 0.85rem;
    line-height: 1.6;
    box-shadow: 0 4px 12px rgba(162, 207, 255, 0.1);
}

.be-code-block pre {
    margin: 0;
    color: var(--accent-slate);
}

/* Scoring Example */
.be-scoring-example {
    margin: var(--spacing-lg) 0;
}

/* Multi-TF Section */
.be-multitf-content {
    margin: var(--spacing-lg) 0;
}

.be-comparison-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

/* Execution Section */
.be-execution-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.be-execution-item {
    background-color: rgba(162, 207, 255, 0.08);
    border-left: 3px solid var(--accent-ice);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.be-execution-item h4 {
    margin-top: 0;
    color: var(--accent-ice);
}

.be-execution-item p {
    margin-bottom: 0;
    font-size: 0.95rem;
}

/* Metrics Section */
.be-metrics-display {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-lg);
    margin: var(--spacing-lg) 0;
}

.be-metrics-section {
    background: linear-gradient(135deg, var(--bg-surface) 0%, rgba(162, 207, 255, 0.03) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: all var(--transition-smooth);
}

.be-metrics-section:hover {
    border-color: var(--accent-ice);
    box-shadow: 0 4px 12px rgba(162, 207, 255, 0.08);
}

.be-metrics-section-title {
    display: flex;
    align-items: center;
    gap: var(--spacing-sm);
    margin-bottom: var(--spacing-md);
    padding-bottom: var(--spacing-md);
    border-bottom: 2px solid var(--border-color);
}

.be-metrics-icon {
    font-size: 1.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.be-metrics-section-title h4 {
    margin: 0;
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
}

.be-metrics-text {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.6;
    color: var(--text-secondary);
}

/* Ranking Section */
.be-ranking-section {
    margin: var(--spacing-lg) 0;
    background-color: rgba(162, 207, 255, 0.05);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
}

.be-weights-display {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
    margin: var(--spacing-md) 0;
}

.be-weight-item {
    /* two-column grid: fixed label column + flexible bar column */
    display: grid;
    grid-template-columns: 180px 1fr;
    align-items: center;
    gap: var(--spacing-sm);
}

.be-weight-label {
    width: 180px;
    font-weight: 600;
    font-size: 0.9rem;
    text-align: left;
}

.be-weight-bar {
    width: 100%;
    height: 24px;
    background: linear-gradient(90deg, var(--accent-ice), rgba(162, 207, 255, 0.3));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
    padding: 0 0.5rem;
    box-sizing: border-box;
}

/* Filtering Section */
.be-filtering-section {
    margin: var(--spacing-lg) 0;
}

.be-filter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-md) 0;
}

.be-filter-item {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    transition: all var(--transition-smooth);
    /* center the checkmark icon and text vertically and horizontally */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-sm);
    text-align: center;
}

.be-filter-item:hover {
    border-color: var(--accent-ice);
    box-shadow: 0 0 15px rgba(162, 207, 255, 0.1);
}

.be-filter-icon {
    display: inline-block;
    width: 40px;
    height: 40px;
    background-color: rgba(34, 197, 94, 0.2);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #22c55e;
    margin-bottom: var(--spacing-xs);
}

.be-filter-item h5 {
    margin: var(--spacing-xs) 0;
    font-size: 1rem;
}

.be-filter-item p {
    margin: 0;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* Results Section */
.be-results-grid {
    display: grid;
    /* show each result card on its own row (one per line) */
    grid-template-columns: 1fr;
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.be-result-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
}

.be-result-card h4 {
    margin-top: 0;
    color: var(--accent-ice);
}

.be-result-list {
    list-style: none;
    padding: 0;
    margin: var(--spacing-md) 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-sm);
}

.be-result-list li {
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.95rem;
    line-height: 1.6;
}

.be-result-list li::before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #22c55e;
    font-weight: 700;
}

/* Results Table */
.be-results-table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--spacing-md) 0;
    background-color: var(--bg-surface);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.be-results-table th,
.be-results-table td {
    padding: var(--spacing-sm);
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

.be-results-table th {
    background-color: rgba(162, 207, 255, 0.1);
    font-weight: 600;
    color: var(--accent-ice);
}

.be-results-table tbody tr:hover {
    background-color: rgba(162, 207, 255, 0.05);
}

.be-red {
    color: #dc2626;
    font-weight: 600;
}

.be-green {
    color: #22c55e;
    font-weight: 600;
}

.be-result-insight {
    margin: var(--spacing-sm) 0 0 0;
    font-size: 0.95rem;
    color: var(--accent-ice);
    font-weight: 600;
}

/* Integration Section */
.be-integration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.be-integration-item {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: all var(--transition-smooth);
}

.be-integration-item:hover {
    border-color: var(--accent-ice);
    box-shadow: 0 0 20px rgba(162, 207, 255, 0.1);
    transform: translateY(-3px);
}

.be-integration-item h4 {
    margin-top: 0;
    color: var(--accent-ice);
    font-size: 1.125rem;
}

.be-integration-item p {
    margin: var(--spacing-xs) 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Integration CTA */
.be-integration-cta {
    margin: var(--spacing-lg) 0;
    text-align: center;
    padding: var(--spacing-lg);
    background-color: rgba(162, 207, 255, 0.08);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.be-integration-cta p {
    margin: 0 0 var(--spacing-md) 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--accent-ice);
}

.be-cta-buttons {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    flex-wrap: wrap;
}

/* Getting Started Section */
.be-steps {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.be-step-card {
    background-color: var(--bg-primary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-lg);
    text-align: center;
    transition: all var(--transition-smooth);
    position: relative;
}

.be-step-card:hover {
    border-color: var(--accent-ice);
    box-shadow: 0 0 30px rgba(162, 207, 255, 0.15);
    transform: translateY(-5px);
}

.be-step-number-large {
    font-family: var(--font-headings);
    font-size: 3rem;
    font-weight: 700;
    color: var(--accent-ice);
    margin-bottom: var(--spacing-sm);
    opacity: 0.3;
}

.be-step-card h4 {
    margin: var(--spacing-sm) 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.be-step-card p {
    color: var(--text-secondary);
    margin: var(--spacing-sm) 0;
}

.be-step-link {
    display: inline-block;
    margin-top: var(--spacing-md);
    color: var(--accent-ice);
    text-decoration: none;
    font-weight: 600;
    transition: all var(--transition-smooth);
    font-size: 0.95rem;
}

.be-step-link:hover {
    gap: 0.5rem;
}

/* Version Section */
.be-version-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.be-version-card {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: all var(--transition-smooth);
}

.be-version-card:hover {
    border-color: var(--accent-ice);
    box-shadow: 0 0 20px rgba(162, 207, 255, 0.1);
}

.be-version-card h3 {
    margin-top: 0;
    color: var(--accent-ice);
    font-size: 1.25rem;
}

.be-version-card h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
}

.be-version-card p {
    margin: var(--spacing-xs) 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

.be-version-list {
    list-style: none;
    padding: 0;
    margin: var(--spacing-sm) 0;
    display: flex;
    flex-direction: column;
    gap: var(--spacing-xs);
}

.be-version-list li {
    padding-left: 1.5rem;
    position: relative;
    font-size: 0.9rem;
    line-height: 1.5;
    color: var(--text-secondary);
}

.be-version-list li::before {
    content: "→";
    position: absolute;
    left: 0;
    color: var(--accent-ice);
    font-weight: 600;
}

.be-version-notes {
    margin-top: var(--spacing-lg);
}

/* FAQ Section */
.be-faq-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--spacing-md);
    margin: var(--spacing-lg) 0;
}

.be-faq-item {
    background-color: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-md);
    transition: all var(--transition-smooth);
}

.be-faq-item:hover {
    border-color: var(--accent-ice);
    box-shadow: 0 0 15px rgba(162, 207, 255, 0.1);
}

.be-faq-item h4 {
    margin-top: 0;
    color: var(--accent-ice);
    font-size: 1.05rem;
    font-weight: 600;
}

.be-faq-item p {
    margin: var(--spacing-xs) 0 0 0;
    font-size: 0.95rem;
    line-height: 1.6;
}

/* Final CTA Section */
.be-final-cta {
    background-color: var(--bg-surface);
    text-align: center;
}

.be-final-cta-content {
    max-width: 700px;
    margin: 0 auto;
}

.be-final-cta-content h2 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: var(--spacing-sm);
}

.be-final-cta-content p {
    color: var(--text-secondary);
    font-size: 1.125rem;
    margin-bottom: var(--spacing-md);
}

.be-final-cta-buttons {
    display: flex;
    gap: var(--spacing-sm);
    justify-content: center;
    flex-wrap: wrap;
}

/* Responsive Design */
@media (max-width: 768px) {
    .be-hero-title {
        font-size: 2.5rem;
    }

    .be-hero-subtitle {
        font-size: 1rem;
    }

    .be-section-header h2 {
        font-size: 2rem;
    }

    .be-pipeline {
        grid-template-columns: 1fr;
    }

    .be-comparison {
        grid-template-columns: 1fr;
    }

    .be-strategy-groups {
        grid-template-columns: 1fr;
    }

    .be-weights-display {
        gap: var(--spacing-md);
    }

    .be-weight-label {
        min-width: 100%;
        margin-bottom: var(--spacing-xs);
    }

    .be-weight-bar {
        width: 100%;
        min-width: auto;
    }

    .be-cta-buttons {
        flex-direction: column;
    }

    .be-steps {
        grid-template-columns: 1fr;
    }

    .be-faq-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .be-hero-title {
        font-size: 1.75rem;
    }

    .be-step-number-large {
        font-size: 2rem;
    }

    .be-section-header h2 {
        font-size: 1.5rem;
    }
}