/* Additional animations for enhanced UX */

/* Page loading state */
.page-loading {
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.page-loading * {
    animation-play-state: paused !important;
}

/* Ripple effect for buttons */
.btn-modern {
    position: relative;
    overflow: hidden;
}

.ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.6);
    transform: scale(0);
    animation: ripple-animation 0.6s linear;
    pointer-events: none;
}

@keyframes ripple-animation {
    to {
        transform: scale(4);
        opacity: 0;
    }
}

/* Staggered card animations */
.modern-condition-card:nth-child(1) {
    animation-delay: 0.1s;
}

.modern-condition-card:nth-child(2) {
    animation-delay: 0.2s;
}

.modern-condition-card:nth-child(3) {
    animation-delay: 0.3s;
}

.modern-condition-card:nth-child(4) {
    animation-delay: 0.4s;
}

.modern-condition-card:nth-child(5) {
    animation-delay: 0.5s;
}

.modern-condition-card:nth-child(6) {
    animation-delay: 0.6s;
}

/* Enhanced hover effects for feature items */
.feature-item:hover {
    animation: pulseGlow 0.6s ease-out;
}

@keyframes pulseGlow {
    0% { transform: scale(1); box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1); }
    50% { transform: scale(1.05); box-shadow: 0 8px 25px rgba(251, 191, 36, 0.3); }
    100% { transform: scale(1.05); box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2); }
}

/* Scroll reveal animation */
@media (prefers-reduced-motion: no-preference) {
    .conditions-preview {
        opacity: 0;
        transform: translateY(30px); /* Smaller initial offset */
        animation: scrollReveal 0.6s ease-out forwards; /* Faster reveal */
        animation-delay: 0.2s; /* Shorter delay */
    }
    
    @keyframes scrollReveal {
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
}

/* Loading state for better UX */
.conditions-grid {
    opacity: 0;
    animation: fadeInGrid 0.8s ease-out forwards;
    animation-delay: 0.3s;
}

@keyframes fadeInGrid {
    to {
        opacity: 1;
    }
}

/* ===== UNIFIED LOADING SYSTEM ===== */

/* Universal Loading Overlay */
.universal-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 45%, #38bdf8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.universal-loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Universal Loading Content */
.universal-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    max-width: 400px;
    padding: 2rem;
}

/* Universal Spinner Ring Animation */
.universal-loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
}

.universal-spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top: 4px solid rgba(191, 219, 254, 0.85);
    border-radius: 50%;
    animation: universalSpin 1.2s linear infinite;
}

.universal-spinner-ring:nth-child(1) {
    animation-delay: 0s;
}

.universal-spinner-ring:nth-child(2) {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    border-top-color: rgba(191, 219, 254, 0.65);
    animation-delay: 0.4s;
}

.universal-spinner-ring:nth-child(3) {
    width: 40px;
    height: 40px;
    top: 20px;
    left: 20px;
    border-top-color: rgba(191, 219, 254, 0.45);
    animation-delay: 0.8s;
}

@keyframes universalSpin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Universal Loading Text Styles */
.universal-loading-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
}

.universal-loading-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
}

/* Universal Progress Bar */
.universal-loading-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.universal-progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.universal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #38bdf8, #2563eb);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}



/* ===== LEGACY COMPATIBILITY ===== */

/* Backward compatibility for existing spinner-ring usage */
.spinner-ring {
    position: absolute;
    width: 100%;
    height: 100%;
    border: 4px solid transparent;
    border-top: 4px solid rgba(191, 219, 254, 0.85);
    border-radius: 50%;
    animation: universalSpin 1.2s linear infinite;
}

.spinner-ring:nth-child(1) {
    animation-delay: 0s;
}

.spinner-ring:nth-child(2) {
    width: 60px;
    height: 60px;
    top: 10px;
    left: 10px;
    border-top-color: rgba(191, 219, 254, 0.65);
    animation-delay: 0.4s;
}

