/* ملف CSS الرئيسي لموقع تقارير علي */

/* متغيرات الألوان للثيمات - 3D Premium */
:root {
    /* ألوان الثيم النهاري - تباين عالي */
    --bg-primary: #f8fafc;
    --bg-secondary: #ffffff;
    --bg-card: #ffffff;
    --text-primary: #0f172a;
    --text-secondary: #1e293b;
    --text-muted: #64748b;
    --text-contrast: #000000;
    --border-color: #e2e8f0;
    --navbar-bg: rgba(255, 255, 255, 0.95);
    --shadow-color: rgba(15, 23, 42, 0.1);
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-info: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    --input-bg: #ffffff;
    --input-border: #cbd5e1;
    --input-text: #0f172a;
    --card-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
    --hover-bg: #f1f5f9;
    
    /* 3D Shadows Premium */
    --shadow-3d-soft: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
    --shadow-3d-medium: 0 15px 50px rgba(0, 0, 0, 0.2), 0 5px 15px rgba(0, 0, 0, 0.1);
    --shadow-3d-strong: 0 25px 80px rgba(0, 0, 0, 0.3), 0 10px 30px rgba(0, 0, 0, 0.2);
    --shadow-3d-inset: inset 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 8px 16px rgba(0, 0, 0, 0.05);
    
    /* Glassmorphism */
    --glass-bg: rgba(255, 255, 255, 0.1);
    --glass-border: rgba(255, 255, 255, 0.2);
    --glass-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    
    /* Neon Glow */
    --neon-blue: 0 0 20px rgba(59, 130, 246, 0.6), 0 0 40px rgba(59, 130, 246, 0.4);
    --neon-purple: 0 0 20px rgba(139, 92, 246, 0.6), 0 0 40px rgba(139, 92, 246, 0.4);
    --neon-pink: 0 0 20px rgba(236, 72, 153, 0.6), 0 0 40px rgba(236, 72, 153, 0.4);
    --neon-green: 0 0 20px rgba(16, 185, 129, 0.6), 0 0 40px rgba(16, 185, 129, 0.4);
    
    /* ألوان الفوتر */
    --text-white: #ffffff;
    --text-white-50: rgba(255, 255, 255, 0.85);
    
    /* متغيرات الخلفية المتحركة */
    --animated-bg-primary: linear-gradient(-45deg, #dbeafe, #ede9fe, #d1fae5, #fed7aa);
    --animated-bg-secondary: linear-gradient(45deg, #bfdbfe, #ddd6fe, #a7f3d0, #fdba74);
    --particle-color: rgba(59, 130, 246, 0.12);
    --wave-color: rgba(59, 130, 246, 0.06);
}

/* ألوان الثيم الليلي - تباين عالي محسن */
[data-theme="dark"] {
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-card: #334155;
    --text-primary: #f8fafc;
    --text-secondary: #e2e8f0;
    --text-muted: #94a3b8;
    --text-contrast: #ffffff;
    --border-color: #475569;
    --navbar-bg: rgba(30, 41, 59, 0.95);
    --shadow-color: rgba(0, 0, 0, 0.5);
    --gradient-primary: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    --gradient-success: linear-gradient(135deg, #10b981 0%, #059669 100%);
    --gradient-danger: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    --gradient-warning: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    --gradient-info: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    --input-bg: #334155;
    --input-border: #475569;
    --input-text: #f8fafc;
    --card-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    --hover-bg: #475569;
    
    /* ألوان الفوتر للثيم الداكن */
    --text-white: #f8fafc;
    --text-white-50: rgba(248, 250, 252, 0.8);
    
    /* متغيرات الخلفية المتحركة للثيم المظلم */
    --animated-bg-primary: linear-gradient(-45deg, #1e293b, #312e81, #064e3b, #78350f);
    --animated-bg-secondary: linear-gradient(45deg, #334155, #4c1d95, #065f46, #92400e);
    --particle-color: rgba(59, 130, 246, 0.15);
    --wave-color: rgba(59, 130, 246, 0.08);
}

/* الخط الافتراضي - تحسين الأداء */
* {
    font-family: 'Cairo', sans-serif;
}

/* تطبيق transitions فقط على العناصر التي تحتاجها */
a, button, .btn, .card, .navbar, .form-control, .form-select, 
.alert, .badge, .nav-link, .theme-toggle, .hamburger {
    transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

/* خلفية الصفحة */
html {
    transition: background-color 0.3s ease, color 0.3s ease;
}

body {
    background: var(--bg-primary);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    color: var(--text-primary);
    position: relative;
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}
.navbar-brand1 {
    border-radius: 8px;
}
/* الخلفية المتحركة ثلاثية الأبعاد - تم إزالتها */

/* تأثيرات الجسيمات العائمة - تم إخفاؤها */
.floating-particles {
    display: none;
}

.particle {
    position: absolute;
    background: var(--particle-color);
    border-radius: 50%;
    pointer-events: none;
}

.particle:nth-child(1) {
    width: 20px;
    height: 20px;
    top: 10%;
    left: 10%;
    /* animation: float 6s ease-in-out infinite; */
}

.particle:nth-child(2) {
    width: 15px;
    height: 15px;
    top: 20%;
    left: 80%;
    /* animation: float 8s ease-in-out infinite reverse; */
}

.particle:nth-child(3) {
    width: 25px;
    height: 25px;
    top: 60%;
    left: 20%;
    /* animation: float 10s ease-in-out infinite; */
}

.particle:nth-child(4) {
    width: 12px;
    height: 12px;
    top: 80%;
    left: 90%;
    /* animation: float 7s ease-in-out infinite reverse; */
}

.particle:nth-child(5) {
    width: 18px;
    height: 18px;
    top: 40%;
    left: 70%;
    /* animation: float 9s ease-in-out infinite; */
}

/* الموجات المتحركة - تم إخفاؤها */
.animated-waves {
    display: none;
}

.wave {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 200%;
    height: 200px;
    background: var(--wave-color);
    border-radius: 50%;
    /* animation: wave 20s linear infinite; */
}

.wave:nth-child(2) {
    animation-delay: -5s;
    opacity: 0.7;
}

.wave:nth-child(3) {
    animation-delay: -10s;
    opacity: 0.5;
}

/* الحركات والتأثيرات */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }
    50% {
        background-position: 100% 50%;
    }
    100% {
        background-position: 0% 50%;
    }
}

@keyframes float {
    0%, 100% {
        transform: translateY(0px) rotate(0deg);
        opacity: 0.7;
    }
    25% {
        transform: translateY(-20px) rotate(90deg);
        opacity: 1;
    }
    50% {
        transform: translateY(-40px) rotate(180deg);
        opacity: 0.8;
    }
    75% {
        transform: translateY(-20px) rotate(270deg);
        opacity: 1;
    }
}

@keyframes wave {
    0% {
        transform: translateX(-50%) translateY(0px) rotate(0deg);
    }
    100% {
        transform: translateX(-50%) translateY(0px) rotate(360deg);
    }
}

/* تأثيرات ثلاثية الأبعاد للبطاقات - محسّن للأداء */
.card-3d {
    transform-style: preserve-3d;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
    border-radius: 25px !important;
    background: rgba(255, 255, 255, 0.95);
    /* تقليل backdrop-filter للأداء */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-3d-soft);
}

.card-3d::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.1) 0%, transparent 70%);
    pointer-events: none;
    /* animation: rotate 8s linear infinite; */
    transform-origin: center;
}

.card-3d::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
    border-radius: 25px;
    opacity: 0;
    transition: opacity 0.6s ease;
}

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

.card-3d:hover::after {
    opacity: 1;
}

.card-3d .card-body {
    position: relative;
    z-index: 2;
    transform: translateZ(20px);
}

@keyframes rotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* تأثير المنظور للصفحة الرئيسية */
.hero-section {
    perspective: 1000px;
    transform-style: preserve-3d;
}

/* تحسينات للأداء */
.gpu-accelerated {
    will-change: transform, opacity;
    transform: translateZ(0);
}

/* تأثيرات إضافية للصفحة الرئيسية */
.hero-section.gpu-accelerated {
    /* animation: heroFloat 6s ease-in-out infinite; */
}

@keyframes heroFloat {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* تأثيرات Glass للثيم المظلم */
[data-theme="dark"] .glass-effect {
    background: rgba(255, 255, 255, 0.05) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* تأثيرات Glass للثيم الفاتح - محسّن للأداء */
.glass-effect {
    background: rgba(255, 255, 255, 0.8);
    /* تقليل blur للأداء */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-3d-medium);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative;
    overflow: hidden;
}

.glass-effect::before {
    content: '';
    position: absolute;
    top: -100%;
    left: -100%;
    width: 300%;
    height: 300%;
    background: linear-gradient(45deg, transparent, rgba(255,255,255,0.3), transparent);
    /* animation: shimmer 3s infinite; */
    pointer-events: none;
}

.glass-effect:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-3d-medium);
}

.glass-effect .bg-primary,
.glass-effect .bg-success,
.glass-effect .bg-warning,
.glass-effect .bg-info {
    position: relative;
    z-index: 2;
    transform: translateZ(30px);
    transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 
        0 8px 25px rgba(0, 0, 0, 0.2),
        inset 0 2px 4px rgba(255, 255, 255, 0.3);
}

.glass-effect:hover .bg-primary,
.glass-effect:hover .bg-success,
.glass-effect:hover .bg-warning,
.glass-effect:hover .bg-info {
    /* transform: translateZ(40px) scale(1.15) rotateY(360deg); */
    transform: translateZ(30px);
}

@keyframes shimmer {
    0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
    100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* تحسين الجسيمات والأداء للأجهزة المحمولة */
@media (max-width: 768px) {
    /* إخفاء الجسيمات للتحسين الأداء */
    .particle {
        display: none;
    }
    
    .wave {
        animation-duration: 30s;
        opacity: 0.5;
    }
    
    body::before,
    body::after {
        animation-duration: 25s, 30s;
        opacity: 0.6;
    }
    
    /* تقليل تأثيرات 3D للهواتف */
    .card-3d::before,
    .stats-card::before,
    .glass-effect::before {
        animation-duration: 15s !important;
        opacity: 0.7;
    }
    
    /* تحسين الأداء */
    .card-3d,
    .stats-card,
    .glass-effect {
        will-change: transform;
        transform: translateZ(0);
    }
    
    /* تقليل الظلال للهواتف */
    .card-3d:hover,
    .stats-card:hover,
    .glass-effect:hover {
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15) !important;
    }
}

/* تقليل الحركة للمستخدمين الذين يفضلون ذلك - محسّن */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .card-3d:hover,
    .glass-effect:hover {
        transform: none !important;
    }
}

/* تحسينات إضافية للأداء - تعطيل animations في الشاشات الصغيرة */
@media (max-width: 768px) {
    .card-3d::before,
    .card-3d::after,
    .glass-effect::before {
        display: none;
    }
    
    .card-3d,
    .glass-effect {
        transform: none !important;
        perspective: none !important;
    }
    
    .card-3d:hover,
    .glass-effect:hover {
        transform: translateY(-2px) !important;
    }
}

/* الشريط العلوي - محسّن للأداء */
.navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.95) !important;
    /* تقليل blur للأداء */
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    transform: translateZ(0);
}

