/* RCM Analytics Dashboard CSS */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #f8f9fa;
    color: #333;
    line-height: 1.6;
}

.dashboard-container {
    display: grid;
    grid-template-areas: 
        "header header"
        "sidebar main";
    grid-template-columns: 250px 1fr;
    grid-template-rows: auto 1fr;
    min-height: 100vh;
}

/* Header Styles */
.dashboard-header {
    grid-area: header;
    background: linear-gradient(135deg, #1f77b4 0%, #1565c0 100%);
    color: white;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.header-content h1 {
    font-size: 1.8rem;
    margin-bottom: 0.25rem;
}

.header-content p {
    opacity: 0.9;
    font-size: 0.9rem;
}

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

/* Button Styles */
.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-primary {
    background-color: #007bff;
    color: white;
}

.btn-primary:hover {
    background-color: #0056b3;
}

.btn-secondary {
    background-color: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background-color: #545b62;
}

.full-width {
    width: 100%;
}

/* Sidebar Styles */
.filters-sidebar {
    grid-area: sidebar;
    background: white;
    padding: 1.5rem;
    border-right: 1px solid #dee2e6;
    height: calc(100vh - 80px);
    overflow-y: auto;
}

.filters-sidebar h3 {
    color: #495057;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.filter-group {
    margin-bottom: 1.5rem;
}

.filter-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: #495057;
}

.filter-select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #ced4da;
    border-radius: 4px;
    background-color: white;
    font-size: 0.9rem;
}

.filter-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* Main Content Styles */
.dashboard-main {
    grid-area: main;
    padding: 2rem;
    overflow-y: auto;
    height: calc(100vh - 80px);
}

/* Tab Navigation */
.tab-navigation {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 2rem;
    border-bottom: 2px solid #dee2e6;
}

.tab-btn {
    padding: 0.75rem 1.5rem;
    border: none;
    background: none;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.3s ease;
    font-size: 0.9rem;
    color: #6c757d;
}

.tab-btn.active {
    color: #007bff;
    border-bottom-color: #007bff;
    background-color: rgba(0, 123, 255, 0.1);
}

.tab-btn:hover {
    color: #007bff;
    background-color: rgba(0, 123, 255, 0.05);
}

/* Tab Content */
.tab-content {
    display: none;
    animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
    display: block;
}

.tab-content h2 {
    color: #343a40;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* KPI Grid */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

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

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

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff, #0056b3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.2rem;
}

.kpi-content h3 {
    font-size: 0.9rem;
    color: #6c757d;
    margin-bottom: 0.25rem;
}

.kpi-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #212529;
    margin-bottom: 0.25rem;
}

.kpi-change {
    font-size: 0.8rem;
    font-weight: 500;
}

.kpi-change.positive {
    color: #28a745;
}

.kpi-change.negative {
    color: #dc3545;
}

/* Charts Grid */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-container {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.chart-container.full-width {
    grid-column: 1 / -1;
    margin-bottom: 2rem;
}

.chart-container h4 {
    color: #495057;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    border-bottom: 2px solid #007bff;
    padding-bottom: 0.5rem;
}

/* Chart Divs */
.chart-container > div[id] {
    min-height: 300px;
    width: 100%;
}

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

.insight-card {
    padding: 1.5rem;
    border-radius: 8px;
    border-left: 4px solid;
}

.insight-card.info {
    background-color: #d1ecf1;
    border-left-color: #17a2b8;
}

.insight-card.warning {
    background-color: #fff3cd;
    border-left-color: #ffc107;
}

.insight-card.success {
    background-color: #d4edda;
    border-left-color: #28a745;
}

.insight-card h5 {
    margin-bottom: 0.5rem;
    color: #495057;
}

.insight-card p {
    margin: 0;
    color: #6c757d;
}

/* Table Styles */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.data-table th,
.data-table td {
    padding: 0.75rem;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.data-table th {
    background-color: #f8f9fa;
    font-weight: 600;
    color: #495057;
}

.data-table tr:hover {
    background-color: #f8f9fa;
}

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-container {
        grid-template-areas: 
            "header"
            "main";
        grid-template-columns: 1fr;
    }
    
    .filters-sidebar {
        display: none;
    }
    
    .dashboard-main {
        height: calc(100vh - 60px);
    }
    
    .tab-navigation {
        overflow-x: auto;
        white-space: nowrap;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .insights-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .dashboard-header {
        padding: 1rem;
    }
    
    .header-content h1 {
        font-size: 1.4rem;
    }
    
    .header-controls {
        flex-direction: column;
        gap: 0.25rem;
    }
    
    .dashboard-main {
        padding: 1rem;
    }
    
    .tab-btn {
        padding: 0.5rem 1rem;
        font-size: 0.8rem;
    }
    
    .kpi-card {
        padding: 1rem;
    }
    
    .chart-container {
        padding: 1rem;
    }
}

/* Loading States */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    color: #6c757d;
}

.loading::after {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid #dee2e6;
    border-top: 2px solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-left: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Utility Classes */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }