/* 1. استيراد الخطوط */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* 2. المتغيرات */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* منع الحركة العرضية لكامل الصفحة */
html,
body {
    max-width: 100%;
    overflow-x: hidden;
}

:root {
    --brand-red: #C8102E;
    --brand-red-light: #fdf0f2;
    --dark-text: #2d3436;
    --light-text: #636e72;
    --white: #FFFFFF;
    --bg-color: #f0f2f5;
    --border-color: #dee2e6;
    --sidebar-width: 250px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 5px 15px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

body {
    font-family: 'Poppins', 'Segoe UI', sans-serif;
    background-color: var(--bg-color);
    color: var(--dark-text);
    margin: 0;
    overflow-x: hidden;
}

.dashboard-container {
    display: flex;
    min-height: 100vh;
}

/* ============================================================ */
/* === SIDEBAR === */
/* ============================================================ */
.sidebar {
    width: var(--sidebar-width);
    background-color: var(--white);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
    transition: margin-left 0.3s ease;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    background: #fdfdfd;
}

.logo {
    max-width: 180px;
    height: auto;
}

.sidebar-nav {
    padding: 15px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--light-text);
    text-decoration: none;
    transition: all 0.2s ease-in-out;
    border-left: 4px solid transparent;
    border-radius: 0;
    margin-bottom: 0;
    border-bottom: 1px solid #f0f0f0;
}

.nav-item:hover {
    background-color: var(--brand-red-light);
    color: var(--brand-red);
    border-left-color: var(--brand-red);
}

.nav-item.active {
    background-color: var(--brand-red);
    color: var(--white);
    border-left-color: transparent;
    font-weight: 600;
}

/* زر التثبيت */
.nav-item.install-item {
    margin-top: 20px;
    background-color: #fff5f6;
    color: var(--brand-red);
    border: 1px dashed var(--brand-red);
    justify-content: center;
    font-weight: 700;
}

.nav-item.install-item:hover {
    background-color: var(--brand-red);
    color: white;
    border-style: solid;
}

/* Dropdown */
.nav-dropdown {
    position: relative;
}

.dropdown-toggle {
    justify-content: space-between;
}

.dropdown-toggle::after {
    content: '▾';
    font-size: 1.2em;
    transition: transform 0.3s;
    margin-left: 10px;
}

.dropdown-toggle.active::after {
    transform: rotate(180deg);
    color: var(--white);
}

.dropdown-toggle:hover::after {
    color: var(--brand-red);
}

.dropdown-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: #fcfcfc;
    border-bottom: 1px solid #f0f0f0;
}

.dropdown-content.open {
    max-height: 500px;
    transition: max-height 0.3s ease-in;
}

.dropdown-link {
    display: block;
    padding: 10px 20px 10px 35px;
    text-decoration: none;
    color: var(--light-text);
    font-size: 13px;
    border-left: 4px solid transparent;
    transition: all 0.2s;
}

.dropdown-link:hover {
    background-color: var(--brand-red-light);
    color: var(--brand-red);
    padding-left: 40px;
}

/* ============================================================ */
/* === MAIN CONTENT === */
/* ============================================================ */
.main-content {
    flex-grow: 1;
    margin-left: var(--sidebar-width);
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 25px;
    transition: margin-left 0.3s ease;
    width: calc(100% - var(--sidebar-width));
}

.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--white);
    padding: 15px 25px;
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
    flex-wrap: wrap;
    gap: 15px;
    /* 👇👇👇 التعديلات المطلوبة للتثبيت 👇👇👇 */
    position: sticky;
    /* يجعل العنصر يلتصق */
    top: 10px;
    /* المسافة من أعلى الشاشة (10 بكسل لترك فراغ جمالي) */
    z-index: 900;
    /* لضمان ظهوره فوق باقي المحتوى */
    margin-bottom: 20px;
    /* مسافة بينه وبين الكروت تحته */
    /* 👆👆👆 ------------------------- 👆👆👆 */
}

