/* ========================================
   Unified Loading & Status Components
   ======================================== */

/* === Spinner === */
.esm-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: esm-spin 0.8s linear infinite;
}

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

.esm-spinner-lg {
    width: 24px;
    height: 24px;
    border-width: 3px;
}

.esm-spinner-primary {
    border-color: var(--primary-subtle);
    border-top-color: var(--primary);
}

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

/* === Status Icons (for queue items, thumbnails) === */
.esm-status-icon {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 600;
    line-height: 1;
}

/* Pending - clock/hourglass style */
.esm-status-icon.pending {
    background: var(--text-subtle);
    color: var(--bg-app);
}

.esm-status-icon.pending::before {
    content: '○';
    font-size: 8px;
}

/* Processing - animated spinner */
.esm-status-icon.processing {
    background: var(--primary);
    animation: esm-pulse 1s infinite;
}

.esm-status-icon.processing::before {
    content: '';
    width: 8px;
    height: 8px;
    border: 1.5px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: esm-spin 0.6s linear infinite;
}

/* Completed - checkmark */
.esm-status-icon.completed,
.esm-status-icon.done {
    background: var(--success);
    color: white;
}

.esm-status-icon.completed::before,
.esm-status-icon.done::before {
    content: '✓';
    font-size: 10px;
}

/* Failed - X mark */
.esm-status-icon.failed,
.esm-status-icon.error {
    background: var(--error);
    color: white;
}

.esm-status-icon.failed::before,
.esm-status-icon.error::before {
    content: '✕';
    font-size: 9px;
}

/* Skipped - dash */
.esm-status-icon.skipped {
    background: var(--text-subtle);
    color: white;
}

.esm-status-icon.skipped::before {
    content: '–';
    font-size: 12px;
}

@keyframes esm-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* === Progress Bar === */
.esm-progress {
    height: 4px;
    background: var(--border-divider);
    border-radius: var(--radius-full);
    overflow: hidden;
}

.esm-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-dark), var(--primary-light));
    border-radius: var(--radius-full);
    transition: width 0.3s ease;
}

.esm-progress-fill.success {
    background: var(--success);
}

.esm-progress-fill.error {
    background: var(--error);
}

/* === Progress Container (floating style) === */
.esm-progress-toast {
    position: fixed;
    bottom: var(--space-xl);
    left: 50%;
    transform: translateX(-50%);
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border-radius: var(--radius-lg);
    border: 1px solid var(--glass-border);
    padding: var(--space-md) var(--space-xl);
    min-width: 300px;
    box-shadow: var(--shadow-xl);
    z-index: 1000;
    display: none;
}

.esm-progress-toast.active {
    display: block;
}

.esm-progress-toast .progress-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.esm-progress-toast .progress-text {
    font-size: var(--font-size-sm);
    color: var(--text-medium);
}

.esm-progress-toast .progress-percent {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--primary-light);
}

.esm-progress-toast .progress-detail {
    font-size: var(--font-size-xs);
    color: var(--text-subtle);
    margin-top: var(--space-sm);
}

/* === Processing Indicator (animated dots) === */
.esm-processing-dots {
    color: var(--primary);
    font-weight: var(--font-weight-medium);
}

.esm-processing-dots::after {
    content: '';
    animation: esm-dots 1.5s infinite;
}

@keyframes esm-dots {
    0%, 20% { content: ''; }
    40% { content: '.'; }
    60% { content: '..'; }
    80%, 100% { content: '...'; }
}

/* === Loading Skeleton === */
.esm-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: esm-skeleton-shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
}

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

/* === Loading Overlay === */
.esm-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(20, 25, 25, 0.85);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    min-height: 150px;
    border-radius: inherit;
    animation: esm-overlay-in 0.2s ease-out;
}

@keyframes esm-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.esm-loading-overlay .esm-overlay-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.08);
    border-top-color: var(--primary-light, #5eead4);
    border-radius: 50%;
    animation: esm-spin 0.7s linear infinite;
    box-shadow: 0 0 16px rgba(94, 234, 212, 0.15);
}

.esm-loading-overlay .esm-overlay-message {
    margin-top: 0.75rem;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-medium, #c5c9c9);
    letter-spacing: 0.01em;
}
