/**
 * ux-001: Loading States - Consistent spinners and skeletons
 * AIPerformRBE theme colors: #006B3F (primary), #2d2d2d (dark bg), #ddd (text)
 */

/* ========================================
   BASE SPINNER STYLES
   ======================================== */

.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(45, 45, 45, 0.85);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: inherit;
}

.loading-overlay.fullscreen {
    position: fixed;
    border-radius: 0;
}

/* Primary Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 107, 63, 0.2);
    border-top-color: #006B3F;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.spinner.sm {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

.spinner.lg {
    width: 60px;
    height: 60px;
    border-width: 5px;
}

.spinner.xl {
    width: 80px;
    height: 80px;
    border-width: 6px;
}

/* White spinner for dark backgrounds */
.spinner.white {
    border-color: rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
}

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

/* Loading Text */
.loading-text {
    margin-top: 16px;
    color: #ddd;
    font-size: 14px;
    font-weight: 500;
}

/* ========================================
   SKELETON LOADERS
   ======================================== */

.skeleton {
    background: linear-gradient(
        90deg,
        #3a3a3a 0%,
        #4a4a4a 50%,
        #3a3a3a 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

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

/* Skeleton text line */
.skeleton-text {
    height: 16px;
    margin-bottom: 8px;
}

.skeleton-text.sm {
    height: 12px;
}

.skeleton-text.lg {
    height: 24px;
}

.skeleton-text.title {
    height: 28px;
    width: 60%;
}

/* Skeleton avatar */
.skeleton-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
}

.skeleton-avatar.sm {
    width: 32px;
    height: 32px;
}

.skeleton-avatar.lg {
    width: 64px;
    height: 64px;
}

/* Skeleton card */
.skeleton-card {
    background: #2d2d2d;
    border-radius: 8px;
    padding: 16px;
}

.skeleton-card .skeleton-image {
    height: 150px;
    margin-bottom: 16px;
    border-radius: 4px;
}

/* Skeleton table row */
.skeleton-table-row {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #3a3a3a;
}

.skeleton-table-row .skeleton-cell {
    height: 20px;
    flex: 1;
}

/* ========================================
   PLAYER CARD SKELETON
   ======================================== */

.player-card-skeleton {
    background: #2d2d2d;
    border-radius: 8px;
    padding: 16px;
    display: flex;
    gap: 16px;
}

.player-card-skeleton .photo {
    width: 80px;
    height: 100px;
    border-radius: 4px;
}

.player-card-skeleton .info {
    flex: 1;
}

.player-card-skeleton .name {
    height: 24px;
    width: 70%;
    margin-bottom: 12px;
}

.player-card-skeleton .team {
    height: 16px;
    width: 50%;
    margin-bottom: 8px;
}

.player-card-skeleton .position {
    height: 16px;
    width: 30%;
}

/* ========================================
   GRID SKELETON
   ======================================== */

.grid-skeleton {
    background: #2d2d2d;
    border-radius: 4px;
    overflow: hidden;
}

.grid-skeleton .header {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: #3a3a3a;
    border-bottom: 2px solid #006B3F;
}

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

.grid-skeleton .rows {
    padding: 8px 0;
}

/* ========================================
   BUTTON LOADING STATE
   ======================================== */

.btn-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

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

.btn-loading.btn-outline-primary::after,
.btn-loading.btn-outline-success::after {
    border-color: rgba(0, 107, 63, 0.3);
    border-top-color: #006B3F;
}

/* ========================================
   PROGRESS INDICATOR
   ======================================== */

.progress-loading {
    height: 4px;
    background: rgba(0, 107, 63, 0.2);
    border-radius: 2px;
    overflow: hidden;
}

.progress-loading::after {
    content: '';
    display: block;
    height: 100%;
    width: 30%;
    background: #006B3F;
    animation: progress-slide 1s ease-in-out infinite;
}

@keyframes progress-slide {
    0% {
        transform: translateX(-100%);
    }
    50% {
        transform: translateX(200%);
    }
    100% {
        transform: translateX(500%);
    }
}

/* ========================================
   CONTENT FADE IN
   ======================================== */

.content-loaded {
    animation: fadeIn 0.3s ease-in;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */

.hide-loading {
    display: none !important;
}

.show-loading {
    display: flex !important;
}

/* Pulse animation for icons */
.loading-pulse {
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}
