/* ملف CSS موحد للمشروع - تصميم عصري ومتسق */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');

/* ========== المتغيرات العامة ========== */
:root {
    --primary-color: #ff9800;
    --primary-light: #ffad33;
    --primary-dark: #f57c00;
    --primary-soft: rgba(255, 152, 0, 0.1);
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #212529;

    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 15px rgba(0, 0, 0, 0.1);

    --transition: all 0.3s ease;
    --font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* ========== الإعدادات الأساسية ========== */
* {
    box-sizing: border-box;
}

body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--dark-color);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* ========== الحاويات ========== */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* ========== القائمة الجانبية ========== */
.profile-menu {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 1050;
    direction: ltr;
}

/* تجنب التداخل مع المحتوى */
body {
    padding-top: 0;
}

@media (max-width: 768px) {
    .profile-menu {
        top: 10px;
        left: 10px;
    }

    .profile-menu .dropdown-toggle {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }

    .profile-menu .dropdown-menu {
        min-width: 180px;
    }
}

.profile-menu .dropdown-toggle {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    border-radius: var(--border-radius);
    padding: 0.75rem 1.25rem;
    font-weight: 600;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.profile-menu .dropdown-toggle:hover,
.profile-menu .dropdown-toggle:focus {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.profile-menu .dropdown-menu {
    border: none;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    padding: 0.5rem 0;
    margin-top: 0.5rem;
    min-width: 200px;
    direction: rtl;
}

.profile-menu .dropdown-item {
    padding: 0.75rem 1.25rem;
    font-weight: 500;
    transition: var(--transition);
    border-radius: 0;
}

.profile-menu .dropdown-item:hover {
    background: var(--light-color);
    color: var(--primary-color);
    transform: translateX(5px);
}

.profile-menu .dropdown-item.text-danger:hover {
    background: var(--danger-color);
    color: white;
}

.profile-menu .dropdown-divider {
    margin: 0.5rem 0;
    border-color: #dee2e6;
}

/* تحسين عرض القائمة */
.profile-menu .dropdown-toggle::after {
    margin-left: 0.5rem;
}

.profile-menu .dropdown-menu {
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* إعادة تعيين كاملة للأزرار الجانبية */
.dashboard-buttons {
    position: fixed !important;
    top: 300px !important; /* مسافة كبيرة جداً تحت البار العلوي */
    right: 20px !important;
    z-index: 9999 !important; /* أولوية عالية جداً */
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

.logout-btn {
    position: fixed !important;
    top: 580px !important; /* موضع ثابت تحت الأزرار */
    right: 20px !important;
    z-index: 9999 !important; /* أولوية عالية جداً */
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    transform: none !important;
}

/* إعدادات موحدة لجميع الشاشات */
@media (min-width: 769px) {
    .dashboard-buttons {
        top: 300px !important;
        right: 15px !important;
    }

    .logout-btn {
        top: 580px !important;
        right: 15px !important;
    }
}

@media (min-width: 1200px) {
    .dashboard-buttons {
        top: 300px !important;
        right: 30px !important;
    }

    .logout-btn {
        top: 580px !important;
        right: 30px !important;
    }
}

@media (min-width: 1400px) {
    .dashboard-buttons {
        top: 300px !important;
        right: 40px !important;
    }

    .logout-btn {
        top: 580px !important;
        right: 40px !important;
    }
}

/* ========== الكروت ========== */
.card {
    background: #fff;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    border: none;
    margin-bottom: 1.5rem;
    overflow: hidden;
    transition: var(--transition);
}

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

.card-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 1rem 1.5rem;
    border-bottom: none;
    font-weight: 600;
}

.card-body {
    padding: 1.5rem;
}

.card-footer {
    background-color: var(--light-color);
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

/* ========== العناوين ========== */
h1, h2, h3, h4, h5, h6 {
    color: var(--primary-dark);
    font-weight: 600;
    margin-bottom: 1rem;
    line-height: 1.3;
}

h1 { font-size: 2.5rem; }
h2 { font-size: 2rem; }
h3 { font-size: 1.75rem; }
h4 { font-size: 1.5rem; }
h5 { font-size: 1.25rem; }
h6 { font-size: 1rem; }

/* ========== الأزرار ========== */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    font-family: var(--font-family);
}

/* ========== أزرار العودة المعيارية ========== */
.back-button {
    position: fixed;
    top: 100px; /* أسفل الهيدر مباشرة */
    right: 20px;
    z-index: 1040;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(245, 124, 0, 0.3);
    transition: all 0.3s ease;
    text-decoration: none;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 120px;
    justify-content: center;
}

.back-button:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 124, 0, 0.4);
    text-decoration: none;
}

.back-button:active {
    transform: translateY(0);
}

.back-button i {
    font-size: 1rem;
}

/* أزرار العودة في المحتوى */
.content-back-button {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #868e96 100%);
    color: white;
    border: none;
    border-radius: var(--border-radius);
    padding: 10px 20px;
    font-size: 0.9rem;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}

.content-back-button:hover {
    background: linear-gradient(135deg, #5a6268 0%, var(--secondary-color) 100%);
    color: white;
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

/* ========== شريط التنقل العلوي المعياري ========== */
.standard-navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1060;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    padding: 12px 20px;
    color: white;
    box-shadow: 0 2px 15px rgba(0,0,0,0.15);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 15px;
    color: white;
    text-decoration: none;
    font-weight: 600;
    font-size: 1.1rem;
}

.navbar-brand:hover {
    color: white;
    text-decoration: none;
}

.navbar-logo {
    height: 40px;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
}

.navbar-logo:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.navbar-user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.user-details {
    text-align: right;
}

.user-name {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
}

.user-role {
    font-size: 0.8rem;
    opacity: 0.8;
    margin: 0;
}

/* قائمة المستخدم المنسدلة */
.user-dropdown {
    position: relative;
}

.dropdown-toggle-custom {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    border-radius: 25px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.3s ease;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
}
/* عند استخدام .dropdown-toggle (Bootstrap) لا نظهر السهم الإضافي */
.dropdown-toggle-custom.dropdown-toggle::after { display: none; }

.dropdown-toggle-custom:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* ========== تخطيط الصفحة المعياري ========== */
.page-container {
    min-height: 100vh;
    padding-top: 80px; /* مساحة للشريط العلوي */
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
}

.page-content {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    position: relative;
}

.page-header {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 30px;
    margin-bottom: 30px;
    box-shadow: var(--shadow);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.page-title {
    color: var(--primary-color);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.page-subtitle {
    color: var(--secondary-color);
    font-size: 1.1rem;
    margin: 0;
    opacity: 0.8;
}

.page-logo {
    height: 50px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-sm);
}

/* بطاقات المحتوى */
.content-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 25px;
    margin-bottom: 25px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255, 255, 255, 0.8);
    transition: var(--transition);
}

.content-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.content-card-header {
    border-bottom: 2px solid var(--light-color);
    padding-bottom: 15px;
    margin-bottom: 20px;
}

.content-card-title {
    color: var(--primary-color);
    font-size: 1.3rem;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

/* أزرار الإجراءات */
.action-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    justify-content: center;
}

.action-buttons .btn {
    min-width: 140px;
}

/* رسائل التنبيه المحسنة */
.alert {
    border-radius: var(--border-radius);
    border: none;
    padding: 15px 20px;
    margin-bottom: 20px;
    font-weight: 500;
    box-shadow: var(--shadow-sm);
}

.alert-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #28a745 100%);
    color: white;
}

