:root {
  --color-primary:       #007BFF;
  --color-primary-hover: #0056b3;
  --color-success:       #28a745;
  --color-danger:        #dc3545;
  --color-info:          #17a2b8;
  --color-warning:       #ffc107;
  --text-dark:           #212529;
  --bg-even:             #f9f9f9;
  --border-light:        #ddd;
  --bg-header:           #f4f4f4;
  /* إضافة متغير لسمك الحدود لتكون واضحة */
  --focus-ring-color:    #000; 
}

/* ===== Base ===== */
body {
    font-family: Arial, sans-serif;
    margin: 20px;
    direction: rtl;
    line-height: 1.6; /* زيادة طفيفة للقراءة */
    font-size: 16px; /* تكبير الخط الأساسي قليلاً */
    color: var(--text-dark);
}

h1, h2 { color: #333; }

/* هام جداً: تحسين إمكانية الوصول (Focus)
   هذا يجعل أي عنصر تقف عليه بلوحة المفاتيح محاطاً بإطار واضح */
*:focus {
    outline: 3px solid var(--color-warning);
    outline-offset: 2px;
}

/* ===== Utilities (أدوات مساعدة) ===== */
/* هذا هو الكود الذي كان ناقصاً وتسبب في ظهور النموذج دائماً */
.hidden {
    display: none !important;
}

/* فئة لإخفاء النصوص بصرياً ولكن قراءتها بقارئ الشاشة */
.sr-only {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0,0,0,0); border: 0;
}

/* ===== Forms (النماذج) ===== */
/* تنسيق حقول الإدخال لتكون كبيرة وواضحة */
input[type="text"],
input[type="email"],
input[type="number"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 12px; /* مساحة داخلية مريحة */
    margin-bottom: 15px;
    border: 2px solid #ccc; /* حدود واضحة */
    border-radius: 4px;
    font-size: 1rem;
    box-sizing: border-box;
}

label {
    display: block;
    margin-bottom: 8px;
    font-weight: bold;
}

/* حاوية النماذج (تستخدم في صفحة الإشعارات) */
.form-section {
    background: #fff;
    padding: 25px;
    border: 2px solid var(--border-light);
    border-radius: 8px;
    margin-bottom: 30px;
}

