/* ========================================
   Splash Screen & Page Loading Animation
   ======================================== */

/* Splash Screen Container */
.splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    pointer-events: all;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), 
                visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.splash-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: scale(1.05);
}

/* Background with Animated Gradient */
.splash-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0f2027 0%, #1a3a3a 50%, #0d1f1f 100%);
    z-index: -2;
}

/* Animated Mesh Gradient Overlay */
.splash-gradient-mesh {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.6;
    background: 
        radial-gradient(ellipse 80% 60% at 20% 30%, rgba(34, 138, 101, 0.4) 0%, transparent 50%),
        radial-gradient(ellipse 60% 50% at 80% 70%, rgba(55, 194, 204, 0.3) 0%, transparent 50%),
        radial-gradient(ellipse 40% 40% at 50% 50%, rgba(141, 222, 207, 0.2) 0%, transparent 50%);
    animation: meshFloat 8s ease-in-out infinite;
}

@keyframes meshFloat {
    0%, 100% {
        transform: translate(0, 0) scale(1);
        opacity: 0.6;
    }
    25% {
        transform: translate(-2%, 2%) scale(1.02);
        opacity: 0.7;
    }
    50% {
        transform: translate(0, -2%) scale(1);
        opacity: 0.5;
    }
    75% {
        transform: translate(2%, 1%) scale(0.98);
        opacity: 0.65;
    }
}

/* Floating Particles */
.splash-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    z-index: -1;
}

.particle {
    position: absolute;
    border-radius: 50%;
    background: rgba(141, 222, 207, 0.3);
    animation: particleFloat linear infinite;
}

.particle:nth-child(1) {
    width: 8px;
    height: 8px;
    left: 10%;
    animation-duration: 12s;
    animation-delay: 0s;
}

.particle:nth-child(2) {
    width: 6px;
    height: 6px;
    left: 25%;
    animation-duration: 15s;
    animation-delay: -3s;
}

.particle:nth-child(3) {
    width: 12px;
    height: 12px;
    left: 40%;
    animation-duration: 18s;
    animation-delay: -6s;
}

.particle:nth-child(4) {
    width: 5px;
    height: 5px;
    left: 55%;
    animation-duration: 14s;
    animation-delay: -2s;
}

.particle:nth-child(5) {
    width: 10px;
    height: 10px;
    left: 70%;
    animation-duration: 16s;
    animation-delay: -5s;
}

.particle:nth-child(6) {
    width: 7px;
    height: 7px;
    left: 85%;
    animation-duration: 13s;
    animation-delay: -8s;
}

.particle:nth-child(7) {
    width: 4px;
    height: 4px;
    left: 95%;
    animation-duration: 11s;
    animation-delay: -1s;
}

.particle:nth-child(8) {
    width: 9px;
    height: 9px;
    left: 5%;
    animation-duration: 17s;
    animation-delay: -4s;
}

@keyframes particleFloat {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }
    10% {
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translateY(-100vh) rotate(720deg);
        opacity: 0;
    }
}

/* Main Content Container */
.splash-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 40px;
    z-index: 1;
}

/* Logo Container with Glow Effect */
.splash-logo-container {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    animation: logoEntrance 1s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    opacity: 0;
    transform: scale(0.5) translateY(30px);
}

@keyframes logoEntrance {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(30px);
    }
    100% {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

/* Logo Glow Ring */
.logo-glow-ring {
    position: absolute;
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid rgba(55, 194, 204, 0.3);
    animation: ringPulse 2s ease-in-out infinite;
}

.logo-glow-ring::before {
    content: '';
    position: absolute;
    top: -10px;
    left: -10px;
    right: -10px;
    bottom: -10px;
    border-radius: 50%;
    border: 1px solid rgba(141, 222, 207, 0.15);
    animation: ringPulse 2s ease-in-out infinite 0.5s;
}

.logo-glow-ring::after {
    content: '';
    position: absolute;
    top: -20px;
    left: -20px;
    right: -20px;
    bottom: -20px;
    border-radius: 50%;
    border: 1px solid rgba(141, 222, 207, 0.08);
    animation: ringPulse 2s ease-in-out infinite 1s;
}

@keyframes ringPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.6;
    }
}

