/* إعدادات عامة */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Tajawal', Arial, sans-serif;
    direction: rtl;
    overflow-x: hidden;
    scroll-behavior: smooth;
    background-image: url('../assets/bg.png');
    /* تحسين الأداء */
    will-change: auto;
    contain: layout style;
}

/* تحسين الخطوط العربية */
.font-arabic {
    font-family: 'Tajawal', 'Cairo', 'Amiri', Arial, sans-serif;
    font-feature-settings: "liga" 1, "kern" 1;
}

/* تأثيرات Glassmorphism */
.glass-card {
    background: rgba(56, 5, 71, 0.281);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(74, 51, 82, 0.336);
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
    transform: translateZ(0);
}

.glass-card:hover {
    background: rgba(76, 19, 94, 0.281);
    transform: translateY(-2px);
    box-shadow: 0 12px 40px 0 rgba(31, 38, 135, 0.5);
}

.glass-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border-radius: inherit;
    z-index: -1;
}

.glass-input {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    color: white;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    will-change: border-color, box-shadow;
}

.glass-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(147, 51, 234, 0.5) !important;
    box-shadow: 0 0 20px rgba(147, 51, 234, 0.3) !important;
    transform: translateY(-2px);
}

.glass-input option {
    background: rgba(30, 30, 30, 0.9);
    color: white;
}

.glow-button {
    position: relative;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    will-change: transform;
    transform: translateZ(0);
}

.glow-button:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5) !important;
    transform: translateY(-2px) translateZ(0);
}

.glow-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}

.glow-button:hover::before {
    left: 100%;
}

/* النص المتحرك */
#animated-text {
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

/* تأثيرات CSS مخصصة */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes glow {
    from {
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 10px rgba(255, 255, 255, 0.3);
    }
    to {
        text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 255, 255, 0.6);
    }
}

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

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(50px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); opacity: 0.3; }
    50% { transform: translateY(-20px) rotate(180deg); opacity: 0.8; }
}

/* تحسينات للرسوم المتحركة */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInLeft {
    from {
        transform: translateX(-100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-slide-in-right {
    animation: slideInRight 0.6s ease-out;
}

.animate-slide-in-left {
    animation: slideInLeft 0.6s ease-out;
}

.animate-bounce-in {
    animation: bounceIn 0.8s ease-out;
}

/* تأثيرات إضافية للحقول */
.glass-input:hover {
    transform: scale(1.02);
}

/* تأثير النجاح */
.success-button {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%) !important;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4) !important;
}

.success-button:hover {
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.6) !important;
}

/* أزرار الإضافة - تصميم موحد */
.add-button {
    background: linear-gradient(135deg, #1B5E20 0%, #2E7D32 100%) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(76, 175, 80, 0.3) !important;
    box-shadow: 0 4px 15px rgba(27, 94, 32, 0.4) !important;
    color: white !important;
    transition: all 0.3s ease;
}

.add-button:hover {
    background: linear-gradient(135deg, #2E7D32 0%, #388E3C 100%) !important;
    box-shadow: 0 8px 25px rgba(27, 94, 32, 0.6) !important;
    transform: translateY(-2px) scale(1.02);
}

.add-button:active {
    transform: translateY(0) scale(0.98);
}

/* تأثير التحميل */
.loading {
    pointer-events: none;
    opacity: 0.7;
}

/* شريط التقدم */
#progressBar::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    animation: shimmer 1.5s infinite;
}

/* استجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    .glass-card {
        margin: 20px;
        padding: 30px 20px !important;
    }
    
    #animated-text {
        font-size: 20px !important;
    }
    
    .glass-input {
        padding: 12px 45px 12px 12px !important;
        font-size: 14px !important;
    }
    
    .glow-button {
        padding: 12px !important;
        font-size: 16px !important;
    }
}

@media (max-width: 480px) {
    .glass-card {
        padding: 25px 15px !important;
    }
    
    #animated-text {
        font-size: 18px !important;
    }
}

/* تأثيرات لوحة التحكم */
.dashboard-card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.dashboard-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.dashboard-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.logout-btn {
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.logout-btn:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* تأثيرات الجسيمات */
.particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1;
}

.particle {
    position: absolute;
    width: 2px;
    height: 2px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: float 3s ease-in-out infinite;
}

/* تحسينات إضافية */
.glass-input::placeholder {
    color: rgba(255, 255, 255, 0.6) !important;
}

.glass-input:focus::placeholder {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* تأثير الضوء المتحرك */
.moving-light {
    position: absolute;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    border-radius: 50%;
    animation: float 4s ease-in-out infinite;
    pointer-events: none;
}

/* تحسين الخطوط العربية */
.arabic-text {
    font-feature-settings: 'liga' 1, 'calt' 1;
    text-rendering: optimizeLegibility;
}

/* تأثيرات الانتقال السلسة */
.smooth-transition {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* تحسين الظلال */
.enhanced-shadow {
    box-shadow: 
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06),
        0 0 0 1px rgba(255, 255, 255, 0.05);
}

/* تأثير الانعكاس */
.glass-reflection {
    position: relative;
}

.glass-reflection::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(
        45deg,
        transparent 30%,
        rgba(255, 255, 255, 0.1) 50%,
        transparent 70%
    );
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.glass-reflection:hover::after {
    opacity: 1;
}

/* تحسينات التمرير المخصص للقائمة الجانبية */
.sidebar-scroll-enhancement {
    scroll-behavior: smooth;
    overscroll-behavior: contain;
}

/* مؤشر التمرير المحسن */
.scroll-progress-indicator {
    position: fixed;
    top: 0;
    right: 0;
    width: 3px;
    background: linear-gradient(to bottom, #9333ea, #3b82f6);
    z-index: 61;
    transition: all 0.3s ease;
    border-radius: 0 0 0 2px;
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.5);
}

/* تأثيرات التمرير للعناصر */
.scroll-fade-item {
    transition: all 0.3s ease;
}

.scroll-fade-item.fade-out {
    opacity: 0.5;
    transform: translateX(10px);
}

/* تحسين شريط التمرير العام */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(45deg, rgba(147, 51, 234, 0.6), rgba(59, 130, 246, 0.6));
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s ease;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(45deg, rgba(147, 51, 234, 0.8), rgba(59, 130, 246, 0.8));
    box-shadow: 0 0 10px rgba(147, 51, 234, 0.5);
}

/* تأثيرات التمرير للجوال */
@media (max-width: 768px) {
    .custom-scrollbar::-webkit-scrollbar {
        width: 6px;
    }
    
    .scroll-progress-indicator {
        width: 2px;
    }
}

/* تحسين الأداء للتمرير */
.sidebar-container {
    will-change: scroll-position;
    contain: layout style paint;
}

/* تأثير التمرير السلس للمحتوى */
.smooth-scroll-content {
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
}

/* مؤشر اتجاه التمرير */
.scroll-direction-indicator {
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    opacity: 0;
    transition: opacity 0.3s ease;
    color: rgba(147, 51, 234, 0.7);
    font-size: 12px;
}

.sidebar-container:hover .scroll-direction-indicator {
    opacity: 1;
}

/* تأثير النبضة للتمرير */
@keyframes scrollPulse {
    0%, 100% {
        box-shadow: 0 0 5px rgba(147, 51, 234, 0.3);
    }
    50% {
        box-shadow: 0 0 15px rgba(147, 51, 234, 0.6);
    }
}

.custom-scrollbar::-webkit-scrollbar-thumb:active {
    animation: scrollPulse 0.5s ease-in-out;
}

/* تصميم القائمة المنسدلة المحسن */
.dropdown-container {
    position: relative;
    display: inline-block;
}

.dropdown-select {
    background: rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 12px;
    padding: 12px 40px 12px 16px;
    color: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 4 5"><path fill="%23ffffff" d="M2 0L0 2h4zm0 5L0 3h4z"/></svg>');
    background-repeat: no-repeat;
    background-position: left 12px center;
    background-size: 12px;
    min-width: 150px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.dropdown-select:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    border-color: rgba(147, 51, 234, 0.4) !important;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(147, 51, 234, 0.2);
}

.dropdown-select:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.2) !important;
    border-color: rgba(147, 51, 234, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(147, 51, 234, 0.1), 0 8px 25px rgba(147, 51, 234, 0.3);
    transform: translateY(-2px);
}

