
/* ==========================================================================
   إعدادات الخطوط والتنسيق العام للموقع بالكامل
   ========================================================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: #ffffff;
    color: #333;
    text-align: right;
    direction: rtl;
    overflow-x: hidden;
}

/* ==========================================================================
   تنسيقات الواجهة الأمامية (Front-End) - شاشات الديسكتوب والكمبيوتر
   ========================================================================== */

/* الهيدر العلوي وشريط الأخبار العاجلة */
.breaking-news-bar {
    background-color: #ff0000;
    color: #fff;
    padding: 8px 15px;
    font-size: 14px;
    display: flex;
    align-items: center;
    overflow: hidden;
}

.breaking-title {
    background: #b30000;
    padding: 3px 10px;
    font-weight: bold;
    margin-left: 15px;
    border-radius: 3px;
    white-space: nowrap;
}

.breaking-ticker {
    white-space: nowrap;
    animation: ticker 20s linear infinite;
}

@keyframes ticker {
    0% { transform: translate3d(100%, 0, 0); }
    100% { transform: translate3d(-100%, 0, 0); }
}

/* القائمة الرئيسية للهيدر العلوي للموقع العام */
.main-header {
    background-color: #171d39;
    color: #ffffff;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 1000;
}

.header-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    width: 100%;
}

.logo a {
    color: #fff;
    text-decoration: none;
    font-size: 24px;
    font-weight: bold;
}

/* القائمة المنسدلة للديسكتوب */
.nav-menu ul {
    display: flex;
    list-style: none;
}

.nav-menu ul li {
    position: relative;
    margin-left: 20px;
}

.nav-menu ul li a {
    color: #fff;
    text-decoration: none;
    padding: 10px 5px;
    display: block;
    font-weight: bold;
    transition: color 0.3s;
}

.nav-menu ul li a:hover {
    color: #ffcc00;
}

.nav-menu ul li ul.dropdown {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    background-color: #ffffff;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    min-width: 180px;
    border-radius: 4px;
}

.nav-menu ul li ul.dropdown li {
    margin: 0;
    width: 100%;
}

.nav-menu ul li ul.dropdown li a {
    color: #333;
    padding: 10px 15px;
}

.nav-menu ul li ul.dropdown li a:hover {
    background-color: #f5f5f5;
    color: #171d39;
}

.nav-menu ul li:hover ul.dropdown {
    display: block;
}

/* إخفاء أزرار الموبايل الافتراضية على الديسكتوب */
.menu-toggle, .menu-close, .admin-top-bar {
    display: none !important;
}

/* الهيكل العام للواجهة الأمامية وتوزيع الكتل */
.main-layout {
    max-width: 1200px;
    margin: 20px auto;
    display: flex;
    gap: 25px;
    padding: 0 15px;
    width: 100%;
}

.content-area {
    flex: 3;
}

.sidebar-area {
    flex: 1;
    background: #fcfcfc;
    border-right: 1px solid #eee;
    padding: 15px;
}

/* ==========================================================================
   تنسيقات لوحة التحكم (Admin Dashboard) - شاشات الديسكتوب والكمبيوتر
   ========================================================================== */

/* عزل بناء جسم لوحة التحكم ليعمل ككتل أفقية ثابتة ومستقلة */
body.admin-body-fix {
    display: flex !important;
    flex-direction: row !important;
    min-height: 100vh !important;
    background-color: #f4f6f9 !important;
    overflow-x: hidden !important;
}

.admin-sidebar {
    width: 260px !important;
    min-width: 260px !important;
    background-color: #171d39;
    color: #fff;
    padding: 20px 0;
    display: flex;
    flex-direction: column;
    position: relative !important;
    z-index: 10;
}

.sidebar-brand {
    text-align: center;
    font-size: 20px;
    font-weight: bold;
    padding-bottom: 20px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 20px;
}

.sidebar-user {
    padding: 0 20px 20px 20px;
    font-size: 14px;
    color: #ffcc00;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 10px;
}

.sidebar-menu {
    list-style: none;
}

.sidebar-menu li a {
    display: block;
    padding: 12px 20px;
    color: #ddd;
    text-decoration: none;
    font-weight: bold;
    transition: all 0.3s;
}

.sidebar-menu li a:hover, .sidebar-menu li a.active {
    background-color: rgba(255,255,255,0.1);
    color: #fff;
    border-right: 4px solid red;
}

.admin-content {
    flex: 1 !important;
    padding: 30px;
    box-sizing: border-box;
}

.content-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
    border-bottom: 2px solid #ddd;
    padding-bottom: 15px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.stat-card {
    background: #fff;
    padding: 25px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.stat-number {
    font-size: 28px;
    font-weight: bold;
    color: #171d39;
    margin-top: 5px;
}

.stat-label {
    color: #777;
    font-size: 14px;
}

.stat-icon {
    font-size: 40px;
    opacity: 0.2;
}

.form-container, .table-container {
    background: #fff;
    padding: 25px;
    border-radius: 6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.02);
    margin-bottom: 30px;
}

.form-group {
    margin-bottom: 15px;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: bold;
    font-size: 14px;
    color: #555;
}

