@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&display=swap');

:root {
    --primary-green: #0a6b4a;
    --primary-blue: #1d4ed8;
    --dark-navy: #0f172a;
    --bg-light: #f8fafc;
    --card-bg: #ffffff;
    --border-color: #e2e8f0;
    --text-color: #334155;
    
    /* City Accent Colors */
    --color-jeddah: #10b981;
    --color-makkah: #3b82f6;
    --color-taif: #8b5cf6;
    --color-jizan: #f59e0b;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Tajawal', sans-serif;
    background-color: var(--bg-light);
    color: var(--text-color);
    line-height: 1.6;
    overflow-x: hidden; /* لمنع أي شريط تمرير أفقي غير مرغوب فيه */
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    width: 100%;
}

/* ==========================================
   Header Section
   ========================================== */
.main-header {
    background: linear-gradient(135deg, #0d3b2e, var(--primary-green));
    color: white;
    padding: 24px 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.header-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 16px;
}

.brand-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-icon {
    font-size: 2.2rem;
    color: #4ade80;
    flex-shrink: 0;
}

.brand-info h1 {
    font-size: 1.3rem;
    font-weight: 700;
}

.brand-info p {
    font-size: 0.85rem;
    opacity: 0.85;
}

.report-meta {
    text-align: right;
}

.report-meta h2 {
    font-size: 1.2rem;
    margin-bottom: 6px;
}

.report-date {
    font-size: 0.8rem;
    background: rgba(255, 255, 255, 0.15);
    padding: 4px 12px;
    border-radius: 20px;
    display: inline-block;
}

/* ==========================================
   Stats Grid
   ========================================== */
.stats-grid {
    display: grid;
    /* تحسين التجاوب عبر السماح بالتقلص لـ 100% بدلاً من العرض الثابت */
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 16px;
    margin: 24px 0;
}

.stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.stat-card.highlight {
    background: linear-gradient(135deg, #ffffff, #f0fdf4);
    border: 2px solid #bbf7d0;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    color: white;
    flex-shrink: 0;
}

.icon-blue { background-color: #2563eb; }
.icon-cyan { background-color: #0284c7; }
.icon-orange { background-color: #ea580c; }
.icon-green { background-color: #16a34a; }
.icon-purple { background-color: #7c3aed; }
.icon-deep-purple { background-color: #4338ca; }
.icon-teal { background-color: #0d9488; }

.stat-content h3 {
    font-size: 0.85rem;
    color: #64748b;
    margin-bottom: 2px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--dark-navy);
}

.stat-value .unit {
    font-size: 0.75rem;
    font-weight: 400;
    color: #64748b;
}

/* ==========================================
   Section Titles
   ========================================== */
.section-title {
    font-size: 1.1rem;
    padding: 10px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    color: white;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-title.center {
    background-color: var(--dark-navy);
    justify-content: center;
}

.title-green { background-color: var(--primary-green); }
.title-blue { background-color: #1e40af; }
.title-navy { background-color: #1e293b; }

/* ==========================================
   Tables Section
   ========================================== */
.tables-section {
    display: grid;
    grid-template-columns: 3fr 2fr;
    gap: 20px;
    margin-bottom: 32px;
}

.table-wrapper {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    width: 100%;
}

.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; /* تمرير ناعم في آيفون */
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: right;
    white-space: nowrap; /* الحفاظ على ترتيب الأعمدة داخل التمرير الأفقي للجوال */
}

th, td {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.88rem;
}

th {
    background-color: #f1f5f9;
    color: #475569;
    font-weight: 700;
}

tfoot td {
    font-weight: 800;
    background-color: #f8fafc;
    border-top: 2px solid var(--border-color);
}

.badge {
    padding: 3px 8px;
    border-radius: 6px;
    color: white;
    font-size: 0.8rem;
    font-weight: 700;
    display: inline-block;
}

.badge.jeddah { background-color: var(--color-jeddah); }
.badge.makkah { background-color: var(--color-makkah); }
.badge.taif { background-color: var(--color-taif); }
.badge.jizan { background-color: var(--color-jizan); }

/* ==========================================
   Charts Section
   ========================================== */
.charts-section {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 20px;
    border: 1px solid var(--border-color);
    margin-bottom: 32px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
}

.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
    gap: 20px;
}

.chart-card {
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    width: 100%;
}

.chart-card h4 {
    margin-bottom: 12px;
    font-size: 0.95rem;
    color: #475569;
}

.chart-container {
    position: relative;
    height: 240px;
    width: 100%;
}

/* ==========================================
   Recommendations Section
   ========================================== */
.recommendations-section {
    margin-bottom: 24px;
}

.recommendations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
    gap: 16px;
}

.rec-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.03);
    transition: transform 0.2s ease;
}

.rec-card:hover {
    transform: translateY(-3px);
}

.rec-icon {
    font-size: 1.8rem;
    color: var(--primary-green);
    margin-bottom: 8px;
}

.rec-card h4 {
    font-size: 0.95rem;
    color: var(--dark-navy);
    margin-bottom: 10px;
    border-bottom: 2px solid var(--bg-light);
    padding-bottom: 6px;
}

.rec-card ul {
    list-style: none;
}

.rec-card li {
    font-size: 0.82rem;
    color: #475569;
    margin-bottom: 6px;
    position: relative;
    padding-right: 14px;
}

.rec-card li::before {
    content: "•";
    color: var(--primary-green);
    font-weight: bold;
    position: absolute;
    right: 0;
}

/* ==========================================
   Disclaimer & Footer
   ========================================== */
.disclaimer {
    background-color: #e0f2fe;
    border-right: 4px solid #0284c7;
    padding: 12px 16px;
    border-radius: 6px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.85rem;
    color: #0369a1;
    margin-bottom: 32px;
}

.main-footer {
    text-align: center;
    padding: 16px 0;
    border-top: 1px solid var(--border-color);
    color: #94a3b8;
    font-size: 0.8rem;
}

/* ==========================================
   Media Queries (Responsive Breakpoints)
   ========================================== */

/* أجهزة الآيباد والشاشات المتوسطة */
@media (max-width: 992px) {
    .tables-section {
        grid-template-columns: 1fr;
    }
}

/* أجهزة الجوال الهواتف الذكية */
@media (max-width: 768px) {
    .header-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .report-meta {
        text-align: right;
        width: 100%;
        border-top: 1px solid rgba(255,255,255,0.1);
        padding-top: 10px;
    }

    .section-title {
        font-size: 1rem;
    }

    .chart-container {
        height: 200px;
    }
}

/* الشاشات الصغيرة جداً (أقل من 480px) */
@media (max-width: 480px) {
    .container {
        padding: 0 12px;
    }

    .brand-info h1 {
        font-size: 1.1rem;
    }

    .stat-card {
        padding: 12px;
    }

    .stat-icon {
        width: 40px;
        height: 40px;
        font-size: 1.1rem;
    }

    .stat-value {
        font-size: 1.1rem;
    }
}