/* Dashboard Styles */

/* Dashboard Header */
.dashboard-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
    color: white;
    padding: 2rem 0;
}

.dashboard-title-section {
    margin-bottom: 2rem;
}

.dashboard-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
    color: white;
}

.dashboard-subtitle {
    font-size: 1.125rem;
    opacity: 0.8;
    margin-bottom: 0;
}

.dashboard-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.time-filter {
    display: flex;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 0.25rem;
    border-radius: 0.5rem;
}

.time-btn {
    padding: 0.5rem 1rem;
    background: transparent;
    border: none;
    color: white;
    border-radius: 0.375rem;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.time-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.time-btn.active {
    background: #3b82f6;
    color: white;
}

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

.refresh-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #22c55e;
    color: white;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.3s ease;
}

.refresh-btn:hover {
    background: #16a34a;
    transform: translateY(-1px);
}

.auto-refresh {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.auto-refresh input[type="checkbox"] {
    accent-color: #3b82f6;
}

/* Main Metrics */
.main-metrics {
    padding: 3rem 0;
    background: #f8fafc;
}

.metrics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

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

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.1);
}

.metric-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.metric-card.users .metric-icon {
    background: #3b82f6;
}

.metric-card.active-users .metric-icon {
    background: #22c55e;
}

.metric-card.transactions .metric-icon {
    background: #f59e0b;
}

.metric-card.revenue .metric-icon {
    background: #8b5cf6;
}

.metric-content {
    flex: 1;
}

.metric-number {
    font-size: 2rem;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.metric-label {
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 0.5rem;
}

.metric-change {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
}

.metric-change.positive {
    color: #22c55e;
}

.metric-change.negative {
    color: #ef4444;
}

/* Charts */
.main-charts {
    padding: 3rem 0;
}

.charts-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.charts-grid-secondary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.chart-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.chart-header {
    padding: 1.5rem 1.5rem 1rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chart-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: #1e293b;
}

.chart-legend {
    display: flex;
    gap: 1rem;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #64748b;
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.legend-item.transactions .legend-dot {
    background: #3b82f6;
}

.legend-item.revenue .legend-dot {
    background: #22c55e;
}

.chart-container {
    padding: 1rem 1.5rem 1.5rem;
    height: 300px;
    position: relative;
}

.chart-container canvas {
    max-height: 100% !important;
}

/* Detailed Stats */
.detailed-stats {
    padding: 3rem 0;
    background: #f8fafc;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 2rem;
}

.stat-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    overflow: hidden;
}

.stat-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0;
    color: #1e293b;
}

.average-rating {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rating-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #f59e0b;
}

.stars {
    display: flex;
    gap: 0.125rem;
}

.stars i.filled {
    color: #f59e0b;
}

.stars i {
    color: #e2e8f0;
    font-size: 0.875rem;
}

.rating-breakdown {
    padding: 1.5rem;
}

.rating-row {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.rating-stars {
    width: 40px;
    font-size: 0.8rem;
    color: #64748b;
}

.rating-bar {
    flex: 1;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
}

.rating-fill {
    height: 100%;
    background: #f59e0b;
    border-radius: 4px;
    transition: width 0.3s ease;
}

.rating-count {
    width: 60px;
    text-align: right;
    font-size: 0.8rem;
    color: #64748b;
}

.regions-list {
    padding: 1.5rem;
}

.region-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid #e2e8f0;
}

.region-item:last-child {
    border-bottom: none;
}

.region-rank {
    width: 30px;
    height: 30px;
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 600;
}

.region-info {
    flex: 1;
}

.region-name {
    font-weight: 500;
    color: #1e293b;
    margin-bottom: 0.25rem;
}

.region-count {
    font-size: 0.8rem;
    color: #64748b;
}

.region-percentage {
    font-weight: 600;
    color: #3b82f6;
}

/* Real-time Stats */
.stat-card.realtime {
    border: 2px solid #22c55e;
    position: relative;
    overflow: visible;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: #22c55e;
    font-weight: 600;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: #22c55e;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.realtime-stats {
    padding: 1.5rem;
    display: grid;
    gap: 1rem;
}

.realtime-stat {
    text-align: center;
    padding: 1rem;
    background: #f0fdf4;
    border-radius: 0.5rem;
}

.realtime-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #22c55e;
    margin-bottom: 0.25rem;
}

.realtime-label {
    font-size: 0.8rem;
    color: #64748b;
}

/* Loading States */
.chart-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    font-size: 0.9rem;
    color: #64748b;
}

.loading-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid #e2e8f0;
    border-top: 2px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-right: 0.5rem;
}

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

/* Responsive Design */
@media (max-width: 768px) {
    .dashboard-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .time-filter {
        order: 2;
    }
    
    .refresh-controls {
        order: 1;
        justify-content: center;
    }
    
    .charts-grid {
        grid-template-columns: 1fr;
    }
    
    .charts-grid-secondary {
        grid-template-columns: 1fr;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .metric-card {
        flex-direction: column;
        text-align: center;
    }
    
    .chart-header {
        flex-direction: column;
        gap: 1rem;
        align-items: flex-start;
    }
    
    .chart-legend {
        align-self: stretch;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .dashboard-title {
        font-size: 2rem;
    }
    
    .time-filter {
        flex-wrap: wrap;
    }
    
    .time-btn {
        flex: 1;
        min-width: 0;
    }
    
    .metric-number {
        font-size: 1.5rem;
    }
    
    .chart-container {
        height: 250px;
    }
}