/* KPI Dashboard Styles */
.main-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: 100px 20px 20px;
}

.page-header {
    text-align: center;
    margin-bottom: 2rem;
    color: #333;
}

.page-header .page-subtitle {
    display: block;
    font-size: 1rem;
    font-weight: normal;
    color: #666;
    margin-top: 0.5rem;
}

/* Dashboard Controls */
.dashboard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 8px;
}

.period-selector {
    display: flex;
    gap: 0.5rem;
}

.period-btn {
    padding: 0.5rem 1rem;
    border: 1px solid #dee2e6;
    background-color: white;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
}

.period-btn.active {
    background-color: #2eaadc;
    color: white;
    border-color: #2eaadc;
}

.period-btn:hover:not(.active) {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

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

.btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    display: inline-block;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-primary {
    background-color: #2eaadc;
    color: white;
}

.btn-primary:hover {
    background-color: #2691bd;
}

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

.btn-secondary:hover {
    background-color: #5a6268;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* Empty Dashboard */
.empty-dashboard {
    text-align: center;
    padding: 3rem 2rem;
    background-color: #f8f9fa;
    border-radius: 12px;
    border: 2px dashed #dee2e6;
}

.empty-dashboard h2 {
    color: #6c757d;
    margin-bottom: 1rem;
}

.empty-dashboard p {
    color: #868e96;
    margin-bottom: 2rem;
}

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

.kpi-chart-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

/* Chart Header */
.chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 1.5rem 1rem;
    background-color: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
}

.chart-title {
    margin: 0;
    color: #333;
    font-size: 1.1rem;
    font-weight: 600;
}

.chart-meta {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.direction-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 50%;
    font-size: 0.9rem;
    font-weight: bold;
}

.direction-indicator.up {
    background-color: #d4edda;
    color: #155724;
}

.direction-indicator.down {
    background-color: #fff3cd;
    color: #856404;
}

.trend-badge {
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    background-color: #e9ecef;
    color: #495057;
}

.trend-badge.positive {
    background-color: #d4edda;
    color: #155724;
}

.trend-badge.negative {
    background-color: #f8d7da;
    color: #721c24;
}

.trend-badge.neutral {
    background-color: #fff3cd;
    color: #856404;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 250px;
    padding: 1rem;
}

.kpi-chart {
    width: 100%;
    height: 100%;
}

/* Chart Footer */
.chart-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    background-color: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.chart-stats {
    display: flex;
    gap: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.stat-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: #6c757d;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value {
    font-size: 0.9rem;
    color: #333;
    font-weight: 600;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 2rem;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    position: relative;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.close {
    position: absolute;
    right: 1rem;
    top: 1rem;
    font-size: 1.5rem;
    font-weight: bold;
    cursor: pointer;
    color: #aaa;
    transition: color 0.2s ease;
}

.close:hover {
    color: #333;
}

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

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    transition: border-color 0.2s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #2eaadc;
    box-shadow: 0 0 0 3px rgba(46, 170, 220, 0.1);
}

.form-actions {
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
    margin-top: 2rem;
}

/* Loading States */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: #6c757d;
    font-style: italic;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    }
}

@media (max-width: 768px) {
    .main-content {
        padding: 100px 15px 20px;
    }
    
    .dashboard-controls {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .refresh-controls {
        justify-content: center;
    }
    
    .kpi-grid {
        grid-template-columns: 1fr;
    }
    
    .chart-footer {
        flex-direction: column;
        gap: 1rem;
        align-items: stretch;
    }
    
    .chart-stats {
        justify-content: space-around;
    }
    
    .modal-content {
        margin: 5% auto;
        width: 95%;
    }
}

@media (max-width: 480px) {
    .chart-header {
        flex-direction: column;
        gap: 0.75rem;
        align-items: flex-start;
    }
    
    .chart-meta {
        align-self: flex-end;
    }
}