.form-group input[type="text"], .form-group input[type="email"], .form-group input[type="password"], .form-group select, .form-group textarea {
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    font-family: 'Cairo', sans-serif;
    width: 100%;
}

.checkbox-group {
    display: flex;
    gap: 20px;
    margin: 15px 0;
}

.checkbox-group label {
    font-weight: bold;
    font-size: 14px;
    cursor: pointer;
}

.btn-add, .btn-save {
    background: green;
    color: #fff;
    border: none;
    padding: 12px 25px;
    font-size: 16px;
    font-weight: bold;
    border-radius: 4px;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
}

.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}

.admin-table th, .admin-table td {
    padding: 12px;
    border-bottom: 1px solid #eee;
    font-size: 14px;
    text-align: right;
}

.admin-table th {
    background: #f8f9fa;
    color: #555;
}

.btn-delete {
    color: red;
    text-decoration: none;
    font-weight: bold;
}

.alert {
    padding: 12px;
    border-radius: 4px;
    margin-bottom: 20px;
    font-weight: bold;
}

.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }


/* ==========================================================================
   أكواد التجاوب الذكي والشامل مع شاشات الموبايل والتابلت (Responsive Engine)
   ========================================================================== */

@media (max-width: 768px) {
    
    /* ---------------- Front-End Mobile Style ---------------- */
    .main-layout {
        flex-direction: column;
        gap: 20px;
    }

    .header-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
        padding: 10px 15px;
        width: 100%;
    }

    .menu-toggle {
        display: block !important;
        background: none;
        border: none;
        color: #fff;
        font-size: 28px;
        cursor: pointer;
    }

    .menu-close {
        display: block !important;
        background: none;
        border: none;
        color: #333;
        font-size: 24px;
        padding: 15px;
        text-align: left;
        width: 100%;
        cursor: pointer;
        border-bottom: 1px solid #eee;
    }

    .nav-menu {
        position: fixed;
        top: 0;
        right: -280px;
        width: 280px;
        height: 100vh;
        background: #ffffff;
        box-shadow: -5px 0 15px rgba(0,0,0,0.1);
        z-index: 9999;
        transition: right 0.3s ease;
        display: block;
    }

    .nav-menu.open {
        right: 0; 
    }

    .nav-menu ul {
        flex-direction: column;
        padding: 0;
        margin: 0;
    }

    .nav-menu ul li {
        margin: 0;
        width: 100%;
        border-bottom: 1px solid #f5f5f5;
    }

    .nav-menu ul li a {
        color: #333 !important;
        padding: 15px 20px;
        display: block;
        font-size: 16px;
        text-align: right;
    }

    .nav-menu ul li ul.dropdown {
        position: relative;
        top: 0;
        right: 0;
        width: 100%;
        background: #fafafa;
        box-shadow: none;
        display: block;
        padding-right: 15px;
    }

    .nav-menu ul li ul.dropdown li a {
        padding: 10px 20px;
        font-size: 14px;
        color: #666;
    }

    .search-desktop {
        display: none !important;
    }

    .sidebar-area {
        border-right: none;
        border-top: 2px solid #eee;
        padding-top: 20px;
        background: #fff;
    }

    h1 {
        font-size: 22px !important;
    }

    /* ---------------- Backend Admin Mobile Style (صيانة لوحة الإدارة) ---------------- */
    
    body.admin-body-fix {
        flex-direction: column !important;
    }

    .admin-top-bar {
        display: flex !important;
        background-color: #171d39;
        color: #fff;
        padding: 12px 15px;
        justify-content: space-between;
        align-items: center;
        position: sticky !important;
        top: 0 !important;
        width: 100% !important;
        z-index: 1002 !important;
        box-shadow: 0 2px 5px rgba(0,0,0,0.1);
    }
    
    .admin-top-title {
        font-weight: bold;
        font-size: 16px;
    }

    .admin-menu-toggle {
        display: block !important;
        background: rgba(255,255,255,0.15);
        border: 1px solid rgba(255,255,255,0.3);
        color: #fff;
        padding: 6px 12px;
        border-radius: 4px;
        font-family: 'Cairo', sans-serif;
        font-size: 14px;
        cursor: pointer;
    }

    .admin-sidebar {
        position: fixed !important;
        top: 52px !important;
        right: -280px !important;
        width: 280px !important;
        min-width: 280px !important;
        height: calc(100vh - 52px) !important;
        z-index: 1001 !important;
        box-shadow: -5px 0 15px rgba(0,0,0,0.15);
    }

    .admin-sidebar.active {
        right: 0 !important;
    }

    .admin-content {
        width: 100% !important;
        min-width: 100% !important;
        padding: 15px !important;
        box-sizing: border-box !important;
        flex: none !important;
    }

    .form-container, .table-container {
        padding: 15px !important;
        margin-bottom: 20px !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: auto !important;
        box-sizing: border-box !important;
    }

    div[style*="grid-template-columns"], 
    .stats-grid {
        grid-template-columns: 1fr !important;
        gap: 15px !important;
    }

    .admin-table th, .admin-table td {
        padding: 8px 10px !important;
        font-size: 13px !important;
        white-space: nowrap !important;
    }
}