.main-header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--dark-text);
    letter-spacing: -0.5px;
}

.controls-container {
    display: flex;
    align-items: center;
    gap: 15px;
}

/* تنسيق موحد لفلاتر السنة والشهر */
#month-filter,
#year-filter {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    /* حواف دائرية ناعمة */
    padding: 10px 15px;
    /* مساحة داخلية مريحة */
    font-size: 14px;
    font-weight: 600;
    /* خط سميك قليلاً للوضوح */
    background-color: #fafafa;
    /* خلفية فاتحة جداً */
    color: var(--dark-text);
    outline: none;
    cursor: pointer;
    transition: var(--transition);
    min-width: 100px;
    /* عرض أدنى لضمان عدم انكماش السنة */
    appearance: none;
    /* إخفاء السهم الافتراضي القديم (اختياري) */
    background-image: url("data:image/svg+xml;charset=US-ASCII,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%22292.4%22%20height%3D%22292.4%22%3E%3Cpath%20fill%3D%22%23C8102E%22%20d%3D%22M287%2069.4a17.6%2017.6%200%200%200-13-5.4H18.4c-5%200-9.3%201.8-12.9%205.4A17.6%2017.6%200%200%200%200%2082.2c0%205%201.8%209.3%205.4%2012.9l128%20127.9c3.6%203.6%207.8%205.4%2012.8%205.4s9.2-1.8%2012.8-5.4L287%2095c3.5-3.5%205.4-7.8%205.4-12.8%200-5-1.9-9.2-5.5-12.8z%22%2F%3E%3C%2Fsvg%3E");
    background-repeat: no-repeat;
    background-position: right 12px top 50%;
    background-size: 10px auto;
    padding-right: 30px;
    /* مساحة للسهم المخصص */
}

/* تأثير عند الضغط أو الوقوف عليه */
#month-filter:focus,
#year-filter:focus,
#month-filter:hover,
#year-filter:hover {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
    /* توهج أحمر خفيف */
    background-color: white;
}

#month-filter:focus {
    border-color: var(--brand-red);
    box-shadow: 0 0 0 3px rgba(200, 16, 46, 0.1);
}

/* Cards */
.card {
    background-color: var(--white);
    padding: 25px;
    border-radius: 20px;
    border: none;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-3px);
}

.card h2 {
    font-size: 1.1rem;
    margin-top: 0;
    margin-bottom: 20px;
    font-weight: 600;
    color: var(--dark-text);
    border-left: 4px solid var(--brand-red);
    padding-left: 10px;
}

/* KPI */
.total-kpi {
    text-align: center;
    padding: 10px;
}

#total-hours-card {
    background: linear-gradient(135deg, var(--brand-red) 0%, #a00d25 100%);
    color: var(--white);
}

#total-hours-card .kpi-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: 10px;
}

#total-hours-card .kpi-value {
    color: var(--white);
    font-size: 3.5rem;
    font-weight: 700;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 20px;
}

.kpi-card {
    background: var(--white);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
    box-shadow: var(--shadow-sm);
    border: 1px solid transparent;
    transition: var(--transition);
}

.kpi-card:hover {
    border-color: var(--brand-red-light);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.kpi-label {
    font-size: 0.85rem;
    color: var(--light-text);
    margin-bottom: 10px;
    font-weight: 500;
}

.kpi-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark-text);
}

.row-3-container {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
}

/* Charts */
.bar {
    fill: var(--brand-red);
    rx: 4;
}

.bar:hover {
    opacity: 0.85;
    filter: drop-shadow(0 4px 6px rgba(200, 16, 46, 0.4));
}

.arc-path {
    cursor: pointer;
    stroke: var(--white);
    stroke-width: 3px;
}

.line {
    fill: none;
    stroke: var(--brand-red);
    stroke-width: 4px;
    stroke-linecap: round;
}

