/* ═══════════════════════════════════════════════════════════════
   تصميم قسم الإحصائيات والمتابعة - Dashboard Styles
   ═══════════════════════════════════════════════════════════════ */

/* Dashboard Header */
.dashboard-header {
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 2px solid #e5e7eb;
}

.dashboard-title-group {
    width: 100%;
}

.dashboard-subtitle {
    color: #6b7280;
    font-size: 0.95rem;
    margin-top: 0.5rem;
    font-weight: 400;
}

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

.stat-card {
    background: white;
    border-radius: 1rem;
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.25rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 4px;
    background: linear-gradient(90deg, var(--card-color-1), var(--card-color-2));
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

/* Stat Card Variants */
.stat-card-primary {
    --card-color-1: #667eea;
    --card-color-2: #764ba2;
}

.stat-card-blue {
    --card-color-1: #3b82f6;
    --card-color-2: #2563eb;
}

.stat-card-pink {
    --card-color-1: #ec4899;
    --card-color-2: #db2777;
}

.stat-card-green {
    --card-color-1: #10b981;
    --card-color-2: #059669;
}

.stat-card-icon {
    width: 70px;
    height: 70px;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--card-color-1), var(--card-color-2));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 2rem;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.stat-card-content {
    flex: 1;
}

.stat-card-label {
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.stat-card-value {
    font-size: 2rem;
    font-weight: 800;
    color: #1f2937;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.stat-card-trend {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: #6b7280;
}

.stat-card-trend i {
    color: var(--card-color-1);
}

/* Charts Container */
.charts-container {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.chart-card {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

.chart-card-full {
    width: 100%;
}

.chart-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 2px solid #f3f4f6;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
}

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

.chart-card-title i {
    font-size: 1.5rem;
    color: #667eea;
}

.chart-card-title h3 {
    font-size: 1.125rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

.chart-card-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: #f3f4f6;
    border-radius: 2rem;
    font-size: 0.875rem;
    color: #6b7280;
    font-weight: 500;
}

.chart-card-badge i {
    font-size: 0.875rem;
}

.chart-card-body {
    padding: 2rem;
}

.chart-wrapper {
    position: relative;
    height: 350px;
    width: 100%;
}

.chart-wrapper-large {
    height: 450px;
}

.chart-wrapper-medium {
    height: 380px;
}

.chart-wrapper canvas {
    max-width: 100%;
    max-height: 100%;
}

/* Top Districts Section */
.top-districts-section {
    background: white;
    border-radius: 1rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    margin-bottom: 2rem;
}

.section-header {
    padding: 1.5rem;
    border-bottom: 2px solid #f3f4f6;
    background: linear-gradient(135deg, #f9fafb 0%, #ffffff 100%);
}

.section-header-content {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.section-header-content i {
    font-size: 2rem;
    color: #f59e0b;
}

.section-header-content h3 {
    font-size: 1.25rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0 0 0.25rem 0;
}

.section-header-content p {
    font-size: 0.875rem;
    color: #6b7280;
    margin: 0;
}

.top-districts-grid {
    padding: 2rem;
}

/* Additional Styling */
.chart-card-body {
    background: #fafbfc;
}

.chart-wrapper {
    background: white;
    border-radius: 0.75rem;
    padding: 1rem;
}

/* Responsive Design */
@media (max-width: 1200px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .dashboard-header {
        padding-bottom: 1rem;
    }

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

    .stat-card {
        padding: 1.25rem;
    }

    .stat-card-icon {
        width: 60px;
        height: 60px;
        font-size: 1.75rem;
    }

    .stat-card-value {
        font-size: 1.75rem;
    }

    .charts-container {
        grid-template-columns: 1fr;
    }

    .chart-wrapper {
        height: 250px;
    }

    .chart-wrapper-large {
        height: 300px;
    }

    .chart-wrapper-medium {
        height: 280px;
    }

    .chart-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .chart-card-badge {
        align-self: flex-start;
    }
}

@media (max-width: 480px) {
    .stat-card {
        flex-direction: column;
        text-align: center;
    }

    .stat-card-icon {
        width: 80px;
        height: 80px;
        font-size: 2rem;
    }

    .stat-card-content {
        width: 100%;
    }

    .stat-card-trend {
        justify-content: center;
    }

    .chart-card-body {
        padding: 1rem;
    }

    .top-districts-grid {
        padding: 1rem;
    }
}

/* Animation */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.stat-card,
.chart-card,
.top-districts-section {
    animation: fadeInUp 0.5s ease-out;
}

.stat-card:nth-child(1) { animation-delay: 0.1s; }
.stat-card:nth-child(2) { animation-delay: 0.2s; }
.stat-card:nth-child(3) { animation-delay: 0.3s; }
.stat-card:nth-child(4) { animation-delay: 0.4s; }

/* Loading State */
.stat-card-value.loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

/* ═══════════════════════════════════════════════════════════════
   Google Sheets Integration Styles
   ═══════════════════════════════════════════════════════════════ */

/* Sync Indicator */
.sync-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
}

.sync-indicator i {
    font-size: 0.75rem;
}

.sync-indicator.active {
    background: rgba(255, 255, 255, 0.25);
}

.sync-indicator.active i {
    color: #10b981;
    animation: pulse 2s infinite;
}

/* Sync Status */
.sync-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

.sync-status i {
    font-size: 1rem;
}

.sync-status.status-idle {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.sync-status.status-syncing {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
}

.sync-status.status-success {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.sync-status.status-error {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

/* Pulse Animation for Active Sync */
@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* Google Sheets Settings Card Overrides */
.settings-card .google-sheets-info {
    backdrop-filter: blur(10px);
}

.settings-card .setting-item {
    transition: all 0.3s ease;
}

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