.alert-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #e74c3c 100%);
    color: white;
}

.alert-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #f39c12 100%);
    color: var(--dark-color);
}

.alert-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #17a2b8 100%);
    color: white;
}

/* ========== التصميم المتجاوب للمكونات المعيارية ========== */
@media (max-width: 768px) {
    /* شريط التنقل */
    .standard-navbar {
        padding: 10px 15px;
    }

    .navbar-content {
        flex-direction: column;
        gap: 10px;
        align-items: flex-start;
    }

    .navbar-logo {
        height: 30px;
    }

    .navbar-brand {
        font-size: 1rem;
        gap: 10px;
    }

    .navbar-user-info {
        align-self: flex-end;
        gap: 10px;
    }

    .user-avatar {
        width: 30px;
        height: 30px;
        font-size: 1rem;
    }

    .user-name {
        font-size: 0.85rem;
    }

    .user-role {
        font-size: 0.75rem;
    }

    /* أزرار العودة */
    .back-button {
        top: 90px;
        right: 15px;
        padding: 10px 16px;
        font-size: 0.8rem;
        min-width: 100px;
    }

    /* تخطيط الصفحة */
    .page-container {
        padding-top: 120px; /* مساحة إضافية للشريط العلوي المتعدد الأسطر */
    }

    .page-content {
        padding: 15px;
    }

    .page-header {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    .page-title {
        font-size: 1.5rem;
        flex-direction: column;
        gap: 10px;
    }

    .page-subtitle {
        font-size: 1rem;
    }

    .page-logo {
        height: 40px;
    }

    /* بطاقات المحتوى */
    .content-card {
        padding: 20px 15px;
        margin-bottom: 20px;
    }

    .content-card-title {
        font-size: 1.1rem;
        flex-direction: column;
        gap: 8px;
        text-align: center;
    }

    /* أزرار الإجراءات */
    .action-buttons {
        flex-direction: column;
        align-items: stretch;
    }

    .action-buttons .btn {
        min-width: auto;
        width: 100%;
        margin-bottom: 10px;
    }

    /* القوائم المنسدلة */
    .dropdown-toggle-custom {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    /* تحسينات إضافية للشاشات الصغيرة جداً */
    .standard-navbar {
        padding: 8px 10px;
    }

    .page-container {
        padding-top: 140px;
    }

    .page-content {
        padding: 10px;
    }

    .page-header {
        padding: 15px 10px;
    }

    .page-title {
        font-size: 1.3rem;
    }

    .content-card {
        padding: 15px 10px;
    }

    .back-button {
        top: 85px;
        right: 10px;
        padding: 8px 12px;
        font-size: 0.75rem;
        min-width: 80px;
    }
}

/* ========== فئات المساعدة والأدوات ========== */
.text-center { text-align: center !important; }
.text-left { text-align: left !important; }
.text-right { text-align: right !important; }

.mt-1 { margin-top: 0.25rem !important; }
.mt-2 { margin-top: 0.5rem !important; }
.mt-3 { margin-top: 1rem !important; }
.mt-4 { margin-top: 1.5rem !important; }
.mt-5 { margin-top: 3rem !important; }

.mb-1 { margin-bottom: 0.25rem !important; }
.mb-2 { margin-bottom: 0.5rem !important; }
.mb-3 { margin-bottom: 1rem !important; }
.mb-4 { margin-bottom: 1.5rem !important; }
.mb-5 { margin-bottom: 3rem !important; }

.pt-1 { padding-top: 0.25rem !important; }
.pt-2 { padding-top: 0.5rem !important; }
.pt-3 { padding-top: 1rem !important; }
.pt-4 { padding-top: 1.5rem !important; }
.pt-5 { padding-top: 3rem !important; }

.pb-1 { padding-bottom: 0.25rem !important; }
.pb-2 { padding-bottom: 0.5rem !important; }
.pb-3 { padding-bottom: 1rem !important; }
.pb-4 { padding-bottom: 1.5rem !important; }
.pb-5 { padding-bottom: 3rem !important; }

.d-none { display: none !important; }
.d-block { display: block !important; }
.d-flex { display: flex !important; }
.d-inline { display: inline !important; }
.d-inline-block { display: inline-block !important; }

.justify-content-center { justify-content: center !important; }
.justify-content-between { justify-content: space-between !important; }
.justify-content-end { justify-content: flex-end !important; }
.align-items-center { align-items: center !important; }
.align-items-start { align-items: flex-start !important; }
.align-items-end { align-items: flex-end !important; }

.w-100 { width: 100% !important; }
.h-100 { height: 100% !important; }

.text-primary { color: var(--primary-color) !important; }
.text-secondary { color: var(--secondary-color) !important; }
.text-success { color: var(--success-color) !important; }
.text-danger { color: var(--danger-color) !important; }
.text-warning { color: var(--warning-color) !important; }
.text-info { color: var(--info-color) !important; }
.text-light { color: var(--light-color) !important; }
.text-dark { color: var(--dark-color) !important; }

.bg-primary { background-color: var(--primary-color) !important; }
.bg-secondary { background-color: var(--secondary-color) !important; }
.bg-success { background-color: var(--success-color) !important; }
.bg-danger { background-color: var(--danger-color) !important; }
.bg-warning { background-color: var(--warning-color) !important; }
.bg-info { background-color: var(--info-color) !important; }
.bg-light { background-color: var(--light-color) !important; }
.bg-dark { background-color: var(--dark-color) !important; }

.border { border: 1px solid #dee2e6 !important; }
.border-0 { border: 0 !important; }
.border-top { border-top: 1px solid #dee2e6 !important; }
.border-bottom { border-bottom: 1px solid #dee2e6 !important; }
.border-left { border-left: 1px solid #dee2e6 !important; }
.border-right { border-right: 1px solid #dee2e6 !important; }

.rounded { border-radius: var(--border-radius) !important; }
.rounded-sm { border-radius: var(--border-radius-sm) !important; }
.rounded-lg { border-radius: var(--border-radius-lg) !important; }
.rounded-circle { border-radius: 50% !important; }

.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow) !important; }
.shadow-lg { box-shadow: var(--shadow-lg) !important; }

/* فئات الشبكة البسيطة */
.row {
    display: flex;
    flex-wrap: wrap;
    margin-left: -15px;
    margin-right: -15px;
}

.col {
    flex: 1;
    padding-left: 15px;
    padding-right: 15px;
}

.col-1 { flex: 0 0 8.333333%; max-width: 8.333333%; }
.col-2 { flex: 0 0 16.666667%; max-width: 16.666667%; }
.col-3 { flex: 0 0 25%; max-width: 25%; }
.col-4 { flex: 0 0 33.333333%; max-width: 33.333333%; }
.col-5 { flex: 0 0 41.666667%; max-width: 41.666667%; }
.col-6 { flex: 0 0 50%; max-width: 50%; }
.col-7 { flex: 0 0 58.333333%; max-width: 58.333333%; }
.col-8 { flex: 0 0 66.666667%; max-width: 66.666667%; }
.col-9 { flex: 0 0 75%; max-width: 75%; }
.col-10 { flex: 0 0 83.333333%; max-width: 83.333333%; }
.col-11 { flex: 0 0 91.666667%; max-width: 91.666667%; }
.col-12 { flex: 0 0 100%; max-width: 100%; }

/* تحسينات إضافية للجداول */
.table-container {
    background: white;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow);
    overflow: hidden;
    margin-bottom: 2rem;
}

.table-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    padding: 20px;
    font-weight: 600;
    font-size: 1.1rem;
}

.table-responsive {
    border-radius: 0;
    box-shadow: none;
    overflow-x: auto;
    max-width: 100%;
}

/* تحسينات للنماذج */
.form-container {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 30px;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
}

.form-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    padding-top: 20px;
    border-top: 2px solid var(--light-color);
    margin-top: 30px;
}

/* تحسينات للبطاقات */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 2rem;
}

.stat-card {
    background: white;
    border-radius: var(--border-radius-lg);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow);
    transition: var(--transition);
    border: 1px solid rgba(255, 255, 255, 0.8);
}

