/* Modern, clean, responsive styling */

:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --success-color: #10b981;
    --warning-color: #f59e0b;
    --danger-color: #ef4444;
    --background: #f8fafc;
    --surface: #ffffff;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --border: #e2e8f0;
    --border-radius: 12px;
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
    flex: 1;
}

/* Header */
header {
    margin-bottom: 3rem;
    text-align: center;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.5rem;
}

.subtitle {
    font-size: 1.125rem;
    color: var(--text-secondary);
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content h1 {
    margin: 0;
}

/* Provider Grid */
.provider-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.provider-card {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    border: 2px solid transparent;
}

.provider-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
    border-color: var(--primary-color);
}

.provider-icon {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.provider-card h2 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.provider-card p {
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Status Badges */
.status-badge {
    display: inline-block;
    padding: 0.375rem 0.75rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    text-transform: uppercase;
}

.status-active {
    background-color: #d1fae5;
    color: #065f46;
}

.status-coming {
    background-color: #fef3c7;
    color: #92400e;
}

/* Buttons */
.btn-primary, .btn-secondary {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--surface);
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.btn-secondary:hover {
    background-color: var(--primary-color);
    color: white;
}

/* Coming Soon */
.coming-soon {
    text-align: center;
    padding: 4rem 2rem;
}

.coming-soon-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.coming-soon h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.coming-soon p {
    font-size: 1.125rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

/* Filters */
.filters {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 200px;
}

.filter-group label {
    display: block;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.filter-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--surface);
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
}

.filter-group select:hover {
    border-color: var(--primary-color);
}

.filter-group select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* Multi-select component */
.multi-select {
    position: relative;
    width: 100%;
}

.multi-select-display {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background-color: var(--surface);
    color: var(--text-primary);
    font-size: 0.9375rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.multi-select-display:hover {
    border-color: var(--primary-color);
}

.multi-select.active .multi-select-display {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.multi-select-text {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.multi-select-arrow {
    margin-left: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.75rem;
    transition: transform 0.2s;
}

.multi-select.active .multi-select-arrow {
    transform: rotate(180deg);
}

.multi-select-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    max-height: 300px;
    overflow-y: auto;
    z-index: 1000;
    display: none;
}

.multi-select.active .multi-select-dropdown {
    display: block;
}

.multi-select-option {
    padding: 0;
}

.multi-select-option label {
    display: flex;
    align-items: center;
    padding: 0.625rem 0.875rem;
    cursor: pointer;
    transition: background-color 0.15s;
    user-select: none;
}

.multi-select-option label:hover {
    background-color: var(--background);
}

.multi-select-option input[type="checkbox"] {
    margin-right: 0.625rem;
    cursor: pointer;
    width: 1rem;
    height: 1rem;
    accent-color: var(--primary-color);
}

.multi-select-option span {
    flex: 1;
    color: var(--text-primary);
    font-size: 0.9375rem;
}

.multi-select-option:first-child {
    border-bottom: 1px solid var(--border);
    background-color: var(--background);
}

.multi-select-option:first-child label {
    font-weight: 600;
}

/* Summary Banner */
.summary-banner {
    display: flex;
    gap: 2rem;
    padding: 1.5rem 2rem;
    background: var(--surface);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-md);
    margin-bottom: 2rem;
    flex-wrap: wrap;
    justify-content: space-around;
}

.summary-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    min-width: 200px;
}

.summary-label {
    font-size: 0.875rem;
    color: var(--text-secondary);
    font-weight: 500;
    text-align: center;
}

.summary-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-align: center;
}

/* Dashboard Grid */
.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
    gap: 2rem;
    margin-bottom: 3rem;
}

