/* Professional Backtest Results Styling */

/* Stats Section Styling */
.stats-section {
    padding: 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .stats-section {
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.stats-section:last-child {
    border-bottom: none !important;
}

.stats-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.75rem;
    opacity: 0.9;
    color: var(--text-color);
}

[data-theme="dark"] .stats-section-title {
    color: #e5e7eb !important;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    transition: background-color 0.2s ease;
}

[data-theme="dark"] .stat-row {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-row:last-child {
    border-bottom: none;
}

.stat-row.highlight {
    background-color: rgba(0, 123, 255, 0.05);
    padding: 0.75rem 0.5rem;
    margin: 0.25rem -0.5rem;
    border-radius: 0.375rem;
    border-bottom: none;
}

[data-theme="dark"] .stat-row.highlight {
    background-color: rgba(10, 124, 255, 0.1);
}

.stat-row:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .stat-row:hover {
    background-color: rgba(255, 255, 255, 0.02);
}

.stat-label {
    display: flex;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-color);
    font-weight: 500;
}

[data-theme="dark"] .stat-label {
    color: #adb5bd !important;
}

[data-theme="light"] .stat-label {
    color: #6c757d !important;
}

.stat-value {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--text-color);
    text-align: right;
}

[data-theme="dark"] .stat-value {
    color: #f8f9fa !important;
}

[data-theme="light"] .stat-value {
    color: #212529 !important;
}

/* Ensure stat value children inherit proper color */
[data-theme="dark"] .stat-value span {
    color: inherit;
}

/* Override any text-dark or dark text in stats */
[data-theme="dark"] .stat-label .text-muted,
[data-theme="dark"] .stat-value .text-muted {
    color: #9ca3af !important;
    opacity: 1;
}

