/* ===================================
   LBO Results Display Styles
   =================================== */

/* LBO Result Header */
.lbo-result-header {
    background: linear-gradient(135deg, #1e3a5f 0%, #2d5a87 100%);
    color: #fff;
    padding: 1.25rem 1.5rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.lbo-result-header h5 {
    color: #ffc107;
    margin-bottom: 0.5rem;
    font-size: 1.25rem;
    font-weight: 600;
}

/* LBO Section Headers */
.lbo-returns-section h6,
.lbo-sources-uses-section h6,
.lbo-projections-section h6,
.lbo-debt-section h6,
.lbo-sensitivity-section h6,
.lbo-analysis-section h6,
.lbo-cim-extracts-section h6 {
    color: #6c757d;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Returns Cards */
.lbo-returns-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.lbo-return-card {
    border-radius: 8px;
    padding: 1.25rem;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: default;
}

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

.lbo-return-card.irr-card {
    border-left: 4px solid #10b981;
    background: linear-gradient(135deg, #ffffff 0%, #f0fdf4 100%);
}

.lbo-return-card.moic-card {
    border-left: 4px solid #3b82f6;
    background: linear-gradient(135deg, #ffffff 0%, #eff6ff 100%);
}

.lbo-return-card.equity-card {
    border-left: 4px solid #8b5cf6;
    background: linear-gradient(135deg, #ffffff 0%, #f5f3ff 100%);
}

.lbo-return-card.profit-card {
    border-left: 4px solid #f59e0b;
    background: linear-gradient(135deg, #ffffff 0%, #fffbeb 100%);
}

.lbo-return-label {
    display: block;
    font-size: 0.75rem;
    color: #6c757d;
    margin-bottom: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.lbo-return-value {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.lbo-return-value.irr { color: #10b981; }
.lbo-return-value.moic { color: #3b82f6; }
.lbo-return-value.equity { color: #8b5cf6; }
.lbo-return-value.profit { color: #f59e0b; }

.lbo-return-unit {
    font-size: 1rem;
    color: #6c757d;
    margin-left: 0.125rem;
}

/* Chart Containers */
.lbo-chart-container {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-top: 1.25rem;
    height: 200px;
    position: relative;
}

.lbo-chart-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

/* Sources & Uses */
.lbo-sources-uses-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.lbo-sources-box,
.lbo-uses-box {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.lbo-sources-box h4,
.lbo-uses-box h4 {
    font-size: 0.875rem;
    font-weight: 600;
    color: #ffffff;
    margin: 0;
    padding: 0.75rem 1rem;
}

.lbo-sources-box h4 {
    background: #10b981;
}

.lbo-uses-box h4 {
    background: #ef4444;
}

.lbo-sources-list,
.lbo-uses-list {
    background: #f8f9fa;
    padding: 1rem;
}

.lbo-source-item,
.lbo-use-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    border-bottom: 1px solid #e9ecef;
}

.lbo-source-item:last-child,
.lbo-use-item:last-child {
    border-bottom: none;
}

.lbo-source-name,
.lbo-use-name {
    color: #495057;
    font-weight: 500;
}

.lbo-source-amount,
.lbo-use-amount {
    font-weight: 600;
    color: #212529;
}

.lbo-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-top: 0.75rem;
    border-top: 2px solid #495057;
    font-weight: 600;
    font-size: 0.875rem;
    color: #212529;
}

/* Data Tables */
.lbo-table-container {
    overflow-x: auto;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.lbo-data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    background: #ffffff;
}

.lbo-data-table thead th {
    background: #f8f9fa;
    color: #495057;
    font-weight: 600;
    padding: 0.625rem 0.75rem;
    text-align: right;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid #dee2e6;
}

.lbo-data-table thead th:first-child {
    text-align: left;
}

.lbo-data-table tbody td {
    padding: 0.625rem 0.75rem;
    text-align: right;
    border-bottom: 1px solid #e9ecef;
    color: #495057;
}

.lbo-data-table tbody td:first-child {
    text-align: left;
    font-weight: 500;
}

.lbo-data-table tbody tr:hover td {
    background: #f8f9fa;
}

/* Sensitivity Heatmap */
.lbo-sensitivity-table .cell-best {
    background: rgba(16, 185, 129, 0.15);
    font-weight: 600;
    color: #10b981;
}

.lbo-sensitivity-table .cell-base {
    background: rgba(59, 130, 246, 0.15);
    font-weight: 600;
    color: #3b82f6;
}

.lbo-sensitivity-table .cell-worst {
    background: rgba(239, 68, 68, 0.15);
    font-weight: 600;
    color: #ef4444;
}

.lbo-sensitivity-legend {
    display: flex;
    gap: 1.25rem;
    margin-top: 0.75rem;
    font-size: 0.75rem;
    color: #6c757d;
}

.lbo-legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.lbo-legend-item::before {
    content: '';
    width: 12px;
    height: 12px;
    border-radius: 2px;
}

.lbo-legend-item.best::before {
    background: rgba(16, 185, 129, 0.3);
}

.lbo-legend-item.base::before {
    background: rgba(59, 130, 246, 0.3);
}

.lbo-legend-item.worst::before {
    background: rgba(239, 68, 68, 0.3);
}

/* CIM Extracts Section */
.lbo-cim-extracts-section {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.lbo-cim-tabs {
    display: flex;
    gap: 0.75rem;
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 0.5rem;
    margin-bottom: 1rem;
}

.lbo-cim-tab {
    flex: 1;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    color: #6c757d;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: center;
}

.lbo-cim-tab:hover {
    background: #f8f9fa;
    color: #495057;
}

.lbo-cim-tab.active {
    color: #212529;
    background: #f59e0b;
    border-color: #f59e0b;
}

.lbo-cim-pane {
    display: block;
}

.lbo-cim-pane.hidden {
    display: none;
}

.lbo-cim-doc-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 0.5rem;
    background: #ffffff;
}

.lbo-cim-doc-item {
    padding: 0.625rem 0.75rem;
    border-radius: 6px;
    cursor: pointer;
    border: 1px solid transparent;
    margin-bottom: 0.5rem;
    transition: all 0.2s;
}

.lbo-cim-doc-item:hover {
    background: #f8f9fa;
    border-color: #dee2e6;
}

.lbo-cim-doc-item.active {
    background: rgba(245, 158, 11, 0.1);
    border-color: #f59e0b;
}

.lbo-cim-doc-filename {
    font-weight: 500;
    color: #212529;
    font-size: 0.875rem;
}

.lbo-cim-doc-meta {
    font-size: 0.75rem;
    color: #6c757d;
    margin-top: 0.125rem;
}

.lbo-cim-detail-card {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
}

.lbo-cim-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.lbo-cim-detail-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lbo-cim-detail-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
    font-weight: 500;
}

.lbo-cim-detail-value {
    font-size: 0.9375rem;
    color: #212529;
    font-weight: 500;
}

.lbo-cim-empty-state {
    color: #6c757d;
    font-size: 0.875rem;
    text-align: center;
    padding: 2rem;
}

/* Analysis Accordion */
.lbo-analysis-accordion details {
    background: #ffffff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 0.5rem;
    overflow: hidden;
}

.lbo-analysis-accordion summary {
    background: #f8f9fa;
    padding: 0.75rem 1rem;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 500;
    color: #495057;
    transition: background 0.2s;
    user-select: none;
}

.lbo-analysis-accordion summary:hover {
    background: #e9ecef;
}

.lbo-analysis-accordion summary::-webkit-details-marker {
    display: none;
}

.lbo-analysis-accordion summary::after {
    content: '+';
    font-weight: 600;
    font-size: 1.125rem;
}

.lbo-analysis-accordion details[open] summary::after {
    content: '-';
}

.lbo-analysis-accordion div {
    padding: 1rem;
    font-size: 0.875rem;
    color: #495057;
}

.lbo-analysis-accordion ul {
    margin: 0;
    padding-left: 1.25rem;
}

.lbo-analysis-accordion li {
    margin-bottom: 0.375rem;
}

/* Badges */
.lbo-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    margin-left: 0.5rem;
}

.lbo-badge.high {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.lbo-badge.medium {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.lbo-badge.low {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

.lbo-badge.secondary {
    background: rgba(108, 117, 125, 0.15);
    color: #6c757d;
}

/* Metric Badges */
.lbo-metric-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    border-radius: 4px;
    font-size: 0.7rem;
    font-weight: 500;
    gap: 0.375rem;
}

.lbo-metric-badge.positive {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.lbo-metric-badge.negative {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.lbo-metric-badge.neutral {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
}

/* Workspace Status */
.lbo-workspace-status {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.lbo-workspace-status.loading {
    background: #fff3cd;
    border-color: #ffc107;
}

/* Export Buttons */
.lbo-export-buttons {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}

.lbo-export-button {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    background: #ffffff;
    color: #495057;
}

.lbo-export-button:hover:not(:disabled) {
    background: #f8f9fa;
    border-color: #adb5bd;
}

.lbo-export-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.lbo-export-button.primary {
    background: #10b981;
    color: #ffffff;
    border-color: #10b981;
}

.lbo-export-button.primary:hover:not(:disabled) {
    background: #059669;
}

/* Raw JSON Toggle */
.lbo-raw-json-toggle {
    margin-top: 1rem;
}

.lbo-raw-json {
    max-height: 400px;
    overflow-y: auto;
    background: #212529;
    color: #d1d5db;
    padding: 1rem;
    border-radius: 6px;
    font-size: 0.75rem;
    font-family: 'Monaco', 'Courier New', monospace;
}

/* Responsive */
@media (max-width: 768px) {
    .lbo-returns-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .lbo-sources-uses-grid,
    .lbo-chart-row {
        grid-template-columns: 1fr;
    }

    .lbo-cim-detail-grid {
        grid-template-columns: 1fr;
    }
}