.chart-container, .break-even-container {
    background: var(--surface);
    border-radius: var(--border-radius);
    padding: 2rem;
    box-shadow: var(--shadow-md);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.section-header h2 {
    font-size: 1.5rem;
    color: var(--text-primary);
}

.info-tooltip {
    cursor: help;
    color: var(--text-secondary);
}

/* Chart */
canvas {
    max-height: 400px;
}

/* Multi-column legend at bottom - Chart.js renders on canvas, so we style the container */
.chart-container {
    position: relative;
}

/* Style the chart canvas wrapper to ensure proper spacing */
.chart-container canvas {
    display: block;
}

/* Add spacing for bottom legend */
.chart-container::after {
    content: '';
    display: block;
    height: 150px; /* Space for multi-row legend */
    min-height: 150px;
}

.chart-note {
    margin-top: 1rem;
    font-size: 0.875rem;
    color: var(--text-secondary);
    text-align: center;
}

/* Break-Even Table */
#break-even-table-container {
    position: relative;
}

.table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    background-color: var(--background);
    padding: 0.75rem;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border-bottom: 2px solid var(--border);
}

tbody td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
}

tbody tr:hover {
    background-color: var(--background);
}

/* Mobile card layout for break-even table */
.break-even-card {
    display: none;
    background: var(--background);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border: 1px solid var(--border);
}

.break-even-card-header {
    font-weight: 600;
    font-size: 1.125rem;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid var(--border);
}

.break-even-card-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}

.break-even-card-row:last-child {
    border-bottom: none;
}

.break-even-card-label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.875rem;
}

.break-even-card-value {
    font-weight: 600;
    color: var(--text-primary);
    text-align: right;
}

/* Break-Even Badges */
.break-even-good {
    color: var(--success-color);
    font-weight: 600;
}

.break-even-fair {
    color: var(--warning-color);
    font-weight: 600;
}

.break-even-warning {
    color: var(--warning-color);
    font-weight: 600;
}

.break-even-poor {
    color: var(--danger-color);
    font-weight: 600;
}

/* Loading Spinner */
.loading-spinner {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
}

/* Footer */
footer {
    margin-top: auto;
    padding-top: 2rem;
    text-align: center;
    color: var(--text-secondary);
    font-size: 0.875rem;
    border-top: 1px solid var(--border);
}

/* Responsive */
/* Small desktop / Large tablet - break dashboard grid earlier */
@media (max-width: 1200px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-container::after {
        height: 120px;
        min-height: 120px;
    }
}

/* Tablet */
@media (max-width: 900px) {
    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }
    
    .summary-banner {
        flex-direction: column;
        gap: 1rem;
    }
    
    .summary-item {
        min-width: 100%;
        border-bottom: 1px solid var(--border);
        padding-bottom: 1rem;
    }
    
    .summary-item:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
    
    .chart-container::after {
        height: 100px;
        min-height: 100px;
    }
}

/* Mobile */
@media (max-width: 768px) {
    .container {
        padding: 1rem;
    }

    header h1 {
        font-size: 2rem;
    }

    .header-content {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .header-content .btn-secondary {
        width: 100%;
        text-align: center;
    }

    .provider-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
    
    .chart-container, .break-even-container {
        padding: 1.5rem;
    }

    .filters {
        flex-direction: column;
    }
    
    .filter-group {
        min-width: 100%;
    }

    /* Hide table on mobile, show cards instead */
    #break-even-table {
        display: none !important;
    }
    
    .break-even-card {
        display: block;
    }
    
    /* Chart adjustments for mobile */
    .chart-container::after {
        height: 80px;
        min-height: 80px;
    }
    
    canvas {
        max-height: 300px;
    }
    
    .chart-note {
        font-size: 0.75rem;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0.75rem;
    }
    
    header h1 {
        font-size: 1.5rem;
    }

    .section-header h2 {
        font-size: 1.25rem;
    }

    .chart-container, .break-even-container {
        padding: 1rem;
    }
    
    .summary-banner {
        padding: 1rem;
    }
    
    .summary-value {
        font-size: 1.25rem;
    }
    
    .chart-container::after {
        height: 60px;
        min-height: 60px;
    }
    
    canvas {
        max-height: 250px;
    }
}

