/**
 * MiniTiendAI Loading Screen Styles
 * Premium animated loading screen with glassmorphism and modern effects
 */

/* Loading Screen Container */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;

    /* Background - Premium gradient with pattern */
    background:
        radial-gradient(ellipse at 20% 80%, rgba(255, 49, 49, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, rgba(255, 107, 107, 0.12) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(255, 255, 255, 0.9) 0%, rgba(248, 250, 252, 0.98) 100%);

    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.loading-screen.show {
    opacity: 1;
    visibility: visible;
}

.loading-screen.fade-out {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.6s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.6s;
}

/* Loading Content Container */
.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 40px;
}

/* Logo Container */
.loading-logo-container {
    position: relative;
    width: 180px;
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 32px;
}

/* Logo Glow Effect */
.loading-logo-glow {
    position: absolute;
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(255, 49, 49, 0.4) 0%, transparent 70%);
    border-radius: 50%;
    animation: logoGlowPulse 2s ease-in-out infinite;
    filter: blur(20px);
}

@keyframes logoGlowPulse {

    0%,
    100% {
        transform: scale(0.9);
        opacity: 0.6;
    }

    50% {
        transform: scale(1.1);
        opacity: 1;
    }
}

/* Main Logo - Circular */
.loading-logo {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 50%;
    position: relative;
    z-index: 10;
    animation: logoEntrance 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
        logoFloat 3s ease-in-out 0.8s infinite;
    opacity: 0;
    transform: scale(0.5);
    filter: drop-shadow(0 10px 30px rgba(255, 49, 49, 0.3));
    border: 4px solid rgba(255, 255, 255, 0.9);
    box-shadow:
        0 0 0 4px rgba(255, 49, 49, 0.2),
        0 10px 40px rgba(255, 49, 49, 0.25);
    background: white;
}

