/**
 * Loading Screen and Error States
 * Extracted from inline styles in index.html
 */

.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg-primary, #ffffff);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.3s ease-in-out;
}

.loading-screen__content {
    text-align: center;
    max-width: 300px;
}

.loading-screen__logo h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #2563eb;
    font-weight: 600;
}

.loading-screen__message {
    font-size: 1rem;
    color: #64748b;
    margin-bottom: 2rem;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top: 3px solid #2563eb;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto;
}

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

#loading-status {
    margin-top: 1rem;
    font-size: 0.9rem;
    color: #64748b;
}

.app {
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}

.app--hidden {
    display: none !important;
}

.app-visible {
    opacity: 1 !important;
}

.loading-hidden {
    display: none !important;
}

/* Development mode indicator */
.app-footer__dev-mode {
    color: #f59e0b;
}

.error-state {
    max-width: 400px;
    text-align: center;
}

.error-state__icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.error-state__title {
    color: #dc2626;
    margin-bottom: 1rem;
}

.error-state__message {
    color: #6b7280;
    margin-bottom: 2rem;
}

.error-state__details {
    margin-top: 2rem;
    text-align: left;
}

.error-state__details summary {
    cursor: pointer;
    color: #6b7280;
    margin-bottom: 0.5rem;
}

.error-state__details pre {
    background: #f3f4f6;
    padding: 1rem;
    border-radius: 0.25rem;
    overflow-x: auto;
    font-size: 0.75rem;
    color: #374151;
}

/* Error fallback styles */
.error-fallback {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fee2e2;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family:
        -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.error-fallback__content {
    max-width: 400px;
    padding: 2rem;
    background: white;
    border-radius: 0.5rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    text-align: center;
}

/* Button styles */
.btn {
    background: #2563eb;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    cursor: pointer;
}

.btn:hover {
    background: #1d4ed8;
}

.btn--primary {
    background: #2563eb;
}

.btn--primary:hover {
    background: #1d4ed8;
}

/* Dark theme support */
[data-theme='dark'] .loading-screen {
    background: var(--bg-primary, #1f2937);
}

[data-theme='dark'] .loading-screen__logo h1 {
    color: var(--text-primary, #f9fafb);
}

[data-theme='dark'] .loading-screen__message {
    color: var(--text-secondary, #9ca3af);
}

[data-theme='dark'] #loading-status {
    color: #9ca3af;
}

[data-theme='dark'] .loading-spinner {
    border-color: #374151;
    border-top-color: #60a5fa;
}

[data-theme='dark'] .error-fallback {
    background: #7f1d1d;
}

[data-theme='dark'] .error-fallback__content {
    background: #1f2937;
    color: #f9fafb;
}

[data-theme='dark'] .error-state__title {
    color: #ef4444;
}

[data-theme='dark'] .error-state__message {
    color: #9ca3af;
}

[data-theme='dark'] .error-state__details pre {
    background: #111827;
    color: #d1d5db;
}
