/**
 * Global Loading Overlay Component
 * Provides a full-page loading animation for dashboard pages
 */

/* Loading overlay container */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 20, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* YOYAKU Logo animation */
.loading-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 24px;
    animation: pulse-logo 1.5s ease-in-out infinite;
}

.loading-logo svg {
    width: 100%;
    height: 100%;
}

@keyframes pulse-logo {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.05);
        opacity: 0.8;
    }
}

/* Vinyl spinner */
.loading-vinyl {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, #1a1a1f, #2d2d35, #1a1a1f);
    position: relative;
    animation: spin-vinyl 1.2s linear infinite;
    margin-bottom: 20px;
}

.loading-vinyl::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    background: var(--accent, #6366f1);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

.loading-vinyl::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 6px;
    height: 6px;
    background: #0f0f14;
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

@keyframes spin-vinyl {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Loading text */
.loading-text {
    color: #a0a0b0;
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.5px;
}

/* Progress bar variant */
.loading-progress {
    width: 200px;
    height: 3px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 16px;
}

.loading-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent, #6366f1), #818cf8);
    border-radius: 2px;
    animation: progress-indeterminate 1.5s ease-in-out infinite;
    width: 30%;
}

@keyframes progress-indeterminate {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(400%); }
}

/* Dots variant */
.loading-dots {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.loading-dots span {
    width: 10px;
    height: 10px;
    background: var(--accent, #6366f1);
    border-radius: 50%;
    animation: bounce-dot 1.4s ease-in-out infinite;
}

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

@keyframes bounce-dot {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Skeleton loading for content */
.skeleton {
    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: skeleton-shimmer 1.5s infinite;
    border-radius: 4px;
}

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

.skeleton-text.short { width: 60%; }
.skeleton-text.medium { width: 80%; }
.skeleton-text.long { width: 100%; }

.skeleton-row {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.skeleton-cell {
    flex: 1;
    height: 16px;
}

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

/* Table loading state */
.table-loading {
    position: relative;
    min-height: 200px;
}

.table-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 20, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Inline spinner for buttons */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin-vinyl 0.8s linear infinite;
}

/* Card loading placeholder */
.card-loading {
    padding: 20px;
    background: var(--card-bg, #1a1a1f);
    border-radius: 8px;
}

.card-loading .skeleton-title {
    height: 20px;
    width: 40%;
    margin-bottom: 16px;
}

.card-loading .skeleton-content {
    height: 100px;
}
