/* LazyLoadingTabSystem CSS - Visual feedback and styling for lazy loading */

/* Loading indicators */
.lazy-loading-indicator {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #dee2e6;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 9999;
    text-align: center;
}

.lazy-loading-indicator.show {
    display: block;
}

.lazy-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #4a7c59;
    border-radius: 50%;
    animation: lazy-spin 1s linear infinite;
    margin: 0 auto 15px;
}

@keyframes lazy-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.lazy-loading-text {
    color: #6c757d;
    font-size: 14px;
    margin: 0;
}

/* Cache status indicators */
.cache-status {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 9998;
    font-size: 12px;
    display: none;
}

.cache-status.show {
    display: block;
}

.cache-status.cache-hit {
    border-left: 4px solid #28a745;
}

.cache-status.cache-miss {
    border-left: 4px solid #ffc107;
}

.cache-status.cache-error {
    border-left: 4px solid #dc3545;
}

/* Performance metrics display */
.performance-metrics {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 9997;
    font-size: 11px;
    max-width: 300px;
    display: none;
}

.performance-metrics.show {
    display: block;
}

.performance-metrics h6 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 12px;
    font-weight: 600;
}

.metric-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
    padding: 2px 0;
}

.metric-label {
    color: #6c757d;
    font-weight: 500;
}

.metric-value {
    color: #495057;
    font-weight: 600;
}

.metric-value.excellent {
    color: #28a745;
}

.metric-value.good {
    color: #17a2b8;
}

.metric-value.warning {
    color: #ffc107;
}

.metric-value.poor {
    color: #dc3545;
}

/* Table loading states */
.table-loading {
    position: relative;
    min-height: 200px;
}

.table-loading::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.8);
    z-index: 1;
}

.table-loading::after {
    content: 'Loading data...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    color: #6c757d;
    font-size: 14px;
}

/* Batch loading indicator */
.batch-loading {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-size: 14px;
}

.batch-loading .spinner-border {
    width: 1rem;
    height: 1rem;
    margin-right: 8px;
}

/* Memory usage indicator */
.memory-usage {
    position: fixed;
    top: 20px;
    left: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 10px 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 9996;
    font-size: 12px;
    display: none;
}

.memory-usage.show {
    display: block;
}

.memory-usage.low {
    border-left: 4px solid #28a745;
}

.memory-usage.medium {
    border-left: 4px solid #ffc107;
}

.memory-usage.high {
    border-left: 4px solid #dc3545;
}

/* Tab-specific loading indicators */
.tab-loading-indicator {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid #f3f3f3;
    border-top: 2px solid #4a7c59;
    border-radius: 50%;
    animation: lazy-spin 1s linear infinite;
    margin-left: 8px;
    vertical-align: middle;
}

.tab-item.loading .tab-loading-indicator {
    display: inline-block;
}

/* Cache management controls */
.cache-controls {
    position: fixed;
    top: 80px;
    right: 20px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid #dee2e6;
    border-radius: 6px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    z-index: 9995;
    font-size: 12px;
    display: none;
}

.cache-controls.show {
    display: block;
}

.cache-controls h6 {
    margin: 0 0 10px 0;
    color: #495057;
    font-size: 12px;
    font-weight: 600;
}

.cache-control-btn {
    display: block;
    width: 100%;
    margin-bottom: 5px;
    padding: 5px 10px;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    background: #fff;
    color: #495057;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.cache-control-btn:hover {
    background: #f8f9fa;
    border-color: #4a7c59;
    color: #4a7c59;
}

.cache-control-btn.danger:hover {
    background: #f8d7da;
    border-color: #dc3545;
    color: #dc3545;
}

/* Lazy loading progress bar */
.lazy-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: #f3f3f3;
    z-index: 10000;
    display: none;
}

.lazy-progress.show {
    display: block;
}

.lazy-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4a7c59, #6c757d);
    width: 0%;
    transition: width 0.3s ease;
}

/* Virtual scrolling indicators */
.virtual-scroll-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: #4a7c59;
    opacity: 0.3;
    pointer-events: none;
}

/* Responsive design */
@media (max-width: 768px) {
    .cache-status,
    .performance-metrics,
    .memory-usage,
    .cache-controls {
        position: static;
        margin: 10px;
        max-width: none;
    }
    
    .lazy-loading-indicator {
        width: 90%;
        max-width: 300px;
    }
}

/* Animation for cache hits */
.cache-hit-animation {
    animation: cacheHit 0.5s ease-in-out;
}

@keyframes cacheHit {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Stale data indicator */
.stale-data-indicator {
    position: absolute;
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
    background: #ffc107;
    border-radius: 50%;
    animation: stalePulse 2s infinite;
}

@keyframes stalePulse {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}

/* Preloading indicator */
.preloading-indicator {
    position: absolute;
    bottom: 5px;
    right: 5px;
    width: 6px;
    height: 6px;
    background: #17a2b8;
    border-radius: 50%;
    animation: preloadPulse 1s infinite;
}

@keyframes preloadPulse {
    0% { opacity: 0.3; }
    50% { opacity: 1; }
    100% { opacity: 0.3; }
}

/* Debug mode styling */
.debug-mode .lazy-loading-indicator,
.debug-mode .cache-status,
.debug-mode .performance-metrics,
.debug-mode .memory-usage,
.debug-mode .cache-controls {
    display: block !important;
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .lazy-loading-indicator,
    .cache-status,
    .performance-metrics,
    .memory-usage,
    .cache-controls {
        border-width: 2px;
        background: #ffffff;
    }
    
    .lazy-loading-spinner {
        border-width: 3px;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .lazy-loading-spinner,
    .tab-loading-indicator {
        animation: none;
    }
    
    .lazy-progress-bar {
        transition: none;
    }
    
    .stale-data-indicator,
    .preloading-indicator {
        animation: none;
        opacity: 0.7;
    }
}
