/**
 * Styles for reliability features
 * Loading states, notifications, and error displays
 */

/* Loading Indicators */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: #f8f9fa;
    border-radius: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #dee2e6;
}

.loading-indicator .spinner-border-sm {
    width: 1.5rem;
    height: 1.5rem;
    border-width: 0.2em;
}

/* Toast Container */
#toast-container {
    z-index: 9999;
}

.toast {
    min-width: 300px;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.toast-body {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.toast-body i {
    font-size: 1.2rem;
}

/* Error Modal */
#error-modal .modal-header {
    border-bottom: none;
}

#error-modal .modal-footer {
    border-top: none;
}

/* Slow Connection Warning */
.alert.mt-2 {
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Status Badges */
.status-badge {
    padding: 0.25rem 0.75rem;
    border-radius: 0.25rem;
    font-weight: 500;
    font-size: 0.875rem;
}

.badge-pass {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.badge-fail {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* Offline Mode Indicator */
.offline-indicator {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    padding: 0.75rem 1.5rem;
    background-color: #ffc107;
    color: #000;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    z-index: 9998;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.offline-indicator i {
    font-size: 1.2rem;
}

/* Retry Button in Error State */
.retry-button {
    margin-top: 1rem;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.retry-button i {
    animation: spin 1s linear infinite;
}

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

/* Loading Skeleton */
.skeleton {
    background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
    background-size: 200% 100%;
    animation: loading 1.5s ease-in-out infinite;
    border-radius: 0.25rem;
}

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

.skeleton-text {
    height: 1rem;
    margin-bottom: 0.5rem;
}

.skeleton-title {
    height: 1.5rem;
    width: 60%;
    margin-bottom: 1rem;
}

/* Success Animation */
.success-checkmark {
    display: inline-block;
    animation: scaleIn 0.3s ease-out;
}

@keyframes scaleIn {
    from {
        transform: scale(0);
    }
    to {
        transform: scale(1);
    }
}

/* Connection Status Indicator */
.connection-status {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.75rem;
    border-radius: 1rem;
    font-size: 0.875rem;
    font-weight: 500;
}

.connection-status.online {
    background-color: #d4edda;
    color: #155724;
}

.connection-status.offline {
    background-color: #f8d7da;
    color: #721c24;
}

.connection-status .status-dot {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

.connection-status.online .status-dot {
    background-color: #28a745;
}

.connection-status.offline .status-dot {
    background-color: #dc3545;
}

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

/* Data Freshness Indicator */
.data-freshness {
    font-size: 0.75rem;
    color: #6c757d;
    font-style: italic;
}

.data-freshness.stale {
    color: #ffc107;
}

.data-freshness.fresh {
    color: #28a745;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .toast {
        min-width: 250px;
    }
    
    .offline-indicator {
        bottom: 0.5rem;
        right: 0.5rem;
        padding: 0.5rem 1rem;
        font-size: 0.875rem;
    }
}
