/* ============ PAGE LOADER - CINEMATIC ============ */
.page-loader {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: radial-gradient(ellipse at center, #1a0a1a 0%, #0a0a0a 70%);
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.6s cubic-bezier(0.65, 0, 0.35, 1), 
                visibility 0.6s cubic-bezier(0.65, 0, 0.35, 1);
    opacity: 1;
    visibility: visible;
}

/* ذرات پس‌زمینه */
.page-loader::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, var(--primary, #8B2252) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.08;
    animation: loaderOrb1 4s ease-in-out infinite;
}

.page-loader::after {
    content: '';
    position: absolute;
    width: 300px;
    height: 300px;
    background: radial-gradient(circle, var(--primary-light, #A83262) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0.05;
    animation: loaderOrb2 5s ease-in-out infinite;
}

@keyframes loaderOrb1 {
    0%, 100% { transform: translate(-50px, -30px) scale(1); }
    25% { transform: translate(80px, 40px) scale(1.3); }
    50% { transform: translate(30px, -50px) scale(0.9); }
    75% { transform: translate(-60px, 20px) scale(1.2); }
}

@keyframes loaderOrb2 {
    0%, 100% { transform: translate(40px, 50px) scale(1.2); }
    33% { transform: translate(-70px, -30px) scale(0.8); }
    66% { transform: translate(20px, 60px) scale(1.4); }
}

.page-loader.loader-hidden {
    opacity: 0;
    visibility: hidden;
}

/* ===== CONTENT ===== */
.loader-content {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    max-width: 400px;
    width: 90%;
}

/* ===== LOGO - با انیمیشن‌های جذاب ===== */
.loader-logo-wrapper {
    position: relative;
    width: 90px;
    height: 90px;
    margin: 0 auto 2rem;
}

/* حلقه چرخان بیرونی */
.loader-logo-ring {
    position: absolute;
    inset: -8px;
    border: 2px solid transparent;
    border-top-color: var(--primary, #8B2252);
    border-right-color: var(--primary-light, #A83262);
    border-radius: 50%;
    animation: loaderRingSpin 1.5s linear infinite;
}

/* حلقه دوم */
.loader-logo-ring2 {
    position: absolute;
    inset: -16px;
    border: 1px solid transparent;
    border-bottom-color: var(--primary, #8B2252);
    border-left-color: rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    animation: loaderRingSpin 2s linear infinite reverse;
}

/* نقطه‌های نورانی */
.loader-logo-dot {
    position: absolute;
    width: 6px;
    height: 6px;
    background: var(--primary, #8B2252);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--primary, #8B2252), 0 0 20px var(--primary-light, #A83262);
}

.loader-logo-dot:nth-child(1) {
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    animation: loaderDotBlink 1.5s ease-in-out infinite;
}

.loader-logo-dot:nth-child(2) {
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    animation: loaderDotBlink 1.5s ease-in-out 0.75s infinite;
}

.loader-logo-dot:nth-child(3) {
    right: -16px;
    top: 50%;
    transform: translateY(-50%);
    animation: loaderDotBlink 2s ease-in-out 0.5s infinite;
}

/* لوگو اصلی */
.loader-logo {
    width: 100%;
    height: 100%;
    border-radius: 25px;
    overflow: hidden;
    box-shadow: 
        0 0 30px var(--primary-glow, rgba(139, 34, 82, 0.5)),
        0 0 60px var(--primary-glow, rgba(139, 34, 82, 0.2)),
        inset 0 0 20px rgba(255, 255, 255, 0.05);
    animation: loaderLogoFloat 3s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

.loader-logo::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, transparent 40%, rgba(255, 255, 255, 0.1) 50%, transparent 60%);
    animation: loaderShine 2s ease-in-out infinite;
}

.loader-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: hue-rotate(-320deg);
}

/* ===== TITLE ===== */
.loader-title {
    direction: ltr;
    font-size: 1.8rem;
    color: var(--primary, #8B2252);
    font-weight: bold;
    margin-bottom: 1.5rem;
    text-shadow: 0 0 30px var(--primary-glow, rgba(139, 34, 82, 0.4));
    animation: loaderTitleGlow 2s ease-in-out infinite;
    letter-spacing: 2px;
}

.loader-title span {
    display: inline-block;
    animation: loaderLetterBounce 2s ease-in-out infinite;
}

.loader-title span:nth-child(1) { animation-delay: 0s; }
.loader-title span:nth-child(2) { animation-delay: 0.05s; }
.loader-title span:nth-child(3) { animation-delay: 0.1s; }
.loader-title span:nth-child(4) { animation-delay: 0.15s; }
.loader-title span:nth-child(5) { animation-delay: 0.2s; }
.loader-title span:nth-child(6) { animation-delay: 0.25s; }
.loader-title span:nth-child(7) { animation-delay: 0.3s; }
.loader-title span:nth-child(8) { animation-delay: 0.35s; }
.loader-title span:nth-child(9) { animation-delay: 0.4s; }
.loader-title span:nth-child(10) { animation-delay: 0.45s; }
.loader-title span:nth-child(11) { animation-delay: 0.5s; }
.loader-title span:nth-child(12) { animation-delay: 0.55s; }
.loader-title span:nth-child(13) { animation-delay: 0.6s; }
.loader-title span:nth-child(14) { animation-delay: 0.65s; }

/* ===== TIP ===== */
.loader-tip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    background: rgba(139, 34, 82, 0.05);
    border: 1px solid rgba(139, 34, 82, 0.15);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    margin-bottom: 1.5rem;
    border-right: 3px solid var(--primary, #8B2252);
    animation: loaderTipSlide 0.6s ease-out;
    backdrop-filter: blur(10px);
}

.loader-tip-icon {
    font-size: 1.5rem;
    flex-shrink: 0;
    animation: loaderTipBounce 2s ease-in-out infinite;
}

.loader-tip-text {
    color: var(--text-light, #cccccc);
    font-size: 0.85rem;
    line-height: 1.5;
    margin: 0;
    text-align: right;
}

/* ===== PROGRESS BAR ===== */
.loader-progress-wrapper {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.loader-progress-bar {
    flex: 1;
    height: 4px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.loader-progress-fill {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, 
        var(--primary, #8B2252) 0%, 
        var(--primary-light, #A83262) 50%, 
        var(--primary, #8B2252) 100%);
    background-size: 200% 100%;
    border-radius: 10px;
    transition: width 0.1s ease;
    animation: loaderProgressShine 1.5s linear infinite;
    position: relative;
}

.loader-progress-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    width: 30px;
    height: 100%;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 10px;
    filter: blur(5px);
    animation: loaderGlow 1s ease-in-out infinite;
}

.loader-progress-text {
    color: var(--primary, #8B2252);
    font-weight: bold;
    font-size: 0.85rem;
    min-width: 35px;
    text-align: left;
    animation: loaderTextPulse 1.5s ease-in-out infinite;
}

/* ===== KEYFRAMES ===== */
@keyframes loaderRingSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes loaderDotBlink {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.5); }
}

@keyframes loaderLogoFloat {
    0%, 100% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-8px) scale(1.02); }
}

@keyframes loaderShine {
    0%, 100% { opacity: 0; transform: translateX(-100%); }
    50% { opacity: 0.6; }
    100% { transform: translateX(100%); }
}

@keyframes loaderTitleGlow {
    0%, 100% { text-shadow: 0 0 20px rgba(139, 34, 82, 0.3); }
    50% { text-shadow: 0 0 40px rgba(139, 34, 82, 0.6), 0 0 80px rgba(139, 34, 82, 0.3); }
}

@keyframes loaderLetterBounce {
    0%, 100% { transform: translateY(0); }
    25% { transform: translateY(-5px); }
    75% { transform: translateY(2px); }
}

@keyframes loaderTipSlide {
    from { opacity: 0; transform: translateX(-30px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes loaderTipBounce {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    30% { transform: translateY(-8px) rotate(-10deg); }
    50% { transform: translateY(0) rotate(0deg); }
    70% { transform: translateY(-4px) rotate(10deg); }
}

@keyframes loaderProgressShine {
    0% { background-position: 200% 0; }
    100% { background-position: 0 0; }
}

@keyframes loaderGlow {
    0%, 100% { opacity: 0; }
    50% { opacity: 1; }
}

@keyframes loaderTextPulse {
    0%, 100% { opacity: 0.8; }
    50% { opacity: 1; }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 480px) {
    .loader-logo-wrapper {
        width: 70px;
        height: 70px;
        margin-bottom: 1.5rem;
    }
    
    .loader-logo-ring {
        inset: -6px;
    }
    
    .loader-logo-ring2 {
        inset: -12px;
    }
    
    .loader-logo {
        border-radius: 18px;
    }
    
    .loader-title {
        font-size: 1.3rem;
        letter-spacing: 1px;
    }
    
    .loader-tip {
        padding: 0.6rem 0.8rem;
    }
    
    .loader-tip-icon {
        font-size: 1.2rem;
    }
    
    .loader-tip-text {
        font-size: 0.75rem;
    }
}

/* لوگو */
.loader-logo {
    box-shadow: 0 0 30px rgba(139, 34, 82, 0.5),
                0 0 60px rgba(139, 34, 82, 0.2),
                0 0 100px rgba(139, 34, 82, 0.1),
                inset 0 0 20px rgba(255, 255, 255, 0.05);
}

/* Tip */
.loader-tip {
    box-shadow: 0 0 40px rgba(139, 34, 82, 0.1);
}

/* Progress */
.loader-progress-fill {
    box-shadow: 0 0 20px rgba(139, 34, 82, 0.3);
}