/* ===== RESET & BASE STYLES ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
    overflow-x: hidden;
}

#app {
    min-height: 100vh;
    min-width: 100vw;
    display: flex;
    flex-direction: column;
}

/* Main content area */
#main-content {
    flex: 1;
    width: 100%;
}

/* ===== SPLASH SCREEN WITH ANIMATED LOGO ===== */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    width: 100%;
    background: linear-gradient(135deg,
            #72a7cc 0%,
            #708ae0 25%,
            #6a68df 50%,
            #424ccf 75%,
            #0000ff 100%);
    background-size: 400% 400%;
    animation: gradientFlow 8s ease infinite;
    position: fixed;
    /* Changed to fixed for full screen coverage */
    top: 0;
    left: 0;
    z-index: 9999;
}

/* Logo Container with Animation */
.logo-container {
    position: relative;
    width: 160px;
    height: 160px;
    margin-bottom: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Main Logo Element */
.app-logo {
    width: 120px;
    height: 120px;
    opacity: 0;
    border-radius: 10px;
    transform: translateY(-100px);
    animation: 
        logoDrop 2.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards,
            /* logoPulse 0.8s ease-in-out 3s infinite, */
            splashEffect 0.8s ease-out 3s infinite;
    animation-fill-mode: forwards;
}

/* Logo Splash Effect */
.logo-splash {
    position: absolute;
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    opacity: 0;
    transform: scale(0);
    animation: splashEffect 1s ease-out 2.7s forwards;
}

/* Particle Effects for Splash */
.splash-particle {
    position: absolute;
    width: 15px;
    height: 15px;
    background: rgba(255, 255, 255, .8);
    border-radius: 50%;
    opacity: 0;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

/* Particle positions */
.splash-particle:nth-child(1) {
    top: 20px;
    left: 50%;
    animation: particleFly 0.8s ease-out 2..2s forwards;
}

.splash-particle:nth-child(2) {
    top: 50%;
    right: 20px;
    animation: particleFly 0.8s ease-out 2.3s forwards;
}

.splash-particle:nth-child(3) {
    bottom: 20px;
    left: 50%;
    animation: particleFly 0.8s ease-out 2.4s forwards;
}

.splash-particle:nth-child(4) {
    top: 50%;
    left: 20px;
    animation: particleFly 0.8s ease-out 2.5s forwards;
}

.splash-particle:nth-child(5) {
    top: 30px;
    left: 30px;
    animation: particleFly 0.8s ease-out 2.6s forwards;
}

.splash-particle:nth-child(6) {
    top: 30px;
    right: 30px;
    animation: particleFly 0.6s ease-out 2.7s forwards;
}

.splash-particle:nth-child(7) {
    bottom: 30px;
    right: 30px;
    animation: particleFly 0.6s ease-out 2.8s forwards;
}

.splash-particle:nth-child(8) {
    bottom: 30px;
    left: 30px;
    animation: particleFly 0.6s ease-out 2.5s forwards;
}

/* Subtle pulse after animation */
@keyframes logoPulse {

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

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

/* Animations */
@keyframes gradientFlow {

    0%,
    100% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }
}

@keyframes logoDrop {
    0% {
        opacity: 0.8;
        transform: translateY(-100px) rotate(-80deg);
    }

    40% {
        opacity: 1;
        transform: translateY(20px) rotate(20deg);
    }

    55% {
        opacity: 1;
        transform: translateY(-10px) rotate(359deg);
    }

    80% {
        opacity: 1;
        transform: translateY(0) rotate(0deg);
        /* animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1.275); */
    }
    100% {
        opacity: 0;
        transform: translateY(0) rotate(0deg);
    }
}

@keyframes splashEffect {
    0% {
        opacity: 1;
        transform: scale(0);
        box-shadow: 0 0 2px 0 rgba(255, 255, 255, 0.4);
    }

    50% {
        transform: scale(1.8);
        box-shadow: 0 0 0 40px rgba(255, 255, 255, 0);
    }

    100% {
        opacity: 0;
        transform: scale(2);
        box-shadow: 0 0 0 60px rgba(255, 255, 255, 0);
    }
}

@keyframes particleFly {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(calc(var(--tx, 0) * 40px),
                calc(var(--ty, 0) * 40px)) scale(0.6);
    }
}

/* Text Animation - Enhanced */
.loading-text {
    color: white;
    font-size: 20px;
    font-weight: 300;
    margin-top: 20px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    position: relative;
    opacity: 0;
    animation: textReveal 0.8s ease-out 1.8s forwards;
}

.loading-text span {
    display: inline-block;
    opacity: 0;
    animation: letterWave 1.5s ease infinite;
}

.loading-text span:nth-child(1) {
    animation-delay: 2.0s;
}

.loading-text span:nth-child(2) {
    animation-delay: 2.05s;
}

.loading-text span:nth-child(3) {
    animation-delay: 2.1s;
}

.loading-text span:nth-child(4) {
    animation-delay: 2.15s;
}

.loading-text span:nth-child(5) {
    animation-delay: 2.2s;
}

.loading-text span:nth-child(6) {
    animation-delay: 2.25s;
}

.loading-text span:nth-child(7) {
    animation-delay: 2.3s;
}

.loading-text span:nth-child(8) {
    animation-delay: 2.35s;
}

.loading-text span:nth-child(9) {
    animation-delay: 2.4s;
}

.loading-text span:nth-child(10) {
    animation-delay: 2.45s;
}

.loading-text span:nth-child(11) {
    animation-delay: 2.5s;
}

.loading-text span:nth-child(12) {
    animation-delay: 2.55s;
}

.loading-text span:nth-child(13) {
    animation-delay: 2.6s;
}

.loading-text span:nth-child(14) {
    animation-delay: 2.65s;
}

.loading-text span:nth-child(15) {
    animation-delay: 2.7s;
}

.loading-text span:nth-child(16) {
    animation-delay: 2.75s;
}

@keyframes textReveal {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

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

@keyframes letterWave {

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

    50% {
        transform: translateY(-5px);
        opacity: 0.8;
    }
}

/* Optional: Subtle loading dots */
.loading-dots {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    opacity: 0;
    animation: fadeIn 0.5s ease-out 2.8s forwards;
}

.loading-dot {
    width: 8px;
    height: 8px;
    background: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes dotBounce {

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

    40% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

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

/* Fade out animation */
.loading-container.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
    0%, 80% {
        opacity: 1;
    }
    100%{
        opacity: 0;
        visibility: hidden;
    }
}

.loading-container::after {
    content: '';
    position: absolute;
    top: 0%;
    left: 0%;
    width: 100%;
    height: 100%;
    background-image:
        radial-gradient(20px 20px at 5% 15%, rgba(33, 150, 243, 0.5) 50%, transparent),
        radial-gradient(10px 10px at 90% 70%, rgba(33, 150, 243, 0.5) 50%, transparent),
        radial-gradient(8px 8px at 85% 40%, rgba(33, 150, 243, 0.5) 50%, transparent),
        radial-gradient(15px 15px at 80% 90%, rgba(33, 150, 243, 0.5) 50%, transparent),
        radial-gradient(5px 5px at 10% 85%, rgba(33, 150, 243, 0.5) 50%, transparent);
    background-repeat: repeat;
    animation: floatParticles 1s linear infinite;
    z-index: 0;
}

@keyframes floatParticles {
    0% {
        transform: translateY(0) translateX(0);
    }

    50% {
        transform: translateY(-100px) translateX(100px);
    }
    100% {
        transform: translateY(0) translateX(0);
    }
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.text-left {
    text-align: left;
}

.text-right {
    text-align: right;
}

.mt-1 {
    margin-top: 0.5rem;
}

.mt-2 {
    margin-top: 1rem;
}

.mt-3 {
    margin-top: 1.5rem;
}

.mt-4 {
    margin-top: 2rem;
}

.mb-1 {
    margin-bottom: 0.5rem;
}

.mb-2 {
    margin-bottom: 1rem;
}

.mb-3 {
    margin-bottom: 1.5rem;
}

.mb-4 {
    margin-bottom: 2rem;
}

.p-1 {
    padding: 0.5rem;
}

.p-2 {
    padding: 1rem;
}

.p-3 {
    padding: 1.5rem;
}

.p-4 {
    padding: 2rem;
}

.hidden {
    display: none !important;
}

.visible {
    display: block;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.w-full {
    width: 100%;
}

.h-full {
    height: 100%;
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 768px) {
    .mobile-hidden {
        display: none;
    }

    .mobile-full {
        width: 100%;
    }

    .mobile-stack {
        flex-direction: column;
    }
}

@media (max-width: 480px) {
    body {
        font-size: 14px;
    }
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Focus styles for better accessibility */
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

/* ===== PRINT STYLES ===== */
@media print {
    .no-print {
        display: none !important;
    }

    body {
        background: white !important;
        color: black !important;
    }
}

/* ===== ERROR STATES ===== */
.error-message {
    color: #e53e3e;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.error-message.visible {
    display: block;
}

.input-error {
    border-color: #e53e3e !important;
    background-color: #fed7d7 !important;
}

/* ===== SUCCESS STATES ===== */
.success-message {
    color: #38a169;
    font-size: 12px;
    margin-top: 4px;
    display: none;
}

.success-message.visible {
    display: block;
}

.input-success {
    border-color: #38a169 !important;
    background-color: #f0fff4 !important;
}