/* =========================================
   تأثيرات متقدمة وحركات حديثة
========================================= */

/* تأثيرات Parallax */
.parallax-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.parallax-layer {
    position: absolute;
    inset: -10%;
    background-size: cover;
    background-position: center;
}

.layer-1 {
    background: radial-gradient(circle at 20% 50%, rgba(99, 102, 241, 0.1) 0%, transparent 50%);
}

.layer-2 {
    background: radial-gradient(circle at 80% 20%, rgba(16, 185, 129, 0.1) 0%, transparent 50%);
}

.layer-3 {
    background: radial-gradient(circle at 50% 80%, rgba(245, 158, 11, 0.1) 0%, transparent 50%);
}

/* تأثيرات 3D على البطاقات */
.card-3d {
    transform-style: preserve-3d;
    perspective: 1000px;
    transition: transform 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.card-3d:hover {
    transform: translateY(-20px) rotateX(5deg) rotateY(5deg);
}

.card-3d::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(45deg, var(--primary), var(--secondary), var(--accent));
    border-radius: var(--radius-xl);
    z-index: -1;
    opacity: 0;
    filter: blur(20px);
    transition: opacity 0.6s ease;
}

.card-3d:hover::before {
    opacity: 0.6;
}

/* تأثيرات الكتابة النصية */
.typing-animation {
    overflow: hidden;
    border-right: 3px solid var(--primary);
    white-space: nowrap;
    animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
    from { width: 0 }
    to { width: 100% }
}

@keyframes blink-caret {
    from, to { border-color: transparent }
    50% { border-color: var(--primary) }
}

/* تأثيرات موجة المياه */
.wave-effect {
    position: relative;
    overflow: hidden;
}

.wave-effect::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 5px;
    height: 5px;
    background: rgba(255, 255, 255, 0.4);
    opacity: 0;
    border-radius: 100%;
    transform: scale(1, 1) translate(-50%);
    transform-origin: 50% 50%;
}

.wave-effect:focus::after {
    animation: ripple 1s ease-out;
}

@keyframes ripple {
    0% {
        transform: scale(0, 0);
        opacity: 0.5;
    }
    20% {
        transform: scale(25, 25);
        opacity: 0.3;
    }
    100% {
        opacity: 0;
        transform: scale(40, 40);
    }
}

/* تأثيرات الظهور التدريجي */
.stagger-fade-in > * {
    opacity: 0;
    transform: translateY(30px);
    animation: fadeInUp 0.6s ease forwards;
}

.stagger-fade-in > *:nth-child(1) { animation-delay: 0.1s; }
.stagger-fade-in > *:nth-child(2) { animation-delay: 0.2s; }
.stagger-fade-in > *:nth-child(3) { animation-delay: 0.3s; }
.stagger-fade-in > *:nth-child(4) { animation-delay: 0.4s; }
.stagger-fade-in > *:nth-child(5) { animation-delay: 0.5s; }

/* تأثيرات الجاذبية */
.gravity-effect {
    animation: gravity 3s ease-in-out infinite;
}

@keyframes gravity {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

/* تأثيرات الإضاءة */
.glow-on-hover {
    position: relative;
    overflow: hidden;
}

.glow-on-hover::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(45deg, var(--primary), var(--secondary), var(--accent), var(--primary));
    background-size: 400%;
    border-radius: inherit;
    z-index: -1;
    filter: blur(10px);
    opacity: 0;
    transition: opacity 0.3s ease;
    animation: glow 20s linear infinite;
}

.glow-on-hover:hover::before {
    opacity: 1;
}

@keyframes glow {
    0% { background-position: 0 0; }
    50% { background-position: 400% 0; }
    100% { background-position: 0 0; }
}

/* تأثيرات الطبقات العائمة */
.floating-shapes {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    pointer-events: none;
    z-index: 1;
}

.floating-shape {
    position: absolute;
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: floatRandom 20s infinite linear;
}

.floating-shape.shape-1 {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
}

.floating-shape.shape-2 {
    top: 60%;
    right: 15%;
    animation-delay: 5s;
}

.floating-shape.shape-3 {
    bottom: 30%;
    left: 20%;
    animation-delay: 10s;
}

.floating-shape.shape-4 {
    top: 40%;
    right: 25%;
    animation-delay: 15s;
}

@keyframes floatRandom {
    0% {
        transform: translate(0, 0) rotate(0deg);
    }
    25% {
        transform: translate(100px, 50px) rotate(90deg);
    }
    50% {
        transform: translate(50px, 100px) rotate(180deg);
    }
    75% {
        transform: translate(-50px, 50px) rotate(270deg);
    }
    100% {
        transform: translate(0, 0) rotate(360deg);
    }
}

/* شاشة التحميل المتطورة */
.advanced-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--darker);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.advanced-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    text-align: center;
}

.loader-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    margin-bottom: 40px;
}

.loader-icon {
    width: 80px;
    height: 80px;
    background: var(--gradient-primary);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 2s ease-in-out infinite;
}

.loader-icon i {
    font-size: 36px;
    color: white;
}

.loader-text {
    font-size: 36px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.loader-text span {
    color: white;
}

.loader-progress {
    width: 300px;
}

.progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 10px;
}

.progress-bar::after {
    content: '';
    display: block;
    width: 0%;
    height: 100%;
    background: var(--gradient-primary);
    animation: loading 2s ease-in-out forwards;
}

@keyframes loading {
    to { width: 100% }
}

/* تأثيرات الماوس التفاعلية */
.mouse-follower {
    position: fixed;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, var(--primary) 0%, transparent 70%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    mix-blend-mode: screen;
    opacity: 0.3;
    transform: translate(-50%, -50%);
    transition: width 0.2s, height 0.2s;
}

.mouse-follower.active {
    width: 80px;
    height: 80px;
    opacity: 0.1;
}

/* تأثيرات التحديث في الوقت الحقيقي */
.live-update {
    position: relative;
}

.live-update::after {
    content: '🔄 حديث';
    position: absolute;
    top: -8px;
    right: -8px;
    background: var(--gradient-primary);
    color: white;
    font-size: 10px;
    padding: 4px 8px;
    border-radius: 12px;
    animation: pulse 2s infinite;
}

/* تأثيرات الانتقال بين الصفحات */
.page-transition {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--gradient-primary);
    z-index: 9999;
    transform: scaleY(0);
    transform-origin: bottom;
    transition: transform 0.6s cubic-bezier(0.77, 0, 0.175, 1);
}

.page-transition.active {
    transform: scaleY(1);
    transform-origin: top;
}