/**
 * Special Pages & Loading System Styles
 * استایل‌های اختصاصی صفحه Maintenance، صفحه 404، پری‌لودر و شیمر اسلایدر
 */

html, body.sp-maintenance-body {
    overflow-x: hidden !important;
    max-width: 100vw !important;
    margin: 0 !important;
    padding: 0 !important;
    box-sizing: border-box !important;
}
.sp-maintenance-body *, .sp-maintenance-body *::before, .sp-maintenance-body *::after,
.sp-404-container *, .sp-404-container *::before, .sp-404-container *::after {
    box-sizing: border-box !important;
}

/* =========================================
   1. صفحه MAINTENANCE (حالت تعمیرات و 503)
========================================= */
.sp-maintenance-body {
    margin: 0 !important;
    padding: 30px 15px !important;
    min-height: 100vh !important;
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at 10% 20%, rgb(15, 23, 42) 0%, rgb(2, 6, 23) 90%);
    font-family: 'Vazirmatn', 'Vazir', 'IRANSans', 'IRANSansWeb', 'Tahoma', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    color: #f8fafc;
    overflow-x: hidden;
    position: relative;
    box-sizing: border-box !important;
}
.sp-maintenance-body::before {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(14, 165, 233, 0.15) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}
.sp-maintenance-body::after {
    content: "";
    position: absolute;
    bottom: 0;
    left: 0;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.12) 0%, transparent 70%);
    pointer-events: none;
    z-index: 1;
}
.sp-maintenance-card {
    position: relative;
    z-index: 2;
    background: rgba(30, 41, 59, 0.7);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    padding: 28px 24px;
    max-width: 800px;
    width: 100%;
    text-align: center;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}
.sp-maint-title {
    font-size: 30px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 12px 0;
    line-height: 1.4;
}
.sp-custom-text {
    line-height: 1.8;
    margin: 10px 0;
    font-weight: 500;
    word-break: break-word;
}
.sp-top-text {
    margin: 0 0 12px 0 !important;
}
.sp-bot-text {
    margin: 12px 0 0 0 !important;
}
.sp-visual-wrapper {
    margin: 20px auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
    overflow: hidden !important;
}
.sp-visual-wrapper dotlottie-player,
.sp-visual-wrapper lottie-player,
.sp-visual-img,
.sp-visual-video {
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    display: block;
    margin: 0 auto;
}
.sp-visual-img {
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.3));
    border-radius: 16px;
}
.sp-visual-video {
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

/* =========================================
   2. صفحه خطای 404 اختصاصی (CUSTOM 404)
========================================= */
.sp-404-container {
    padding: 30px 15px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: auto !important;
    font-family: 'Vazirmatn', 'Vazir', 'IRANSans', 'IRANSansWeb', 'Tahoma', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    box-sizing: border-box !important;
}
.sp-404-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 24px;
    padding: 28px 24px;
    max-width: 800px;
    width: 100%;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.04);
}
.sp-maintenance-card.sp-card-transparent,
.sp-404-card.sp-card-transparent {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 8px 0 !important;
    max-width: 1100px !important;
}
.sp-maintenance-card > *:first-child,
.sp-404-card > *:first-child {
    margin-top: 0 !important;
}
.sp-maintenance-card > *:last-child,
.sp-404-card > *:last-child,
.sp-maintenance-card > *:last-child > *:last-child,
.sp-404-card > *:last-child > *:last-child {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}
.sp-404-title {
    font-size: 28px;
    font-weight: 800;
    color: #0f172a;
    margin: 0 0 12px 0;
    line-height: 1.4;
}
.sp-404-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    text-decoration: none !important;
    font-weight: 700;
    font-size: 15px;
    border-radius: 14px;
    box-shadow: 0 10px 25px -5px rgba(14, 165, 233, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.sp-404-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px -5px rgba(14, 165, 233, 0.6);
}

/* =========================================
   3. لودر کل صفحه (FULL PAGE PRELOADER)
========================================= */
.sp-preloader-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
    visibility: visible;
    will-change: opacity, visibility;
    transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    font-family: 'Vazirmatn', 'Vazir', 'IRANSans', 'IRANSansWeb', 'Tahoma', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
}
.sp-preloader-overlay.sp-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.sp-preloader-box {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
}

