/* Loading animations for trade and coinflip listings */

.listings-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    min-height: 200px;
    color: #999;
    background: rgba(255, 255, 255, 0.02);
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    margin: 10px;
}

.listings-loading.hidden {
    display: none;
}

/* Spinner animation */
.listings-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top: 3px solid #ff4655;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

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

/* Pulsing dots loader */
.listings-dots {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.listings-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #ff4655;
    animation: pulse-dot 1.5s ease-in-out infinite;
}

.listings-dot:nth-child(1) { animation-delay: 0s; }
.listings-dot:nth-child(2) { animation-delay: 0.2s; }
.listings-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes pulse-dot {
    0%, 80%, 100% {
        opacity: 0.3;
        transform: scale(1);
    }
    40% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Loading text */
.listings-loading-text {
    font-size: 16px;
    font-weight: 500;
    color: #ccc;
    margin-bottom: 8px;
    text-align: center;
}

.listings-loading-subtitle {
    font-size: 14px;
    color: #888;
    text-align: center;
    line-height: 1.4;
}

/* Skeleton loading cards */
.listings-skeleton {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 20px;
    width: 100%;
}

.skeleton-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

.skeleton-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 255, 255, 0.05),
        transparent
    );
    animation: skeleton-wave 2s infinite;
}

@keyframes skeleton-shimmer {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.7;
    }
}

@keyframes skeleton-wave {
    0% {
        left: -100%;
    }
    100% {
        left: 100%;
    }
}

.skeleton-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.skeleton-title {
    width: 60%;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.skeleton-value {
    width: 80px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.skeleton-items {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.skeleton-item {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
}

.skeleton-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.skeleton-user {
    width: 100px;
    height: 16px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
}

.skeleton-button {
    width: 80px;
    height: 32px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 6px;
}

/* Trade-specific loading styles */
.trade-listings-loading .listings-loading-text::after {
    content: ' trades...';
}

.player-trades-loading .listings-loading-text::before {
    content: 'Loading player ';
}

.bot-trades-loading .listings-loading-text::before {
    content: 'Loading bot ';
}

/* Coinflip-specific loading styles */
.coinflip-listings-loading .listings-loading-text::after {
    content: ' games...';
}

.player-coinflips-loading .listings-loading-text::before {
    content: 'Loading player ';
}

.bot-coinflips-loading .listings-loading-text::before {
    content: 'Loading bot ';
}

/* Loading overlay for containers */
.listings-container {
    position: relative;
    min-height: 150px;
}

.listings-container.loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(2px);
    z-index: 10;
    border-radius: 12px;
}

.listings-container.loading .listings-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 11;
    margin: 0;
    border-radius: 12px;
    background: rgba(0, 0, 0, 0.8);
}

/* Mobile responsive */
@media (max-width: 768px) {
    .listings-loading {
        padding: 30px 15px;
        min-height: 150px;
    }
    
    .listings-spinner {
        width: 32px;
        height: 32px;
    }
    
    .listings-loading-text {
        font-size: 14px;
    }
    
    .listings-loading-subtitle {
        font-size: 12px;
    }
    
    .skeleton-card {
        padding: 12px;
    }
}

/* Dark mode compatibility */
@media (prefers-color-scheme: dark) {
    .listings-loading {
        background: rgba(255, 255, 255, 0.01);
        border-color: rgba(255, 255, 255, 0.05);
    }
    
    .skeleton-card {
        background: rgba(255, 255, 255, 0.02);
        border-color: rgba(255, 255, 255, 0.05);
    }
}

/* Reduced motion accessibility */
@media (prefers-reduced-motion: reduce) {
    .listings-spinner,
    .listings-dot,
    .skeleton-card,
    .skeleton-card::before {
        animation: none;
    }
    
    .listings-spinner {
        border-top-color: #ff4655;
    }
    
    .listings-dot {
        opacity: 0.6;
    }
    
    .skeleton-card {
        opacity: 0.8;
    }
}