.area {
    fill: url(#area-gradient);
    opacity: 0.6;
    stroke: none;
}

.axis-x text,
.axis-y text {
    font-size: 11px;
    fill: #888;
}

.axis-x path,
.axis-y path {
    display: none;
}

.axis-x line,
.axis-y line {
    stroke: #eee;
    stroke-dasharray: 4;
}

.bar-label {
    font-size: 11px;
    font-weight: 600;
    fill: var(--dark-text);
    text-anchor: middle;
    pointer-events: none;
}

.legend-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 20px;
}

.legend-item {
    display: flex;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    background: #f9f9f9;
    padding: 5px 10px;
    border-radius: 20px;
}

.legend-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 8px;
}

.install-container {
    display: flex;
    justify-content: center;
    margin: 20px 0;
    width: 100%;
}

.main-install-btn {
    background-color: var(--brand-red);
    color: var(--white);
    border: none;
    padding: 12px 30px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(200, 16, 46, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    align-items: center;
    gap: 10px;
}

.main-install-btn:hover {
    background-color: #a00d25;
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(200, 16, 46, 0.4);
}

.site-footer {
    text-align: center;
    padding: 30px;
    color: #999;
    font-size: 13px;
    background: transparent;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

/* === RESPONSIVE === */
.logo-mobile,
.sidebar-toggle,
.mobile-header-top {
    display: none;
}

@media screen and (max-width: 1024px) {
    .row-3-container {
        grid-template-columns: 1fr 1fr;
    }
}

@media screen and (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 0 100px rgba(0, 0, 0, 0.5);
        border-right: none;
    }

    .sidebar.visible {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        padding: 15px;
        width: 100%;
    }

    .main-header {
        flex-direction: column;
        padding: 15px;
        gap: 20px;
        position: sticky;
        top: 0;
        /* في الموبايل نجعله 0 ليلتصق تماماً بالحافة */
        border-radius: 0 0 16px 16px;
        /* تدوير الحواف السفلية فقط */
        z-index: 900;

    }

    .mobile-header-top {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
    }

    .logo-mobile {
        display: block;
        height: 45px;
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
        background-color: var(--white);
        color: var(--dark-text);
        border: 1px solid var(--border-color);
        border-radius: 10px;
        font-size: 22px;
        cursor: pointer;
        width: 45px;
        height: 45px;
        box-shadow: var(--shadow-sm);
    }

    .controls-container,
    .filter-container,
    #month-filter {
        width: 100%;
        text-align: center;
    }

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

    .kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .kpi-value {
        font-size: 1.5rem !important;
    }

    #total-hours-card .kpi-value {
        font-size: 2.5rem !important;
    }

    .card {
        padding: 15px;
    }
}

/* ============================================================ */
/* === MODAL & TABLE (FIXED SCROLL & STYLE) === */
/* ============================================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--white);
    padding: 25px;
    border-radius: 15px;
    box-shadow: var(--shadow-lg);
    width: 95%;
    max-width: 800px;
    max-height: 85vh;
    /* أقصى ارتفاع للنافذة */
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease-out;
}

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

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--brand-red);
    padding-bottom: 15px;
    margin-bottom: 15px;
    flex-shrink: 0;
    /* الهيدر ثابت لا ينكمش */
}

.modal-header h3 {
    margin: 0;
    font-size: 1.4rem;
    color: var(--brand-red);
}

.close-button {
    background: #f1f1f1;
    border: none;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    color: #555;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
}

.close-button:hover {
    background: var(--brand-red);
    color: white;
}

/* 👇👇👇 الحاوية المسؤولة عن السكرول 👇👇👇 */
#modal-table-container {
    overflow-y: auto;
    /* سكرول رأسي */
    overflow-x: auto;
    /* سكرول أفقي (للجدول العريض) */
    width: 100%;
    border: 1px solid var(--border-color);
    /* إطار خفيف */
}

/* 👇👇👇 تصميم الجدول الكلاسيكي الواضح 👇👇👇 */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    white-space: nowrap;
    /* يمنع النص من الانثناء، مما يجبر السكرول عند الحاجة */
}