.navbar::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.5), transparent);
    /* animation: shimmerNav 3s infinite; */
}

@keyframes shimmerNav {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

[data-theme="dark"] .navbar {
    background: rgba(30, 41, 59, 0.85) !important;
    border-bottom-color: rgba(255, 255, 255, 0.1);
    box-shadow: 
        0 8px 32px rgba(0, 0, 0, 0.3),
        0 2px 8px rgba(0, 0, 0, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.navbar-brand {
    font-weight: 700;
    color: var(--text-primary) !important;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
}

.navbar-brand img {
    border-radius: 8px;
    transition: transform 0.3s ease;
}

.navbar-brand:hover img {
    border-radius: 10px;
    transform: scale(1.05);
}

.navbar-nav .nav-link {
    font-weight: 500;
    color: var(--text-secondary) !important;
    transition: color 0.3s ease;
    padding: 8px 16px !important;
    border-radius: 20px;
    margin: 0 5px;
}

.navbar-nav .nav-link:hover {
    color: var(--text-primary) !important;
    background: var(--border-color);
}

/* تصميم Hamburger المتحرك الجديد */
.hamburger {
    cursor: pointer;
    border: 2px solid var(--border-color) !important;
    border-radius: 10px !important;
    padding: 8px !important;
    background: var(--bg-card) !important;
    transition: all 0.3s ease !important;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    width: 50px;
    height: 50px;
}
.ti1{
    color: #fff;
}
.hamburger:hover {
    background: var(--hover-bg) !important;
    border-color: var(--text-primary) !important;
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.hamburger:focus {
    box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.3) !important;
    outline: none !important;
}

.hamburger input {
    display: none;
    pointer-events: none; /* منع التفاعل المباشر مع checkbox */
}

.hamburger svg {
    height: 2.5em;
    width: 2.5em;
    transition: transform 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.line {
    fill: none;
    stroke: var(--text-primary);
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
    transition: stroke-dasharray 600ms cubic-bezier(0.4, 0, 0.2, 1),
                stroke-dashoffset 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.line-top-bottom {
    stroke-dasharray: 12 63;
}

.hamburger input:checked + svg {
    transform: rotate(-45deg);
}

.hamburger input:checked + svg .line-top-bottom {
    stroke-dasharray: 20 300;
    stroke-dashoffset: -32.42;
}

/* ضمان سلوك صحيح للـ label */
.hamburger {
    cursor: pointer;
    user-select: none; /* منع تحديد النص */
    /* باقي الخصائص تبقى كما هي من الـ CSS الموجود */
}

/* تحسينات للثيم المظلم */
[data-theme="dark"] .hamburger {
    border-color: var(--border-color) !important;
    background: var(--bg-card) !important;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .hamburger:hover {
    background: var(--hover-bg) !important;
    border-color: #ffffff !important;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.15);
}

[data-theme="dark"] .line {
    stroke: #ffffff;
}

/* تحسينات للأجهزة التي تدعم اللمس */
@media (hover: none) and (pointer: coarse) {
    .hamburger {
        min-height: 50px; /* الحد الأدنى للمس */
        min-width: 50px;
        padding: 10px !important;
    }
    
    .hamburger svg {
        height: 2.2em;
        width: 2.2em;
    }
    
    .hamburger:hover {
        transform: none; /* إزالة التكبير في الأجهزة اللمسية */
    }
    
    .hamburger:active {
        background: var(--hover-bg) !important;
        transform: scale(0.95);
    }
}

/* تحسينات للهواتف المحمولة */
@media (max-width: 576px) {
    .hamburger {
        width: 45px;
        height: 45px;
        padding: 6px !important;
    }
    
    .hamburger svg {
        height: 2em;
        width: 2em;
    }
    
    .line {
        stroke-width: 2.5;
    }
}

/* تحسينات للأجهزة اللوحية */
@media (min-width: 577px) and (max-width: 992px) {
    .hamburger {
        width: 48px;
        height: 48px;
        padding: 8px !important;
    }
    
    .hamburger svg {
        height: 2.3em;
        width: 2.3em;
    }
}

/* تحسينات للشاشات الكبيرة */
@media (min-width: 1200px) {
    .hamburger {
        width: 52px;
        height: 52px;
    }
    
    .hamburger svg {
        height: 2.8em;
        width: 2.8em;
    }
}

/* تحسينات للوضع الأفقي في الهواتف */
@media (max-height: 500px) and (orientation: landscape) {
    .hamburger {
        width: 40px;
        height: 40px;
        padding: 5px !important;
    }
    
    .hamburger svg {
        height: 1.8em;
        width: 1.8em;
    }
}

/* تحسينات للوضع الأفقي في الهواتف */
@media (max-height: 500px) and (orientation: landscape) {
    .navbar {
        padding: 0.25rem 1rem;
    }
    
    .navbar-toggler {
        width: 36px;
        height: 32px;
        padding: 3px 6px;
    }
    
    .navbar-toggler-icon {
        width: 16px !important;
        height: 12px !important;
    }
    
    .navbar-brand {
        font-size: 1.2rem !important;
    }
    
    .navbar-brand img {
        height: 22px !important;
    }
}

/* تحسين إمكانية الوصول للوحة المفاتيح */
.navbar-toggler:focus-visible {
    outline: 3px solid var(--gradient-primary);
    outline-offset: 2px;
}

/* تحسين للشاشات عالية الكثافة */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .navbar-toggler-icon,
    .navbar-toggler-icon::before,
    .navbar-toggler-icon::after {
        border-radius: 1.5px;
    }
}

/* قواعد خاصة للشريط العلوي في الثيم المظلم */
[data-theme="dark"] .navbar {
    background: var(--navbar-bg) !important;
}

[data-theme="dark"] .navbar-brand {
    color: #ffffff !important;
}

/* تصميم القائمة المحمولة */
.mobile-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: linear-gradient(135deg, 
                #007bff 0%, 
                #0056b3 100%);
    border-radius: 0 0 15px 15px;
    margin-top: 0;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    overflow: hidden;
    display: none;
    z-index: 1000;
}

.mobile-menu.show {
    display: block !important;
    animation: slideDown 0.2s ease;
}

.mobile-menu-content {
    padding: 20px 15px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.mobile-nav-link {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 18px 20px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 12px;
    color: #333333 !important;
    text-decoration: none;
    font-weight: 600;
    font-size: 16px;
    transition: all 0.3s ease;
    cursor: pointer;
    min-height: 56px;
    width: 100%;
    box-sizing: border-box;
    text-align: center;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus {
    background: rgba(255, 255, 255, 1) !important;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    color: #333333 !important;
    border-color: rgba(0, 0, 0, 0.2);
    text-decoration: none;
}

.mobile-nav-link i {
    font-size: 20px;
    width: 24px;
    text-align: center;
    color: #007bff;
    opacity: 1;
    margin-left: 0;
    margin-right: 0;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-nav-link span {
    font-size: 16px;
    font-weight: 500;
    color: #333333;
    display: inline;
    line-height: 1;
}

/* تحسينات للثيم الفاتح */
[data-theme="light"] .mobile-menu {
    background: linear-gradient(135deg, 
                #007bff 0%, 
                #0056b3 100%);
}

[data-theme="light"] .mobile-nav-link {
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #333333 !important;
    backdrop-filter: blur(10px);
    justify-content: center;
    text-align: center;
}

[data-theme="light"] .mobile-nav-link:hover,
[data-theme="light"] .mobile-nav-link:focus {
    background: rgba(255, 255, 255, 1) !important;
    color: #333333 !important;
    border-color: rgba(0, 0, 0, 0.2);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
    justify-content: center;
}

[data-theme="light"] .mobile-nav-link i {
    color: #504dc4;
    margin-left: 5px;
    margin-right: 5px;
    opacity: 1;
}

[data-theme="light"] .mobile-nav-link span {
    color: #333333;
}

/* تحسينات للثيم المظلم */
[data-theme="dark"] .mobile-menu {
    background: linear-gradient(135deg, 
                var(--primary-color) 0%, 
                var(--accent-color) 100%);
}

[data-theme="dark"] .mobile-nav-link {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff !important;
    justify-content: center;
    text-align: center;
}

[data-theme="dark"] .mobile-nav-link:hover,
[data-theme="dark"] .mobile-nav-link:focus {
    background: rgba(255, 255, 255, 0.25) !important;
    color: #ffffff !important;
    border-color: rgba(255, 255, 255, 0.3);
    justify-content: center;
}

[data-theme="dark"] .mobile-nav-link i {
    margin-left: 5px;
    margin-right: 5px;
    color: #ffffff;
    opacity: 0.9;

}

[data-theme="dark"] .mobile-nav-link span {
    color: #ffffff;
}

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

/* إزالة التصميم القديم */
#mobileNav.collapsing,
#mobileNav .navbar-nav,
#mobileNav .nav-item,
#mobileNav .nav-link {
    /* إزالة التصميم القديم */
}

/* تحسينات للثيم المظلم في القائمة المحمولة */
[data-theme="dark"] #mobileNav {
    border-color: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] #mobileNav .nav-link {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] #mobileNav .nav-link:hover,
[data-theme="dark"] #mobileNav .nav-link:focus {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(255, 255, 255, 0.3);
}

/* تأثيرات الانتقال للقائمة المحمولة */
#mobileNav.collapsing {
    transition: height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#mobileNav.show {
    animation: slideDown 0.2s ease;
}

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

/* تحسينات للشاشات الصغيرة جداً */
@media (max-width: 360px) {
    #mobileNav .nav-link {
        margin: 0 10px;
        padding: 10px 20px !important;
        font-size: 14px;
    }
    
    #mobileNav .nav-link i {
        font-size: 16px;
    }
    
    /* تحسينات إضافية للهيدر */
    .navbar {
        padding: 3px 0 !important;
    }
    
    .navbar .container {
        padding: 0 8px !important;
    }
    
    .navbar-brand {
        font-size: 1.05rem !important;
    }
    
    .navbar-brand img {
        height: 20px !important;
        margin-left: 4px !important;
    }
    
    .theme-toggle {
        width: 26px !important;
        height: 26px !important;
        font-size: 11px !important;
        border-width: 1px !important;
    }
    
    .hamburger {
        width: 26px !important;
        height: 26px !important;
        padding: 2px !important;
        border-width: 1px !important;
    }
}

/* تحسينات للشاشات الصغيرة (576px) */
@media (max-width: 576px) {
    .navbar {
        padding: 4px 0 !important;
    }
    
    .navbar .container {
        padding: 0 10px !important;
    }
    
    .navbar-brand {
        font-size: 1.15rem !important;
    }
    
    .navbar-brand img {
        height: 22px !important;
        margin-left: 5px !important;
    }
    
    .theme-toggle {
        width: 30px !important;
        height: 30px !important;
        font-size: 13px !important;
    }
    
    .hamburger {
        width: 30px !important;
        height: 30px !important;
        padding: 3px !important;
    }
    
    /* تحسين القائمة المنسدلة */
    #mobileNav {
        margin-top: 5px;
        border-radius: 0 0 12px 12px;
    }
    
    #mobileNav .nav-link {
        margin: 0 12px;
        padding: 11px 22px !important;
        font-size: 15px;
    }
    
    #mobileNav .nav-link i {
        font-size: 17px;
    }
}

