/**
 * Scenario Comparison Styles
 * Optimized for horizontal scrolling with sticky columns
 */

#scenario-comparison-container.scenario-comparison-hidden {
    display: none;
}

#scenario-comparison-container {
    transition: opacity 0.2s ease-in-out;
}

/* ===== Main Container ===== */
.scenario-comparison-wrapper {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin: 2rem 0;
}

/* ===== Header Section ===== */
.scenario-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #f0f0f0;
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
}

.scenario-header h5 {
    font-weight: 600;
    color: #2c3e50;
}

.scenario-controls {
    display: flex;
    gap: 0.5rem;
}

/* ===== Horizontal Scroll Container ===== */
.scenario-scroll-container {
    overflow-x: auto;
    overflow-y: visible;
    position: relative;
    max-width: 100%;
    scroll-behavior: smooth;
    
    /* Custom scrollbar styling */
    scrollbar-width: thin;
    scrollbar-color: #0d6efd #f8f9fa;
}

/* WebKit scrollbar styling (Chrome, Safari, Edge) */
.scenario-scroll-container::-webkit-scrollbar {
    height: 12px;
}

.scenario-scroll-container::-webkit-scrollbar-track {
    background: #f8f9fa;
    border-radius: 6px;
    margin: 0 1rem;
}

.scenario-scroll-container::-webkit-scrollbar-thumb {
    background: linear-gradient(90deg, #0d6efd 0%, #0a58ca 100%);
    border-radius: 6px;
    border: 2px solid #f8f9fa;
}

.scenario-scroll-container::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(90deg, #0a58ca 0%, #084298 100%);
}

/* ===== Table Styling ===== */
.scenario-comparison-table {
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    width: max-content;
    min-width: 100%;
}

/* ===== Sticky Header ===== */
.sticky-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: white;
}

.sticky-header th {
    background: linear-gradient(180deg, #0d6efd 0%, #0a58ca 100%);
    color: white;
    font-weight: 600;
    padding: 1rem;
    border: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    vertical-align: middle;
}

/* ===== Sticky First Column ===== */
.sticky-column {
    position: sticky;
    left: 0;
    z-index: 11;
    background: white;
    box-shadow: 2px 0 4px rgba(0, 0, 0, 0.08);
}

.sticky-header .sticky-column {
    z-index: 12;
    background: linear-gradient(180deg, #084298 0%, #052c65 100%);
}

/* ===== Column Widths ===== */
.channel-column {
    min-width: 200px;
    width: 200px;
}

.scenario-column {
    min-width: 180px;
    width: 180px;
}

/* ===== Header Content ===== */
.scenario-header-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: center;
    text-align: center;
}

.scenario-name {
    font-size: 0.95rem;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.scenario-meta {
    display: flex;
    gap: 0.25rem;
    flex-wrap: wrap;
    justify-content: center;
}

.scenario-meta .badge {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
}

/* ===== Channel Names ===== */
.channel-name {
    font-weight: 600;
    color: #2c3e50;
    padding: 1rem;
    white-space: nowrap;
}

.channel-name i {
    opacity: 0.6;
}

/* ===== Budget Cells ===== */
.scenario-value {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    text-align: center;
}

.budget-cell {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    align-items: center;
}

.current-budget {
    font-size: 0.75rem;
    text-decoration: line-through;
    opacity: 0.7;
}

.recommended-budget {
    font-size: 1.1rem;
    color: #2c3e50;
}

.change-indicator {
    font-size: 0.85rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    display: inline-block;
}

.change-indicator.text-success {
    background: rgba(25, 135, 84, 0.1);
}

.change-indicator.text-danger {
    background: rgba(220, 53, 69, 0.1);
}

.change-indicator.text-secondary {
    background: rgba(108, 117, 125, 0.1);
}

/* ===== Change Bar (Progress Indicator) ===== */
.change-bar {
    width: 100%;
    height: 4px;
    background: #e9ecef;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 0.25rem;
}

.change-bar-fill {
    height: 100%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

.change-bar-fill.positive {
    background: linear-gradient(90deg, #28a745 0%, #20c997 100%);
}

.change-bar-fill.negative {
    background: linear-gradient(90deg, #dc3545 0%, #fd7e14 100%);
}

/* ===== Sticky Footer ===== */
.sticky-footer {
    position: sticky;
    bottom: 0;
    z-index: 9;
    background: white;
}

.sticky-footer td {
    background: linear-gradient(180deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 1rem;
    border-top: 2px solid #dee2e6;
    font-weight: 700;
}

.sticky-footer .sticky-column {
    background: linear-gradient(180deg, #e9ecef 0%, #dee2e6 100%);
    z-index: 11;
}

.total-budget {
    text-align: center;
}

/* ===== Insights Panel ===== */
.scenario-insights {
    padding: 1.5rem;
    background: #f8f9fa;
    border-top: 2px solid #e9ecef;
}

.insight-card {
    background: white;
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.insight-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
}

.insight-icon {
    font-size: 2rem;
    width: 60px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(13, 110, 253, 0.1);
}

.insight-icon.text-success {
    background: rgba(25, 135, 84, 0.1);
}

.insight-icon.text-info {
    background: rgba(13, 202, 240, 0.1);
}

.insight-icon.text-warning {
    background: rgba(255, 193, 7, 0.1);
}

.insight-content {
    flex: 1;
}

.insight-label {
    font-size: 0.85rem;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.insight-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #2c3e50;
}

/* ===== Empty State ===== */
.empty-state {
    padding: 3rem 2rem;
}

.empty-state i {
    opacity: 0.3;
}

/* ===== Responsive Design ===== */
@media (max-width: 768px) {
    .scenario-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .scenario-controls {
        width: 100%;
        justify-content: space-between;
    }
    
    .scenario-controls .btn {
        flex: 1;
    }
    
    .channel-column {
        min-width: 150px;
        width: 150px;
    }
    
    .scenario-column {
        min-width: 150px;
        width: 150px;
    }
    
    .recommended-budget {
        font-size: 1rem;
    }
    
    .insight-card {
        flex-direction: column;
        text-align: center;
    }
    
    .insight-icon {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    .channel-column {
        min-width: 120px;
        width: 120px;
    }
    
    .scenario-column {
        min-width: 120px;
        width: 120px;
    }
    
    .scenario-header h5 {
        font-size: 1rem;
    }
    
    .recommended-budget {
        font-size: 0.9rem;
    }
    
    .channel-name {
        font-size: 0.85rem;
    }
}

/* ===== Accessibility ===== */
@media (prefers-reduced-motion: reduce) {
    .change-bar-fill,
    .insight-card {
        transition: none;
    }
}

/* ===== Print Styles ===== */
@media print {
    .scenario-scroll-container {
        overflow: visible;
    }
    
    .sticky-column,
    .sticky-header,
    .sticky-footer {
        position: static;
    }
    
    .scenario-controls {
        display: none;
    }
}
