/* نظام الوضع الليلي والنهاري - Dark/Light Mode System */

:root {
    /* الألوان الأساسية */
    --primary-color:  #E63946;
    --primary-hover:  #C1121F;
    --secondary-color: #FFA500;
    --accent-color:   #1A1A2E;

    /* الخلفيات */
    --bg-primary:   #FFFFFF;
    --bg-secondary: #FFF5F5;
    --bg-tertiary:  #FFE8E9;
    --bg-card:      #FFFFFF;

    /* النصوص */
    --text-primary:   #1A1A2E;
    --text-secondary: #6B6B80;
    --text-tertiary:  #9999AA;

    /* الحدود */
    --border-color: #FFD6D8;
    --border-hover: #FFB3B7;

    /* الظلال */
    --shadow-sm: 0 1px 3px  rgba(230, 57, 70, 0.08);
    --shadow-md: 0 4px 12px rgba(230, 57, 70, 0.15);
    --shadow-lg: 0 10px 30px rgba(230, 57, 70, 0.18);
    --shadow-xl: 0 20px 50px rgba(230, 57, 70, 0.22);

    /* التدرجات */
    --gradient-primary:   linear-gradient(135deg, #E63946 0%, #FF6B35 100%);
    --gradient-secondary: linear-gradient(135deg, #FFA500 0%, #FF6B35 100%);
    --gradient-success:   linear-gradient(135deg, #2DC653 0%, #1A9E3F 100%);

    /* الأيقونات */
    --icon-sun:  '☀️';
    --icon-moon: '🌙';
}

/* الوضع الليلي */
[data-theme="dark"],
body.dark-mode {
    /* الخلفيات */
    --bg-primary:   #0D0D0D;
    --bg-secondary: #1A1A1A;
    --bg-tertiary:  #252525;
    --bg-card:      #1E1E1E;

    /* النصوص */
    --text-primary:   #F5F5F5;
    --text-secondary: #BBBBCC;
    --text-tertiary:  #888899;

    /* الحدود */
    --border-color: #2D2D2D;
    --border-hover: #3D3D3D;

    /* الظلال */
    --shadow-sm: 0 1px 3px  rgba(0,0,0,0.5);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.6);
    --shadow-lg: 0 10px 30px rgba(0,0,0,0.7);
    --shadow-xl: 0 20px 50px rgba(0,0,0,0.8);
}

/* تطبيق الألوان على العناصر */
body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* زر تبديل الوضع */
.theme-toggle {
    position: fixed;
    bottom: 30px;
    left: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--gradient-primary);
    border: none;
    cursor: pointer;
    display: none; /* مخفي - نستخدم الزر في الهيدر */
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    box-shadow: var(--shadow-lg);
    z-index: 9998;
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    box-shadow: var(--shadow-xl);
}

.theme-toggle:active {
    transform: scale(0.95);
}

/* أنيميشن التبديل */
@keyframes rotate {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.theme-toggle.rotating {
    animation: rotate 0.5s ease-in-out;
}

/* البطاقات */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-md);
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-5px);
}

/* الأزرار */
.btn {
    transition: all 0.3s ease;
}

.btn-primary {
    background: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* الهيدر */
header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    box-shadow: var(--shadow-sm);
}

/* الفوتر */
footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-color);
}

/* الإدخالات */
input, textarea, select {
    background: var(--bg-primary);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    transition: all 0.3s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

/* الروابط */
a {
    color: var(--primary-color);
    transition: color 0.3s ease;
}

a:hover {
    color: var(--primary-hover);
}

/* الجداول */
table {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

th {
    background: var(--bg-secondary);
    color: var(--text-primary);
    border-bottom: 2px solid var(--border-color);
}

td {
    border-bottom: 1px solid var(--border-color);
}

tr:hover {
    background: var(--bg-tertiary);
}

/* النماذج */
.form-group label {
    color: var(--text-primary);
}

/* التنبيهات */
.alert {
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

/* التحميل */
.loading-spinner {
    border-color: var(--border-color);
    border-top-color: var(--primary-color);
}

/* Responsive */
@media (max-width: 768px) {
    .theme-toggle {
        bottom: 20px;
        left: 20px;
        width: 50px;
        height: 50px;
        font-size: 1.25rem;
    }
}

/* تأثيرات إضافية */
.glass-effect {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .glass-effect {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* تأثير النيون */
.neon-effect {
    text-shadow: 0 0 10px var(--primary-color),
                 0 0 20px var(--primary-color),
                 0 0 30px var(--primary-color);
}

/* تأثير التدرج المتحرك */
@keyframes gradient-shift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.animated-gradient {
    background: linear-gradient(270deg, #E63946, #FFA500, #f093fb, #f5576c);
    background-size: 800% 800%;
    animation: gradient-shift 15s ease infinite;
}

/* Smooth Scrollbar */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--primary-color);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary-hover);
}

/* تأثير الموجة عند النقر */
.ripple {
    position: relative;
    overflow: hidden;
}

.ripple::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.5);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.ripple:active::after {
    width: 300px;
    height: 300px;
}
