/* ===========================
   LOADING STATES & SKELETONS
   =========================== */

/* Spinner Loader */
.spinner {
    display: inline-block;
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.spinner.small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner.large {
    width: 60px;
    height: 60px;
    border-width: 5px;
}

/* Loading Container */
.loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 40px 20px;
    min-height: 200px;
}

.loading-text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
}

/* Skeleton Loader */
.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-loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

@keyframes skeleton-loading {
    0% {
        background-position: 200% 0;
    }
    100% {
        background-position: -200% 0;
    }
}

/* Skeleton Shapes */
.skeleton-text {
    height: 16px;
    margin: 8px 0;
}

.skeleton-text.title {
    height: 24px;
    width: 60%;
}

.skeleton-text.subtitle {
    height: 18px;
    width: 40%;
}

.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-avatar.large {
    width: 80px;
    height: 80px;
}

.skeleton-image {
    width: 100%;
    height: 200px;
}

/* Member Card Skeleton */
.skeleton-member-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    background: rgba(26, 26, 26, 0.6);
    border: 1px solid #333;
    border-radius: 8px;
    margin-bottom: 12px;
}

.skeleton-member-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Ship Card Skeleton */
.skeleton-ship-card {
    display: flex;
    gap: 16px;
    padding: 16px;
    background: rgba(26, 26, 26, 0.6);
    border: 1px solid #333;
    border-radius: 8px;
    margin-bottom: 12px;
}

.skeleton-ship-icon {
    width: 60px;
    height: 60px;
    border-radius: 8px;
}

.skeleton-ship-details {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-ship-specs {
    display: flex;
    gap: 12px;
}

.skeleton-ship-specs .skeleton {
    width: 80px;
    height: 14px;
}

/* Grid Skeleton */
.skeleton-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    padding: 20px;
}

/* Pulse Animation (alternative to shimmer) */
.pulse {
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 0.8;
    }
}

/* Loading Overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    backdrop-filter: blur(4px);
}

.loading-overlay .spinner {
    width: 60px;
    height: 60px;
}

/* Button Loading State */
.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    top: 50%;
    left: 50%;
    margin-left: -8px;
    margin-top: -8px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Progress Bar */
.progress-bar {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-gold), #ffd700);
    transition: width 0.3s ease;
}

.progress-bar-indeterminate {
    height: 100%;
    background: linear-gradient(90deg, var(--accent-gold), #ffd700);
    animation: indeterminate 1.5s ease-in-out infinite;
    width: 30%;
}

@keyframes indeterminate {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(400%);
    }
}

/* Hide when loaded */
.loaded .skeleton,
.loaded .loading-container,
.loaded .loading-overlay {
    display: none;
}

/* Responsive */
@media (max-width: 768px) {
    .skeleton-grid {
        grid-template-columns: 1fr;
    }
    
    .loading-container {
        min-height: 150px;
        padding: 30px 15px;
    }
}
