/* Dashboard Modal Styles */

.dashboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 1rem;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.dashboard-container {
    background: white;
    border-radius: 12px;
    width: 100%;
    max-width: 1400px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease-out;
}

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

/* Header */
.dashboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 2rem;
    border-bottom: 1px solid #e5e7eb;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.dashboard-header h2 {
    margin: 0;
    font-size: 1.5rem;
    color: #1f2937;
}

.dashboard-controls {
    display: flex;
    gap: 1rem;
    align-items: center;
}

#dashboard-year-selector {
    min-width: 120px;
}

/* Loading State */
.dashboard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
}

.spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Error State */
.dashboard-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    gap: 1rem;
}

.error-message {
    color: #ef4444;
    font-size: 1rem;
}

/* Content */
.dashboard-content {
    padding: 2rem;
}

.dashboard-section {
    margin-bottom: 3rem;
}

.dashboard-section:last-child {
    margin-bottom: 0;
}

.dashboard-section h3 {
    margin: 0 0 1.5rem 0;
    font-size: 1.25rem;
    color: #374151;
    font-weight: 600;
}

/* Annual Summary Grid */
.annual-summary-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.month-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
    transition: all 0.2s;
    position: relative;
}

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

.month-card.above-average {
    border-color: #f59e0b;
    background: linear-gradient(to bottom, #fffbeb 0%, white 100%);
}

.month-card.no-data {
    opacity: 0.5;
}

.month-name {
    font-weight: 600;
    font-size: 1rem;
    color: #1f2937;
    margin-bottom: 0.75rem;
}

.month-totals {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.month-total-item {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
}

.month-total-item .total-label {
    color: #6b7280;
}

.month-total-item .total-value {
    font-weight: 500;
    color: #1f2937;
}

.month-total-item.paid .total-value {
    color: #10b981;
}

.month-total-item.pending .total-value {
    color: #f59e0b;
}

.above-average-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: #f59e0b;
    color: white;
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-weight: 500;
}

/* Annual Totals */
.annual-totals {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.total-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1.5rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.total-card.total-average {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.total-card .total-label {
    font-size: 0.875rem;
    opacity: 0.9;
}

.total-card .total-value {
    font-size: 1.75rem;
    font-weight: 700;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 400px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1rem;
}

/* Insights Grid */
.insights-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1rem;
}

.insight-card {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    gap: 1rem;
    align-items: flex-start;
    transition: all 0.2s;
}

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

.insight-icon {
    font-size: 2rem;
    flex-shrink: 0;
}

.insight-content {
    flex: 1;
}

.insight-title {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1f2937;
}

.insight-description {
    margin: 0;
    font-size: 0.875rem;
    color: #6b7280;
}

/* Insight Card Variants */
.insight-card.trend-growing {
    border-left: 4px solid #ef4444;
}

.insight-card.trend-decreasing {
    border-left: 4px solid #10b981;
}

.insight-card.trend-stable {
    border-left: 4px solid #6b7280;
}

.insight-card.insight-highlight {
    border-left: 4px solid #f59e0b;
}

.insight-card.insight-success {
    border-left: 4px solid #10b981;
}

.insight-card.insight-warning {
    border-left: 4px solid #ef4444;
}

/* Empty State */
.empty-state {
    text-align: center;
    padding: 3rem 2rem;
    color: #6b7280;
}

.empty-state p:first-child {
    font-size: 1.125rem;
    margin-bottom: 0.5rem;
}

.empty-state-hint {
    font-size: 0.875rem;
    color: #9ca3af;
}

/* Responsive Design */
@media (max-width: 1024px) {
    .annual-summary-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    }
    
    .chart-container {
        height: 350px;
    }
}

@media (max-width: 768px) {
    .dashboard-container {
        max-height: 95vh;
        border-radius: 0;
    }
    
    .dashboard-header {
        padding: 1rem;
        flex-wrap: wrap;
        gap: 1rem;
    }
    
    .dashboard-header h2 {
        font-size: 1.25rem;
    }
    
    .dashboard-content {
        padding: 1rem;
    }
    
    .annual-summary-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.75rem;
    }
    
    .month-card {
        padding: 0.75rem;
    }
    
    .chart-container {
        height: 300px;
        padding: 0.75rem;
    }
    
    .insights-grid {
        grid-template-columns: 1fr;
    }
    
    .annual-totals {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .dashboard-modal {
        padding: 0;
    }
    
    .annual-summary-grid {
        grid-template-columns: 1fr;
    }
    
    .month-card {
        font-size: 0.875rem;
    }
    
    .chart-container {
        height: 250px;
    }
}