.data-table th {
    background-color: var(--brand-red);
    color: var(--white);
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    border: 1px solid #b00c24;
    position: sticky;
    /* تثبيت الرأس عند السكرول */
    top: 0;
}

.data-table td {
    padding: 10px 15px;
    border: 1px solid var(--border-color);
    color: var(--dark-text);
}

.data-table tr:nth-child(even) {
    background-color: #f8f9fa;
}

.data-table tr:hover {
    background-color: #fff5f6;
}

/* === تنسيق السنوات داخل القائمة === */

/* 1. شكل عنوان السنة (2025) */
.year-header {
    padding: 8px 20px 8px 30px;
    /* مسافة مريحة */
    font-size: 13px;
    font-weight: 700;
    /* خط عريض */
    color: var(--brand-red);
    /* لون أحمر لتمييز السنة */
    background-color: #f1f1f1;
    /* خلفية رمادية خفيفة جداً */
    cursor: default;
    /* الماوس ميتغيرش لأنه مش رابط */
    border-bottom: 1px solid #e0e0e0;
    margin-top: 5px;
}

/* 2. الروابط المتفرعة (تحت السنة) */
.dropdown-link.nested-link {
    padding-left: 45px !important;
    /* إزاحة للداخل أكثر من الطبيعي */
    font-size: 12.5px;
    border-left: 4px solid transparent;
}

/* 3. تأثير عند الوقوف على الرابط المتفرع */
.dropdown-link.nested-link:hover {
    padding-left: 50px !important;
    /* حركة بسيطة */
    background-color: #fff0f2;
    border-left-color: var(--brand-red);
}

/* === تنسيق القوائم الفرعية (Nested Dropdowns) === */

/* زر السنة (2025) */
.sub-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 600;
    color: var(--dark-text) !important;
    background-color: #f8f9fa;
    border-bottom: 1px solid #eee;
}

/* السهم الصغير جنب السنة */
.sub-toggle .arrow {
    font-size: 1.2em;
    transition: transform 0.3s ease;
    margin-right: 5px;
}

/* دوران السهم عند الفتح */
.sub-toggle.active .arrow {
    transform: rotate(90deg);
    color: var(--brand-red);
}

.sub-toggle.active {
    color: var(--brand-red) !important;
    background-color: #fff5f6;
}

/* حاوية الروابط (مخفية افتراضياً) */
.sub-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease-out;
    background-color: #ffffff;
    border-left: 2px solid var(--brand-red-light);
    /* خط جمالي */
}

.sub-content.open {
    max-height: 300px;
    /* ارتفاع كافي للمحتوى */
    transition: max-height 0.3s ease-in;
}

/* الروابط الداخلية */
.nested-link {
    padding-left: 40px !important;
    /* إزاحة للداخل */
    font-size: 12.5px;
    color: #666;
}

.nested-link:hover {
    background-color: var(--brand-red-light);
    color: var(--brand-red);
}

/* ============================================================ */
/* === MONTHLY REPORT STYLES === */
/* ============================================================ */

/* إخفاء/إظهار */
.hidden {
    display: none;
}

/* تنسيق عام لسكاشن التقرير */
.report-header {
    font-size: 1.2rem;
    color: var(--brand-red);
    border-bottom: 2px solid #eee;
    padding-bottom: 10px;
    margin-bottom: 15px;
}

.sub-header {
    font-size: 1rem;
    color: var(--dark-text);
    margin-top: 20px;
    margin-bottom: 10px;
}

/* شبكة الإحصائيات العلوية */
.report-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.stat-box {
    background: #f9f9f9;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    border: 1px solid #eee;
}

.stat-box.highlight {
    background: var(--brand-red);
    color: white;
}

.stat-box.highlight .stat-label {
    color: #f0f0f0;
}

.stat-box.highlight .stat-value {
    color: white;
}

.stat-label {
    display: block;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 5px;
}

.stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--dark-text);
}

/* جداول التقرير */
.report-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 10px;
    font-size: 0.9rem;
}

.report-table th,
.report-table td {
    padding: 10px;
    text-align: center;
    border: 1px solid #eee;
}

