.strategy-tester-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.strategy-tester-hero {
    background: radial-gradient(circle at top right, rgba(79, 70, 229, 0.35), rgba(15, 23, 42, 0.95));
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 18px;
    padding: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    box-shadow: 0 25px 45px rgba(2, 6, 23, 0.45);
}

.strategy-tester-hero__content {
    flex: 1 1 320px;
}

.strategy-tester-hero__content h2 {
    font-size: 2.15rem;
    margin: 0 0 0.5rem;
    color: #f8fafc;
}

.strategy-tester-hero__content p {
    margin: 0;
    color: rgba(226, 232, 240, 0.9);
    line-height: 1.6;
}

.strategy-tester-hero__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    flex: 1 1 260px;
}

.strategy-metric {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.2);
    border-radius: 14px;
    padding: 1rem;
}

.strategy-metric span {
    display: block;
}

.strategy-metric__label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(248, 250, 252, 0.7);
    margin-bottom: 0.35rem;
}

.strategy-metric__value {
    font-size: 1.35rem;
    font-weight: 600;
    color: #e2e8f0;
}

.strategy-metric__hint {
    font-size: 0.85rem;
    color: rgba(226, 232, 240, 0.7);
    margin-top: 0.35rem;
}

.strategy-config-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    align-items: start;
}

.strategy-controls-card,
.strategy-chart-card,
.strategy-trades-card {
    background: rgba(10, 12, 20, 0.85);
    border: 1px solid rgba(148, 163, 184, 0.14);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.35);
}

.strategy-controls-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem 1.25rem;
}

.strategy-field {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.strategy-field label {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(248, 250, 252, 0.75);
}

.strategy-field select,
.strategy-field input {
    appearance: none;
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: 12px;
    background: rgba(15, 23, 42, 0.85);
    color: #f8fafc;
    font-size: 0.95rem;
    padding: 0.75rem 0.95rem;
    min-height: 48px;
    font-family: inherit;
}

.strategy-field input[type="number"] {
    -moz-appearance: textfield;
}

.strategy-field input[type="checkbox"] {
    appearance: auto;
    width: 20px;
    height: 20px;
    min-height: auto;
    cursor: pointer;
}

.strategy-field.checkbox-field {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    background: rgba(30, 41, 59, 0.4);
    padding: 0.75rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.15);
}

.strategy-field.checkbox-field label {
    margin-bottom: 0;
    font-size: 0.85rem;
    color: #cbd5e1;
    cursor: pointer;
}

.strategy-field select:disabled,
.strategy-field input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.strategy-controls-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
}

.strategy-primary-btn {
    background: linear-gradient(135deg, #38bdf8, #6366f1);
    border: none;
    border-radius: 999px;
    color: #0f172a;
    font-weight: 600;
    padding: 0.9rem 1.65rem;
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 12px 30px rgba(79, 70, 229, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.strategy-primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.strategy-primary-btn:not(:disabled):hover {
    transform: translateY(-1px);
    box-shadow: 0 18px 32px rgba(79, 70, 229, 0.4);
}

.strategy-secondary-btn {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(148, 163, 184, 0.3);
    border-radius: 999px;
    color: #cbd5e1;
    font-weight: 500;
    padding: 0.9rem 1.5rem;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.strategy-secondary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.strategy-secondary-btn:not(:disabled):hover {
    background: rgba(30, 41, 59, 0.8);
    border-color: rgba(148, 163, 184, 0.5);
    color: #f8fafc;
}

.strategy-status {
    font-size: 0.9rem;
    color: rgba(226, 232, 240, 0.8);
}

.strategy-status[data-state="error"] {
    color: #f87171;
}

.strategy-meta-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.meta-tile {
    padding: 1rem;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: rgba(15, 23, 42, 0.85);
}

.meta-tile-label {
    display: block;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: rgba(248, 250, 252, 0.6);
    margin-bottom: 0.35rem;
}

.meta-tile-value {
    font-size: 1.05rem;
    color: #e2e8f0;
    font-weight: 500;
}

.strategy-params-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 1.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid rgba(148, 163, 184, 0.15);
}

.strategy-empty-params {
    grid-column: 1 / -1;
    font-size: 0.9rem;
    color: rgba(148, 163, 184, 0.7);
    font-style: italic;
    padding: 0.5rem 0;
}

.strategy-chart-wrapper {
    min-height: 500px;
    margin-top: 1rem;
    position: relative;
}

.strategy-chart-wrapper canvas {
    width: 100%;
    height: 500px;
}

.strategy-chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    color: rgba(226, 232, 240, 0.75);
    font-size: 1rem;
    border: 1px dashed rgba(148, 163, 184, 0.3);
    border-radius: 16px;
    background: rgba(15, 23, 42, 0.5);
}

.strategy-chart-empty[hidden] {
    display: none !important;
}

.strategy-footnote {
    font-size: 0.85rem;
    color: rgba(148, 163, 184, 0.85);
}

/* Trades Table */
.strategy-trades-card[hidden] {
    display: none !important;
}

.table-responsive {
    overflow-x: auto;
    margin-top: 1rem;
}

.strategy-trades-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    color: #e2e8f0;
}

.strategy-trades-table th,
.strategy-trades-table td {
    padding: 0.85rem 1rem;
    text-align: left;
    border-bottom: 1px solid rgba(148, 163, 184, 0.15);
}

.strategy-trades-table th {
    font-weight: 500;
    text-transform: uppercase;
    font-size: 0.75rem;
    letter-spacing: 0.05em;
    color: rgba(148, 163, 184, 0.8);
    background: rgba(15, 23, 42, 0.4);
    position: sticky;
    top: 0;
}

.strategy-trades-table th:first-child {
    border-top-left-radius: 8px;
    border-bottom-left-radius: 8px;
}

.strategy-trades-table th:last-child {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
}

.strategy-trades-table tr:last-child td {
    border-bottom: none;
}

.strategy-trades-table .text-right {
    text-align: right;
}

.trade-badge {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.trade-long {
    background: rgba(34, 197, 94, 0.15);
    color: #4ade80;
    border: 1px solid rgba(34, 197, 94, 0.2);
}

.trade-short {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.profit-positive {
    color: #4ade80;
    font-weight: 600;
}

.profit-negative {
    color: #f87171;
    font-weight: 600;
}

@media (max-width: 960px) {
    .strategy-tester-hero {
        flex-direction: column;
    }
    
    .strategy-config-row {
        grid-template-columns: 1fr;
    }

    .strategy-chart-wrapper canvas {
        height: 400px;
    }
}

@media (max-width: 600px) {
    .strategy-controls-grid {
        grid-template-columns: 1fr;
    }

    .strategy-primary-btn {
        width: 100%;
        text-align: center;
    }
}