.dropdown-select option {
    background: rgba(30, 30, 30, 0.95);
    backdrop-filter: blur(20px);
    color: white;
    padding: 12px 16px;
    border: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

.dropdown-select option:hover {
    background: rgba(147, 51, 234, 0.3);
    color: #ffffff;
}

.dropdown-select option:checked {
    background: rgba(147, 51, 234, 0.5);
    color: #ffffff;
    font-weight: 600;
}

/* تأثير التحميل للقائمة المنسدلة */
.dropdown-select.loading {
    background-image: url('data:image/svg+xml;charset=US-ASCII,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"><circle cx="12" cy="12" r="10" stroke="%23ffffff" stroke-width="2" stroke-linecap="round" stroke-dasharray="31.416" stroke-dashoffset="31.416"><animate attributeName="stroke-dasharray" dur="2s" values="0 31.416;15.708 15.708;0 31.416" repeatCount="indefinite"/><animate attributeName="stroke-dashoffset" dur="2s" values="0;-15.708;-31.416" repeatCount="indefinite"/></circle></svg>');
    background-size: 16px;
    pointer-events: none;
    opacity: 0.7;
}

/* تأثير النجاح */
.dropdown-select.success {
    border-color: rgba(34, 197, 94, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.1);
    animation: successPulse 0.6s ease-out;
}

@keyframes successPulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

/* تأثير الخطأ */
.dropdown-select.error {
    border-color: rgba(239, 68, 68, 0.6) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
    animation: errorShake 0.5s ease-out;
}

@keyframes errorShake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* تصميم القائمة المنسدلة المتقدم */
.advanced-dropdown {
    position: relative;
    display: inline-block;
}

.advanced-dropdown::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, rgba(147, 51, 234, 0.3), rgba(59, 130, 246, 0.3));
    border-radius: 14px;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.advanced-dropdown:hover::before {
    opacity: 1;
}

/* تأثير الانعكاس للقائمة المنسدلة */
.dropdown-select::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%);
    border-radius: inherit;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.dropdown-select:hover::after {
    opacity: 1;
}

/* استجابة للشاشات الصغيرة */
@media (max-width: 768px) {
    .dropdown-select {
        padding: 10px 35px 10px 14px;
        font-size: 13px;
        min-width: 120px;
        background-size: 10px;
        background-position: left 10px center;
    }
}

@media (max-width: 480px) {
    .dropdown-select {
        padding: 8px 30px 8px 12px;
        font-size: 12px;
        min-width: 100px;
        background-size: 8px;
        background-position: left 8px center;
    }
}

/* تأثير التدرج المتحرك */
.dropdown-gradient-effect {
    background: linear-gradient(45deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    background-size: 200% 200%;
    animation: gradientShift 3s ease infinite;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}