/* ================================================================
   CHRONOS UI - BOOTSTRAP 5.3 LOADING ANIMATIONS
   Enhanced loading overlays for ChronosUI integration
   ================================================================ */

/* ChronosUI Global Loading Overlay */
.bootstrap-loading-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background-color: rgba(0, 0, 0, 0.6) !important;
    z-index: 9999 !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    backdrop-filter: blur(2px);
    transition: opacity 0.3s ease-in-out;
}

.bootstrap-loading-content {
    background: var(--bs-body-bg, #ffffff) !important;
    padding: 2rem !important;
    border-radius: var(--bs-border-radius-lg, 0.75rem) !important;
    text-align: center !important;
    box-shadow: var(--bs-box-shadow-lg, 0 1rem 3rem rgba(0, 0, 0, 0.175)) !important;
    min-width: 250px !important;
    border: 1px solid var(--bs-border-color, #dee2e6);
}

.bootstrap-loading-content .spinner-border {
    width: 3rem !important;
    height: 3rem !important;
    margin-bottom: 1rem !important;
}

.bootstrap-loading-text {
    font-weight: 500 !important;
    color: var(--bs-secondary, #6c757d) !important;
    font-size: 1.1rem;
    margin-top: 1rem !important;
}

/* Dark mode support for loading overlay */
[data-bs-theme="dark"] .bootstrap-loading-content {
    background: var(--bs-dark, #212529) !important;
    border-color: var(--bs-border-color, #495057);
}

[data-bs-theme="dark"] .bootstrap-loading-text {
    color: var(--bs-light, #f8f9fa) !important;
}

/* Grid Loading Overlays */
.grid-loading-overlay {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(255, 255, 255, 0.92) !important;
    z-index: 1050 !important;
    border-radius: 6px;
    backdrop-filter: blur(2px);
    transition: opacity 0.2s ease-in-out;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

[data-bs-theme="dark"] .grid-loading-overlay {
    background: rgba(33, 37, 41, 0.92) !important;
}

.grid-loading-overlay .spinner-border {
    width: 2rem !important;
    height: 2rem !important;
    margin-bottom: 0.5rem !important;
}

.grid-loading-overlay .text-muted {
    font-size: 0.9rem;
    font-weight: 500;
}

/* Grid Container Enhancements */
.grid-view.card {
    overflow: hidden;
    position: relative;
    border: 1px solid var(--bs-border-color, #dee2e6);
}

.grid-view.card .table {
    margin-bottom: 0 !important;
}

.grid-view.card .table th,
.grid-view.card .table td {
    border-color: var(--bs-border-color, #dee2e6);
    padding: 0.75rem;
}

.grid-view.card .table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: var(--bs-gray-50, rgba(248, 249, 250, 0.5));
}

[data-bs-theme="dark"] .grid-view.card .table-striped > tbody > tr:nth-of-type(odd) > td {
    background-color: rgba(255, 255, 255, 0.05);
}

.grid-view.card .table-hover > tbody > tr:hover > td {
    background-color: var(--bs-primary-bg-subtle, rgba(13, 110, 253, 0.125));
}

[data-bs-theme="dark"] .grid-view.card .table-hover > tbody > tr:hover > td {
    background-color: rgba(13, 110, 253, 0.25);
}

/* Loading State for Grid */
.grid-view.grid-loading {
    opacity: 0.8;
    pointer-events: none;
}

.grid-view.grid-loading .table {
    transition: opacity 0.2s ease-in-out;
}

/* Spinner size variants */
.spinner-border-xs {
    width: 1rem;
    height: 1rem;
}

.spinner-border-sm {
    width: 1.5rem;
    height: 1.5rem;
}

.spinner-border-lg {
    width: 3rem;
    height: 3rem;
}

.spinner-border-xl {
    width: 4rem;
    height: 4rem;
}

/* Animation for fade effects */
@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.9); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes fadeOut {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0; transform: scale(0.9); }
}

.bootstrap-loading-overlay {
    animation: fadeIn 0.3s ease-in-out;
}

.grid-loading-overlay {
    animation: fadeIn 0.2s ease-in-out;
}

/* Pulse animation for loading states */
@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

.loading-pulse {
    animation: pulse 1.5s infinite;
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .bootstrap-loading-overlay,
    .grid-loading-overlay,
    .grid-view.grid-loading .table,
    .loading-pulse {
        transition: none !important;
        animation: none !important;
    }
    
    .bootstrap-loading-overlay {
        transform: none !important;
    }
}

/* RTL support for loading overlays */
[dir="rtl"] .bootstrap-loading-content {
    text-align: center; /* Center alignment works for both directions */
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .bootstrap-loading-overlay {
        background-color: rgba(0, 0, 0, 0.8) !important;
    }
    
    .bootstrap-loading-content {
        border: 2px solid !important;
    }
    
    .grid-loading-overlay {
        background: rgba(255, 255, 255, 0.95) !important;
    }
    
    [data-bs-theme="dark"] .grid-loading-overlay {
        background: rgba(0, 0, 0, 0.95) !important;
    }
}

/* Print styles - hide loading overlays */
@media print {
    .bootstrap-loading-overlay,
    .grid-loading-overlay {
        display: none !important;
    }
}