.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.stat-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.stat-label {
    font-size: 1rem;
    color: var(--secondary-color);
    font-weight: 500;
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.btn:active {
    transform: translateY(0);
}

/* أحجام الأزرار */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

/* ألوان الأزرار */
.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary-color) 100%);
    color: white;
}

.btn-success {
    background: linear-gradient(135deg, var(--success-color) 0%, #28a745 100%);
    color: white;
}

.btn-success:hover {
    background: linear-gradient(135deg, #157347 0%, var(--success-color) 100%);
    color: white;
}

.btn-danger {
    background: linear-gradient(135deg, var(--danger-color) 0%, #e74c3c 100%);
    color: white;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #c82333 0%, var(--danger-color) 100%);
    color: white;
}

.btn-warning {
    background: linear-gradient(135deg, var(--warning-color) 0%, #f39c12 100%);
    color: var(--dark-color);
}

.btn-warning:hover {
    background: linear-gradient(135deg, #e0a800 0%, var(--warning-color) 100%);
    color: var(--dark-color);
}

.btn-info {
    background: linear-gradient(135deg, var(--info-color) 0%, #17a2b8 100%);
    color: white;
}

.btn-info:hover {
    background: linear-gradient(135deg, #0aa2c0 0%, var(--info-color) 100%);
    color: white;
}

.btn-secondary {
    background: linear-gradient(135deg, var(--secondary-color) 0%, #868e96 100%);
    color: white;
}

.btn-secondary:hover {
    background: linear-gradient(135deg, #5a6268 0%, var(--secondary-color) 100%);
    color: white;
}

/* الأزرار المحددة */
.btn-outline-primary {
    background: transparent;
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
}

.btn-outline-primary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-outline-secondary {
    background: transparent;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

.btn-outline-secondary:hover {
    background: var(--secondary-color);
    color: white;
}

.btn-outline-success {
    background: transparent;
    color: var(--success-color);
    border: 2px solid var(--success-color);
}

.btn-outline-success:hover {
    background: var(--success-color);
    color: white;
}

.btn-outline-danger {
    background: transparent;
    color: var(--danger-color);
    border: 2px solid var(--danger-color);
}

.btn-outline-danger:hover {
    background: var(--danger-color);
    color: white;
}

/* ========== النماذج ========== */
.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--dark-color);
    background-color: #fff;
    border: 2px solid #dee2e6;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-family: var(--font-family);
}

.form-control:focus {
    border-color: var(--primary-light);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(245, 124, 0, 0.25);
}

.form-label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--dark-color);
}

.form-group {
    margin-bottom: 1.5rem;
}

/* ========== الجداول ========== */
.table-responsive {
    border-radius: var(--border-radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.table {
    width: 100%;
    margin-bottom: 0;
    background-color: #fff;
    border-collapse: collapse;
}

.table th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    font-weight: 600;
    padding: 1rem;
    text-align: center;
    border: none;
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, 0.02);
}

.table-hover tbody tr:hover {
    background-color: rgba(245, 124, 0, 0.08);
}

/* ========== التنبيهات ========== */
.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
}

.alert-success {
    color: #0f5132;
    background-color: #d1e7dd;
    border-left: 4px solid var(--success-color);
}

.alert-danger {
    color: #842029;
    background-color: #f8d7da;
    border-left: 4px solid var(--danger-color);
}

.alert-warning {
    color: #664d03;
    background-color: #fff3cd;
    border-left: 4px solid var(--warning-color);
}

.alert-info {
    color: #055160;
    background-color: #cff4fc;
    border-left: 4px solid var(--info-color);
}

/* ========== الشارات ========== */
.badge {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--border-radius-sm);
}

.badge-online, .bg-success {
    background-color: var(--success-color) !important;
    color: white !important;
}

.badge-offline, .bg-warning {
    background-color: var(--warning-color) !important;
    color: var(--dark-color) !important;
}

.badge-disabled, .bg-danger {
    background-color: var(--danger-color) !important;
    color: white !important;
}

.bg-primary {
    background-color: var(--primary-color) !important;
    color: white !important;
}

.bg-info {
    background-color: var(--info-color) !important;
    color: white !important;
}

.bg-secondary {
    background-color: var(--secondary-color) !important;
    color: white !important;
}

/* ========== الشعار ========== */
.logo {
    height: 80px;
    width: auto;
    margin-bottom: 1.5rem;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.logo:hover {
    transform: scale(1.05);
    box-shadow: var(--shadow-lg);
}

/* ========== البحث ========== */
.search-box {
    margin-bottom: 1.5rem;
}

.search-box .form-control {
    border-radius: 25px;
    padding: 0.75rem 1.5rem;
    border: 2px solid var(--primary-light);
    background: rgba(255, 255, 255, 0.9);
}

.search-box .form-control:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 0.25rem rgba(245, 124, 0, 0.18);
}

/* ========== النوافذ المنبثقة ========== */
.modal-content {
    border-radius: var(--border-radius-lg);
    border: none;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border-bottom: none;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-footer {
    border-top: 1px solid #dee2e6;
    border-radius: 0 0 var(--border-radius-lg) var(--border-radius-lg);
}

/* ========== الروابط ========== */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--primary-dark);
    text-decoration: underline;
}

/* ========== التصميم المتجاوب ========== */
@media (max-width: 768px) {
    .container {
        padding: 10px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .btn {
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    h1 { font-size: 2rem; }
    h2 { font-size: 1.75rem; }
    h3 { font-size: 1.5rem; }
}

@media (max-width: 576px) {
    .container {
        padding: 5px;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .btn-sm {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .table th,
    .table td {
        padding: 0.5rem 0.25rem;
        font-size: 0.8rem;
    }
}

/* ========== فئات مساعدة ========== */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.d-flex { display: flex; }
.align-items-center { align-items: center; }
.justify-content-center { justify-content: center; }
.justify-content-between { justify-content: space-between; }

.w-100 { width: 100%; }
.h-100 { height: 100%; }

/* ========== تحسينات خاصة ========== */
.clickable-card {
    cursor: pointer;
    transition: var(--transition);
}

.clickable-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

.password-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.password-text {
    font-family: 'Courier New', monospace;
    font-size: 0.9rem;
    min-width: 80px;
}

.password-text.revealed {
    color: var(--danger-color);
    font-weight: 500;
}

.toggle-password {
    padding: 0.25rem 0.5rem;
    border: 1px solid #dee2e6;
    background-color: var(--light-color);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
}

.toggle-password:hover {
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.mikrotik-btn {
    min-width: 160px;
    text-align: center;
    transition: var(--transition);
}

.spinner-border-sm {
    width: 0.75rem;
    height: 0.75rem;
}

/* ========== تحسينات الإحصائيات ========== */
.stats-card {
    text-align: center;
    padding: 1.5rem;
    border-radius: var(--border-radius);
    color: white;
    transition: var(--transition);
}

.stats-card h4 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: white;
}

.stats-card p {
    margin: 0;
    font-weight: 500;
    opacity: 0.9;
}

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

/* ========== تحسينات الوصولية (Accessibility) ========== */

/* تحسين التباين للألوان */
:root {
    --primary-color: #ff9800;
    --primary-light: #ffad33;
    --primary-dark: #f57c00;
    --secondary-color: #6c757d;
    --success-color: #198754;
    --danger-color: #dc3545;
    --warning-color: #ffc107;
    --info-color: #17a2b8;
    --light-color: #f8f9fa;
    --dark-color: #212529;

    /* تحسين التباين للوصولية */
    --text-primary: #212529;
    --text-secondary: #6c757d;
    --text-muted: #6c757d;
    --link-color: #ff9800;
    --link-hover-color: #f57c00;

    --border-radius: 12px;
    --border-radius-sm: 8px;
    --border-radius-lg: 16px;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.1);
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 8px 15px rgba(0, 0, 0, 0.1);

    --transition: all 0.3s ease;
    --font-family: 'Cairo', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

/* تحسين التباين للنصوص */
body {
    font-family: var(--font-family);
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    color: var(--text-primary);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    min-height: 100vh;
}

/* تحسين الروابط للوصولية */
a {
    color: var(--link-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: var(--link-hover-color);
    text-decoration: underline;
}

a:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    border-radius: 4px;
}

/* تحسين الأزرار للوصولية */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    text-align: center;
    text-decoration: none;
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-sm);
    font-family: var(--font-family);
}

.btn:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow);
    text-decoration: none;
}

.btn:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 0.2rem rgba(245, 124, 0, 0.25);
}

.btn:active {
    transform: translateY(0);
}

/* تحسين النماذج للوصولية */
.form-control {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text-primary);
    background-color: #fff;
    border: 2px solid #dee2e6;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
    font-family: var(--font-family);
}

.form-control:focus {
    border-color: var(--primary-light);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(245, 124, 0, 0.25);
}

.form-label {
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-primary);
}