/* اسپینر گلس‌مورفیک کاستوم */
.sp-custom-spinner {
    position: relative;
    width: 80px;
    height: 80px;
}
.sp-spinner-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 4px solid transparent;
    border-top-color: var(--sp-spinner-color, #0ea5e9);
    animation: sp-spin 1s cubic-bezier(0.6, 0.2, 0.4, 0.8) infinite;
    filter: drop-shadow(0 0 12px var(--sp-spinner-color, #0ea5e9));
}
.sp-ring-2 {
    inset: 12px;
    border-top-color: transparent;
    border-bottom-color: var(--sp-spinner-color, #0ea5e9);
    animation: sp-spin-reverse 1.2s linear infinite;
}

@keyframes sp-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}
@keyframes sp-spin-reverse {
    0% { transform: rotate(360deg); }
    100% { transform: rotate(0deg); }
}

/* =========================================
   4. انیمیشن‌های متن زیر لودر (TEXT ANIMATIONS)
========================================= */
.sp-preloader-text {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

/* Pulse */
.sp-anim-pulse {
    animation: sp-pulse 1.5s ease-in-out infinite;
}
@keyframes sp-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.6; transform: scale(0.97); }
}

/* Shine / Shimmer */
.sp-anim-shine {
    background: linear-gradient(90deg, #94a3b8 0%, #ffffff 50%, #94a3b8 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    animation: sp-shine 2.5s linear infinite;
}
@keyframes sp-shine {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Dots */
.sp-anim-dots::after {
    content: "...";
    display: inline-block;
    width: 1.5em;
    text-align: left;
    animation: sp-dots 1.5s steps(4, end) infinite;
}
@keyframes sp-dots {
    0% { content: ""; }
    25% { content: "."; }
    50% { content: ".."; }
    75%, 100% { content: "..."; }
}

/* Typing */
.sp-anim-typing {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-left: 3px solid #0ea5e9;
    animation: sp-typing 3s steps(30, end) infinite, sp-blink 0.75s step-end infinite;
}
@keyframes sp-typing {
    0%, 15% { width: 0; }
    50%, 85% { width: 100%; }
    100% { width: 0; }
}
@keyframes sp-blink {
    from, to { border-color: transparent; }
    50% { border-color: #0ea5e9; }
}

/* =========================================
   5. شیمر و لودر اسلایدر HERO (SLIDER SHIMMER)
========================================= */
.hero-slider-section {
    position: relative;
}
#heroSliderShimmer {
    position: relative;
    width: 100%;
    height: 480px;
    max-height: 75vh;
    background: #f1f5f9;
    border-radius: 24px;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    margin-bottom: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.04);
    transition: opacity 0.5s ease, height 0.5s ease, margin 0.5s ease;
}
#heroSliderShimmer::before {
    content: "";
    position: absolute;
    top: 0;
    left: -150%;
    width: 150%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent 0%,
        rgba(255, 255, 255, 0.85) 50%,
        transparent 100%
    );
    animation: sp-shimmer-sweep 1.8s infinite cubic-bezier(0.4, 0, 0.2, 1);
@keyframes sp-shimmer-sweep {
    0% { left: -150%; }
    100% { left: 150%; }
}
#heroSliderShimmer.sp-hidden {
    opacity: 0 !important;
    height: 0 !important;
    margin-bottom: 0 !important;
    padding: 0 !important;
    border: none !important;
    overflow: hidden !important;
    pointer-events: none !important;
}

/* =========================================
   6. لودر تصاویر (IMAGE LOADER INDICATOR)
========================================= */
img.sp-img-shimmer-active {
    background: #f1f5f9 linear-gradient(90deg, #f1f5f9 0%, #ffffff 50%, #f1f5f9 100%) !important;
    background-size: 200% 100% !important;
    animation: sp-shine 1.5s infinite linear !important;
    min-height: 120px;
    border-radius: inherit;
}
.sp-img-loading-wrap {
    position: relative;
    display: block;
    width: 100%;
    min-height: 140px;
    background: #f1f5f9;
    border-radius: inherit;
    overflow: hidden;
}
.sp-img-loading-wrap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.8), transparent);
    animation: sp-shimmer-sweep 1.5s infinite;
    pointer-events: none;
}
.sp-img-loaded::after {
    display: none !important;
}

/* RESPONSIVE */
@media (max-width: 768px) {
    .sp-maintenance-body {
        padding: 15px !important;
    }
    .sp-404-container {
        padding: 30px 15px !important;
    }
    .sp-maintenance-card, .sp-404-card {
        padding: 25px 15px !important;
        border-radius: 20px !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .sp-maint-title { font-size: 22px !important; }
    .sp-404-title { font-size: 20px !important; }
    .sp-visual-wrapper {
        margin: 20px auto !important;
        max-width: 100% !important;
        width: 100% !important;
        overflow: hidden !important;
    }
}
