/* assets/css/components/loading-indicator.css */

/* Base loading indicator */
.loading-indicator {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100px;
}

/* Base loading spinner */
.loading-spinner {
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50% !important;
    border-top: 4px solid var(--primary-color);
    width: 30px !important;
    height: 30px !important;
    animation: spin 1s linear infinite;
    margin-right: 10px;
}

/* Spin animation - used by all spinners */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* === NEW: Table Loading Indicators === */

/* Table loading spinner (shows in table header during pagination) */
.table-loading-spinner {
    display: inline-block;
    margin-left: 10px;
    width: 16px !important;
    height: 16px !important;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-top: 2px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    vertical-align: middle;
    margin-right: 0;
}

/* Table loading state - reduced opacity during load */
.orders-table-container table[style*="opacity: 0.5"] {
    cursor: wait;
    user-select: none;
}

/* === Loading Overlay Variants === */

/* Loading overlay for full dashboard */
.loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Background comes from base_style's .loading-overlay so it follows the
       theme. This copy - the sixth in the app - is the one that was actually
       winning, because a feature stylesheet loads after the shell's. */
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    flex-direction: column;
    gap: 1rem;
}

.loading-overlay .loading-spinner {
    width: 50px !important;
    height: 50px !important;
    border-width: 4px;
}

/* Header loading indicator */
.loading-indicator-header {
    display: flex;
    align-items: center;
    margin-left: 20px;
    color: var(--myceo-text-secondary);
    gap: 8px;
    font-size: 0.9rem;
}

.loading-indicator-header .loading-spinner {
    width: 16px !important;
    height: 16px !important;
    border-width: 2px;
}

/* === Additional Loading States === */

/* Inline loading indicator for smaller components */
.inline-loading {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.875rem;
    color: var(--myceo-text-secondary);
}

.inline-loading .loading-spinner {
    width: 14px !important;
    height: 14px !important;
    border-width: 2px;
}

/* Loading text animation */
.loading-text {
    display: inline-block;
    animation: pulse 1.5s ease-in-out infinite;
}

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

/* Skeleton loading placeholders */
.skeleton {
    background: linear-gradient(90deg, var(--myceo-surface-1) 25%, var(--myceo-surface-2) 50%, var(--myceo-surface-1) 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 4px;
}

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

/* Prevent interaction during loading */
.loading-state {
    pointer-events: none;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

/* Success/Error states after loading */
.load-success {
    animation: fadeIn 0.3s ease;
}

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

.load-error {
    color: var(--myceo-status-critical);
    padding: 1rem;
    text-align: center;
    background: rgba(225, 29, 72, 0.12);
    border-radius: 4px;
    margin: 1rem 0;
}

/* Mobile responsive loading indicators */
@media (max-width: 768px) {
    .loading-spinner {
        width: 32px !important;
        height: 32px !important;
        border-width: 3px;
    }
    
    .loading-overlay .loading-spinner {
        width: 40px !important;
        height: 40px !important;
    }
    
    .table-loading-spinner {
        width: 14px !important;
        height: 14px !important;
    }
}