/* ===== Loading Screen ===== */
.loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #F8F2DE 0%, #ECDCBF 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    z-index: 99999;
    transition: opacity 0.5s ease, visibility 0.5s ease;
}

[data-theme="dark"] .loading-screen {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

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

/* Logo Container */
.loading-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    animation: logoPulse 1.5s ease-in-out infinite;
    border-radius: 50%;
    overflow: hidden;
}

.loading-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.loading-logo svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 4px 20px rgba(216, 64, 64, 0.4));
}

@keyframes logoPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.9;
    }
}

/* Brand Text */
.loading-brand {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #A31D1D;
    letter-spacing: 2px;
    margin-bottom: 32px;
}

[data-theme="dark"] .loading-brand {
    color: #D84040;
}

/* Spinner Container */
.loading-spinner {
    position: relative;
    width: 50px;
    height: 50px;
}

/* Ring Spinner */
.spinner-ring {
    position: absolute;
    width: 50px;
    height: 50px;
    border: 3px solid transparent;
    border-top-color: #D84040;
    border-radius: 50%;
    animation: spinRing 1s linear infinite;
}

.spinner-ring:nth-child(2) {
    width: 40px;
    height: 40px;
    top: 5px;
    left: 5px;
    border-top-color: #A31D1D;
    animation-duration: 0.8s;
    animation-direction: reverse;
}

.spinner-ring:nth-child(3) {
    width: 30px;
    height: 30px;
    top: 10px;
    left: 10px;
    border-top-color: #D84040;
    animation-duration: 0.6s;
}

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

/* Loading Text */
.loading-text {
    margin-top: 24px;
    font-size: 0.875rem;
    color: #5A5A5A;
    letter-spacing: 1px;
}

[data-theme="dark"] .loading-text {
    color: #a0a0a0;
}

/* Loading Dots Animation */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background-color: #D84040;
    border-radius: 50%;
    animation: dotBounce 1.4s ease-in-out infinite both;
}

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

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

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

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

/* Progress Bar */
.loading-progress {
    position: absolute;
    bottom: 60px;
    bottom: calc(60px + env(safe-area-inset-bottom, 0px));
    width: 200px;
    height: 4px;
    background: rgba(216, 64, 64, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #D84040, #A31D1D);
    width: 0%;
    border-radius: 2px;
    animation: loadProgress 2s ease-out forwards;
}

@keyframes loadProgress {
    0% {
        width: 0%;
    }
    50% {
        width: 70%;
    }
    100% {
        width: 100%;
    }
}

/* ===== Skeleton Loading for Content ===== */
.skeleton {
    animation: skeletonPulse 1.5s ease-in-out infinite;
    background: linear-gradient(90deg,
        var(--color-surface) 25%,
        rgba(216, 64, 64, 0.1) 50%,
        var(--color-surface) 75%
    );
    background-size: 200% 100%;
    border-radius: var(--border-radius-sm);
}

@keyframes skeletonPulse {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text.short {
    width: 60%;
}

.skeleton-text.medium {
    width: 80%;
}

.skeleton-title {
    height: 32px;
    width: 50%;
    margin-bottom: 16px;
}

.skeleton-card {
    height: 200px;
    width: 100%;
}

.skeleton-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}
