/* ============================
   LOADING SCREEN
============================ */

.loader-wrapper {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

.loader-wrapper.fade-out {
    opacity: 0;
    visibility: hidden;
}

.loader-content {
    position: relative;
    z-index: 2;
    text-align: center;
    max-width: 500px;
    padding: 2rem;
}

/* ============================
   LOGO ANIMATION - خفن ترین استایل
============================ */

.loader-logo {
    margin-bottom: 3rem;
    perspective: 1000px;
    animation: fadeInDown 0.8s ease;
}

.logo-container {
    position: relative;
    width: 180px;
    height: 180px;
    margin: 0 auto;
    transform-style: preserve-3d;
    animation: logoEntrance 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

@keyframes logoEntrance {
    0% {
        opacity: 0;
        transform: scale(0) rotate(180deg);
    }
    60% {
        transform: scale(1.1) rotate(-10deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

/* ==================== تصویر لوگو ==================== */

.logo-image {
    position: relative;
    z-index: 10;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 10px 30px rgba(6, 182, 212, 0.6));
    animation: 
        logoFloat 4s ease-in-out infinite,
        logoPulse 3s ease-in-out infinite,
        logoRotate 20s linear infinite;
    transition: all 0.3s ease;
}

/* حرکت معلق */
@keyframes logoFloat {
    0%, 100% {
        transform: translateY(0) translateZ(0);
    }
    50% {
        transform: translateY(-25px) translateZ(20px);
    }
}

/* پالس (بزرگ و کوچک شدن) */
@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 10px 30px rgba(6, 182, 212, 0.6));
    }
    50% {
        transform: scale(1.08);
        filter: drop-shadow(0 15px 50px rgba(6, 182, 212, 0.9));
    }
}

/* چرخش خیلی آروم */
@keyframes logoRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

/* ==================== حلقه‌های دورانی ==================== */

.logo-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 2px solid;
    border-radius: 50%;
    opacity: 0.4;
    transform-origin: center;
}

.ring-1 {
    width: 140%;
    height: 140%;
    border-color: #06B6D4;
    border-style: dashed;
    transform: translate(-50%, -50%);
    animation: ringRotate 8s linear infinite;
}

.ring-2 {
    width: 160%;
    height: 160%;
    border-color: #0EA5E9;
    border-style: dotted;
    transform: translate(-50%, -50%);
    animation: ringRotate 12s linear infinite reverse;
}

.ring-3 {
    width: 180%;
    height: 180%;
    border-color: #14B8A6;
    border-style: solid;
    border-width: 1px;
    transform: translate(-50%, -50%);
    animation: ringRotate 15s linear infinite;
}

@keyframes ringRotate {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ==================== ذرات معلق اطراف لوگو ==================== */

.logo-particles {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, #06B6D4, #0EA5E9);
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 15px rgba(6, 182, 212, 0.8);
    animation: particleFloat 4s ease-in-out infinite;
}

/* موقعیت ذرات */
.particle:nth-child(1) {
    top: 10%;
    left: 20%;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    top: 20%;
    right: 15%;
    animation-delay: 0.5s;
}

.particle:nth-child(3) {
    bottom: 20%;
    left: 15%;
    animation-delay: 1s;
}

.particle:nth-child(4) {
    bottom: 15%;
    right: 20%;
    animation-delay: 1.5s;
}

.particle:nth-child(5) {
    top: 50%;
    left: 5%;
    animation-delay: 2s;
}

.particle:nth-child(6) {
    top: 50%;
    right: 5%;
    animation-delay: 2.5s;
}

.particle:nth-child(7) {
    top: 30%;
    left: 50%;
    animation-delay: 3s;
}

.particle:nth-child(8) {
    bottom: 30%;
    left: 50%;
    animation-delay: 3.5s;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(0) scale(0);
    }
    20% {
        opacity: 1;
        transform: translateY(-20px) scale(1);
    }
    80% {
        opacity: 1;
        transform: translateY(-40px) scale(1);
    }
    100% {
        opacity: 0;
        transform: translateY(-60px) scale(0);
    }
}

/* ==================== نور پس‌زمینه ==================== */

.logo-glow {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(
        circle,
        rgba(6, 182, 212, 0.3) 0%,
        rgba(14, 165, 233, 0.2) 30%,
        transparent 70%
    );
    transform: translate(-50%, -50%);
    filter: blur(40px);
    animation: glowPulse 3s ease-in-out infinite;
    z-index: 0;
}

@keyframes glowPulse {
    0%, 100% {
        opacity: 0.6;
        transform: translate(-50%, -50%) scale(1);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.2);
    }
}

/* ==================== افکت‌های ویژه ==================== */

/* افکت شیشه‌ای */
.logo-container::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    background: linear-gradient(
        135deg,
        rgba(255, 255, 255, 0.1) 0%,
        rgba(255, 255, 255, 0.05) 50%,
        transparent 100%
    );
    border-radius: 50%;
    z-index: 11;
    pointer-events: none;
    animation: glassShine 5s ease-in-out infinite;
}

@keyframes glassShine {
    0%, 100% {
        opacity: 0;
    }
    50% {
        opacity: 1;
    }
}