.report-table th {
    background-color: var(--brand-red-light);
    color: var(--brand-red);
    font-weight: 600;
}

.report-table tr:nth-child(even) {
    background-color: #fafafa;
}

.report-table tr:hover {
    background-color: #fff5f6;
}

/* للتنسيق المتجاوب في الجداول الكبيرة */
.table-responsive {
    overflow-x: auto;
}

/* تنسيق قسم التدريب */
.row-2-container {
    display: block;
    /* إلغاء الـ Grid */
    width: 100%;
}

.extra-stats {
    display: none;
}

.stat-box.small {
    padding: 10px;
}

/* قائمة الأهداف المفقودة */
.missed-list {
    list-style-type: none;
    padding: 0;
}

.missed-list li {
    padding: 8px 0;
    border-bottom: 1px dashed #eee;
    color: #555;
    position: relative;
    padding-left: 20px;
}

.missed-list li::before {
    content: '⚠️';
    position: absolute;
    left: 0;
    font-size: 12px;
}

@media (max-width: 768px) {
    .row-2-container {
        grid-template-columns: 1fr;
    }
}

/* ============================================================ */
/* === تباعد أقسام التقرير (Spacing Fix) === */
/* ============================================================ */

/* إضافة مسافة أسفل كل قسم في التقرير */
.report-section {
    margin-bottom: 30px;
    /* مسافة واضحة (يمكنك زيادتها لـ 40px لو تحب) */
}

/* إزالة المسافة من آخر قسم عشان الشكل يبقى مضبوط مع الفوتر */
.report-section:last-child {
    margin-bottom: 0;
}

/* ============================================================ */
/* === إصلاح مسافات الداشبورد (Dashboard Spacing Fix) === */
/* ============================================================ */

/* إضافة مسافة أسفل كل كارت أو حاوية داخل الداشبورد */
#dashboard-view>.card,
#dashboard-view>.row-3-container {
    margin-bottom: 30px;
    /* نفس المسافة المستخدمة في التقرير */
}

/* إزالة المسافة من آخر عنصر للحفاظ على شكل الفوتر */
#dashboard-view> :last-child {
    margin-bottom: 0;
}

/* ============================================================ */
/* === LIVE VISITOR COUNTER (التصميم المدمج) === */
/* ============================================================ */

.live-visits-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background-color: #ffffff;
    /* خلفية بيضاء نظيفة */
    border: 1px solid #e0e0e0;
    /* إطار رمادي خفيف جداً */
    padding: 8px 15px;
    border-radius: 8px;
    /* نفس انحناء الفلاتر ليكون متناسقاً */
    font-size: 0.8rem;
    /* خط صغير وأنيق */
    font-weight: 600;
    color: var(--dark-text);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    /* ظل خفيف جداً */
    height: 40px;
    /* نفس ارتفاع الفلاتر لضبط المحاذاة */
    white-space: nowrap;
    /* يمنع النص من النزول لسطرين */
}

/* النقطة النابضة */
/* النقطة الخضراء (ثابتة بدون نبض) */
.pulse-dot {
    width: 8px;
    height: 8px;
    background-color: #27ae60;
    /* أخضر */
    border-radius: 50%;
    display: inline-block;
    /* تم حذف الأنيميشن والظل الكبير */
}

/* يمكنك حذف @keyframes pulse-green بالكامل لأنه لم يعد مستخدماً */

/* === تعديلات الهيدر لضبط المحاذاة === */

.main-header {
    /* جعل العناصر تتوزع: العنوان يسار، والتحكم يمين */
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    /* يسمح بالنزول سطر في الموبايل */
}

.controls-container {
    display: flex;
    align-items: center;
    gap: 10px;
    /* مسافة بين العداد والفلاتر */
    flex-wrap: wrap;
    justify-content: flex-end;
    /* تجميع العناصر لليمين */
}

