/* ============================================================================
   BACKTEST SPECIFIC STYLES - Premium Design
   ============================================================================ */

/* ============================================================================
   BACKTEST FORM
   ============================================================================ */

.backtest-form {
    background: white;
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: var(--space-8);
}

.backtest-form h3 {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin-bottom: var(--space-6);
    padding-bottom: var(--space-4);
    border-bottom: 2px solid var(--color-gray-100);
}

/* ============================================================================
   PAIRS & STRATEGIES LISTS
   ============================================================================ */

.pairs-list,
.strategies-list {
    display: grid;
    gap: var(--space-6);
}

.pair-card,
.strategy-card {
    background: white;
    border: 2px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    transition: all var(--transition-base);
}

.pair-card:hover,
.strategy-card:hover {
    border-color: var(--color-primary-300);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.pair-header,
.strategy-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-4);
}

.pair-title h3,
.strategy-title h3 {
    font-size: var(--text-xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin: 0 0 var(--space-2) 0;
}

.pair-title p,
.strategy-title p {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    margin: 0;
}

.pair-actions,
.strategy-actions {
    display: flex;
    gap: var(--space-2);
}

.pair-details,
.strategy-details {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-4);
    padding-top: var(--space-4);
    border-top: 1px solid var(--color-gray-100);
}

.detail-item {
    display: flex;
    flex-direction: column;
}

.detail-label {
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: var(--space-1);
}

.detail-value {
    font-size: var(--text-base);
    font-weight: var(--font-semibold);
    color: var(--text-primary);
}

/* ============================================================================
   TRADES SECTION
   ============================================================================ */

.trades-section {
    background: white;
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-top: var(--space-8);
}

.trades-section h4 {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin: 0 0 var(--space-6) 0;
}

/* ============================================================================
   TRADES TABLE - PREMIUM DESIGN
   ============================================================================ */

.trades-table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    background: white;
}

.trades-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: var(--text-base);
    min-width: 1000px;
}

.trades-table thead {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.trades-table th {
    padding: var(--space-5) var(--space-6);
    text-align: left;
    font-weight: var(--font-bold);
    font-size: var(--text-sm);
    color: white;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.trades-table th:first-child {
    border-top-left-radius: var(--radius-lg);
}

.trades-table th:last-child {
    border-top-right-radius: var(--radius-lg);
}

.trades-table tbody tr {
    background: white;
    transition: all var(--transition-base);
}

.trades-table tbody tr:hover {
    background: var(--bg-secondary);
    transform: scale(1.005);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.trades-table td {
    padding: var(--space-5) var(--space-6);
    border-bottom: 1px solid var(--color-gray-100);
    color: var(--text-primary);
    font-weight: var(--font-medium);
    font-size: var(--text-base);
    white-space: nowrap;
}

.trades-table tbody tr:last-child td {
    border-bottom: none;
}

.trades-table tbody tr:last-child td:first-child {
    border-bottom-left-radius: var(--radius-lg);
}

.trades-table tbody tr:last-child td:last-child {
    border-bottom-right-radius: var(--radius-lg);
}

/* Trade Win/Loss Rows */
.trade-win {
    background: linear-gradient(90deg, rgba(16, 185, 129, 0.08) 0%, rgba(16, 185, 129, 0.02) 100%);
    border-left: 4px solid var(--color-success-600);
}

.trade-loss {
    background: linear-gradient(90deg, rgba(239, 68, 68, 0.08) 0%, rgba(239, 68, 68, 0.02) 100%);
    border-left: 4px solid var(--color-danger-600);
}

/* Positive/Negative Values */
.trades-table .positive {
    color: var(--color-success-600);
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
}

.trades-table .negative {
    color: var(--color-danger-600);
    font-weight: var(--font-bold);
    font-size: var(--text-lg);
}

/* ============================================================================
   EQUITY CURVE
   ============================================================================ */

.equity-curve-container {
    background: white;
    padding: var(--space-8);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    margin-bottom: var(--space-8);
}

.equity-curve-container h4 {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin: 0 0 var(--space-6) 0;
}

/* ============================================================================
   STATUS BADGES
   ============================================================================ */

.status-badge {
    display: inline-flex;
    align-items: center;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius);
    font-size: var(--text-xs);
    font-weight: var(--font-bold);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: var(--color-success-100);
    color: var(--color-success-700);
}

.status-inactive {
    background: var(--color-gray-100);
    color: var(--color-gray-700);
}

/* ============================================================================
   MODALS
   ============================================================================ */

.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: var(--z-modal);
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal.active {
    display: flex;
}

.modal-content {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-2xl);
    max-width: 600px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn var(--transition-slow);
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    padding: var(--space-6);
    border-bottom: 2px solid var(--color-gray-100);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    font-size: var(--text-2xl);
    font-weight: var(--font-bold);
    color: var(--text-primary);
    margin: 0;
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--text-2xl);
    color: var(--text-secondary);
    cursor: pointer;
    padding: var(--space-2);
    line-height: 1;
    transition: color var(--transition-base);
}

.modal-close:hover {
    color: var(--text-primary);
}

.modal-body {
    padding: var(--space-6);
}

.modal-footer {
    padding: var(--space-6);
    border-top: 2px solid var(--color-gray-100);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 768px) {
    .backtest-form {
        padding: var(--space-6);
    }

    .trades-section {
        padding: var(--space-6);
    }

    .trades-table {
        font-size: var(--text-sm);
    }

    .trades-table th,
    .trades-table td {
        padding: var(--space-3) var(--space-4);
    }

    .pair-details,
    .strategy-details {
        grid-template-columns: 1fr;
    }

    .modal-content {
        margin: var(--space-4);
    }
}