/* افکت نور لیزری */
.logo-container::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 300%;
    height: 2px;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(6, 182, 212, 0.8) 50%,
        transparent 100%
    );
    transform: translate(-50%, -50%) rotate(0deg);
    animation: laserScan 6s linear infinite;
    z-index: 1;
    filter: blur(1px);
}

@keyframes laserScan {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
        opacity: 0;
    }
}

/* ==================== حالت Hover (اختیاری) ==================== */

.logo-container:hover .logo-image {
    transform: scale(1.1) rotate(5deg);
    filter: drop-shadow(0 20px 50px rgba(6, 182, 212, 1));
}

.logo-container:hover .logo-ring {
    animation-play-state: paused;
}

.logo-container:hover .particle {
    animation-duration: 2s;
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {
    .logo-container {
        width: 140px;
        height: 140px;
    }
    
    .particle {
        width: 6px;
        height: 6px;
    }
    
    .logo-ring {
        border-width: 1px;
    }
}

@media (max-width: 480px) {
    .logo-container {
        width: 120px;
        height: 120px;
    }
    
    .particle {
        width: 5px;
        height: 5px;
    }
}

/* ==================== افکت ورود سه‌بعدی ==================== */

@keyframes logo3DEntrance {
    0% {
        opacity: 0;
        transform: rotateX(90deg) rotateY(90deg) scale(0.5);
    }
    50% {
        transform: rotateX(-10deg) rotateY(-10deg) scale(1.1);
    }
    100% {
        opacity: 1;
        transform: rotateX(0) rotateY(0) scale(1);
    }
}

/* فعال کردن برای ورود */
.loader-wrapper.active .logo-container {
    animation: logo3DEntrance 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

/* ==================== Spinner Animation ==================== */

.loader-animation {
    position: relative;
    width: 150px;
    height: 150px;
    margin: 0 auto 3rem;
    animation: fadeIn 1s ease 0.2s both;
}

.loader-spinner {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 100%;
    height: 100%;
    border: 4px solid rgba(6, 182, 212, 0.1);
    border-top-color: var(--primary);
    border-right-color: var(--secondary);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 1.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) infinite;
}

.loader-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 120%;
    height: 120%;
    border: 2px dashed rgba(6, 182, 212, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 3s linear infinite reverse;
}

.loader-orbit::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    width: 12px;
    height: 12px;
    background: var(--gradient-primary);
    border-radius: 50%;
    transform: translateX(-50%);
    box-shadow: 0 0 20px rgba(6, 182, 212, 0.8);
}

@keyframes spin {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }
    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

/* ==================== Loading Text ==================== */

.loader-text {
    animation: fadeIn 1s ease 0.4s both;
}

.loader-text h2 {
    font-size: 2rem;
    font-weight: 700;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 0.5rem;
}

.loader-text p {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.6);
    animation: pulse 1.5s ease-in-out infinite;
}

/* ==================== Progress Bar ==================== */

.loader-progress {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin: 2rem 0 1rem;
    animation: fadeIn 1s ease 0.6s both;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary), var(--primary));
    background-size: 200% 100%;
    border-radius: 2px;
    width: 0%;
    transition: width 0.3s ease;
    animation: shimmer 2s linear infinite;
    box-shadow: 0 0 10px rgba(6, 182, 212, 0.6);
}

@keyframes shimmer {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* ==================== Percentage ==================== */

.loader-percentage {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    animation: fadeIn 1s ease 0.8s both;
}

/* ==================== Background Effects ==================== */

.loader-bg-effects {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.glow-1,
.glow-2,
.glow-3 {
    position: absolute;
    border-radius: 50%;
    filter: blur(100px);
}

.glow-1 {
    top: 10%;
    right: 20%;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(6, 182, 212, 0.2), transparent);
    animation: float1 8s ease-in-out infinite;
}

.glow-2 {
    bottom: 10%;
    left: 20%;
    width: 350px;
    height: 350px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.15), transparent);
    animation: float2 10s ease-in-out infinite;
}

.glow-3 {
    top: 50%;
    left: 50%;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.1), transparent);
    transform: translate(-50%, -50%);
    animation: float3 12s ease-in-out infinite;
}

@keyframes float1 {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(-30px, 30px);
    }
}

@keyframes float2 {
    0%, 100% {
        transform: translate(0, 0);
    }
    50% {
        transform: translate(30px, -30px);
    }
}

@keyframes float3 {
    0%, 100% {
        transform: translate(-50%, -50%);
    }
    50% {
        transform: translate(-50%, calc(-50% + 20px));
    }
}

/* ==================== Animations ==================== */

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* ==================== Responsive ==================== */

@media (max-width: 768px) {
    .logo-icon {
        width: 80px;
        height: 80px;
    }
    
    .logo-icon span {
        font-size: 1.2rem;
    }
    
    .loader-animation {
        width: 120px;
        height: 120px;
    }
    
    .loader-text h2 {
        font-size: 1.5rem;
    }
    
    .loader-text p {
        font-size: 0.9rem;
    }
    
    .loader-percentage {
        font-size: 1.2rem;
    }
}