/* تحسين الجداول للوصولية */
.table th {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    font-weight: 600;
    padding: 1rem;
    text-align: center;
    border: none;
}

.table th:focus {
    outline: 2px solid white;
    outline-offset: -2px;
}

.table td {
    padding: 0.75rem 1rem;
    vertical-align: middle;
    border-top: 1px solid #dee2e6;
    text-align: center;
}

.table tbody tr:focus {
    background-color: rgba(245, 124, 0, 0.12);
    outline: 2px solid var(--primary-color);
    outline-offset: -2px;
}

/* تحسين التنقل عبر لوحة المفاتيح */
*:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* إخفاء outline للعناصر التفاعلية عند النقر */
*:focus:not(:focus-visible) {
    outline: none;
}

/* إظهار outline فقط عند التنقل بالكيبورد */
*:focus-visible {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* تحسين التنبيهات للوصولية */
.alert {
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    border: none;
    border-radius: var(--border-radius);
    font-weight: 500;
    position: relative;
}

.alert:focus {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

/* تحسين الشارات للوصولية */
.badge {
    display: inline-block;
    padding: 0.5rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
    vertical-align: baseline;
    border-radius: var(--border-radius-sm);
}

.badge:focus {
    outline: 2px solid currentColor;
    outline-offset: 1px;
}

/* تحسين القوائم المنسدلة للوصولية */
.dropdown-menu {
    border: none;
    box-shadow: var(--shadow-lg);
    z-index: 1070 !important;
    background: white;
    border-radius: 10px;
    overflow: hidden;
}

.dropdown-item {
    padding: 12px 20px;
    transition: all 0.3s ease;
    color: var(--text-primary);
    font-weight: 500;
    border-radius: 0;
}

.dropdown-item:hover {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white !important;
    transform: translateX(5px);
}

.dropdown-item:focus {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
    color: white !important;
    outline: none;
}

/* تحسين النوافذ المنبثقة للوصولية */
.modal-content {
    border-radius: var(--border-radius-lg);
    border: none;
    box-shadow: var(--shadow-lg);
}

.modal-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    color: white;
    border-bottom: none;
    border-radius: var(--border-radius-lg) var(--border-radius-lg) 0 0;
}

.modal-header .btn-close {
    filter: invert(1);
}

/* تحسين شريط التقدم للوصولية */
.progress {
    height: 8px;
    border-radius: var(--border-radius-sm);
    background-color: #e9ecef;
    overflow: hidden;
}

.progress-bar {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-light) 100%);
    transition: width 0.3s ease;
}

