/* ====================================
   Chemistry Background Animations
   ==================================== */

/* خلفية الجزيئات الكيميائية */
.chemistry-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
    transition: background 0.3s ease;
}

/* Dark Mode Background */
.dark-mode .chemistry-bg {
    background: linear-gradient(135deg, #0a0e27 0%, #141937 50%, #1a1f3a 100%);
}

/* Light Mode Background */
.light-mode .chemistry-bg {
    background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #cbd5e1 100%);
}

/* الجزيئات المتحركة */
.molecule {
    position: absolute;
    border-radius: 50%;
    animation: float-molecule 20s infinite ease-in-out;
    opacity: 0.6;
}

.molecule::before,
.molecule::after {
    content: '';
    position: absolute;
    border-radius: 50%;
}

/* الأيقونات الكيميائية المتحركة */
.chemistry-icon {
    position: absolute;
    font-size: 3rem;
    animation: float-icon 20s infinite ease-in-out;
    opacity: 0.8;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.2));
    transition: all 0.3s ease;
}

.chemistry-icon:hover {
    transform: scale(1.2) rotate(15deg);
    opacity: 1;
}

/* حركة طفو الأيقونات */
@keyframes float-icon {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(30px, -30px) rotate(90deg);
    }
    50% {
        transform: translate(60px, 0) rotate(180deg);
    }
    75% {
        transform: translate(30px, 30px) rotate(270deg);
    }
}

.dark-mode .chemistry-icon {
    filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.3));
}

.light-mode .chemistry-icon {
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
}

/* جزيء الماء H2O */
.molecule-water {
    width: 60px;
    height: 60px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.8), rgba(37, 99, 235, 0.4));
    filter: blur(1px);
}

.molecule-water::before {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, rgba(147, 197, 253, 0.6), transparent);
    top: -20px;
    left: -10px;
}

.molecule-water::after {
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, rgba(147, 197, 253, 0.6), transparent);
    top: -20px;
    right: -10px;
}

/* جزيء الأكسجين O2 */
.molecule-oxygen {
    width: 50px;
    height: 50px;
    background: radial-gradient(circle, rgba(239, 68, 68, 0.8), rgba(220, 38, 38, 0.4));
    filter: blur(1px);
}

.molecule-oxygen::before {
    width: 50px;
    height: 50px;
    background: radial-gradient(circle, rgba(252, 165, 165, 0.6), transparent);
    top: 0;
    left: 30px;
}

/* جزيء الكربون */
.molecule-carbon {
    width: 45px;
    height: 45px;
    background: radial-gradient(circle, rgba(156, 163, 175, 0.8), rgba(107, 114, 128, 0.4));
    filter: blur(1px);
}

/* جزيء النيتروجين */
.molecule-nitrogen {
    width: 55px;
    height: 55px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.8), rgba(124, 58, 237, 0.4));
    filter: blur(1px);
}

/* حركة الطفو */
@keyframes float-molecule {
    0%, 100% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(30px, -30px) rotate(90deg);
    }
    50% {
        transform: translate(60px, 0) rotate(180deg);
    }
    75% {
        transform: translate(30px, 30px) rotate(270deg);
    }
}

/* تأثيرات العناصر الكيميائية */
.element {
    position: absolute;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    animation: orbit-element 15s linear infinite;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* عنصر الهيدروجين H */
.element-h {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: white;
}

/* عنصر الأكسجين O */
.element-o {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: white;
}

/* عنصر الكربون C */
.element-c {
    background: linear-gradient(135deg, #9ca3af, #6b7280);
    color: white;
}

/* عنصر النيتروجين N */
.element-n {
    background: linear-gradient(135deg, #a78bfa, #8b5cf6);
    color: white;
}

/* عنصر الذهب Au */
.element-au {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: white;
}

/* حركة الدوران */
@keyframes orbit-element {
    0% {
        transform: rotate(0deg) translateX(40px) rotate(0deg);
    }
    100% {
        transform: rotate(360deg) translateX(40px) rotate(-360deg);
    }
}

/* خطوط الروابط الكيميائية */
.chemical-bond {
    position: absolute;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(59, 130, 246, 0.3), transparent);
    animation: bond-pulse 3s ease-in-out infinite;
}

@keyframes bond-pulse {
    0%, 100% {
        opacity: 0.3;
        transform: scaleX(1);
    }
    50% {
        opacity: 0.6;
        transform: scaleX(1.1);
    }
}

/* تأثير الجسيمات */
.particle {
    position: absolute;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: rgba(59, 130, 246, 0.6);
    animation: particle-float 10s infinite ease-in-out;
}

@keyframes particle-float {
    0%, 100% {
        transform: translateY(0) translateX(0);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) translateX(50px);
        opacity: 0;
    }
}

/* تأثير الوهج للعناصر */
.glow-effect {
    animation: glow-pulse 2s ease-in-out infinite;
}

@keyframes glow-pulse {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(59, 130, 246, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 20px rgba(59, 130, 246, 0.8));
    }
}

/* موجات الطاقة */
.energy-wave {
    position: absolute;
    border-radius: 50%;
    border: 2px solid rgba(59, 130, 246, 0.3);
    animation: wave-expand 4s ease-out infinite;
}

@keyframes wave-expand {
    0% {
        width: 0;
        height: 0;
        opacity: 1;
    }
    100% {
        width: 300px;
        height: 300px;
        opacity: 0;
    }
}

/* Dark Mode adjustments */
.dark-mode .molecule-water {
    background: radial-gradient(circle, rgba(96, 165, 250, 0.9), rgba(59, 130, 246, 0.5));
}

.dark-mode .molecule-oxygen {
    background: radial-gradient(circle, rgba(248, 113, 113, 0.9), rgba(239, 68, 68, 0.5));
}

.dark-mode .molecule-carbon {
    background: radial-gradient(circle, rgba(209, 213, 219, 0.9), rgba(156, 163, 175, 0.5));
}

.dark-mode .molecule-nitrogen {
    background: radial-gradient(circle, rgba(167, 139, 250, 0.9), rgba(139, 92, 246, 0.5));
}

/* Light Mode adjustments */
.light-mode .molecule-water {
    background: radial-gradient(circle, rgba(59, 130, 246, 0.6), rgba(37, 99, 235, 0.3));
}

.light-mode .molecule-oxygen {
    background: radial-gradient(circle, rgba(239, 68, 68, 0.6), rgba(220, 38, 38, 0.3));
}

.light-mode .molecule-carbon {
    background: radial-gradient(circle, rgba(156, 163, 175, 0.6), rgba(107, 114, 128, 0.3));
}

.light-mode .molecule-nitrogen {
    background: radial-gradient(circle, rgba(139, 92, 246, 0.6), rgba(124, 58, 237, 0.3));
}
