/* Enhanced Pipeline Progress Styling */

/* ====================
   BASE COMPONENT STYLES 
   ==================== */

.pipeline-progress-enhanced {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

.pipeline-progress-enhanced:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

/* Glass inner elements */
.glass-inner {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ====================
   PIPELINE STAGES VISUALIZATION 
   ==================== */

.pipeline-stages-container {
    position: relative;
    overflow-x: auto;
    overflow-y: visible;
    padding: 20px 0;
}

.stages-progress-track {
    display: flex;
    align-items: flex-start;
    gap: 0;
    min-width: 100%;
    position: relative;
    padding: 0 10px;
}

/* Stage Item Base Styles */
.stage-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    min-width: 80px;
    position: relative;
    transition: all 0.3s ease;
}

.stage-item.parallel-stage {
    min-width: 140px;
    flex: 1.5;
}

/* Stage Node (Icon Container) */
.stage-node {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin-bottom: 8px;
}

.stage-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f3f4f6;
    border: 2px solid #e5e7eb;
    transition: all 0.3s ease;
    z-index: 2;
    position: relative;
}

.stage-connector {
    position: absolute;
    top: 50%;
    left: 50%;
    right: -50%;
    height: 2px;
    background: #e5e7eb;
    transform: translateY(-50%);
    z-index: 1;
}

/* Remove connector from last stage */
.stage-item:last-child .stage-connector {
    display: none;
}

/* Stage Labels and Info */
.stage-info {
    text-align: center;
    width: 100%;
}

.stage-label {
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    margin-bottom: 2px;
    line-height: 1.2;
}

.stage-timing {
    font-size: 9px;
    color: #9ca3af;
    line-height: 1;
}

/* ====================
   STAGE STATES 
   ==================== */

/* Pending State */
.stage-item[data-state="pending"] .stage-icon {
    background: #f9fafb;
    border-color: #e5e7eb;
    color: #9ca3af;
}

