/* ============================================================================
   Loading States & Skeleton Loaders
   ============================================================================ */

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

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

/* Skeleton Variants */
.skeleton-text {
    height: 14px;
    margin-bottom: 6px;
}

.skeleton-text-lg {
    height: 20px;
    margin-bottom: 10px;
}

.skeleton-heading {
    height: 24px;
    width: 60%;
    margin-bottom: 12px;
}

.skeleton-card {
    height: 120px;
    margin-bottom: 16px;
}

.skeleton-badge {
    height: 24px;
    width: 80px;
    display: inline-block;
    margin-right: 8px;
}

.skeleton-circle {
    border-radius: 50%;
}

.skeleton-avatar {
    width: 64px;
    height: 64px;
}

/* Scan Results Skeleton */
.skeleton-scan-result {
    padding: 16px;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    margin-bottom: 12px;
}

.skeleton-scan-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.skeleton-grade-badge {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
}

.skeleton-scan-info {
    flex: 1;
}

.skeleton-findings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 12px;
}

.skeleton-finding-card {
    height: 60px;
}

/* Enhanced Progress Bar */
.progress-enhanced {
    height: 24px;
    background-color: #f8f9fa;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.1);
}

.progress-bar-enhanced {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 600;
    color: white;
    transition: width 0.3s ease;
    position: relative;
}

.progress-bar-enhanced.progress-bar-animated {
    background-image: linear-gradient(
        45deg,
        rgba(255, 255, 255, 0.15) 25%,
        transparent 25%,
        transparent 50%,
        rgba(255, 255, 255, 0.15) 50%,
        rgba(255, 255, 255, 0.15) 75%,
        transparent 75%,
        transparent
    );
    background-size: 1rem 1rem;
    animation: progress-bar-stripes 1s linear infinite;
}

@keyframes progress-bar-stripes {
    0% {
        background-position: 1rem 0;
    }
    100% {
        background-position: 0 0;
    }
}

/* Scan Status Card */
.scan-status-card {
    background: linear-gradient(135deg, #0E3A53 0%, #134760 50%, #0E3A53 100%);
    color: white;
    padding: 16px;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

/* Add subtle accent glow */
.scan-status-card::before {
    content: "";
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle at top left, rgba(0, 229, 255, 0.15) 0%, transparent 50%);
    pointer-events: none;
}

.scan-status-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.scan-status-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
}

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

.scan-status-content {
    flex: 1;
}

.scan-status-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 6px;
    line-height: 1.3;
}

.scan-status-detail {
    font-size: 13px;
    opacity: 0.9;
    margin-bottom: 4px;
    line-height: 1.4;
}

.scan-status-time {
    font-size: 11px;
    opacity: 0.8;
    line-height: 1.3;
}

/* Phase Indicator */
.phase-indicator {
    display: flex;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255,255,255,0.2);
}

.phase-step {
    flex: 1;
    height: 3px;
    background: rgba(255,255,255,0.3);
    border-radius: 2px;
    position: relative;
    overflow: hidden;
}

.phase-step.active {
    background: rgba(255,255,255,0.5);
}

.phase-step.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: white;
    animation: phase-progress 2s ease-in-out infinite;
}

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

.phase-step.completed {
    background: white;
}

/* Time Estimate Badge */
.time-estimate {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.2);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
}

.time-estimate i {
    font-size: 12px;
}

/* Pulse Animation for Active States */
.pulse {
    animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

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

/* Loading Dots */
.loading-dots {
    display: inline-flex;
    gap: 4px;
}

.loading-dots span {
    width: 6px;
    height: 6px;
    background: currentColor;
    border-radius: 50%;
    animation: loading-dot 1.4s ease-in-out infinite;
}

.loading-dots span:nth-child(1) {
    animation-delay: 0s;
}

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

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

@keyframes loading-dot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scan Queue Position */
.queue-position {
    background: rgba(255,255,255,0.15);
    padding: 12px 16px;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 13px;
}

.queue-position strong {
    font-weight: 600;
}

/* Compact Mode - Reduce vertical space */
.scan-status-card .d-flex.gap-2 {
    gap: 0.5rem !important;
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .scan-status-card {
        padding: 12px;
    }
    
    .scan-status-spinner {
        width: 28px;
        height: 28px;
        border-width: 2px;
    }
    
    .scan-status-title {
        font-size: 14px;
    }
    
    .scan-status-detail {
        font-size: 12px;
    }
    
    .time-estimate {
        font-size: 10px;
        padding: 3px 8px;
    }
    
    .progress-enhanced {
        height: 20px;
    }
    
    .progress-bar-enhanced {
        font-size: 11px;
    }
    
    .skeleton-findings-grid {
        grid-template-columns: 1fr;
    }
    
    .skeleton-scan-result {
        padding: 12px;
    }
}

/* Modal Specific Styling */
#scanProgressModal {
    z-index: 1055 !important;
}

#scanProgressModal .modal-dialog {
    z-index: 1056 !important;
}

#scanProgressModal .modal-content {
    background: transparent;
    overflow: hidden;
    position: relative;
    z-index: 1057 !important;
}

#scanProgressModal .scan-status-card {
    margin: 0;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    position: relative;
    z-index: 1;
}

#scanProgressModal .modal-body {
    background: transparent;
    overflow: hidden;
    position: relative;
}

#scanProgressModal .skeleton-scan-result {
    background: white !important;
    position: relative !important;
    z-index: 1 !important;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Ensure modal backdrop is below modal content */
.modal-backdrop {
    z-index: 1050 !important;
}

/* Larger modal on desktop for better visibility */
@media (min-width: 992px) {
    #scanProgressModal .modal-lg {
        max-width: 700px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .skeleton {
        background: linear-gradient(90deg, #2a2a2a 25%, #3a3a3a 50%, #2a2a2a 75%);
    }
    
    .progress-enhanced {
        background-color: #2a2a2a;
    }
}
