/* ============================================
   LOADING STATES COMPONENTS
   ============================================ */

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

.btn-loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.btn-spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

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

/* ============================================
   SKELETON LOADING
   ============================================ */

.skeleton-wrapper {
    padding: 16px 0;
}

.skeleton-row {
    display: flex;
    gap: 16px;
    align-items: center;
    padding: 12px 0;
}

.skeleton-cell {
    background: linear-gradient(
        90deg,
        #f0f0f0 25%,
        #e0e0e0 50%,
        #f0f0f0 75%
    );
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s ease-in-out infinite;
    border-radius: 6px;
}

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

/* Skeleton Avatar */
.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

/* Skeleton Text Variants */
.skeleton-text {
    height: 16px;
}

.skeleton-text--full {
    flex: 1;
}

.skeleton-text--medium {
    width: 60%;
}

.skeleton-text--short {
    width: 30%;
}

.skeleton-text--large {
    height: 20px;
    width: 80%;
}

/* Skeleton Badge */
.skeleton-badge {
    width: 80px;
    height: 24px;
    border-radius: 12px;
}

/* Table Skeleton */
.skeleton-table-row td {
    padding: 16px 12px;
}

.skeleton-table-row .skeleton-text {
    height: 14px;
}

/* ============================================
   GLOBAL SPINNER OVERLAY
   ============================================ */

.global-spinner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99999;
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.global-spinner-content {
    text-align: center;
}

.global-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: #ffffff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

.global-spinner-message {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    margin: 0;
}

/* ============================================
   INLINE SPINNER
   ============================================ */

.inline-spinner {
    display: inline-block;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    vertical-align: middle;
}

.inline-spinner--small {
    width: 12px;
    height: 12px;
    border: 2px solid rgba(37, 99, 235, 0.2);
    border-top-color: #2563eb;
}

.inline-spinner--medium {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(37, 99, 235, 0.2);
    border-top-color: #2563eb;
}

.inline-spinner--large {
    width: 24px;
    height: 24px;
    border: 3px solid rgba(37, 99, 235, 0.2);
    border-top-color: #2563eb;
}

/* ============================================
   INPUT LOADING STATE
   ============================================ */

.input-loading {
    position: relative;
}

.input-loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ============================================
   SEARCH LOADING STATE
   ============================================ */

.search-input-loading {
    background-image: none !important;
    padding-right: 40px;
}

.search-input-loading::after {
    content: '';
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    border: 2px solid #cbd5e1;
    border-top-color: #2563eb;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* ============================================
   EMPTY STATES
   ============================================ */

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #64748b;
}

.empty-state__icon {
    font-size: 48px;
    color: #cbd5e1;
    margin-bottom: 16px;
}

.empty-state__title {
    font-size: 18px;
    font-weight: 600;
    color: #475569;
    margin: 0 0 8px 0;
}

.empty-state__message {
    font-size: 14px;
    color: #64748b;
    margin: 0;
}

/* ============================================
   MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 640px) {
    .skeleton-row {
        gap: 12px;
        padding: 10px 0;
    }
    
    .skeleton-avatar {
        width: 32px;
        height: 32px;
    }
    
    .global-spinner {
        width: 40px;
        height: 40px;
    }
}