/* Active State */
.stage-item[data-state="active"] .stage-icon {
    background: #3b82f6;
    border-color: #2563eb;
    color: white;
    animation: pulse-active 2s infinite;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.stage-item[data-state="active"] .stage-label {
    color: #3b82f6;
    font-weight: 600;
}

.stage-item[data-state="active"] .stage-connector {
    background: linear-gradient(to right, #3b82f6 50%, #e5e7eb 50%);
    background-size: 20px 2px;
    animation: connector-progress 1s linear infinite;
}

/* Completed State */
.stage-item[data-state="completed"] .stage-icon {
    background: #10b981;
    border-color: #059669;
    color: white;
}

.stage-item[data-state="completed"] .stage-label {
    color: #10b981;
    font-weight: 500;
}

.stage-item[data-state="completed"] .stage-connector {
    background: #10b981;
}

/* Error State */
.stage-item[data-state="error"] .stage-icon {
    background: #ef4444;
    border-color: #dc2626;
    color: white;
    animation: shake 0.5s ease-in-out;
}

.stage-item[data-state="error"] .stage-label {
    color: #ef4444;
    font-weight: 600;
}

/* Stage-Specific Icon Colors for Active State */
.stage-item[data-stage="queued"][data-state="active"] .stage-icon {
    background: #f59e0b;
    border-color: #d97706;
}

.stage-item[data-stage="ai_inference"][data-state="active"] .stage-icon {
    background: #8b5cf6;
    border-color: #7c3aed;
}

.stage-item[data-stage="par_scoring"][data-state="active"] .stage-icon {
    background: #10b981;
    border-color: #059669;
}

/* ====================
   PARALLEL PAR COMPONENTS 
   ==================== */

.parallel-components {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
}

.component-progress {
    display: flex;
    align-items: center;
    gap: 6px;
}

.component-name {
    font-size: 8px;
    font-weight: 500;
    color: #6b7280;
    min-width: 35px;
    text-align: left;
}

.component-bar {
    flex: 1;
    height: 3px;
    background: #f3f4f6;
    border-radius: 2px;
    overflow: hidden;
}

.component-fill {
    height: 100%;
    background: linear-gradient(to right, #10b981, #059669);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 2px;
}

/* Component-specific colors */
.component-progress[data-component="anterior"] .component-fill {
    background: linear-gradient(to right, #3b82f6, #2563eb);
}

.component-progress[data-component="overjet"] .component-fill {
    background: linear-gradient(to right, #8b5cf6, #7c3aed);
}

.component-progress[data-component="overbite"] .component-fill {
    background: linear-gradient(to right, #06b6d4, #0891b2);
}

.component-progress[data-component="buccal"] .component-fill {
    background: linear-gradient(to right, #f59e0b, #d97706);
}

.component-progress[data-component="centreline"] .component-fill {
    background: linear-gradient(to right, #ef4444, #dc2626);
}

/* ====================
   OVERALL PROGRESS BAR 
   ==================== */

.progress-bar-container {
    width: 100%;
}

.progress-bar-track {
    width: 100%;
    height: 8px;
    background: #f3f4f6;
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, #3b82f6, #8b5cf6, #10b981);
    border-radius: 4px;
    position: relative;
    overflow: hidden;
}

.progress-bar-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%);
    animation: shimmer 2s infinite;
}

/* ====================
   STATUS BADGE 
   ==================== */

.pipeline-status-badge {
    transition: all 0.3s ease;
}

.pipeline-status-badge[data-status="queued"] {
    background: #fef3c7;
    color: #d97706;
}

.pipeline-status-badge[data-status="running"] {
    background: #dbeafe;
    color: #2563eb;
}

.pipeline-status-badge[data-status="completed"] {
    background: #d1fae5;
    color: #065f46;
}

.pipeline-status-badge[data-status="error"] {
    background: #fecaca;
    color: #dc2626;
}

/* ====================
   CURRENT STAGE DETAILS 
   ==================== */

.current-stage-details {
    transition: all 0.3s ease;
}

.current-stage-icon {
    transition: all 0.3s ease;
}

.current-stage-title {
    transition: color 0.3s ease;
}

.current-stage-description {
    transition: color 0.3s ease;
}

/* ====================
   PERFORMANCE METRICS 
   ==================== */

.metrics-grid {
    gap: 16px;
}

.metric-item {
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    transition: background 0.2s ease;
}

.metric-item:hover {
    background: rgba(255, 255, 255, 0.8);
}

.metric-label {
    margin-bottom: 2px;
}

.metric-value {
    font-size: 14px;
}

/* ====================
   ERROR STATE 
   ==================== */

.error-state {
    animation: slide-in 0.3s ease-out;
}

.error-title {
    margin-bottom: 4px;
}

.error-message {
    line-height: 1.4;
}

.error-actions {
    gap: 8px;
}

/* ====================
   ANIMATIONS 
   ==================== */

@keyframes pulse-active {
    0%, 100% {
        box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0.2);
    }
}

@keyframes connector-progress {
    0% {
        background-position: 0 0;
    }
    100% {
        background-position: 20px 0;
    }
}

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

@keyframes shake {
    0%, 100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-2px);
    }
    75% {
        transform: translateX(2px);
    }
}

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

/* ====================
   RESPONSIVE DESIGN 
   ==================== */

/* Mobile Optimizations */
@media (max-width: 768px) {
    .pipeline-stages-container {
        padding: 15px 0;
    }
    
    .stages-progress-track {
        flex-direction: column;
        align-items: stretch;
        gap: 20px;
        padding: 0 5px;
    }
    
    .stage-item {
        flex-direction: row;
        align-items: center;
        min-width: auto;
        width: 100%;
        text-align: left;
    }
    
    .stage-node {
        flex-shrink: 0;
        width: auto;
        margin-bottom: 0;
        margin-right: 12px;
    }
    
    .stage-connector {
        display: none;
    }
    
    /* Mobile connector - vertical */
    .stage-item:not(:last-child)::after {
        content: '';
        position: absolute;
        bottom: -10px;
        left: 15px;
        width: 2px;
        height: 20px;
        background: #e5e7eb;
        z-index: 1;
    }
    
    .stage-item[data-state="completed"]:not(:last-child)::after {
        background: #10b981;
    }
    
    .stage-info {
        flex: 1;
        text-align: left;
        width: auto;
    }
    
    .stage-label {
        font-size: 13px;
        margin-bottom: 2px;
    }
    
    .stage-timing {
        font-size: 10px;
    }
    
    .parallel-components {
        margin-top: 8px;
        margin-left: 0;
    }
    
    .component-name {
        min-width: 45px;
        font-size: 9px;
    }
    
    .metrics-grid {
        grid-template-columns: 1fr 1fr;
        gap: 12px;
    }
}

/* Tablet Optimizations */
@media (min-width: 769px) and (max-width: 1024px) {
    .stage-item {
        min-width: 70px;
    }
    
    .stage-item.parallel-stage {
        min-width: 120px;
    }
    
    .stage-label {
        font-size: 10px;
    }
    
    .component-name {
        font-size: 9px;
        min-width: 40px;
    }
}

/* Desktop Optimizations */
@media (min-width: 1025px) {
    .stage-item:hover {
        transform: translateY(-2px);
    }
    
    .stage-item:hover .stage-icon {
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
}

/* ====================
   ACCESSIBILITY 
   ==================== */

/* Screen Reader Only */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .stage-icon {
        border-width: 3px;
    }
    
    .progress-bar-fill {
        background: #000;
    }
    
    .component-fill {
        background: #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    
    .progress-bar-fill::after {
        display: none;
    }
}

/* Dark mode support (if implemented) */
@media (prefers-color-scheme: dark) {
    .pipeline-progress-enhanced {
        background: rgba(31, 41, 55, 0.95);
        border-color: rgba(75, 85, 99, 0.3);
    }
    
    .glass-inner {
        background: rgba(55, 65, 81, 0.7);
        border-color: rgba(75, 85, 99, 0.3);
    }
    
    .stage-icon {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
    
    .stage-label {
        color: #d1d5db;
    }
    
    .stage-timing {
        color: #9ca3af;
    }
    
    .component-name {
        color: #d1d5db;
    }
}