.spinner-ring:nth-child(3) {
    width: 40px;
    height: 40px;
    top: 20px;
    left: 20px;
    border-top-color: rgba(191, 219, 254, 0.45);
    animation-delay: 0.8s;
}

/* Backward compatibility for existing loading-spinner */
.loading-spinner {
    position: relative;
    width: 80px;
    height: 80px;
    margin: 0 auto 2rem;
}

/* Backward compatibility for existing loading styles */
.loading-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: white;
}

.loading-subtitle {
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 2rem;
}

.loading-progress {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.progress-bar {
    flex: 1;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #4ade80, #22c55e);
    border-radius: 4px;
    width: 0%;
    transition: width 0.3s ease;
}



/* RTL support for loading content */
.rtl .auth-loading-content {
    direction: rtl;
}

.rtl .universal-loading-content {
    direction: rtl;
}

/* RTL text alignment */
[dir="rtl"] .auth-loading-content {
    direction: rtl;
}

[dir="rtl"] .universal-loading-content {
    direction: rtl;
}

[dir="rtl"] .auth-loading-text {
    text-align: center;
}

[dir="rtl"] .universal-loading-title,
[dir="rtl"] .universal-loading-subtitle {
    text-align: center;
}

/* Interactive button press effect */
.btn-modern:active {
    transform: translateY(-2px) scale(0.98);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Subtle parallax effect for background */
@media (min-width: 768px) {
    .landing-hero {
        background-attachment: fixed;
    }
}

/* Enhanced loading animation for language switch */
.lang-switching .hero-title,
.lang-switching .hero-subtitle,
.lang-switching .hero-description {
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

/* Accessibility: Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .landing-hero {
        background: linear-gradient(135deg, #4facfe 0%, #00f2fe 25%, #667eea 50%, #f093fb 75%, #f5576c 100%);
    }
    
    .feature-item:hover,
    .btn-modern:hover,
    .modern-condition-card:hover {
        transform: none;
    }
}

/* Focus styles for better accessibility */
.btn-modern:focus-visible {
    outline: 3px solid rgba(251, 191, 36, 0.6);
    outline-offset: 2px;
}

.feature-item:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Enhanced CTA section animation */
.modern-cta {
    opacity: 0;
    transform: translateY(30px);
    animation: slideInCta 1s ease-out forwards;
    animation-delay: 1s;
}

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

/* Authentication Loading Overlay */
.auth-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    transition: opacity 0.5s ease-out, visibility 0.5s ease-out;
}

.auth-loading-overlay.hidden {
    opacity: 0;
    visibility: hidden;
}

.auth-loading-content {
    text-align: center;
    color: white;
}

.auth-loading-logo {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    opacity: 0;
    animation: fadeInLogo 1s ease-out forwards;
}

.auth-loading-text {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0;
    animation: fadeInText 1s ease-out forwards;
    animation-delay: 0.3s;
}

.auth-loading-spinner {
    width: 60px;
    height: 60px;
    border: 4px solid rgba(255, 255, 255, 0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
    opacity: 0;
    animation: fadeInSpinner 1s ease-out forwards, spin 1s linear infinite;
    animation-delay: 0.6s, 0.6s;
}

@keyframes fadeInLogo {
    to {
        opacity: 1;
    }
}

@keyframes fadeInText {
    to {
        opacity: 1;
    }
}

@keyframes fadeInSpinner {
    to {
        opacity: 1;
    }
}

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

/* Pulse dots animation */
.loading-dots {
    display: inline-flex;
    gap: 4px;
    margin-left: 8px;
}

.loading-dots .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: white;
    animation: pulseDot 1.4s ease-in-out infinite both;
}

.loading-dots .dot:nth-child(1) { animation-delay: -0.32s; }
.loading-dots .dot:nth-child(2) { animation-delay: -0.16s; }
.loading-dots .dot:nth-child(3) { animation-delay: 0s; }

@keyframes pulseDot {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}