/* تحسين أزرار التبديل للوصولية */
.form-check-input:focus {
    box-shadow: 0 0 0 0.25rem rgba(245, 124, 0, 0.25);
}

/* تحسين أزرار الراديو والـ checkbox للوصولية */
input[type="radio"]:focus,
input[type="checkbox"]:focus {
    outline: 2px solid var(--primary-color);
    outline-offset: 2px;
}

/* تحسين التباين للشاشات الصغيرة */
@media (max-width: 768px) {
    :root {
        --font-size-base: 16px; /* منع التكبير التلقائي في iOS */
    }
    
    body {
        font-size: var(--font-size-base);
    }
    
    .btn {
        min-height: 44px; /* الحد الأدنى للعناصر القابلة للنقر */
        padding: 0.75rem 1rem;
    }
    
    .form-control {
        min-height: 44px;
        font-size: 16px; /* منع التكبير في iOS */
    }
}

/* تحسين التباين للطباعة */
@media print {
    body {
        background: white !important;
        color: black !important;
    }
    
    .btn,
    .badge,
    .alert {
        border: 1px solid black !important;
        background: white !important;
        color: black !important;
    }
    
    .table th {
        background: #f8f9fa !important;
        color: black !important;
    }
}

/* تحسين التباين للوضع المظلم (إذا كان مدعوماً) */
@media (prefers-color-scheme: dark) {
    :root {
        --text-primary: #ffffff;
        --text-secondary: #adb5bd;
        --text-muted: #6c757d;
        --link-color: #66b0ff;
        --link-hover-color: #99ccff;
    }
    
    body {
        background: #212529;
        color: var(--text-primary);
    }
    
    .card {
        background: #343a40;
        color: var(--text-primary);
    }
    
    .form-control {
        background-color: #495057;
        border-color: #6c757d;
        color: var(--text-primary);
    }
}

/* تحسين التباين للحركة المحدودة */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* تحسين التباين للتركيز العالي */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000080;
        --primary-light: #0000ff;
        --primary-dark: #000040;
        --success-color: #008000;
        --danger-color: #800000;
        --warning-color: #804000;
    }
    
    .btn {
        border: 2px solid currentColor;
    }
    
    .form-control {
        border: 2px solid currentColor;
    }
}
