/* scenarioEngine.css — What-If Scenario Engine styles */

.scenario-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    font-family: 'DM Sans', system-ui, sans-serif;
}

/* Layout: two-panel */
.scenario-layout {
    display: flex;
    gap: 24px;
    align-items: flex-start;
}
.scenario-controls {
    flex: 0 0 320px;
    background: #faf8f5;
    border: 1px solid #e8e4e0;
    border-radius: 10px;
    padding: 20px;
    position: sticky;
    top: 20px;
}
.scenario-preview {
    flex: 1;
    min-width: 0;
}

/* Panel titles */
.scenario-panel-title {
    font-family: 'Fraunces', serif;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 18px 0;
    padding-bottom: 10px;
    border-bottom: 1px solid #e8e4e0;
}

/* Control groups */
.scenario-group {
    margin-bottom: 16px;
}
.scenario-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #5a6577;
    margin-bottom: 6px;
}

/* Sliders */
.scenario-slider-row {
    display: flex;
    align-items: center;
    gap: 10px;
}
.scenario-range {
    flex: 1;
    -webkit-appearance: none;
    appearance: none;
    height: 6px;
    background: #ddd8d3;
    border-radius: 3px;
    outline: none;
}
.scenario-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #5b6eae;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.scenario-range::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #5b6eae;
    cursor: pointer;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.scenario-range-value {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    min-width: 48px;
    text-align: right;
    color: #1a1a1a;
}

/* Number inputs */
.scenario-input-row {
    display: flex;
    align-items: center;
    gap: 6px;
}
.scenario-currency {
    font-size: 14px;
    color: #717e96;
    font-weight: 500;
}
.scenario-input {
    flex: 1;
    padding: 7px 10px;
    border: 1px solid #d4d0c8;
    border-radius: 6px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}
.scenario-input:focus {
    border-color: #5b6eae;
}

/* Action buttons */
.scenario-actions {
    display: flex;
    gap: 8px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #e8e4e0;
}
.scenario-btn {
    flex: 1;
    padding: 8px 14px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    transition: background 0.15s, transform 0.1s;
}
.scenario-btn:active {
    transform: scale(0.97);
}
.scenario-btn-reset {
    background: #e8e4e0;
    color: #5a6577;
}
.scenario-btn-reset:hover {
    background: #ddd8d3;
}
.scenario-btn-save {
    background: #5b6eae;
    color: #fff;
}
.scenario-btn-save:hover {
    background: #4a5d9d;
}
.scenario-btn-compare {
    width: 100%;
    margin-top: 10px;
    background: #c4576a;
    color: #fff;
}
.scenario-btn-compare:hover {
    background: #b3465a;
}

/* Saved scenarios */
.scenario-saved-section {
    margin-top: 16px;
}
.scenario-subtitle {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #5a6577;
    margin: 0 0 8px 0;
}
.scenario-saved-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.scenario-saved-item {
    padding: 8px 12px;
    background: #fff;
    border: 1px solid #e8e4e0;
    border-radius: 6px;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}
.scenario-saved-item:hover {
    border-color: #5b6eae;
    background: #f5f3f0;
}
.scenario-saved-name {
    font-size: 13px;
    font-weight: 600;
    color: #1a1a1a;
}
.scenario-saved-detail {
    font-size: 11px;
    color: #717e96;
    font-family: 'JetBrains Mono', monospace;
    margin-top: 2px;
}

/* Impact cards */
.scenario-impact-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}
.scenario-impact-card {
    flex: 1;
    min-width: 130px;
    padding: 14px 16px;
    background: #faf8f5;
    border: 1px solid #e8e4e0;
    border-radius: 8px;
}
.scenario-impact-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #717e96;
    margin-bottom: 4px;
}
.scenario-impact-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    color: #1a1a1a;
}
.scenario-impact-value.positive { color: #38a169; }
.scenario-impact-value.negative { color: #c53030; }

/* P&L comparison table */
.scenario-pl-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid #e8e4e0;
    border-radius: 8px;
    overflow: hidden;
}
.scenario-pl-table thead th {
    padding: 10px 14px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #5a6577;
    background: #faf8f5;
    border-bottom: 1px solid #e8e4e0;
    text-align: right;
}
.scenario-pl-table thead th:first-child {
    text-align: left;
}
.scenario-pl-table td {
    padding: 10px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    text-align: right;
    border-bottom: 1px solid #f0ece8;
}
.scenario-pl-table td:first-child {
    text-align: left;
    font-family: 'DM Sans', sans-serif;
    font-weight: 500;
}
.scenario-pl-table .positive { color: #38a169; }
.scenario-pl-table .negative { color: #c53030; }
.scenario-pl-net {
    background: #faf8f5;
}
.scenario-pl-net td {
    border-top: 2px solid #e8e4e0;
    border-bottom: none;
}
.scenario-changed-row {
    background: rgba(91, 110, 174, 0.04);
}

/* Chart container */
.scenario-chart-container {
    margin-bottom: 24px;
    padding: 16px;
    background: #fff;
    border: 1px solid #e8e4e0;
    border-radius: 8px;
}

/* Sensitivity analysis */
.scenario-sensitivity-section {
    margin-top: 20px;
}
.scenario-sensitivity-table {
    width: 100%;
    border-collapse: collapse;
    background: #fff;
    border: 1px solid #e8e4e0;
    border-radius: 8px;
    overflow: hidden;
}
.scenario-sensitivity-table thead th {
    padding: 8px 12px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #5a6577;
    background: #faf8f5;
    border-bottom: 1px solid #e8e4e0;
    text-align: right;
}
.scenario-sensitivity-table thead th:first-child {
    text-align: left;
}
.scenario-sensitivity-table td {
    padding: 8px 12px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 12px;
    text-align: right;
    border-bottom: 1px solid #f0ece8;
}
.scenario-sensitivity-table td:first-child {
    text-align: left;
    font-weight: 600;
}
.scenario-sensitivity-table .positive { color: #38a169; }
.scenario-sensitivity-table .negative { color: #c53030; }
.scenario-sensitivity-active {
    background: rgba(91, 110, 174, 0.08);
    font-weight: 600;
}
.scenario-sensitivity-active td {
    font-weight: 600;
}
.scenario-sensitivity-loss {
    background: rgba(197, 48, 48, 0.04);
}

/* Comparison overlay/modal */
.scenario-compare-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scenario-compare-modal {
    background: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 700px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.scenario-compare-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e8e4e0;
}
.scenario-compare-header h3 {
    font-family: 'Fraunces', serif;
    font-size: 16px;
    font-weight: 600;
    margin: 0;
}
.scenario-compare-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: #f0ece8;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.scenario-compare-close:hover {
    background: #e8e4e0;
}
.scenario-compare-table {
    width: 100%;
    border-collapse: collapse;
}
.scenario-compare-table th {
    padding: 10px 16px;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: #5a6577;
    background: #faf8f5;
    border-bottom: 1px solid #e8e4e0;
    text-align: right;
}
.scenario-compare-table th:first-child {
    text-align: left;
}
.scenario-compare-table td {
    padding: 10px 16px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    text-align: right;
    border-bottom: 1px solid #f0ece8;
}
.scenario-compare-table td:first-child {
    text-align: left;
    font-family: 'DM Sans', sans-serif;
    font-weight: 600;
}

/* Responsive */
@media (max-width: 768px) {
    .scenario-layout {
        flex-direction: column;
    }
    .scenario-controls {
        flex: none;
        width: 100%;
        position: static;
    }
    .scenario-impact-cards {
        flex-direction: column;
    }
}
