/* ==========================================
   LOADING STATES & SKELETON SCREENS
   ========================================== */

/* Skeleton animation */
@keyframes skeleton-loading {
    0% {
        background-position: -200px 0;
    }

    100% {
        background-position: calc(200px + 100%) 0;
    }
}

.skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 0%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(255, 255, 255, 0.03) 100%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

/* Chat List Skeleton */
.chat-list-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
}

.chat-item-skeleton {
    display: flex;
    align-items: center;
    padding: 12px;
    background: #23272f;
    border-radius: 8px;
    gap: 12px;
}

.chat-item-skeleton .avatar-skeleton {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chat-item-skeleton .content-skeleton {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.chat-item-skeleton .name-skeleton {
    width: 120px;
    height: 14px;
}

.chat-item-skeleton .message-skeleton {
    width: 180px;
    height: 12px;
}

.chat-item-skeleton .time-skeleton {
    width: 40px;
    height: 10px;
    margin-left: auto;
}

/* Message Skeleton */
.message-list-skeleton {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 16px;
}

.message-skeleton {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.message-skeleton.received {
    flex-direction: row;
}

.message-skeleton.sent {
    flex-direction: row-reverse;
}

.message-skeleton .avatar-skeleton {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
}

.message-skeleton .bubble-skeleton {
    max-width: 60%;
    height: 60px;
    border-radius: 12px;
}

.message-skeleton.sent .bubble-skeleton {
    background: linear-gradient(90deg,
            rgba(88, 101, 242, 0.3) 0%,
            rgba(88, 101, 242, 0.5) 50%,
            rgba(88, 101, 242, 0.3) 100%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

.message-skeleton.received .bubble-skeleton {
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0.03) 0%,
            rgba(255, 255, 255, 0.08) 50%,
            rgba(255, 255, 255, 0.03) 100%);
    background-size: 200px 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
}

/* Info Panel Skeleton */
.info-panel-skeleton {
    padding: 20px;
}

.info-panel-skeleton .profile-header-skeleton {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin-bottom: 24px;
}

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

.info-panel-skeleton .name-large-skeleton {
    width: 140px;
    height: 18px;
}

.info-panel-skeleton .info-row-skeleton {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.info-panel-skeleton .label-skeleton {
    width: 60px;
    height: 14px;
}

.info-panel-skeleton .value-skeleton {
    width: 100px;
    height: 14px;
}

/* Loading Spinner (for inline loading) */
.loading-spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: #5865f2;
    animation: spinner-rotate 0.8s linear infinite;
}

@keyframes spinner-rotate {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

.loading-spinner.large {
    width: 40px;
    height: 40px;
    border-width: 4px;
}

/* Loading overlay */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(24, 26, 32, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    backdrop-filter: blur(2px);
}

.loading-overlay .loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #fff;
}

.loading-overlay .loading-text {
    font-size: 14px;
    opacity: 0.8;
}

/* Shimmer effect (alternative to skeleton) */
.shimmer {
    position: relative;
    overflow: hidden;
}

.shimmer::after {
    content: "";
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    left: 0;
    transform: translateX(-100%);
    background: linear-gradient(90deg,
            rgba(255, 255, 255, 0) 0,
            rgba(255, 255, 255, 0.1) 20%,
            rgba(255, 255, 255, 0.2) 60%,
            rgba(255, 255, 255, 0));
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    100% {
        transform: translateX(100%);
    }
}

/* Hide content while loading */
.loading-container {
    position: relative;
    min-height: 200px;
}

.loading-container.is-loading>*:not(.loading-overlay):not(.skeleton) {
    opacity: 0.3;
    pointer-events: none;
}