/* أزرار التبديل والقوائم (الخاصة بصفحة الإشعارات) */
.main-toggle-btn {
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    cursor: pointer;
    border-radius: 5px;
    margin-bottom: 20px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.checkbox-wrapper {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin: 20px 0;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: var(--bg-even);
    border: 1px solid var(--border-light);
    border-radius: 5px;
    cursor: pointer;
}

.checkbox-label input {
    width: 20px; height: 20px; /* تكبير مربع الاختيار */
    margin: 0;
}

/* ===== Buttons ===== */
button, .button {
    display: inline-block;
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 12px 20px; /* تكبير الزر لسهولة الضغط */
    text-decoration: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1rem;
    transition: background-color .2s ease;
    text-align: center;
}

button:hover, .button:hover {
    background-color: var(--color-primary-hover);
}

.btn-secondary { background-color: #6c757d; }
.btn-secondary:hover { background-color: #5a6268; }

/* ===== Tables ===== */
.table-responsive { overflow-x: auto; }

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

table th, table td {
    border: 1px solid var(--border-light);
    padding: 12px; /* مساحة أكبر للقراءة */
    text-align: right;
}

table th {
    background-color: var(--bg-header);
    color: #333;
    font-weight: bold;
}

table tr:nth-child(even) {
    background-color: var(--bg-even);
}

/* ===== Alerts ===== */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 5px;
    color: white;
    font-weight: bold;
}

.alert-success { background-color: var(--color-success); }
.alert-danger  { background-color: var(--color-danger);  }
.alert-info    { background-color: var(--color-info);    }
.alert-warning {
    background-color: var(--color-warning);
    color: var(--text-dark);
}

/* ===== Footer ===== */
.footer {
    background-color: #f1f1f1;
    text-align: center;
    font-size: 1rem;
    padding: 20px;
    border-top: 1px solid #ccc;
    margin-top: 40px;
    color: #333;
}

.footer a {
    color: var(--color-primary);
    text-decoration: none;
    font-weight: bold;
}

.footer a:hover {
    text-decoration: underline;
}/* ===== النافبار الرئيسي ===== */
.nav-container {
    background-color: #f8f9fa;
    padding: 10px 20px;
    border-bottom: 2px solid #ccc;
}

.nav-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.site-logo {
    font-size: 20px;
    font-weight: bold;
    color: #007BFF;
    text-decoration: none;
}

.site-logo:focus {
    outline: 3px solid #ffc107;
    outline-offset: 2px;
    border-radius: 4px;
}

/* زر القائمة في الموبايل */
.menu-toggle {
    background-color: #007BFF;
    color: white;
    padding: 8px 12px;
    font-size: 16px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    display: none;
}

.menu-toggle:focus {
    outline: 3px solid #ffc107;
    outline-offset: 2px;
}

/* القائمة الرئيسية */
.main-nav {
    list-style: none;
    padding: 0;
    margin: 10px 0 0 0;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: flex-start;
}

.main-nav > li {
    flex: 1 1 auto;
    position: relative;
}

/* روابط القائمة */
.main-nav > li > a {
    display: block;
    text-align: center;
    padding: 10px 15px;
    background-color: #007BFF;
    color: white;
    text-decoration: none;
    border-radius: 6px;
    transition: background-color 0.2s;
}

.main-nav > li > a:hover,
.main-nav > li > a:focus {
    background-color: #0056b3;
    outline: none;
    box-shadow: 0 0 0 3px #ffc107;
}

.main-nav > li > a.active {
    background-color: #0056b3;
    font-weight: bold;
    border: 2px solid #004080;
}

/* ===== زر القائمة المنسدلة ===== */
.nav-dropdown-btn {
    display: block;
    width: 100%;
    text-align: center;
    padding: 10px 15px;
    background-color: #007BFF;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: inherit;
}

.nav-dropdown-btn:hover,
.nav-dropdown-btn:focus {
    background-color: #0056b3;
    outline: none;
    box-shadow: 0 0 0 3px #ffc107;
}

.nav-dropdown-btn.active {
    background-color: #0056b3;
    font-weight: bold;
    border: 2px solid #004080;
}

.nav-dropdown-btn[aria-expanded="true"] {
    border-radius: 6px 6px 0 0;
}

.dropdown-arrow {
    font-size: 12px;
    margin-right: 6px;
    transition: transform 0.2s;
    display: inline-block;
}

.nav-dropdown-btn[aria-expanded="true"] .dropdown-arrow {
    transform: rotate(180deg);
}

/* ===== القائمة الفرعية ===== */
.nav-submenu {
    list-style: none;
    padding: 0;
    margin: 0;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    background-color: #fff;
    border: 2px solid #0056b3;
    border-top: none;
    border-radius: 0 0 6px 6px;
    z-index: 100;
    min-width: 200px;
}

.nav-submenu li {
    border-bottom: 1px solid #e0e0e0;
}

.nav-submenu li:last-child {
    border-bottom: none;
}

.nav-submenu a {
    display: block;
    padding: 10px 14px;
    color: #0056b3;
    text-decoration: none;
    font-size: 14px;
    text-align: right;
    transition: background-color 0.15s;
}

.nav-submenu a:hover,
.nav-submenu a:focus {
    background-color: #e8f0fe;
    outline: none;
    box-shadow: inset 0 0 0 2px #ffc107;
}

.nav-submenu a.active {
    background-color: #dbeafe;
    font-weight: bold;
    color: #003d80;
}

/* ===== موبايل ===== */
@media (max-width: 768px) {
    .menu-toggle {
        display: inline-block;
    }

    .main-nav {
        display: none;
        flex-direction: column;
        gap: 0;
    }

    .main-nav > li {
        width: 100%;
    }

    .main-nav.show {
        display: flex;
    }

    .nav-submenu {
        position: static;
        border: none;
        border-top: 1px solid #cce0ff;
        border-radius: 0;
        background-color: #f0f7ff;
    }

    .nav-submenu a {
        padding-right: 28px;
    }
}

