body {
    margin: 0;
    padding: 0;
}

.splash-screen {
    display: none;
    opacity: 0;
    transform: translateY(0);
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s ease-out, visibility 0.8s ease-out;
    visibility: hidden;
}

.page-loading .splash-screen {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999999;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    font-family: 'Inter', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #f97316 0%, #ea580c 50%, #dc2626 100%);
    color: #ffffff;
    line-height: 1.6;
    font-size: 16px;
    font-weight: 400;
    overflow: hidden;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    pointer-events: auto;
}

/* Slide down exit animation when page-loading is removed */
.splash-screen.fade-out {
    transform: translateY(100vh);
    opacity: 0;
    visibility: hidden;
    z-index: 999999;
}

.splash-screen.fade-out .splash-screen-content {
    transform: translateY(50px) scale(0.9);
    opacity: 0;
}

.page-loading .splash-screen::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(251, 191, 36, 0.3) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(249, 115, 22, 0.2) 0%, transparent 50%);
    animation: backgroundFloat 20s ease-in-out infinite;
}

@keyframes backgroundFloat {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(-20px, -20px) rotate(1deg); }
    66% { transform: translate(20px, 20px) rotate(-1deg); }
}

.splash-screen-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 2;
    position: relative;
    text-align: center;
    max-width: 400px;
    padding: 0 20px;
    transition: transform 0.8s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.8s ease-out;
    transform: translateY(0) scale(1);
    opacity: 1;
}

.splash-logo {
    width: 120px;
    height: 120px;
    background: rgba(251, 191, 36, 0.2);
    border-radius: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 30px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(251, 191, 36, 0.3);
    animation: logoFloat 3s ease-in-out infinite;
    box-shadow: 0 8px 32px rgba(249, 115, 22, 0.2);
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-10px); }
}

.splash-logo-img {
    max-width: 90px;
    max-height: 90px;
    width: auto;
    height: auto;
    object-fit: contain;
    /* Remove filter to use original logo colors */
}

.splash-title {
    font-size: 42px;
    font-weight: 700;
    margin-bottom: 12px;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, #ffffff 0%, #fbbf24 50%, #ffffff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleGlow 2s ease-in-out infinite alternate;
    text-shadow: 0 2px 10px rgba(251, 191, 36, 0.3);
}

@keyframes titleGlow {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.1); }
}

.splash-subtitle {
    font-size: 16px;
    font-weight: 400;
    opacity: 0.9;
    margin-bottom: 40px;
    color: rgba(255, 255, 255, 0.85);
}

.splash-loader {
    width: 200px;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    overflow: hidden;
    position: relative;
}

.splash-loader::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(251, 191, 36, 0.9), transparent);
    animation: loading 1.5s infinite;
}

@keyframes loading {
    0% { left: -100%; }
    100% { left: 100%; }
}

.splash-loading-text {
    margin-top: 20px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 1; }
}

.splash-dots {
    display: inline-block;
    animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* Dark theme */
[data-bs-theme="dark"] .splash-screen {
    background: linear-gradient(135deg, #1a0f0a 0%, #2d1810 50%, #451a03 100%);
}

[data-bs-theme="dark"] .splash-screen::before {
    background: 
        radial-gradient(circle at 20% 80%, rgba(251, 191, 36, 0.2) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(249, 115, 22, 0.15) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(251, 191, 36, 0.1) 0%, transparent 50%);
}

[data-bs-theme="dark"] .splash-logo {
    background: rgba(251, 191, 36, 0.15);
    border-color: rgba(251, 191, 36, 0.25);
    box-shadow: 0 8px 32px rgba(249, 115, 22, 0.3);
}

[data-bs-theme="dark"] .splash-title {
    background: linear-gradient(135deg, #ffffff 0%, #fbbf24 50%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* Dark theme logo styling - if needed, uncomment the filter below */
/* 
[data-bs-theme="dark"] .splash-logo-img {
    filter: brightness(0) invert(1);
}
*/

/* Mobile responsiveness */
@media (max-width: 768px) {
    .splash-title {
        font-size: 32px;
    }
    
    .splash-logo {
        width: 100px;
        height: 100px;
        border-radius: 20px;
    }
    
    .splash-logo-img {
        max-width: 70px;
        max-height: 70px;
    }
    
    .splash-loader {
        width: 150px;
    }
}

/* API Loading Indicator - Full Page Blocking */
.api-loading {
    display: none;
}

/* Full page overlay that blocks all interactions */
.api-loading-active .api-loading {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(3px);
    cursor: wait;
}

.api-loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    min-width: 200px;
    text-align: center;
}

.api-loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(249, 115, 22, 0.2);
    border-top: 4px solid #f97316;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.api-loading-text {
    color: #5a6c7d;
    font-size: 16px;
    font-weight: 500;
    font-family: 'Inter', 'Segoe UI', sans-serif;
    margin: 0;
}

.api-loading-subtext {
    color: #8a9ba8;
    font-size: 13px;
    font-weight: 400;
    margin-top: 8px;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

/* Deprecated - keeping old styles for reference */
.api-loading-bar {
    height: 100%;
    background: linear-gradient(90deg, #ff6b35, #f7931e);
    width: 100%;
    animation: apiProgress 1.0s ease-in-out infinite;
    box-shadow: 0 2px 15px rgba(255, 107, 53, 0.5);
}

@keyframes apiProgress {
    0% { width: 0%; margin-left: 0%; margin-right: 100%; }
    50% { width: 75%; margin-left: 12.5%; margin-right: 12.5%; }
    100% { width: 0%; margin-left: 100%; margin-right: 0%; }
}

/* Alternative overlay API loading for complex operations */
.api-loading-overlay {
    display: none;
}

.api-loading-spinner {
    width: 60px;
    height: 60px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    animation: spin 1s linear infinite;
}

.api-loading-spinner::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 3px solid #667eea;
    border-top: 3px solid transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite reverse;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Dark theme for API loading */
[data-bs-theme="dark"] .api-loading-active .api-loading {
    background: rgba(0, 0, 0, 0.6);
}

[data-bs-theme="dark"] .api-loading-content {
    background: rgba(30, 30, 30, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

[data-bs-theme="dark"] .api-loading-text {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .api-loading-subtext {
    color: #94a3b8;
}

[data-bs-theme="dark"] .api-loading-spinner {
    border-color: rgba(249, 115, 22, 0.2);
    border-top-color: #f97316;
}

/* Deprecated dark theme styles - keeping for reference */
[data-bs-theme="dark"] .api-loading-bar {
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.4);
}

[data-bs-theme="dark"] .api-loading-overlay {
    background: rgba(0, 0, 0, 0.5);
}