/* === تنسيق الموبايل (محدث لتوسط العنوان) === */
@media screen and (max-width: 768px) {
    .main-header {
        flex-direction: column;
        align-items: center;
        /* هذا السطر يجبر كل العناصر (بما فيها العنوان) على التوسط */
        text-align: center;
        /* ضمان توسط النصوص */
    }

    .main-header h1 {
        width: 100%;
        text-align: center;
        /* إجبار العنوان تحديداً على التوسط */
        margin-bottom: 15px;
        /* مسافة أسفله */
    }

    .controls-container {
        justify-content: center;
        width: 100%;
    }

    .live-visits-badge {
        width: 100%;
        justify-content: center;
        margin-bottom: 10px;
        /* مسافة بين العداد والفلاتر */
    }

    #year-filter,
    #month-filter {
        flex: 1;
    }
}

/* ============================================================ */
/* === RAMADAN THEME & CALENDAR === */
/* ============================================================ */

#ramadan-view {
    color: #2c3e50;
}

.ramadan-header {
    background: linear-gradient(135deg, #1a2a6c, #b21f1f, #fdbb2d);
    /* ألوان الغروب الرمضاني */
    color: white !important;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40px !important;
    text-align: center;
}

.ramadan-header h2 {
    border-left: none !important;
    font-size: 2rem;
    margin: 0;
}

.fanoos,
.hilal {
    font-size: 3rem;
    animation: swing 3s infinite ease-in-out;
}

@keyframes swing {

    0%,
    100% {
        transform: rotate(-10deg);
    }

    50% {
        transform: rotate(10deg);
    }
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 15px;
    margin-top: 20px;
}

.day-box {
    background: #fff;
    border: 1px solid #e0e0e0;
    padding: 15px;
    border-radius: 12px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.day-box:hover {
    background: #fdf2e9;
    border-color: #f39c12;
    transform: translateY(-5px);
}

.day-number {
    display: block;
    font-weight: 700;
    font-size: 1.2rem;
    color: #d35400;
}

.day-tip-icon {
    font-size: 1.5rem;
    margin-top: 5px;
}

/* تنسيق الفعاليات */
.event-item {
    display: flex;
    gap: 20px;
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.event-date {
    background: #1a2a6c;
    color: white;
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 0.8rem;
    height: fit-content;
    min-width: 80px;
    text-align: center;
}

.highlight-event {
    background-color: #fff9eb;
    border-radius: 12px;
    border: 1px solid #f1c40f;
}

@media screen and (max-width: 768px) {
    .calendar-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.hero-metrics-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 15px;
    margin-bottom: 25px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    border: 1px solid #eaebec;
    gap: 15px;
}

.metric-section {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 10px 20px;
}

.eco-section-highlight {
    flex: 1.5;
    display: flex;
    align-items: center;
    gap: 20px;
    background: linear-gradient(135deg, rgba(46, 204, 113, 0.04) 0%, rgba(46, 204, 113, 0.1) 100%);
    border: 1px solid rgba(46, 204, 113, 0.2);
    border-radius: 12px;
    padding: 15px 25px;
}

.metric-icon {
    min-width: 65px;
    height: 65px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
}

.hours-content {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.eco-stats-wrapper {
    flex: 1;
    display: flex;
    justify-content: space-around;
    align-items: center;
    width: 100%;
}

.eco-divider {
    width: 1px;
    height: 40px;
    background-color: rgba(46, 204, 113, 0.25);
}

/* --- إعدادات الموبايل الشاشات الصغيرة --- */
@media (max-width: 768px) {
    .hero-metrics-card {
        flex-direction: column;
        padding: 15px;
        gap: 15px;
    }

    .metric-section,
    .eco-section-highlight {
        flex-direction: column;
        text-align: center;
        gap: 12px;
        width: 100%;
        padding: 20px 15px;
    }

    .hours-content {
        align-items: center;
    }

    .metric-icon {
        min-width: 55px;
        height: 55px;
        font-size: 1.8rem;
    }

    .eco-stats-wrapper {
        justify-content: center;
        gap: 25px;
    }
}
