/**
 * Error & Loading States CSS
 */

/* ========================================
   Offline Banner
   ======================================== */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: #F59E0B;
    color: #000;
    padding: 8px 16px;
    text-align: center;
    font-size: 14px;
    z-index: 10000;
    animation: slideDown 0.3s ease;
}

@keyframes slideDown {
    from { transform: translateY(-100%); }
    to { transform: translateY(0); }
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 350px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: rgba(30, 30, 30, 0.95);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    transform: translateX(120%);
    transition: transform 0.3s ease;
    backdrop-filter: blur(10px);
}

.toast.show {
    transform: translateX(0);
}

.toast-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.toast-message {
    flex: 1;
    font-size: 14px;
    color: #fff;
}

.toast-close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 18px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.toast-close:hover {
    color: #fff;
}

/* Toast types */
.toast-success { border-left: 3px solid #10B981; }
.toast-error { border-left: 3px solid #EF4444; }
.toast-warning { border-left: 3px solid #F59E0B; }
.toast-info { border-left: 3px solid #3B82F6; }
.toast-achievement {
    border-left: 3px solid #F59E0B;
    background: linear-gradient(135deg, rgba(30, 30, 30, 0.95), rgba(50, 40, 20, 0.95));
}

/* ========================================
   Error State
   ======================================== */
.error-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
    min-height: 200px;
}

.error-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.8;
}

.error-message {
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    margin-bottom: 20px;
    max-width: 300px;
}

.error-retry {
    padding: 10px 24px;
    background: var(--color-accent, #3B82F6);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
}

.error-retry:hover {
    background: #2563EB;
}

/* ========================================
   Empty State
   ======================================== */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
}

.empty-icon {
    font-size: 64px;
    margin-bottom: 20px;
    opacity: 0.5;
}

.empty-message {
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
    max-width: 300px;
}

/* ========================================
   Loading State
   ======================================== */
.loading-state {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    min-height: 200px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--color-accent, #3B82F6);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Button spinner */
.btn-spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ========================================
   Skeleton Loader
   ======================================== */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    padding: 16px;
}

.skeleton-item {
    aspect-ratio: 1;
    background: linear-gradient(90deg, 
        rgba(255, 255, 255, 0.05) 25%, 
        rgba(255, 255, 255, 0.1) 50%, 
        rgba(255, 255, 255, 0.05) 75%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 8px;
}

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

/* ========================================
   Image Error State
   ======================================== */
.image-error {
    background: #1a1a1a;
    object-fit: contain;
}

/* ========================================
   Mobile Adjustments
   ======================================== */
@media (max-width: 480px) {
    .toast-container {
        left: 10px;
        right: 10px;
        max-width: none;
    }
    
    .toast {
        width: 100%;
    }
}
