/**
 * loading-skeleton (Wave D5a)
 *
 * Component contract (Phase C):
 * - Unknown / pending data → .skeleton-card + .skeleton-line (or .skeleton-row)
 * - Known empty result     → .empty-state (styles.css), not a blank skeleton forever
 * - Inline busy in table   → .loading-spinner
 * Respects prefers-reduced-motion via global reduce rule in styles.css.
 */

/* --- styles.css L4218-L4469 --- */
/* === Loading States (Enhanced for Mobile) === */

/* Inline loading spinner for tables and small containers */
.loading-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    color: var(--text-secondary);
    font-size: 16px;
    gap: 12px;
}

.loading-spinner::before {
    content: '';
    width: 28px;
    height: 28px;
    border: 3px solid var(--border-color);
    border-top-color: var(--brand-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

/* Full page loading overlay */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(18, 18, 18, 0.85);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    gap: 16px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loading-overlay .spinner-large {
    width: 56px;
    height: 56px;
    border: 4px solid var(--brand-tint-20, rgba(var(--brand-color-rgb), 0.2));
    border-top-color: var(--brand-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-overlay .loading-text {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* Container-specific loading (for cards, sections) */
.loading-container {
    position: relative;
    min-height: 100px;
}

.loading-container::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(var(--bg-surface-1), 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease;
    z-index: 10;
}

.loading-container.is-loading::after {
    opacity: 1;
    visibility: visible;
}

.loading-container.is-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 40px;
    height: 40px;
    border: 3px solid var(--border-color);
    border-top-color: var(--brand-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 11;
}

/* Button loading state */
.btn-loading,
button.is-loading {
    position: relative;
    color: transparent !important;
    pointer-events: none;
}

.btn-loading::after,
button.is-loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin: -10px 0 0 -10px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* Table loading row */
.table-loading-row td {
    text-align: center;
    padding: 40px !important;
}

.table-loading-row .loading-spinner {
    padding: 20px;
}

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

/* Skeleton Loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-surface-1) 25%, var(--bg-card) 50%, var(--bg-surface-1) 75%);
    background-size: 200% 100%;
    animation: skeleton-loading 1.5s infinite;
    border-radius: 4px;
    width: 100%;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: 4px;
}

.skeleton-title {
    height: 1.5em;
    width: 60%;
    margin-bottom: 1em;
}

.skeleton-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 20px;
}

.skeleton-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    margin-right: 15px;
}

.skeleton-row {
    display: flex;
    align-items: center;
    margin-bottom: 15px;
}

.skeleton-table-row {
    height: 48px;
    margin-bottom: 8px;
    border-radius: 8px;
}

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

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

/* Responsive adjustments */
@media (max-width: 768px) and (hover: none) and (pointer: coarse) {
    .user-stats-bar {
        justify-content: center;
    }

    .panel-header-inline {
        flex-direction: column;
    }

    .stat-item {
        min-width: 80px;
        padding: calc(var(--spacing-unit) * 1.5);
    }

    .stat-number {
        font-size: 22px;
    }

    .user-filter-bar {
        flex-direction: column;
    }

    .search-box {
        width: 100%;
    }

    .filter-group {
        width: 100%;
        justify-content: space-between;
    }

    .filter-group select {
        flex: 1;
        min-width: auto;
    }

    .pagination-container {
        flex-direction: column;
        gap: calc(var(--spacing-unit) * 1.5);
    }

    .page-numbers {
        order: -1;
    }
}

/* assessment styles (L5850-L8399) → styles/modules/assessment.css */

/* auth styles (L5132-L5625) → styles/modules/auth.css */


/* --- styles.css L5047-L5306 --- */
/* ============= SKELETON LOADING ============= */
@keyframes skeleton-shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.skeleton {
    background: linear-gradient(90deg,
        var(--bg-surface-1) 25%,
        var(--bg-card) 50%,
        var(--bg-surface-1) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-text {
    height: 1em;
    margin-bottom: 0.5em;
    border-radius: 4px;
}

.skeleton-text.title {
    height: 1.5em;
    width: 60%;
}

.skeleton-text.subtitle {
    height: 1em;
    width: 40%;
}

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

.skeleton-card {
    padding: 20px;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
    background: var(--bg-card);
}

.skeleton-stat {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px;
}

.skeleton-stat .skeleton-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
}

.skeleton-stat .skeleton-value {
    height: 2em;
    width: 50%;
}

.skeleton-stat .skeleton-label {
    height: 1em;
    width: 70%;
}

/* Skeleton Table */
.skeleton-table {
    width: 100%;
}

.skeleton-row {
    display: flex;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-row:last-child {
    border-bottom: none;
}

.skeleton-cell {
    height: 1em;
    flex: 1;
}

.skeleton-cell.small {
    flex: 0.5;
}

.skeleton-cell.large {
    flex: 2;
}

/* Skeleton List Item */
.skeleton-list-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    border-bottom: 1px solid var(--border-color);
}

.skeleton-list-item .skeleton-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Stats Grid Skeleton */
.skeleton-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
}

/* Chart Skeleton */
.skeleton-chart {
    height: 200px;
    border-radius: var(--border-radius);
}

/* Form Skeleton */
.skeleton-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.skeleton-input {
    height: 44px;
    border-radius: 8px;
}

.skeleton-button {
    height: 44px;
    width: 120px;
    border-radius: 8px;
}

/* Hide content when loading */
.loading-skeleton > *:not(.skeleton-container) {
    display: none !important;
}

.skeleton-container {
    width: 100%;
}

/* Skeleton wrapper for JS utilities */
.skeleton-wrapper {
    padding: 16px;
}

.skeleton-line {
    height: 14px;
    margin-bottom: 12px;
    background: linear-gradient(90deg,
        var(--bg-surface-1) 25%,
        var(--bg-card) 50%,
        var(--bg-surface-1) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px;
}

.skeleton-line.short {
    width: 60%;
}

.skeleton-line.skeleton-title {
    height: 20px;
    width: 70%;
    margin-bottom: 16px;
}

.skeleton-item {
    height: 48px;
    margin-bottom: 8px;
    background: linear-gradient(90deg,
        var(--bg-surface-1) 25%,
        var(--bg-card) 50%,
        var(--bg-surface-1) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-chart-bar {
    width: 40px;
    display: inline-block;
    margin-right: 8px;
    background: linear-gradient(90deg,
        var(--bg-surface-1) 25%,
        var(--bg-card) 50%,
        var(--bg-surface-1) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 4px 4px 0 0;
    vertical-align: bottom;
}

.skeleton-stat-card {
    height: 80px;
    width: 100%;
    display: inline-block;
    margin-right: 12px;
    margin-bottom: 12px;
    background: linear-gradient(90deg,
        var(--bg-surface-1) 25%,
        var(--bg-card) 50%,
        var(--bg-surface-1) 75%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s ease-in-out infinite;
    border-radius: 8px;
}

.skeleton-stats {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.skeleton-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.skeleton-table .skeleton-row.header {
    height: 40px;
    background: var(--bg-surface-2);
}

.container.loading {
    min-height: 200px;
}

/* Spinner small for buttons */
.spinner-small {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 50%;
    border-top-color: #fff;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
    margin-right: 6px;
}

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