@keyframes logoEntrance {
    from {
        opacity: 0;
        transform: scale(0.5) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes logoFloat {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

/* Animated Rings */
.loading-logo-ring {
    position: absolute;
    width: 160px;
    height: 160px;
    border: 2px solid rgba(255, 49, 49, 0.3);
    border-radius: 50%;
    animation: ringExpand 2s ease-out infinite;
}

.loading-logo-ring-2 {
    animation-delay: 0.6s;
    border-color: rgba(255, 107, 107, 0.25);
}

.loading-logo-ring-3 {
    animation-delay: 1.2s;
    border-color: rgba(255, 49, 49, 0.2);
}

@keyframes ringExpand {
    0% {
        transform: scale(0.8);
        opacity: 1;
    }

    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

/* Loading Text */
.loading-text-container {
    text-align: center;
    margin-bottom: 32px;
    animation: textEntrance 0.6s cubic-bezier(0.4, 0, 0.2, 1) 0.3s forwards;
    opacity: 0;
    transform: translateY(20px);
}

@keyframes textEntrance {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-title {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: clamp(2rem, 5vw, 2.8rem);
    font-weight: 800;
    margin: 0 0 8px 0;
    letter-spacing: -0.02em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}

.loading-title-word {
    background: linear-gradient(135deg, #2d3748 0%, #1a202c 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: wordShimmer 3s ease-in-out infinite;
}

.loading-title-red {
    background: linear-gradient(135deg, #ff3131 0%, #ff6b6b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: wordPulse 2s ease-in-out infinite;
}

.loading-title-tm {
    font-size: 0.5em;
    opacity: 0.7;
    vertical-align: super;
    margin-left: 2px;
    background: linear-gradient(135deg, #ff3131 0%, #ff6b6b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes wordShimmer {

    0%,
    100% {
        filter: brightness(1);
    }

    50% {
        filter: brightness(1.1);
    }
}

@keyframes wordPulse {

    0%,
    100% {
        filter: brightness(1);
        transform: scale(1);
    }

    50% {
        filter: brightness(1.2);
        transform: scale(1.02);
    }
}

.loading-subtitle {
    font-family: 'Outfit', sans-serif;
    font-size: clamp(0.95rem, 2.5vw, 1.1rem);
    color: #64748b;
    margin: 0;
    font-weight: 500;
    letter-spacing: 0.02em;
    transition: opacity 0.2s ease;
}

/* Progress Bar */
.loading-progress-container {
    width: 280px;
    max-width: 90vw;
    animation: progressEntrance 0.5s cubic-bezier(0.4, 0, 0.2, 1) 0.5s forwards;
    opacity: 0;
    transform: translateY(10px);
}

@keyframes progressEntrance {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.loading-progress-bar {
    height: 6px;
    background: linear-gradient(90deg, rgba(255, 49, 49, 0.1) 0%, rgba(255, 107, 107, 0.15) 100%);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05);
}

.loading-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff3131 0%, #ff6b6b 50%, #ff3131 100%);
    background-size: 200% 100%;
    border-radius: 100px;
    animation: progressFill 2s ease-in-out infinite, progressShimmer 1.5s linear infinite;
    width: 60%;
    position: relative;
}

@keyframes progressFill {
    0% {
        width: 0%;
        transform: translateX(-10%);
    }

    50% {
        width: 70%;
    }

    100% {
        width: 100%;
        transform: translateX(0);
    }
}

@keyframes progressShimmer {
    from {
        background-position: 200% 0;
    }

    to {
        background-position: -200% 0;
    }
}

.loading-progress-glow {
    position: absolute;
    top: -2px;
    right: 0;
    width: 40px;
    height: 10px;
    background: radial-gradient(ellipse at center, rgba(255, 49, 49, 0.6) 0%, transparent 70%);
    filter: blur(4px);
    animation: progressGlow 2s ease-in-out infinite;
}

@keyframes progressGlow {
    0% {
        right: 100%;
        opacity: 0;
    }

    50% {
        opacity: 1;
    }

    100% {
        right: 0%;
        opacity: 0;
    }
}

/* Floating Particles */
.loading-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: hidden;
}

.loading-particle {
    position: absolute;
    width: 8px;
    height: 8px;
    background: linear-gradient(135deg, rgba(255, 49, 49, 0.6) 0%, rgba(255, 107, 107, 0.4) 100%);
    border-radius: 50%;
    animation: particleFloat 4s ease-in-out infinite;
    opacity: 0;
}

.loading-particle:nth-child(1) {
    top: 20%;
    left: 10%;
    animation-delay: 0s;
    animation-duration: 3.5s;
}

.loading-particle:nth-child(2) {
    top: 60%;
    left: 20%;
    animation-delay: 0.5s;
    animation-duration: 4s;
    width: 6px;
    height: 6px;
}

.loading-particle:nth-child(3) {
    top: 30%;
    left: 80%;
    animation-delay: 1s;
    animation-duration: 3.8s;
}

.loading-particle:nth-child(4) {
    top: 70%;
    left: 85%;
    animation-delay: 1.5s;
    animation-duration: 4.2s;
    width: 10px;
    height: 10px;
}

.loading-particle:nth-child(5) {
    top: 15%;
    left: 60%;
    animation-delay: 0.3s;
    animation-duration: 3.6s;
    width: 5px;
    height: 5px;
}

.loading-particle:nth-child(6) {
    top: 80%;
    left: 40%;
    animation-delay: 0.8s;
    animation-duration: 4.4s;
}

.loading-particle:nth-child(7) {
    top: 45%;
    left: 5%;
    animation-delay: 1.2s;
    animation-duration: 3.4s;
    width: 7px;
    height: 7px;
}

.loading-particle:nth-child(8) {
    top: 25%;
    left: 90%;
    animation-delay: 1.8s;
    animation-duration: 4.1s;
    width: 9px;
    height: 9px;
}

@keyframes particleFloat {
    0% {
        opacity: 0;
        transform: translateY(20px) scale(0.5);
    }

    20% {
        opacity: 0.8;
    }

    80% {
        opacity: 0.6;
    }

    100% {
        opacity: 0;
        transform: translateY(-100px) scale(1.2);
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .loading-screen {
        background:
            radial-gradient(ellipse at 20% 80%, rgba(255, 49, 49, 0.2) 0%, transparent 50%),
            radial-gradient(ellipse at 80% 20%, rgba(255, 107, 107, 0.15) 0%, transparent 50%),
            radial-gradient(ellipse at 50% 50%, rgba(15, 23, 42, 0.98) 0%, rgba(30, 41, 59, 0.98) 100%);
    }

    .loading-title-word {
        background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
        -webkit-background-clip: text;
        background-clip: text;
    }

    .loading-subtitle {
        color: #94a3b8;
    }

    .loading-progress-bar {
        background: linear-gradient(90deg, rgba(255, 49, 49, 0.15) 0%, rgba(255, 107, 107, 0.2) 100%);
    }
}

/* Mobile Optimizations */
@media (max-width: 768px) {
    .loading-logo-container {
        width: 150px;
        height: 150px;
        margin-bottom: 24px;
    }

    .loading-logo {
        width: 110px;
        height: 110px;
    }

    .loading-logo-glow {
        width: 160px;
        height: 160px;
    }

    .loading-logo-ring {
        width: 130px;
        height: 130px;
    }

    .loading-progress-container {
        width: 220px;
    }

    .loading-content {
        padding: 24px;
    }
}

@media (max-width: 480px) {
    .loading-logo-container {
        width: 120px;
        height: 120px;
        margin-bottom: 20px;
    }

    .loading-logo {
        width: 90px;
        height: 90px;
    }

    .loading-logo-glow {
        width: 130px;
        height: 130px;
    }

    .loading-logo-ring {
        width: 100px;
        height: 100px;
    }

    .loading-title {
        font-size: 1.8rem;
    }

    .loading-subtitle {
        font-size: 0.9rem;
    }

    .loading-progress-container {
        width: 180px;
    }
}

/* Reduced Motion Preference */
@media (prefers-reduced-motion: reduce) {

    .loading-logo,
    .loading-logo-glow,
    .loading-logo-ring,
    .loading-progress-fill,
    .loading-particle {
        animation: none !important;
    }

    .loading-logo {
        opacity: 1;
        transform: none;
    }

    .loading-text-container,
    .loading-progress-container {
        opacity: 1;
        transform: none;
    }

    .loading-progress-fill {
        width: 100%;
    }

    .loading-particle {
        display: none;
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .loading-screen {
        background: white;
    }

    .loading-title-word {
        -webkit-text-fill-color: #000;
    }

    .loading-title-red {
        -webkit-text-fill-color: #ff0000;
    }

    .loading-progress-bar {
        border: 2px solid #000;
    }

    .loading-progress-fill {
        background: #ff0000;
    }
}