/* Logo Image Wrapper */
.splash-logo {
    width: 120px;
    height: 120px;
    background: linear-gradient(145deg, #fff 0%, #f8fffe 100%);
    border-radius: 30px;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 
        0 20px 60px rgba(0, 0, 0, 0.3),
        0 0 40px rgba(55, 194, 204, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.8);
    position: relative;
    z-index: 2;
    animation: logoBreath 3s ease-in-out infinite;
}

@keyframes logoBreath {
    0%, 100% {
        box-shadow: 
            0 20px 60px rgba(0, 0, 0, 0.3),
            0 0 40px rgba(55, 194, 204, 0.2),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
    50% {
        box-shadow: 
            0 25px 70px rgba(0, 0, 0, 0.35),
            0 0 60px rgba(55, 194, 204, 0.4),
            inset 0 1px 0 rgba(255, 255, 255, 0.8);
    }
}

.splash-logo img {
    width: 75%;
    height: auto;
    object-fit: contain;
}

/* Brand Name Text */
.splash-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    animation: brandEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards 0.3s;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes brandEntrance {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

.splash-brand h1 {
    font-family: YekanBakh, sans-serif;
    font-size: 28px;
    font-weight: 900;
    color: #fff;
    margin: 0;
    letter-spacing: 2px;
    text-shadow: 0 2px 20px rgba(55, 194, 204, 0.3);
}

.splash-brand span {
    font-family: YekanBakh, sans-serif;
    font-size: 14px;
    font-weight: 500;
    color: rgba(141, 222, 207, 0.8);
    letter-spacing: 4px;
}

/* Loading Animation Container */
.splash-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    animation: loaderEntrance 0.6s ease-out forwards 0.5s;
    opacity: 0;
    transform: translateY(15px);
}

@keyframes loaderEntrance {
    0% {
        opacity: 0;
        transform: translateY(15px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Progress Bar */
.splash-progress-container {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    overflow: hidden;
    position: relative;
}

.splash-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #228A65, #37C2CC, #8DDECF);
    background-size: 200% 100%;
    border-radius: 10px;
    width: 0%;
    transition: width 0.3s ease-out;
    animation: progressGradient 2s linear infinite;
}

@keyframes progressGradient {
    0% {
        background-position: 0% 50%;
    }
    100% {
        background-position: 200% 50%;
    }
}

/* Animated Dots Loader */
.splash-dots {
    display: flex;
    gap: 8px;
    align-items: center;
}

.splash-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(55, 194, 204, 0.8);
    animation: dotBounce 1.4s ease-in-out infinite;
}

.splash-dot:nth-child(1) {
    animation-delay: 0s;
}

.splash-dot:nth-child(2) {
    animation-delay: 0.16s;
}

.splash-dot:nth-child(3) {
    animation-delay: 0.32s;
}

@keyframes dotBounce {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1.2);
        opacity: 1;
        background: #8DDECF;
    }
}

/* Loading Text */
.splash-text {
    font-family: YekanBakh, sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    letter-spacing: 1px;
}

/* Decorative Corner Elements */
.splash-corner {
    position: absolute;
    width: 100px;
    height: 100px;
    opacity: 0.1;
}

.splash-corner--top-right {
    top: 40px;
    right: 40px;
    border-top: 2px solid #37C2CC;
    border-right: 2px solid #37C2CC;
}

.splash-corner--top-left {
    top: 40px;
    left: 40px;
    border-top: 2px solid #37C2CC;
    border-left: 2px solid #37C2CC;
}

.splash-corner--bottom-right {
    bottom: 40px;
    right: 40px;
    border-bottom: 2px solid #37C2CC;
    border-right: 2px solid #37C2CC;
}

.splash-corner--bottom-left {
    bottom: 40px;
    left: 40px;
    border-bottom: 2px solid #37C2CC;
    border-left: 2px solid #37C2CC;
}

/* Responsive Design */
@media screen and (max-width: 768px) {
    .splash-logo {
        width: 100px;
        height: 100px;
        border-radius: 25px;
    }
    
    .logo-glow-ring {
        width: 150px;
        height: 150px;
    }
    
    .splash-brand h1 {
        font-size: 24px;
    }
    
    .splash-brand span {
        font-size: 12px;
        letter-spacing: 3px;
    }
    
    .splash-progress-container {
        width: 160px;
    }
    
    .splash-corner {
        width: 60px;
        height: 60px;
    }
    
    .splash-corner--top-right,
    .splash-corner--top-left {
        top: 20px;
    }
    
    .splash-corner--top-right,
    .splash-corner--bottom-right {
        right: 20px;
    }
    
    .splash-corner--top-left,
    .splash-corner--bottom-left {
        left: 20px;
    }
    
    .splash-corner--bottom-right,
    .splash-corner--bottom-left {
        bottom: 20px;
    }
}

@media screen and (max-width: 480px) {
    .splash-logo {
        width: 80px;
        height: 80px;
        border-radius: 20px;
    }
    
    .logo-glow-ring {
        width: 120px;
        height: 120px;
    }
    
    .splash-content {
        gap: 30px;
    }
    
    .splash-brand h1 {
        font-size: 20px;
    }
    
    .splash-brand span {
        font-size: 10px;
    }
    
    .splash-corner {
        display: none;
    }
}

/* ========================================
   Page Content Reveal Animation
   ======================================== */

/* Stagger reveal for main content after splash */
body.page-loaded main {
    animation: contentReveal 0.8s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes contentReveal {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header reveal animation */
body.page-loaded header {
    animation: headerSlide 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards 0.1s;
}

@keyframes headerSlide {
    0% {
        opacity: 0;
        transform: translateY(-100%);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Footer reveal animation */
body.page-loaded footer {
    animation: footerSlide 0.6s cubic-bezier(0.4, 0, 0.2, 1) forwards 0.3s;
}

@keyframes footerSlide {
    0% {
        opacity: 0;
        transform: translateY(30px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Initial hidden state before page load */
body:not(.page-loaded) main,
body:not(.page-loaded) header,
body:not(.page-loaded) footer {
    opacity: 0;
}

/* Prevent scroll during splash */
body.splash-active {
    overflow: hidden;
}

/* ========================================
   Quick Mode - Faster loading for return visits
   ======================================== */

.splash-screen.quick-mode {
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(10px);
    transition: opacity 0.3s ease-out, visibility 0.3s ease-out;
}

.splash-screen.quick-mode .splash-background,
.splash-screen.quick-mode .splash-gradient-mesh,
.splash-screen.quick-mode .splash-particles,
.splash-screen.quick-mode .splash-corner,
.splash-screen.quick-mode .splash-brand,
.splash-screen.quick-mode .splash-dots,
.splash-screen.quick-mode .splash-text,
.splash-screen.quick-mode .logo-glow-ring {
    display: none !important;
}

.splash-screen.quick-mode .splash-content {
    gap: 20px;
}

.splash-screen.quick-mode .splash-logo-container {
    animation: none;
    opacity: 1;
    transform: none;
}

.splash-screen.quick-mode .splash-logo {
    width: 70px;
    height: 70px;
    border-radius: 18px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    animation: quickPulse 0.8s ease-in-out infinite;
}

@keyframes quickPulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(0.95);
    }
}

.splash-screen.quick-mode .splash-loader {
    animation: none;
    opacity: 1;
    transform: none;
}

.splash-screen.quick-mode .splash-progress-container {
    width: 120px;
    height: 3px;
    background: rgba(34, 138, 101, 0.15);
}

.splash-screen.quick-mode .splash-progress-bar {
    background: linear-gradient(90deg, #228A65, #37C2CC);
}

.splash-screen.quick-mode.hidden {
    opacity: 0;
    visibility: hidden;
    transform: none;
}

/* Quick mode content reveal - faster */
body.page-loaded.quick-loaded main,
body.page-loaded.quick-loaded header,
body.page-loaded.quick-loaded footer {
    animation-duration: 0.3s;
}