/* تحسين المساحات بين العناصر */
@media (max-width: 768px) {
    .navbar .d-flex.align-items-center.gap-2 {
        gap: 0.5rem !important;
    }
    
    /* تحسين عرض العناصر في الصف */
    .navbar .container {
        justify-content: space-between;
    }
    
    .navbar-brand {
        flex: 1;
        max-width: calc(100% - 80px);
        overflow: hidden;
    }
    
    .navbar-brand img {
        flex-shrink: 0;
    }
    
    /* إصلاح المسافات بين الأزرار في Hero Section للهواتف */
    .hero-section .btn,
    .hero-section a.btn {
        margin: 0 0 15px 0 !important;
        width: 100% !important;
        display: block !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: 0 !important;
    }
    
    .hero-section .btn:last-child,
    .hero-section .btn:last-of-type,
    .hero-section a.btn:last-child,
    .hero-section a.btn:last-of-type {
        margin-bottom: 0 !important;
    }
    
    /* إزالة جميع margins الجانبية من Bootstrap */
    .hero-section .btn.me-3,
    .hero-section .btn.ms-3,
    .hero-section .btn.mx-3,
    .hero-section a.btn.me-3,
    .hero-section a.btn.ms-3,
    .hero-section a.btn.mx-3,
    .hero-section .me-3,
    .hero-section .ms-3,
    .hero-section .mx-3 {
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 15px !important;
    }
    
    .hero-section .btn.me-3:last-child,
    .hero-section .btn.ms-3:last-child,
    .hero-section .btn.mx-3:last-child,
    .hero-section a.btn.me-3:last-child,
    .hero-section a.btn.ms-3:last-child,
    .hero-section a.btn.mx-3:last-child {
        margin-bottom: 0 !important;
    }
    
    /* إزالة padding الجانبي من Bootstrap */
    .hero-section .btn.px-5,
    .hero-section a.btn.px-5 {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
    
    /* إضافة مسافة بين الأزرار */
    .hero-section .btn + .btn,
    .hero-section a.btn + a.btn {
        margin-top: 15px !important;
    }
    
    /* إصلاح نهائي للأزرار - استخدام gap */
    .hero-section .col-lg-10 {
        gap: 15px !important;
    }
    
    .hero-section .text-center {
        gap: 15px !important;
    }
    
    /* ضمان المسافة بين الأزرار */
    .hero-section a.btn:not(:last-child) {
        margin-bottom: 15px !important;
    }
    
    /* إصلاح شامل للمسافات */
    .hero-section a.btn.btn-primary {
        margin-bottom: 15px !important;
    }
    
    .hero-section a.btn.btn-outline-light {
        margin-top: 0 !important;
    }
}

/* تحسينات للوضع الأفقي في الهواتف */
@media (max-height: 500px) and (orientation: landscape) {
    body {
        padding-top: 50px !important;
    }
    
    .navbar {
        padding: 2px 0 !important;
        min-height: 45px !important;
        max-height: 50px !important;
    }
    
    .navbar-brand {
        font-size: 1rem !important;
    }
    
    .navbar-brand img {
        height: 18px !important;
    }
    
    .theme-toggle {
        width: 24px !important;
        height: 24px !important;
        font-size: 10px !important;
    }
    
    .hamburger {
        width: 24px !important;
        height: 24px !important;
        padding: 2px !important;
    }
}

/* تحسين نص العلامة التجارية في الشاشات الصغيرة */
@media (max-width: 480px) {
    .navbar-brand {
        font-size: 1.1rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
}

[data-theme="dark"] .nav-link {
    color: #f0f0f0 !important;
}

[data-theme="dark"] .nav-link:hover {
    color: #ffffff !important;
    background: var(--hover-bg) !important;
}

[data-theme="dark"] .dropdown-menu {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .dropdown-item {
    color: #ffffff !important;
}

[data-theme="dark"] .dropdown-item:hover {
    background: var(--hover-bg) !important;
    color: #ffffff !important;
}
.nav-item{
    justify-content: center;

}
/* زر تبديل الثيم */
.theme-toggle {
    background: var(--gradient-primary);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.theme-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px var(--shadow-color);
}

/* قواعد خاصة للثيم المظلم - ضمان وضوح النصوص */
[data-theme="dark"] body {
    color: #ffffff !important;
}

[data-theme="dark"] .card {
    background: var(--bg-card) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .card-body {
    background: var(--bg-card) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .card-title {
    color: #ffffff !important;
}

[data-theme="dark"] .card-text {
    color: #f0f0f0 !important;
}

[data-theme="dark"] h1, 
[data-theme="dark"] h2, 
[data-theme="dark"] h3, 
[data-theme="dark"] h4, 
[data-theme="dark"] h5, 
[data-theme="dark"] h6 {
    color: #ffffff !important;
}

[data-theme="dark"] p {
    color: #f0f0f0 !important;
}

[data-theme="dark"] .text-muted {
    color: #b3b3b3 !important;
}

[data-theme="dark"] .lead {
    color: #f0f0f0 !important;
}

/* المحتوى الرئيسي */
.main-content {
    margin-top: 50px;
    margin-bottom: 100px;
    min-height: calc(100vh - 200px);
}

/* البطاقات - تباين محسن */
.card {
    border: 2px solid var(--border-color);
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    background: var(--bg-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: var(--text-contrast);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px var(--shadow-color);
    border-color: var(--text-muted);
}

.card-header {
    background: var(--gradient-primary);
    color: #ffffff;
    border-radius: 13px 13px 0 0 !important;
    border: none;
    padding: 20px;
    font-weight: 700;
    font-size: 1.3rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.card-body {
    padding: 30px;
    background: var(--bg-card);
    color: var(--text-contrast);
    line-height: 1.6;
}

.card-title {
    color: var(--text-contrast);
    font-weight: 700;
    font-size: 1.4rem;
    margin-bottom: 15px;
}

.card-text {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 16px;
}

/* الأزرار */
.btn-primary {
    background: var(--gradient-primary);
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    color: white;
}

.btn-primary:hover {
    background: var(--gradient-primary);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px var(--shadow-color);
    color: white;
}

.btn-secondary {
    background: var(--text-muted);
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: white;
}

.btn-success {
    background: var(--gradient-success);
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: white;
}

.btn-danger {
    background: var(--gradient-danger);
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: white;
}

.btn-warning {
    background: var(--gradient-warning);
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: white;
}

.btn-info {
    background: var(--gradient-info);
    border: none;
    border-radius: 25px;
    padding: 12px 30px;
    font-weight: 600;
    transition: all 0.3s ease;
    color: white;
}

/* النماذج - تباين محسن */
.form-control {
    border: 2px solid var(--input-border);
    border-radius: 10px;
    padding: 12px 15px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s ease;
    background: var(--input-bg);
    color: var(--input-text);
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-control:focus {
    border-color: #1976d2;
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.25);
    background: var(--input-bg);
    color: var(--input-text);
    outline: none;
}

.form-control::placeholder {
    color: var(--text-muted);
    opacity: 0.7;
    font-weight: 400;
}

.form-label {
    font-weight: 700;
    color: var(--text-contrast);
    margin-bottom: 8px;
    font-size: 15px;
}

.form-select {
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    color: var(--input-text);
    border-radius: 10px;
    padding: 12px 15px;
    font-size: 16px;
    font-weight: 500;
    box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-select:focus {
    background: var(--input-bg);
    border-color: #1976d2;
    color: var(--input-text);
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.25);
    outline: none;
}

.form-select option {
    background: var(--input-bg);
    color: var(--input-text);
    font-weight: 500;
}

.form-text {
    color: rgba(0, 0, 0, 0.75);
    font-weight: 500;
    font-size: 14px;
}
[data-theme="dark"] .form-text {
    color: rgba(255, 255, 255, 0.753);
}

.input-group-text {
    background: var(--input-bg);
    border: 2px solid var(--input-border);
    color: var(--text-contrast);
    border-radius: 10px;
    font-weight: 600;
}

/* التنبيهات */
.alert {
    border-radius: 10px;
    border: none;
    box-shadow: 0 5px 15px var(--shadow-color);
    font-weight: 500;
}

.alert-success {
    background: var(--gradient-success);
    color: white;
}

.alert-danger {
    background: var(--gradient-danger);
    color: white;
}

.alert-info {
    background: var(--gradient-info);
    color: white;
}

.alert-warning {
    background: var(--gradient-warning);
    color: white;
}

/* الجداول */
.table {
    background: var(--bg-card);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

/* قواعد خاصة للجداول في الثيم المظلم */
[data-theme="dark"] .table {
    background: var(--bg-card) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .table tbody td {
    background: var(--bg-card) !important;
    color: #ffffff !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .table tbody tr:hover {
    background: var(--hover-bg) !important;
    color: #ffffff !important;
}

/* قواعد خاصة للنماذج في الثيم المظلم */
[data-theme="dark"] .form-control {
    background: var(--input-bg) !important;
    color: #ffffff !important;
    border-color: var(--input-border) !important;
}

[data-theme="dark"] .form-control::placeholder {
    color: #b3b3b3 !important;
}

[data-theme="dark"] .form-label {
    color: #ffffff !important;
}

[data-theme="dark"] .form-select {
    background: var(--input-bg) !important;
    color: #ffffff !important;
    border-color: var(--input-border) !important;
}

[data-theme="dark"] .form-select option {
    background: var(--input-bg) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .input-group-text {
    background: var(--input-bg) !important;
    color: #ffffff !important;
    border-color: var(--input-border) !important;
}

/* قواعد إضافية للوضوح في الثيم المظلم */
[data-theme="dark"] .alert {
    color: #fff !important;
    background: #333;
}

[data-theme="dark"] .badge {
    color: #ffffff !important;
}

[data-theme="dark"] .list-group-item {
    background: var(--bg-card) !important;
    color: #ffffff !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .modal-content {
    background: var(--bg-card) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .modal-header {
    background: var(--bg-card) !important;
    color: #ffffff !important;
    border-bottom-color: var(--border-color) !important;
}

[data-theme="dark"] .modal-footer {
    color: #ffffff !important;
    border-top-color: var(--border-color) !important;
}

[data-theme="dark"] .modal-title {
    color: #ffffff !important;
}

[data-theme="dark"] strong,
[data-theme="dark"] b {
    color: #ffffff !important;
}

[data-theme="dark"] small,
[data-theme="dark"] .small {
    color: #b3b3b3 !important;
}

[data-theme="dark"] .text-white {
    color: #ffffff !important;
}

[data-theme="dark"] .bg-light {
    background: var(--bg-card) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .bg-dark {
    background: var(--bg-secondary) !important;
    color: #ffffff !important;
}

/* تحسينات نهائية للوضوح */
[data-theme="dark"] .hero-section {
    background: var(--bg-card) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .hero-section h1 {
    color: #ffffff !important;
    background: var(--gradient-primary) !important;
    -webkit-background-clip: text !important;
}

[data-theme="dark"] .hero-section p {
    color: #f0f0f0 !important;
}

[data-theme="dark"] .service-card {
    background: var(--bg-card) !important;
    color: #ffffff !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .service-card h3 {
    color: #ffffff !important;
}

[data-theme="dark"] .service-card p {
    color: #f0f0f0 !important;
}

[data-theme="dark"] .stats-card {
    background: var(--bg-card) !important;
    color: #ffffff !important;
}

[data-theme="dark"] .stats-card .card-title {
    color: #ffffff !important;
}

[data-theme="dark"] .stats-card .card-text {
    color: #f0f0f0 !important;
}

[data-theme="dark"] .btn-outline-primary {
    border-color: #ffffff !important;
    color: #ffffff !important;
}

[data-theme="dark"] .btn-outline-secondary {
    border-color: #f0f0f0 !important;
    color: #f0f0f0 !important;
}

[data-theme="dark"] .btn-outline-light {
    border-color: #ffffff !important;
    color: #ffffff !important;
}

.table thead th {
    background: var(--gradient-primary);
    color: #ffffff;
    border: none;
    font-weight: 600;
    padding: 15px;
}

.table tbody td {
    padding: 15px;
    border-color: var(--border-color);
    color: var(--text-primary);
    background: var(--bg-card);
}

.table tbody tr:hover {
    background: var(--border-color);
}

/* البطاقات المحسنة */
.card {
    border: 1px solid var(--border-color);
    border-radius: 15px;
    box-shadow: var(--card-shadow);
    backdrop-filter: blur(10px);
    background: var(--bg-card);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    color: var(--text-primary);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 35px var(--shadow-color);
}

.card-body {
    padding: 30px;
    background: var(--bg-card);
    color: var(--text-primary);
}

.card-title {
    color: var(--text-primary);
    font-weight: 600;
}

.card-text {
    color: var(--text-secondary);
}

.table tbody tr {
    transition: background-color 0.3s ease;
}

.table tbody tr:hover {
    background-color: var(--border-color);
}

.table tbody td {
    padding: 15px;
    border-color: var(--border-color);
    color: var(--text-primary);
}

.table-dark {
    background: var(--text-primary);
    color: var(--bg-card);
}

/* التذييل */
footer {
    background: var(--gradient-primary) !important;
    margin-top: auto;
    color: var(--text-white);
    border-top: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

footer h5, footer h6 {
    color: var(--text-white) !important;
    font-weight: 600;
}

footer p, footer a {
    color: var(--text-white-50) !important;
    transition: color 0.3s ease;
}

footer a:hover {
    color: var(--text-white) !important;
    text-decoration: none;
    transform: translateY(-1px);
}

.social-links a {
    font-size: 1.5rem;
    transition: all 0.3s ease;
    color: var(--text-white);
    margin: 0 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    text-decoration: none;
    position: relative;
}

.social-links a i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
    font-size: 1.2rem;
}

.social-links a:hover {
    transform: translateY(-3px) scale(1.1);
    color: var(--text-white);
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* الثيم الداكن للفوتر */
[data-theme="dark"] footer {
    background: linear-gradient(135deg, #1a1a1a 0%, #26282e 100%) !important;
    border-top: 1px solid var(--border-color);
}

[data-theme="dark"] footer h5,
[data-theme="dark"] footer h6 {
    color: var(--text-white) !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] footer p,
[data-theme="dark"] footer a {
    color: var(--text-white-50) !important;
}

[data-theme="dark"] footer a:hover {
    color: var(--text-white) !important;
    text-shadow: 0 0 8px rgba(33, 150, 243, 0.3);
}

[data-theme="dark"] .social-links a {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .social-links a i {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    line-height: 1;
    font-size: 1.2rem;
}

[data-theme="dark"] .social-links a:hover {
    background: rgba(33, 150, 243, 0.2);
    border-color: rgba(33, 150, 243, 0.3);
    box-shadow: 0 4px 15px rgba(33, 150, 243, 0.3);
}

/* تحسينات الفوتر للشاشات الصغيرة */
@media (max-width: 768px) {
    footer {
        padding: 30px 0 20px;
        text-align: center;
    }
    
    footer .row {
        text-align: center !important;
    }
    
    footer .col-md-6 {
        text-align: center !important;
        margin-bottom: 20px;
    }
    
    footer .social-links {
        justify-content: center;
        display: flex;
        margin-bottom: 15px;
    }
    
    footer .social-links a {
        margin: 0 10px;
        width: 45px;
        height: 45px;
        font-size: 1.3rem;
    }
    
    footer .social-links a i {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        line-height: 1;
        font-size: 1.4rem;
    }
    
    footer .d-flex {
        justify-content: center;
        flex-direction: column;
        align-items: center;
    }
    
    footer .d-flex img {
        margin-bottom: 10px;
    }
    
    footer .text-md-end {
        text-align: center !important;
    }
}

@media (max-width: 576px) {
    /* تحسينات إضافية للشاشات الصغيرة جداً */
    .hero-section {
        padding: 40px 15px !important;
        border-radius: 20px !important;
    }
    
    .hero-section h1 {
        font-size: 1.5rem !important;
    }
    
    .hero-section h1 img {
        height: 35px !important;
        margin-left: 8px !important;
    }
    
    .hero-section p {
        font-size: 0.95rem !important;
    }
    
    .card-3d,
    .glass-effect,
    .stats-card {
        border-radius: 18px !important;
    }
    
    .stats-card .card-title {
        font-size: 1.8rem !important;
    }
    
    .stats-card i {
        font-size: 1.8rem !important;
    }
    
    .btn {
        padding: 12px 22px !important;
        font-size: 0.9rem !important;
        margin-bottom: 12px !important;
        width: 100% !important;
        display: block !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .btn:last-child {
        margin-bottom: 0 !important;
    }
    
    .btn-lg {
        padding: 14px 26px !important;
        font-size: 0.95rem !important;
        margin-bottom: 12px !important;
    }
    
    /* تحسين المسافات في Hero Section للشاشات الصغيرة جداً */
    .hero-section .btn,
    .hero-section a.btn {
        margin: 0 0 12px 0 !important;
        width: 100% !important;
        display: block !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .hero-section .btn:last-of-type,
    .hero-section .btn:last-child,
    .hero-section a.btn:last-of-type,
    .hero-section a.btn:last-child {
        margin-bottom: 0 !important;
    }
    
    .hero-section .btn-group {
        flex-direction: column !important;
        gap: 12px !important;
    }
    
    /* إزالة جميع margins الجانبية من Bootstrap */
    .hero-section .btn.me-3,
    .hero-section .btn.ms-3,
    .hero-section .btn.mx-3,
    .hero-section a.btn.me-3,
    .hero-section a.btn.ms-3,
    .hero-section a.btn.mx-3,
    .hero-section .me-3,
    .hero-section .ms-3,
    .hero-section .mx-3 {
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 12px !important;
    }
    
    .hero-section .btn.me-3:last-child,
    .hero-section .btn.ms-3:last-child,
    .hero-section .btn.mx-3:last-child,
    .hero-section a.btn.me-3:last-child,
    .hero-section a.btn.ms-3:last-child,
    .hero-section a.btn.mx-3:last-child {
        margin-bottom: 0 !important;
    }
    
    /* إبقاء margin للأيقونات فقط */
    .hero-section .btn i.me-2,
    .hero-section .btn i.ms-2,
    .hero-section a.btn i.me-2,
    .hero-section a.btn i.ms-2 {
        margin-left: 8px !important;
        margin-right: 0 !important;
    }
    
    /* إضافة مسافة بين الأزرار المتجاورة */
    .hero-section .btn + .btn,
    .hero-section a.btn + a.btn {
        margin-top: 12px !important;
    }
    
    /* إصلاح المسافات في col-lg-10 للشاشات الصغيرة */
    .hero-section .col-lg-10 {
        display: flex !important;
        flex-direction: column !important;
        gap: 12px !important;
        align-items: center !important;
    }
    
    /* إزالة أي margins من row */
    .hero-section .row {
        margin: 0 !important;
    }
    
    .hero-section .row > * {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    /* إصلاح نهائي للأزرار - استخدام gap */
    .hero-section .col-lg-10 {
        gap: 12px !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
    }
    
    .hero-section .text-center {
        gap: 12px !important;
    }
    
    /* ضمان المسافة بين الأزرار */
    .hero-section a.btn:not(:last-child) {
        margin-bottom: 12px !important;
    }
    
    /* إصلاح شامل للمسافات */
    .hero-section a.btn.btn-primary {
        margin-bottom: 12px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .hero-section a.btn.btn-outline-light {
        margin-top: 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .card-body {
        padding: 15px !important;
    }
    
    .glass-effect {
        padding: 15px 10px !important;
    }
    
    .glass-effect .bg-primary,
    .glass-effect .bg-success,
    .glass-effect .bg-warning,
    .glass-effect .bg-info {
        width: 50px !important;
        height: 50px !important;
        font-size: 1.2rem !important;
    }
    
    .display-4 {
        font-size: 1.5rem !important;
    }
    
    .display-5 {
        font-size: 1.3rem !important;
    }
    
    footer {
        padding: 25px 0 15px;
    }
    
    footer .social-links a {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
        margin: 0 8px;
    }
    
    footer .social-links a i {
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        line-height: 1;
        font-size: 1.1rem;
    }
    
    footer h6 {
        font-size: 1rem;
        margin-bottom: 5px;
    }
    
    footer p {
        font-size: 0.9rem;
        margin-bottom: 8px;
    }
}

/* الصفحة الرئيسية - تحسين الألوان */
.hero-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-radius: 35px;
    padding: 90px 40px;
    text-align: center;
    color: var(--text-primary);
    margin: 50px 0;
    border: 2px solid rgba(255, 255, 255, 0.3);
    position: relative;
    overflow: hidden;
    box-shadow: 
        var(--shadow-3d-medium),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    transform-style: preserve-3d;
}

.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -50%;
    width: 200%;
    height: 200%;
    background: 
        radial-gradient(circle at 30% 40%, rgba(102, 126, 234, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 70% 60%, rgba(118, 75, 162, 0.2) 0%, transparent 50%);
    /* animation: heroRotate 12s linear infinite; */
    transform-origin: center;
    pointer-events: none;
}

.hero-section::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, transparent 50%);
    pointer-events: none;
    border-radius: 35px;
}

@keyframes heroRotate {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

[data-theme="dark"] .hero-section {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.15) 0%, rgba(168, 85, 247, 0.15) 100%);
    box-shadow: 0 15px 50px rgba(0,0,0,0.4);
}

.hero-section h1 {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 20px;
    color: var(--text-primary) !important;
    position: relative;
    z-index: 2;
    text-shadow: 0 2px 15px rgba(0, 0, 0, 0.1);
    transform: translateZ(30px);
    transition: transform 0.4s ease;
}

.hero-section:hover h1 {
    transform: translateZ(40px) scale(1.02);
}

.hero-section p {
    font-size: 1.3rem;
    margin-bottom: 30px;
    color: var(--text-secondary) !important;
    position: relative;
    z-index: 2;
    line-height: 1.8;
    transform: translateZ(20px);
}

/* تحسين الألوان للثيم المظلم */
[data-theme="dark"] .hero-section {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .hero-section h1 {
    color: #ffffff !important;
}

[data-theme="dark"] .hero-section p {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .hero-section .lead {
    color: #d0d0d0 !important;
}

/* ألوان النصوص العامة للصفحة الرئيسية */
.main-content h1,
.main-content h2,
.main-content h3,
.main-content h4,
.main-content h5,
.main-content h6 {
    color: #464751 !important;
}

.main-content p {
    color: var(--text-secondary) !important;
}

.main-content .lead {
    color: #fff !important ;
}

/* للثيم المظلم */
[data-theme="dark"] .main-content h1,
[data-theme="dark"] .main-content h2,
[data-theme="dark"] .main-content h3,
[data-theme="dark"] .main-content h4,
[data-theme="dark"] .main-content h5,
[data-theme="dark"] .main-content h6 {
    color: #ffffff !important;
}

[data-theme="dark"] .main-content p {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .main-content .lead {
    color: #d0d0d0 !important;
}

.services-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin: 50px 0;
}

.service-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 30px;
    text-align: center;
    transition: transform 0.3s ease;
    box-shadow: 0 10px 30px var(--shadow-color);
    border: 2px solid var(--border-color);
}

.service-card:hover {
    transform: translateY(-10px);
}

.service-card i {
    font-size: 3rem;
    margin-bottom: 20px;
}

.service-card h3 {
    color: var(--text-primary) !important;
    font-weight: 600;
    margin-bottom: 15px;
}

.service-card p {
    color: var(--text-secondary) !important;
    line-height: 1.6;
}

/* للثيم المظلم */
[data-theme="dark"] .service-card {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .service-card i {
    color: #2196f3 !important;
}

[data-theme="dark"] .service-card h3 {
    color: #ffffff !important;
}

[data-theme="dark"] .service-card p {
    color: #e0e0e0 !important;
} 


.service-card h3 {
    color: var(--text-primary);
    font-weight: 600;
    margin-bottom: 15px;
}

.service-card p {
    color: var(--text-secondary);
    line-height: 1.6;
}

/* تحسين ألوان الأزرار */
.btn-primary {
    background: var(--gradient-primary) !important;
    border: none !important;
    color: #ffffff !important;
    font-weight: 600;
    border-radius: 25px;
    padding: 12px 30px;
    transition: all 0.3s ease;
}

.btn-primary:hover {
    background: var(--gradient-primary) !important;
    color: #ffffff !important;
    transform: translateY(-5px) scale(1.08);
    box-shadow: 
        0 15px 40px rgba(59, 130, 246, 0.4),
        0 0 25px rgba(59, 130, 246, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.btn-primary:active {
    transform: translateY(-2px) scale(1.05);
}

.btn-outline-light {
    border: 2px solid var(--text-primary) !important;
    color: var(--text-primary) !important;
    background: transparent !important;
    font-weight: 600;
    border-radius: 25px;
    padding: 12px 30px;
}

.btn-outline-light:hover {
    background: var(--text-primary) !important;
    color: var(--bg-primary) !important;
}

/* للثيم المظلم */
[data-theme="dark"] .btn-outline-light {
    border-color: #ffffff !important;
    color: #ffffff !important;
}

[data-theme="dark"] .btn-outline-light:hover {
    background: #ffffff !important;
    color: #000000 !important;
}

/* تحسين ألوان العناوين العامة */
.display-5 {
    color: var(--text-primary) !important;
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

[data-theme="dark"] .display-5 {
    color: #ffffff !important;
}

/* بطاقات الإحصائيات - تحسين الألوان */
.stats-card {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    color: var(--text-primary);
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
    border-radius: 25px !important;
    box-shadow: var(--shadow-3d-soft);
    transform-style: preserve-3d;
    perspective: 1000px;
}

.stats-card::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15) 0%, transparent 70%);
    pointer-events: none;
    /* animation: rotate 8s linear infinite; */
    transform-origin: center;
}

.stats-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.2), transparent);
    transition: left 0.6s ease;
    pointer-events: none;
}

.stats-card:hover::after {
    left: 100%;
}

.stats-card:hover {
    /* transform: translateY(-18px) rotateX(8deg) rotateY(-8deg) scale(1.05); */
    box-shadow: var(--shadow-3d-strong), var(--neon-blue);
    border-color: rgba(59, 130, 246, 0.4);
}

.stats-card .card-body {
    position: relative;
    z-index: 2;
    transform: translateZ(20px);
}

.stats-card .card-title {
    color: var(--text-primary) !important;
    font-weight: 800;
    font-size: 2.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    transform: translateZ(30px);
    transition: transform 0.6s ease;
}

.stats-card:hover .card-title {
    transform: translateZ(40px) scale(1.1);
}

.stats-card .card-text {
    color: var(--text-secondary) !important;
    font-weight: 600;
    transform: translateZ(15px);
}

.stats-card i {
    color: var(--text-primary) !important;
    transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform: translateZ(25px);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

.stats-card:hover i {
    /* transform: translateZ(35px) scale(1.3) rotateY(360deg); */
    transform: translateZ(25px);
    filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.2));
}

/* ألوان الأيقونات */
.text-primary {
    color: #1976d2 !important;
}

.text-success {
    color: #2e7d32 !important;
}

.text-warning {
    color: #f57c00 !important;
}

/* للثيم المظلم */
[data-theme="dark"] .stats-card {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .stats-card .card-title {
    color: #ffffff !important;
}

[data-theme="dark"] .stats-card .card-text {
    color: #e0e0e0 !important;
}

[data-theme="dark"] .stats-card i {
    color: #ffffff !important;
}

[data-theme="dark"] .text-primary {
    color: #2196f3 !important;
}

[data-theme="dark"] .text-success {
    color: #4caf50 !important;
}

[data-theme="dark"] .text-warning {
    color: #ff9800 !important;
}

/* الروابط */
a {
    color: var(--gradient-primary);
    text-decoration: none;
    transition: all 0.3s ease;
}

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

/* القوائم المنسدلة */
.dropdown-menu {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    box-shadow: var(--card-shadow);
}

.dropdown-item {
    color: var(--text-primary);
    transition: all 0.3s ease;
}

.dropdown-item:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* الشارات */
.badge {
    border-radius: 20px;
    font-weight: 500;
    padding: 8px 12px;
}

.badge.bg-success {
    background: var(--gradient-success) !important;
}

.badge.bg-danger {
    background: var(--gradient-danger) !important;
}

.badge.bg-warning {
    background: var(--gradient-warning) !important;
    color: var(--text-primary) !important;
}

.badge.bg-info {
    background: var(--gradient-info) !important;
}

/* المودال */
.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    color: var(--text-primary);
}

.modal-header {
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-card);
}

.modal-footer {
    border-top: 1px solid var(--border-color);
    background: var(--bg-card);
}

.modal-title {
    color: var(--text-primary);
}

/* تحسينات النصوص - تباين عالي */
h1, h2, h3, h4, h5, h6 {
    color: var(--text-contrast);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    text-shadow: 0 1px 2px var(--shadow-color);
}

h1 {
    font-size: 2.5rem;
    font-weight: 800;
}

h2 {
    font-size: 2rem;
    font-weight: 750;
}

h3 {
    font-size: 1.6rem;
    font-weight: 700;
}

p {
    color: var(--text-secondary);
    line-height: 1.7;
    font-weight: 500;
    font-size: 16px;
    margin-bottom: 1rem;
}

.text-muted {
    color: var(--text-muted) !important;
    font-weight: 500;
}

.lead {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 1.25rem;
    line-height: 1.6;
}

/* تحسينات خاصة للنصوص المهمة */
.display-1, .display-2, .display-3, .display-4, .display-5, .display-6 {
    color: var(--text-contrast);
    font-weight: 800;
    text-shadow: 0 2px 4px var(--shadow-color);
}

.fw-bold, .font-weight-bold {
    color: #ffffff !important;
    font-weight: 700 !important;
}

.text-primary {
    color: var(--text-contrast) !important;
}

.text-secondary {
    color: var(--text-secondary) !important;
}

/* خلفيات مخصصة */
.bg-light {
    background: var(--bg-secondary) !important;
    color: var(--text-contrast) !important;
}

.bg-dark {
    background: var(--bg-primary) !important;
    color: var(--text-contrast) !important;
}

/* تحسينات الجداول - تباين محسن */
.table {
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: var(--card-shadow);
    color: var(--text-contrast);
}

.table thead th {
    background: var(--gradient-primary);
    color: #ffffff;
    border: none;
    font-weight: 700;
    padding: 18px;
    font-size: 16px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.table tbody td {
    padding: 16px 18px;
    border-color: var(--border-color);
    color: var(--text-contrast);
    background: var(--bg-card);
    font-weight: 500;
    font-size: 15px;
}

.table tbody tr:hover {
    background: var(--hover-bg);
    color: var(--text-contrast);
}

/* تحسينات القوائم */
.list-group-item {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-contrast);
    font-weight: 500;
    padding: 15px 20px;
}

.list-group-item:hover {
    background: var(--hover-bg);
    color: var(--text-contrast);
}

/* تحسينات الشريط العلوي */
.navbar-brand {
    font-weight: 800;
    color: var(--text-contrast) !important;
    font-size: 1.6rem;
    text-shadow: 0 1px 2px var(--shadow-color);
}

.navbar-nav .nav-link {
    font-weight: 600;
    color: var(--text-secondary) !important;
    font-size: 16px;
}

.navbar-nav .nav-link:hover {
    color: var(--text-contrast) !important;
    background: var(--hover-bg);
}

/* خلفيات مخصصة */
.bg-light {
    background: var(--bg-secondary) !important;
}

.bg-dark {
    background: var(--bg-primary) !important;
}
@media (max-width: 768px) {
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section {
        padding: 40px 20px;
        margin: 20px 0;
    }
    
    .hero-section p {
        font-size: 1.1rem;
    }
    
    .card-body {
        padding: 20px;
    }
    
    .services-grid {
        grid-template-columns: 1fr;
        gap: 20px;
        margin: 30px 0;
    }
    
    .service-card {
        padding: 25px 20px;
    }
    
    .navbar-nav {
        text-align: center;
        margin-top: 1rem;
    }
    
    .btn {
        padding: 12px 24px !important;
        font-size: 0.95rem !important;
        margin-bottom: 15px !important;
        width: 100% !important;
        display: block !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    .btn:last-child,
    .btn:last-of-type {
        margin-bottom: 0 !important;
    }
    
    .btn-lg {
        padding: 14px 28px !important;
        font-size: 1rem !important;
        margin-bottom: 15px !important;
    }
    
    /* إصلاح المسافات بين الأزرار في Hero Section - إصلاح شامل */
    .hero-section .btn,
    .hero-section a.btn,
    .hero-section .btn.btn-primary,
    .hero-section .btn.btn-outline-light {
        margin: 0 0 15px 0 !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-top: 0 !important;
        width: 100% !important;
        display: block !important;
        float: none !important;
    }
    
    .hero-section .btn:last-child,
    .hero-section .btn:last-of-type,
    .hero-section a.btn:last-child,
    .hero-section a.btn:last-of-type {
        margin-bottom: 0 !important;
    }
    
    /* إزالة جميع margins الجانبية من Bootstrap classes */
    .hero-section .btn.me-3,
    .hero-section .btn.ms-3,
    .hero-section .btn.mx-3,
    .hero-section a.btn.me-3,
    .hero-section a.btn.ms-3,
    .hero-section a.btn.mx-3,
    .hero-section .btn.btn-primary.me-3,
    .hero-section .btn.btn-outline-light.me-3 {
        margin-left: 0 !important;
        margin-right: 0 !important;
        margin-bottom: 15px !important;
        margin-top: 0 !important;
    }
    
    .hero-section .btn.me-3:last-child,
    .hero-section .btn.ms-3:last-child,
    .hero-section .btn.mx-3:last-child,
    .hero-section a.btn.me-3:last-child,
    .hero-section a.btn.ms-3:last-child,
    .hero-section a.btn.mx-3:last-child {
        margin-bottom: 0 !important;
    }
    
    /* إزالة margin من Bootstrap utility classes */
    .hero-section .me-3,
    .hero-section .ms-3,
    .hero-section .mx-3 {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* إزالة padding الجانبي المفرط */
    .hero-section .btn.px-5,
    .hero-section a.btn.px-5 {
        padding-left: 1.5rem !important;
        padding-right: 1.5rem !important;
    }
    
    /* إضافة مسافة بين الأزرار المتجاورة - مهم جداً */
    .hero-section .btn + .btn,
    .hero-section a.btn + a.btn,
    .hero-section .btn.btn-primary + .btn.btn-outline-light,
    .hero-section .btn.btn-outline-light + .btn.btn-primary {
        margin-top: 15px !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* إزالة أي flex أو inline-block وتحويل إلى column */
    .hero-section .text-center {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 15px !important;
    }
    
    /* إصلاح المسافات في col-lg-10 */
    .hero-section .col-lg-10 {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }
    
    /* إزالة أي inline styles من Bootstrap */
    .hero-section .row {
        margin: 0 !important;
    }
    
    .hero-section .row > * {
        padding-left: 0 !important;
        padding-right: 0 !important;
    }
    
    /* إصلاح نهائي للأزرار - استخدام gap */
    .hero-section .col-lg-10 {
        gap: 15px !important;
    }
    
    .hero-section .text-center {
        gap: 15px !important;
    }
    
    /* ضمان المسافة بين الأزرار */
    .hero-section a.btn:not(:last-child) {
        margin-bottom: 15px !important;
    }
    
    .table-responsive {
        font-size: 0.9rem;
    }
    
    .card-header h2 {
        font-size: 1.5rem;
    }
    
    /* تحسين الأزرار في الجوال */
    .btn-group {
        flex-direction: column !important;
        width: 100%;
        gap: 15px !important;
    }
    
    .btn-group .btn {
        margin: 0 0 15px 0 !important;
        border-radius: 20px;
        width: 100%;
    }
    
    .btn-group .btn:last-child {
        margin-bottom: 0 !important;
    }
    
    /* تحسين بطاقات الإحصائيات */
    .stats-card {
        margin-bottom: 20px;
    }
    
    .stats-card .card-title {
        font-size: 2rem;
    }
    
    /* تحسين العناوين */
    .display-4,
    .display-5 {
        font-size: 2rem;
    }
}

/* تحسينات للتابلت */
@media (max-width: 1024px) and (min-width: 769px) {
    .navbar-toggler {
        width: 42px;
        height: 38px;
        padding: 5px 9px;
    }
    
    .navbar-toggler-icon {
        width: 22px !important;
        height: 17px !important;
    }
    
    .navbar-brand {
        font-size: 1.4rem;
    }
    
    .hero-section h1 {
        font-size: 2.5rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 25px;
    }
    
    .card-body {
        padding: 25px;
    }
}

/* تحسينات للشاشات الكبيرة */
@media (min-width: 1400px) {
    .navbar-toggler {
        width: 48px;
        height: 42px;
        padding: 7px 12px;
        border-radius: 10px;
    }
    
    .navbar-toggler-icon {
        width: 26px !important;
        height: 20px !important;
    }
    
    .navbar-toggler-icon,
    .navbar-toggler-icon::before,
    .navbar-toggler-icon::after {
        height: 3px;
    }
    
    .navbar-toggler-icon::before {
        top: -9px;
    }
    
    .navbar-toggler-icon::after {
        top: 9px;
    }
    
    .navbar-brand {
        font-size: 1.6rem;
    }
    
    .navbar-brand img {
        height: 32px !important;
    }
    
    .container {
        max-width: 1200px;
    }
    
    .hero-section h1 {
        font-size: 3.5rem;
    }
    
    .services-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 40px;
    }
}

/* تحسينات إضافية */
.fade-in {
    animation: fadeIn 0.2s ease-in;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* حالة الطلب */
.status-badge {
    padding: 5px 15px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.status-pending {
    background: var(--gradient-warning);
    color: white;
}

.status-in-progress {
    background: var(--gradient-info);
    color: white;
}

.status-completed {
    background: var(--gradient-success);
    color: white;
}

.status-cancelled {
    background: var(--gradient-danger);
    color: white;
}

/* تحسين إمكانية الوصول */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* تأثيرات متقدمة */
.glass-effect {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
}

.gradient-text {
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* تحسينات Dashboard */
.border-left-primary {
    border-left: 0.25rem solid #4e73df !important;
}

.border-left-warning {
    border-left: 0.25rem solid #f6c23e !important;
}

.border-left-info {
    border-left: 0.25rem solid #36b9cc !important;
}

.border-left-success {
    border-left: 0.25rem solid #1cc88a !important;
}

.text-xs {
    font-size: 0.7rem;
}

.font-weight-bold {
    font-weight: 700 !important;
}

.text-gray-800 {
    color: var(--text-primary) !important;
}

.text-gray-300 {
    color: var(--text-muted) !important;
}

/* تحسينات النموذج للجوال */
@media (max-width: 576px) {
    /* تحسين Forms للهواتف */
    .form-control {
        font-size: 16px !important; /* منع التكبير التلقائي في iOS */
        padding: 12px 15px !important;
        border-radius: 12px !important;
    }
    
    .form-control:focus {
        transform: translateY(-1px) scale(1.005) !important;
        box-shadow: 
            0 0 0 3px rgba(59, 130, 246, 0.15),
            0 4px 15px rgba(59, 130, 246, 0.1) !important;
    }
    
    .form-select {
        font-size: 16px !important;
        padding: 12px 15px !important;
        border-radius: 12px !important;
    }
    
    .form-label {
        font-size: 0.9rem !important;
        margin-bottom: 8px !important;
    }
    
    .input-group-text {
        background: var(--bg-card);
        border-color: var(--border-color);
        color: var(--text-primary);
    }
    
    .modal-dialog {
        margin: 10px;
    }
    
    .navbar-toggler {
        border: 2px solid var(--border-color) !important;
        padding: 5px 8px !important;
        background: var(--bg-card) !important;
        border-radius: 6px !important;
        width: 40px;
        height: 36px;
        margin-right: 10px;
    }
    
    .navbar-toggler-icon {
        width: 20px !important;
        height: 16px !important;
    }
    
    .navbar-toggler-icon,
    .navbar-toggler-icon::before,
    .navbar-toggler-icon::after {
        height: 2px;
    }
    
    .navbar-toggler-icon::before {
        top: -6px;
    }
    
    .navbar-toggler-icon::after {
        top: 6px;
    }
}

/* تحسينات navbar-collapse المتقدمة */
.navbar-collapse {
    background: var(--navbar-bg) !important;
    backdrop-filter: blur(15px) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 20px !important;
    margin-top: 20px !important;
    padding: 25px !important;
    box-shadow: 0 8px 32px var(--shadow-color) !important;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1) !important;
    transform: translateY(-10px) !important;
    opacity: 0 !important;
    pointer-events: none !important;
}

.navbar-collapse.show {
    transform: translateY(0) !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

.navbar-collapse.collapsing {
    opacity: 0.5 !important;
    transform: translateY(-5px) !important;
}

/* تحسين قائمة التنقل */
.navbar-collapse .navbar-nav {
    gap: 10px !important;
    align-items: center !important;
    justify-content: center !important;
}

.navbar-collapse .nav-item {
    margin: 8px 0 !important;
    width: 100% !important;
    text-align: center !important;
}

.navbar-collapse .nav-link {
    font-weight: 600 !important;
    font-size: 1.1rem !important;
    padding: 15px 25px !important;
    border-radius: 15px !important;
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
    border: 2px solid var(--border-color) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: block !important;
    text-decoration: none !important;
    position: relative !important;
    overflow: hidden !important;
}

.navbar-collapse .nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    transition: left 0.3s ease;
    z-index: -1;
}

.navbar-collapse .nav-link:hover {
    color: #ffffff !important;
    border-color: transparent !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 25px var(--shadow-color) !important;
}

.navbar-collapse .nav-link:hover::before {
    left: 0;
}

.navbar-collapse .nav-link:active {
    transform: translateY(-1px) !important;
}

/* تحسين إدارة hamburger مع Bootstrap */
.hamburger input:checked + svg {
    transform: rotate(-45deg);
}

.hamburger input:checked + svg .line-top-bottom {
    stroke-dasharray: 20 300;
    stroke-dashoffset: -32.42;
}

/* منع تداخل events من checkbox */
.hamburger input {
    display: none;
    pointer-events: none; /* منع التفاعل المباشر مع checkbox */
}

/* ضمان سلوك صحيح للـ label */
.hamburger {
    cursor: pointer;
    user-select: none; /* منع تحديد النص */
}

.navbar-collapse .nav-link:hover {
    color: #ffffff !important;
    border-color: transparent !important;
    transform: translateY(-3px) !important;
    box-shadow: 0 8px 25px var(--shadow-color) !important;
}

.navbar-collapse .nav-link:hover::before {
    left: 0;
}

.navbar-collapse .nav-link:active {
    transform: translateY(-1px) !important;
}

/* تحسين زر الثيم في القائمة المنهارة */
.navbar-collapse .theme-toggle {
    background: var(--bg-card) !important;
    border: 2px solid var(--border-color) !important;
    border-radius: 50% !important;
    width: 60px !important;
    height: 60px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    color: var(--text-primary) !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1) !important;
    cursor: pointer !important;
    margin: 15px auto !important;
    font-size: 1.3rem !important;
    box-shadow: 0 4px 15px var(--shadow-color) !important;
}

.navbar-collapse .theme-toggle:hover {
    background: var(--gradient-primary) !important;
    border-color: transparent !important;
    color: #ffffff !important;
    /* transform: scale(1.1) rotate(15deg) !important; */
    box-shadow: 0 8px 25px var(--shadow-color) !important;
}

.navbar-collapse .theme-toggle:active {
    /* transform: scale(1.05) rotate(10deg) !important; */
}

/* تأثيرات متقدمة للقائمة */
.navbar-collapse .navbar-nav:first-child {
    margin-bottom: 20px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
    position: relative;
}

.navbar-collapse .navbar-nav:first-child::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 4px;
    background: var(--gradient-primary);
    border-radius: 2px;
}

/* تحسينات للثيم المظلم */
[data-theme="dark"] .navbar-collapse {
    background: var(--navbar-bg) !important;
    border-color: var(--border-color) !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="dark"] .navbar-collapse .nav-link {
    background: var(--bg-card) !important;
    color: #ffffff !important;
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .navbar-collapse .nav-link:hover {
    color: #ffffff !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .navbar-collapse .theme-toggle {
    background: var(--bg-card) !important;
    border-color: var(--border-color) !important;
    color: #ffffff !important;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4) !important;
}

[data-theme="dark"] .navbar-collapse .theme-toggle:hover {
    background: var(--gradient-primary) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.5) !important;
}

[data-theme="dark"] .navbar-collapse .navbar-nav:first-child {
    border-bottom-color: var(--border-color);
}

/* تحسينات للأجهزة اللوحية */
@media (min-width: 577px) and (max-width: 991px) {
    .navbar-collapse {
        margin-top: 25px !important;
        padding: 30px !important;
        border-radius: 25px !important;
    }
    
    .navbar-collapse .nav-link {
        font-size: 1.2rem !important;
        padding: 18px 30px !important;
    }
    
    .navbar-collapse .theme-toggle {
        width: 65px !important;
        height: 65px !important;
        font-size: 1.4rem !important;
    }
}

/* تحسينات للشاشات الكبيرة عند استخدام القائمة المنهارة */
@media (min-width: 1200px) {
    .navbar-collapse {
        max-width: 400px;
        margin-left: auto;
        margin-right: auto;
    }
}

/* تأثيرات الدخول المتدرجة للعناصر - محسّنة للأداء */
.navbar-collapse.show .nav-item {
    animation: slideInFromTop 0.2s ease forwards;
}

.navbar-collapse.show .nav-item:nth-child(1) {
    animation-delay: 0.05s;
}

.navbar-collapse.show .nav-item:nth-child(2) {
    animation-delay: 0.1s;
}

.navbar-collapse.show .theme-toggle {
    animation: bounceIn 0.2s ease forwards;
    animation-delay: 0.15s;
}

@keyframes slideInFromTop {
    0% {
        opacity: 0;
        transform: translateY(-20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes bounceIn {
    0% {
        opacity: 0;
        transform: scale(0.8);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* تحسين سلوك التمرير */
@media (max-width: 991px) {
    .navbar-collapse.show {
        overflow-y: auto;
        max-height: 70vh;
    }
    
    .navbar-collapse::-webkit-scrollbar {
        width: 6px;
    }
    
    .navbar-collapse::-webkit-scrollbar-track {
        background: var(--bg-card);
        border-radius: 3px;
    }
    
    .navbar-collapse::-webkit-scrollbar-thumb {
        background: var(--border-color);
        border-radius: 3px;
    }
    
    .navbar-collapse::-webkit-scrollbar-thumb:hover {
        background: var(--text-muted);
    }
}

/* تحسينات إمكانية الوصول */
.navbar-collapse .nav-link:focus {
    outline: 3px solid var(--gradient-primary) !important;
    outline-offset: 3px !important;
}

.navbar-collapse .theme-toggle:focus {
    outline: 3px solid var(--gradient-primary) !important;
    outline-offset: 3px !important;
}

/* تقليل الحركة للمستخدمين الذين يفضلون ذلك */
@media (prefers-reduced-motion: reduce) {
    .navbar-collapse,
    .navbar-collapse .nav-link,
    .navbar-collapse .theme-toggle {
        transition: none !important;
        animation: none !important;
    }
    
    .navbar-collapse .nav-link:hover {
        transform: none !important;
    }
    
    .navbar-collapse .theme-toggle:hover {
        transform: scale(1.02) !important;
    }
}

/* تحسينات إضافية للثيم المظلم */
[data-theme="dark"] .table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(255, 255, 255, 0.05);
}

[data-theme="dark"] .modal-content {
    background: var(--bg-card);
    color: var(--text-primary);
}

[data-theme="dark"] .modal-header {
    border-bottom-color: var(--border-color);
}

[data-theme="dark"] .modal-footer {
    border-top-color: var(--border-color);
}

[data-theme="dark"] .dropdown-menu {
    background: var(--bg-card);
    border-color: var(--border-color);
}

[data-theme="dark"] .dropdown-item {
    color: var(--text-primary);
}

[data-theme="dark"] .dropdown-item:hover {
    background: var(--border-color);
    color: var(--text-primary);
}

/* انيميشن تبديل الثيم */
.theme-transition,
.theme-transition *,
.theme-transition *::before,
.theme-transition *::after {
    transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
}

/* ضمان عمل الانتقالات في الشاشات الصغيرة */
@media (max-width: 991px) {
    html,
    body {
        transition: background-color 0.3s ease, color 0.3s ease !important;
    }
    
    body *,
    body *::before,
    body *::after {
        transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
    }
    
    .card,
    .navbar,
    .btn,
    .form-control,
    .form-select,
    .alert,
    .badge,
    .list-group-item,
    .modal-content,
    .dropdown-menu,
    .offcanvas,
    .card-header,
    .card-body,
    .card-footer,
    .navbar-brand,
    .nav-link,
    .hamburger,
    .theme-toggle {
        transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease !important;
    }
}

/* تحسينات إضافية للهواتف المحمولة */
@media (max-width: 480px) {
    .navbar-toggler {
        width: 38px !important;
        height: 34px !important;
        padding: 4px 6px !important;
        margin-right: 8px;
    }
    
    .navbar-toggler-icon {
        width: 18px !important;
        height: 14px !important;
    }
    
    .navbar-toggler-icon,
    .navbar-toggler-icon::before,
    .navbar-toggler-icon::after {
        height: 3px;
        border-radius: 1px;
    }
    
    .navbar-toggler-icon::before {
        top: -5px;
    }
    
    .navbar-toggler-icon::after {
        top: 5px;
    }
    
    .navbar-brand {
        font-size: 1.3rem !important;
    }
    
    .navbar-brand img {
        height: 24px !important;
    }
    
    .hero-section h1 {
        font-size: 1.8rem;
        line-height: 1.2;
    }
    
    .hero-section p {
        font-size: 1rem;
    }
    
    .card-header h2 {
        font-size: 1.3rem;
    }
    
    .service-card {
        padding: 15px;
    }
    
    .service-card i {
        font-size: 2.5rem;
    }
    
    .btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .navbar-brand {
        font-size: 1.2rem;
    }
    
    .main-content {
        margin-top: 80px;
        margin-bottom: 80px;
    }
    
    .table-responsive {
        font-size: 0.8rem;
    }
    
    .form-control {
        padding: 10px 12px;
    }
    
    .theme-toggle {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
}

/* تحسينات إضافية للثيم المظلم */
[data-theme="dark"] .bg-light {
    background: var(--bg-card) !important;
    color: var(--text-primary) !important;
}

[data-theme="dark"] .text-dark {
    color: var(--text-primary) !important;
}

[data-theme="dark"] .border {
    border-color: var(--border-color) !important;
}

[data-theme="dark"] .list-group-item {
    background: var(--bg-card);
    border-color: var(--border-color);
    color: var(--text-primary);
}

[data-theme="dark"] .list-group-item:hover {
    background: var(--border-color);
}

/* تحسينات النافذة المنبثقة للثيم المظلم */
[data-theme="dark"] .offcanvas {
    background: var(--bg-card);
    color: var(--text-primary);
}

[data-theme="dark"] .offcanvas-header {
    border-bottom-color: var(--border-color);
}

/* تحسينات الطباعة */
@media print {
    .theme-toggle,
    .navbar,
    .btn,
    footer {
        display: none !important;
    }
    
    .main-content {
        margin: 0 !important;
    }
    
    .card {
        box-shadow: none !important;
        border: 1px solid #000 !important;
        background: #fff !important;
        color: #000 !important;
    }
    
    .text-muted {
        color: #666 !important;
    }
    
    body {
        background: #fff !important;
        color: #000 !important;
    }
}

/* تحسينات إضافية للتباين */
[data-theme="dark"] {
    color-scheme: dark;
}

:root {
    color-scheme: light;
}

/* تحسينات خاصة للنصوص */
.text-white {
    color: #ffffff !important;
}

.text-black {
    color: #000000 !important;
}

[data-theme="dark"] .text-black {
    color: #ffffff !important;
}

/* تحسين الخلفيات للصفحات الخاصة */
.admin-page {
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
}

.main-page {
    background: var(--bg-primary);
    min-height: 100vh;
    color: var(--text-primary);
}

/* تحسينات الأزرار الثانوية */
.btn-outline-primary {
    border-color: var(--text-primary);
    color: var(--text-primary);
}

.btn-outline-primary:hover {
    background: var(--text-primary);
    color: var(--bg-card);
}

.btn-outline-secondary {
    border-color: var(--text-muted);
    color: var(--text-muted);
}

.btn-outline-secondary:hover {
    background: var(--text-muted);
    color: var(--bg-card);
}

/* تحسينات إمكانية الوصول */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
/* تحسينات للشاشات عالية الدقة */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .service-card i {
        transform: translateZ(0);
    }
    
    .btn {
        transform: translateZ(0);
    }
    
    .card {
        transform: translateZ(0);
    }
}

/* تحسينات نهائية للتباين العالي */

/* ===== تصميم معرض النماذج - تصميم حديث ===== */
.templates-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 2rem;
    padding: 1rem 0;
}

.template-card-modern {
    background: var(--bg-card);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    height: 100%;
}

.template-card-modern:hover {
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    transform: translateY(-5px);
    border-color: var(--primary-color);
}

.template-card-header {
    position: relative;
    width: 100%;
    height: 250px;
    overflow: hidden;
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
}

.template-card-image-container {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

.template-card-main-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: transform 0.4s ease;
    display: block;
}

.template-card-modern:hover .template-card-main-img {
    transform: scale(1.05);
}

/* على الشاشات الكبيرة فقط */
@media (min-width: 769px) {
    .template-card-modern:hover .template-card-main-img {
        transform: scale(1.1);
    }
}

.template-card-image-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
}

.template-card-no-image {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
}

.template-images-badge {
    position: absolute;
    top: 12px;
    left: 12px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    gap: 4px;
    z-index: 5;
}

.template-card-image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.7) 0%, transparent 100%);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.template-card-modern:hover .template-card-image-overlay {
    opacity: 1;
}

.template-view-btn {
    border-radius: 25px;
    padding: 8px 20px;
    font-weight: 600;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.template-card-body {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.template-card-title-section {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
    gap: 1rem;
}

.template-card-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.template-card-title i {
    font-size: 1.1rem;
    opacity: 0.8;
}

.template-card-id {
    background: var(--hover-bg);
    color: var(--text-muted);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
    white-space: nowrap;
}

.template-card-thumbnails {
    display: flex;
    gap: 8px;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}

.template-thumbnail-item {
    width: 60px;
    height: 60px;
    border-radius: 8px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.template-thumbnail-item:hover {
    border-color: var(--primary-color);
    transform: scale(1.1);
    z-index: 2;
    position: relative;
}

.template-thumbnail-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.template-thumbnail-more {
    background: linear-gradient(135deg, var(--gradient-primary));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 0.9rem;
    border: none;
}

.template-card-footer {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

.template-card-action-btn {
    width: 100%;
    border-radius: 12px;
    padding: 12px 24px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.2);
}

.template-card-action-btn:hover {
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
    transform: translateY(-2px);
}

/* معرض الصور */
.template-gallery-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.template-gallery-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
}

.template-gallery-content {
    position: relative;
    background: var(--bg-card);
    border-radius: 20px;
    padding: 2rem;
    max-width: 1200px;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 10001;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.template-gallery-close {
    position: absolute;
    top: 15px;
    left: 15px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10002;
}

.template-gallery-close:hover {
    background: rgba(0, 0, 0, 0.8);
    transform: scale(1.1);
}

.template-gallery-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 1.5rem;
    text-align: center;
}

.template-gallery-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
}

.template-gallery-item {
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    border: 2px solid var(--border-color);
    transition: all 0.3s ease;
}

.template-gallery-item:hover {
    border-color: var(--primary-color);
    transform: scale(1.05);
}

.template-gallery-item img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    display: block;
}

/* الوضع الداكن */
[data-theme="dark"] .template-card-modern {
    background: rgba(30, 41, 59, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .template-card-modern:hover {
    border-color: var(--primary-color);
    box-shadow: 0 8px 30px rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .template-card-header {
    background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
}

[data-theme="dark"] .template-card-image-placeholder {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
}

[data-theme="dark"] .template-card-id {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-muted);
}

[data-theme="dark"] .template-gallery-content {
    background: rgba(30, 41, 59, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.template-image-slide {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 0.6s ease;
}

.template-image-slide.active {
    opacity: 1;
    z-index: 1;
}

.template-image-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 20px;
    background: var(--bg-card);
}

.template-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    background: rgba(0, 0, 0, 0.05);
    position: relative;
    z-index: 1;
}

.template-img[src=""],
.template-img:not([src]),
.template-img[src="undefined"] {
    display: none;
}

.image-error-placeholder {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.1);
    display: none;
    align-items: center;
    justify-content: center;
    color: #999;
    flex-direction: column;
    z-index: 2;
    border-radius: 20px;
}

.template-image-card:hover .template-img {
    transform: scale(1.15);
}

/* أزرار التنقل */
.template-carousel-controls {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0 1rem;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.template-image-card:hover .template-carousel-controls {
    opacity: 1;
}

.template-carousel-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.template-carousel-btn:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

/* المؤشرات */
.template-carousel-indicators {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 8px;
    z-index: 10;
}

.template-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    cursor: pointer;
    transition: all 0.3s ease;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.template-indicator.active {
    background: white;
    width: 30px;
    border-radius: 5px;
}

.template-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.9) 0%,
        rgba(0, 0, 0, 0.7) 50%,
        rgba(0, 0, 0, 0) 100%
    );
    display: flex;
    align-items: flex-end;
    padding: 2rem;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.template-image-card:hover .template-overlay {
    opacity: 1;
}

.template-overlay-content {
    width: 100%;
    color: white;
    transform: translateY(20px);
    transition: transform 0.4s ease;
}

.template-image-card:hover .template-overlay-content {
    transform: translateY(0);
}

.template-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.75rem;
    color: white;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.template-description {
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 1rem;
    line-height: 1.6;
    text-shadow: 0 1px 5px rgba(0, 0, 0, 0.5);
}

.template-action-btn {
    border-radius: 25px;
    padding: 0.6rem 1.5rem;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.template-action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

/* تصميم للنماذج بدون صور */
.template-no-image {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
}

.template-placeholder {
    text-align: center;
    padding: 2rem;
    color: var(--text-primary);
}

.template-placeholder i {
    color: var(--primary-color);
    opacity: 0.7;
}

.template-placeholder .template-title {
    color: var(--text-primary);
    text-shadow: none;
    margin-top: 1rem;
}

.template-placeholder .template-description {
    color: var(--text-secondary);
    text-shadow: none;
}

[data-theme="dark"] .template-image-wrapper {
    background: rgba(30, 41, 59, 0.95);
}

[data-theme="dark"] .template-no-image {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
}

/* تحسينات للهواتف المحمولة - التصميم الجديد */
@media (max-width: 768px) {
    .templates-gallery {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 0.5rem;
    }
    
    .template-card-modern {
        border-radius: 12px;
        margin: 0 auto;
        max-width: 100%;
    }
    
    .template-card-header {
        height: auto;
        min-height: 200px;
        aspect-ratio: 4 / 3;
        max-height: 350px;
    }
    
    .template-card-main-img {
        object-fit: cover !important;
        object-position: center;
        width: 100%;
        height: 100%;
    }
    
    .template-card-modern:hover .template-card-main-img {
        transform: none !important;
    }
    
    .template-card-title {
        font-size: 1.1rem;
    }
    
    .template-card-body {
        padding: 1rem;
    }
    
    .template-thumbnail-item {
        width: 50px;
        height: 50px;
    }
    
    .template-card-image-overlay {
        opacity: 1;
        background: linear-gradient(to top, rgba(0, 0, 0, 0.5) 0%, transparent 100%);
    }
    
    .template-view-btn {
        padding: 6px 16px;
        font-size: 0.85rem;
    }
    
    .template-gallery-content {
        padding: 1rem;
        max-height: 95vh;
        border-radius: 12px;
    }
    
    .template-gallery-images {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 0.5rem;
    }
    
    .template-gallery-item img {
        height: 120px;
    }
    
    /* للتصميم القديم (إذا كان موجوداً) */
    .template-images-carousel,
    .template-image-wrapper {
        height: 300px;
    }
    
    .template-title {
        font-size: 1.25rem;
    }
    
    .template-description {
        font-size: 0.85rem;
    }
    
    .template-overlay {
        padding: 1.5rem;
        opacity: 1;
    }
    
    .template-overlay-content {
        transform: translateY(0);
    }
    
    .template-carousel-controls {
        opacity: 1;
    }
    
    .template-carousel-btn {
        width: 35px;
        height: 35px;
    }
}

@media (max-width: 576px) {
    .templates-gallery {
        grid-template-columns: 1fr;
        gap: 1rem;
        padding: 0.5rem;
    }
    
    .template-card-modern {
        border-radius: 10px;
    }
    
    .template-card-header {
        height: auto;
        min-height: 180px;
        aspect-ratio: 4 / 3;
        max-height: 300px;
    }
    
    .template-card-main-img {
        object-fit: cover !important;
        object-position: center;
        width: 100%;
        height: 100%;
    }
    
    .template-card-title-section {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .template-card-title {
        font-size: 1rem;
    }
    
    .template-card-body {
        padding: 0.875rem;
    }
    
    .template-thumbnail-item {
        width: 45px;
        height: 45px;
    }
    
    .template-card-action-btn {
        padding: 10px 20px;
        font-size: 0.9rem;
    }
    
    .template-images-badge {
        top: 8px;
        left: 8px;
        padding: 4px 10px;
        font-size: 0.75rem;
    }
    
    .template-gallery-content {
        padding: 0.75rem;
        border-radius: 10px;
    }
    
    .template-gallery-images {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.5rem;
    }
    
    .template-gallery-item img {
        height: 100px;
    }
    
    .template-gallery-title {
        font-size: 1.2rem;
        margin-bottom: 1rem;
    }
    
    /* للتصميم القديم */
    .template-image-wrapper {
        height: 280px;
    }
}

/* تحسينات إضافية للشاشات الصغيرة جداً */
@media (max-width: 400px) {
    .template-card-header {
        height: auto;
        min-height: 160px;
        aspect-ratio: 3 / 2;
        max-height: 250px;
    }
    
    .template-card-body {
        padding: 0.75rem;
    }
    
    .template-card-title {
        font-size: 0.95rem;
    }
    
    .template-thumbnail-item {
        width: 40px;
        height: 40px;
    }
}

/* ===== شريط البحث والتصفية ===== */
.template-search-filter {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    border: 1px solid var(--border-color);
    margin-bottom: 2rem;
}

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

.template-search-filter .form-control,
.template-search-filter .form-select {
    border: 2px solid var(--border-color);
    border-radius: 10px;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.template-search-filter .form-control:focus,
.template-search-filter .form-select:focus {
    border-color: var(--gradient-primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
    outline: none;
}

.template-search-filter .input-group .btn {
    border-radius: 0 10px 10px 0;
    padding: 0.75rem 1.5rem;
}

.template-search-filter .input-group .form-control {
    border-radius: 10px 0 0 10px;
}

@media (max-width: 768px) {
    .template-search-filter {
        padding: 1rem;
    }
    
    .template-search-filter .row {
        gap: 1rem;
    }
    
    .template-search-filter .col-md-6,
    .template-search-filter .col-md-4,
    .template-search-filter .col-md-2 {
        width: 100%;
        max-width: 100%;
    }
}

/* ===== Lightbox للصور ===== */
.image-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.image-lightbox.active {
    opacity: 1;
    visibility: visible;
}

.lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.95);
    backdrop-filter: blur(10px);
}

.lightbox-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    z-index: 10001;
}

.lightbox-close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10002;
    backdrop-filter: blur(10px);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.3);
    /* transform: rotate(90deg) scale(1.1); */
}

.lightbox-prev,
.lightbox-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    z-index: 10002;
    backdrop-filter: blur(10px);
}

.lightbox-prev {
    right: 20px;
}

.lightbox-next {
    left: 20px;
}

.lightbox-prev:hover,
.lightbox-next:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.1);
}

.lightbox-image-container {
    max-width: 90%;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.lightbox-image {
    max-width: 100%;
    max-height: 85vh;
    object-fit: contain;
    border-radius: 10px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: opacity 0.3s ease;
}

.lightbox-footer {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    color: white;
    z-index: 10002;
}

.lightbox-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.lightbox-counter {
    font-size: 1rem;
    opacity: 0.9;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: inline-block;
    backdrop-filter: blur(10px);
}

@media (max-width: 768px) {
    .lightbox-content {
        padding: 1rem;
    }
    
    .lightbox-close {
        top: 10px;
        right: 10px;
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
    
    .lightbox-prev,
    .lightbox-next {
        width: 50px;
        height: 50px;
        font-size: 1.2rem;
    }
    
    .lightbox-prev {
        right: 10px;
    }
    
    .lightbox-next {
        left: 10px;
    }
    
    .lightbox-image-container {
        max-width: 95%;
        max-height: 80vh;
    }
    
    .lightbox-title {
        font-size: 1.2rem;
    }
    
    .lightbox-footer {
        bottom: 10px;
    }
}

/* أيقونات محسنة */
.fa, .fas, .far, .fab {
    filter: drop-shadow(0 1px 2px var(--shadow-color));
}

/* تباين عالي للعناوين المهمة */
.display-1, .display-2, .display-3, .display-4 {
    color: var(--text-contrast) !important;
    font-weight: 900 !important;
    text-shadow: 0 3px 6px var(--shadow-color) !important;
}

/* تحسين القوائم والعناصر التفاعلية */
.dropdown-item:focus,
.nav-link:focus {
    outline: 2px solid var(--text-primary);
    outline-offset: 2px;
}

/* تحسين التباين للشارات */
.badge {
    font-weight: 700 !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* تحسينات أخيرة للنصوص */
strong, b {
    color: var(--text-contrast);
    font-weight: 700;
}

small, .small {
    color: var(--text-muted);
    font-weight: 500;
}