/* TTC Loading States & Spinners */

/* Loading Container */
.ttc-loading-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--ttc-space-3xl) var(--ttc-space-lg);
    gap: var(--ttc-space-lg);
}

/* Default Spinner */
.ttc-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--ttc-border-light);
    border-top: 3px solid var(--ttc-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

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

/* Small Spinner */
.ttc-spinner.small {
    width: 20px;
    height: 20px;
    border-width: 2px;
}

/* Large Spinner */
.ttc-spinner.large {
    width: 60px;
    height: 60px;
    border-width: 4px;
}

/* Color Variants */
.ttc-spinner.primary {
    border-color: rgba(99, 102, 241, 0.2);
    border-top-color: var(--ttc-primary);
}

.ttc-spinner.success {
    border-color: rgba(16, 185, 129, 0.2);
    border-top-color: #10b981;
}

.ttc-spinner.danger {
    border-color: rgba(239, 68, 68, 0.2);
    border-top-color: #ef4444;
}

.ttc-spinner.warning {
    border-color: rgba(245, 158, 11, 0.2);
    border-top-color: #f59e0b;
}

/* Double Ring Spinner */
.ttc-spinner-double {
    width: 40px;
    height: 40px;
    position: relative;
}

.ttc-spinner-double::before,
.ttc-spinner-double::after {
    content: '';
    position: absolute;
    width: 100%;
    height: 100%;
    border: 3px solid transparent;
    border-radius: 50%;
    border-top-color: var(--ttc-primary);
    animation: spin 1s linear infinite;
}

.ttc-spinner-double::after {
    border-top-color: rgba(99, 102, 241, 0.5);
    animation-duration: 0.7s;
    inset: 4px;
}

/* Dots Spinner */
.ttc-spinner-dots {
    display: flex;
    gap: var(--ttc-space-sm);
    align-items: center;
}

.ttc-spinner-dots span {
    width: 8px;
    height: 8px;
    background: var(--ttc-primary);
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite;
}

.ttc-spinner-dots span:nth-child(2) {
    animation-delay: 0.2s;
}

.ttc-spinner-dots span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes bounce {
    0%, 80%, 100% {
        opacity: 0.5;
        transform: scale(0.8);
    }
    40% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Pulse Spinner */
.ttc-spinner-pulse {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--ttc-primary);
    animation: pulse-ring 1.5s ease-in-out infinite;
}

@keyframes pulse-ring {
    0% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(99, 102, 241, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(99, 102, 241, 0);
    }
}

/* Progress Bar */
.ttc-progress-bar {
    width: 100%;
    height: 4px;
    background: var(--ttc-border-subtle);
    border-radius: var(--ttc-radius-pill);
    overflow: hidden;
}

.ttc-progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--ttc-primary), #a855f7);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: var(--ttc-radius-pill);
}

/* Indeterminate Progress */
.ttc-progress-bar.indeterminate .ttc-progress-bar-fill {
    width: 30%;
    animation: progress-indeterminate 1.5s ease-in-out infinite;
}

@keyframes progress-indeterminate {
    0% {
        transform: translateX(-100%);
    }
    100% {
        transform: translateX(400%);
    }
}

/* Progress Bar with Label */
.ttc-progress-container {
    display: flex;
    flex-direction: column;
    gap: var(--ttc-space-sm);
}

.ttc-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: var(--ttc-fs-sm);
}

.ttc-progress-percent {
    font-weight: var(--ttc-fw-semibold);
    color: var(--ttc-primary);
}

/* Skeleton Loader */
.ttc-skeleton-loader {
    display: flex;
    flex-direction: column;
    gap: var(--ttc-space-md);
}

.ttc-skeleton-item {
    background: linear-gradient(
        90deg,
        var(--ttc-border-subtle),
        var(--ttc-border-light),
        var(--ttc-border-subtle)
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--ttc-radius-md);
}

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

/* Skeleton Shapes */
.ttc-skeleton-line {
    height: 12px;
    border-radius: var(--ttc-radius-sm);
}

.ttc-skeleton-heading {
    height: 24px;
    border-radius: var(--ttc-radius-sm);
    margin-bottom: var(--ttc-space-lg);
}

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

.ttc-skeleton-card {
    height: 200px;
    border-radius: var(--ttc-radius-lg);
}

.ttc-skeleton-table-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--ttc-space-md);
    margin-bottom: var(--ttc-space-md);
}

.ttc-skeleton-table-row .ttc-skeleton-item {
    height: 16px;
}

/* Loading Overlay */
.ttc-loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s ease;
}

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

/* Loading Modal */
.ttc-loading-modal {
    background: var(--ttc-bg-card);
    border-radius: var(--ttc-radius-lg);
    padding: var(--ttc-space-2xl);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--ttc-space-lg);
    box-shadow: var(--ttc-shadow-lg);
}

.ttc-loading-modal-text {
    font-weight: var(--ttc-fw-semibold);
    color: var(--ttc-text-main);
}

.ttc-loading-modal-subtext {
    font-size: var(--ttc-fs-xs);
    color: var(--ttc-text-muted);
}

/* Loader with Status */
.ttc-loader-status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--ttc-space-md);
    text-align: center;
}

.ttc-loader-status-item {
    display: flex;
    align-items: center;
    gap: var(--ttc-space-sm);
    font-size: var(--ttc-fs-xs);
    color: var(--ttc-text-muted);
}

.ttc-loader-status-item.completed {
    color: #10b981;
}

.ttc-loader-status-item.completed::before {
    content: '✓';
    font-weight: var(--ttc-fw-bold);
}

.ttc-loader-status-item.active::before {
    content: '';
    width: 4px;
    height: 4px;
    background: var(--ttc-primary);
    border-radius: 50%;
    animation: pulse 1s ease-in-out infinite;
}

.ttc-loader-status-item.pending::before {
    content: '◦';
    color: var(--ttc-text-muted);
}