/* Colored card headers */
.card-header.bg-primary {
    background: linear-gradient(135deg, #0066cc 0%, #004899 100%) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .card-header.bg-primary {
    background: linear-gradient(135deg, #1a73e8 0%, #0d5bbf 100%) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
}

.card-header.bg-info {
    background: linear-gradient(135deg, #0dcaf0 0%, #0aa8cc 100%) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .card-header.bg-info {
    background: linear-gradient(135deg, #17a2b8 0%, #138496 100%) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
}

.card-header.bg-success {
    background: linear-gradient(135deg, #198754 0%, #146c43 100%) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .card-header.bg-success {
    background: linear-gradient(135deg, #28a745 0%, #20893a 100%) !important;
    border-bottom: 2px solid rgba(255, 255, 255, 0.15);
}

/* Icon styling in stat labels */
.stat-label i {
    font-size: 0.875rem;
    width: 1.25rem;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .stats-section {
        padding: 0.75rem;
    }
    
    .stat-row {
        padding: 0.4rem 0;
    }
    
    .stat-label {
        font-size: 0.8125rem;
    }
    
    .stat-value {
        font-size: 0.875rem;
    }
    
    .stats-section-title {
        font-size: 0.8125rem;
        margin-bottom: 0.5rem;
    }
}

/* Summary card enhancements */
.summary-card {
    border-radius: 0.5rem;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

[data-theme="dark"] .summary-card {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .summary-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

/* Card header icon styling */
.card-header i {
    opacity: 0.9;
}

/* Stat value color variations */
.stat-value.text-success {
    color: #198754 !important;
}

.stat-value.text-danger {
    color: #dc3545 !important;
}

.stat-value.text-info {
    color: #0dcaf0 !important;
}

[data-theme="dark"] .stat-value.text-success {
    color: #4ade80 !important;
}

[data-theme="dark"] .stat-value.text-danger {
    color: #f87171 !important;
}

[data-theme="dark"] .stat-value.text-info {
    color: #38bdf8 !important;
}

/* Section title colors */
[data-theme="dark"] .stats-section-title {
    color: #e5e7eb;
}

/* Icon colors in dark theme */
[data-theme="dark"] .stats-section-title i.text-warning {
    color: #fbbf24 !important;
}

[data-theme="dark"] .stats-section-title i.text-info {
    color: #38bdf8 !important;
}

[data-theme="dark"] .stats-section-title i.text-primary {
    color: #60a5fa !important;
}

[data-theme="dark"] .stats-section-title i.text-success {
    color: #4ade80 !important;
}

[data-theme="dark"] .stats-section-title i.text-danger {
    color: #f87171 !important;
}

/* Stat label icon colors in dark theme */
[data-theme="dark"] .stat-label i.text-muted {
    color: #9ca3af !important;
}

[data-theme="dark"] .stat-label i.text-success {
    color: #4ade80 !important;
}

[data-theme="dark"] .stat-label i.text-danger {
    color: #f87171 !important;
}

[data-theme="dark"] .stat-label i.text-info {
    color: #38bdf8 !important;
}

[data-theme="dark"] .stat-label i.text-warning {
    color: #fbbf24 !important;
}

/* Card body background in dark theme */
[data-theme="dark"] .summary-card .card-body {
    background-color: var(--card-bg);
}

/* ULTRA-SPECIFIC SELECTORS TO OVERRIDE BOOTSTRAP */
/* Performance Summary and Strategy Configuration - Force light text on dark backgrounds */
[data-theme="dark"] .summary-card .card-body .stats-section-title,
[data-theme="dark"] .summary-card .card-body .stat-label,
[data-theme="dark"] .summary-card .card-body .stat-value,
[data-theme="dark"] .summary-card .card-body .stat-value span,
[data-theme="dark"] .summary-card .card-body div.stat-value,
[data-theme="dark"] .summary-card .card-body div.stat-label {
    color: #f0f0f0 !important;
}

/* Make sure highlighted stat rows are also light text */
[data-theme="dark"] .summary-card .card-body .stat-row.highlight .stat-label,
[data-theme="dark"] .summary-card .card-body .stat-row.highlight .stat-value,
[data-theme="dark"] .summary-card .card-body .stat-row.highlight .stat-value span {
    color: #f0f0f0 !important;
}

/* Section titles need extra specificity */
[data-theme="dark"] .card-body .stats-section .stats-section-title {
    color: #e5e7eb !important;
}

/* All stat labels in any card */
[data-theme="dark"] .card .stats-section .stat-label {
    color: #adb5bd !important;
}

/* All stat values in any card */
[data-theme="dark"] .card .stats-section .stat-value {
    color: #f8f9fa !important;
}

/* Specific overrides for the backtest results cards */
[data-theme="dark"] #summary-results-card .stat-value,
[data-theme="dark"] #input-parameters-results-card .stat-value {
    color: #f8f9fa !important;
}

[data-theme="dark"] #summary-results-card .stat-label,
[data-theme="dark"] #input-parameters-results-card .stat-label {
    color: #adb5bd !important;
}

[data-theme="dark"] #summary-results-card .stats-section-title,
[data-theme="dark"] #input-parameters-results-card .stats-section-title {
    color: #e5e7eb !important;
}

/* Nuclear option - target every possible element by ID */
[data-theme="dark"] #backtestInitialCapital,
[data-theme="dark"] #backtestFinalCapital,
[data-theme="dark"] #backtestTotalReturn,
[data-theme="dark"] #backtestCagr,
[data-theme="dark"] #backtestMaxDrawdown,
[data-theme="dark"] #backtestTotalTrades,
[data-theme="dark"] #backtestHitRate,
[data-theme="dark"] #backtestAvgWin,
[data-theme="dark"] #backtestAvgLoss,
[data-theme="dark"] #backtestMissedTrades,
[data-theme="dark"] #backtestStrategyName,
[data-theme="dark"] #backtestStartDate,
[data-theme="dark"] #backtestEndDate,
[data-theme="dark"] #backtestWeeksForGrowth,
[data-theme="dark"] #backtestPercentageGrowth,
[data-theme="dark"] #backtestProfitTarget,
[data-theme="dark"] #backtestStopLoss,
[data-theme="dark"] #backtestHoldingPeriod,
[data-theme="dark"] #backtestTradeAllocation {
    color: #f8f9fa !important;
}
