/**
 * Workflow Progress Component Styles
 * Phase 4: UI Polish - Real-time workflow progress tracking
 *
 * GPU-accelerated animations for 60 FPS performance
 */

/* ===========================================
   CONTAINER & LAYOUT
   =========================================== */

.workflow-progress-container {
    position: relative;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid rgba(99, 102, 241, 0.15);
    border-radius: 16px;
    margin: 12px 16px;
    overflow: hidden;
    transition: all 0.3s ease;
    will-change: opacity, transform;
}

.workflow-progress-container.hidden {
    display: none;
}

/* ===========================================
   HEADER
   =========================================== */

.workflow-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.08) 0%, rgba(139, 92, 246, 0.08) 100%);
    border-bottom: 1px solid rgba(99, 102, 241, 0.1);
}

.workflow-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
}

.workflow-icon {
    font-size: 16px;
}

.workflow-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.workflow-status-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.workflow-status-badge.pending {
    background: rgba(107, 114, 128, 0.1);
    color: #6b7280;
}

.workflow-status-badge.running {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    animation: pulse-status 2s ease-in-out infinite;
}

.workflow-status-badge.completed {
    background: rgba(16, 185, 129, 0.1);
    color: #10b981;
}

.workflow-status-badge.failed {
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
}

.workflow-status-badge.cancelled {
    background: rgba(245, 158, 11, 0.1);
    color: #f59e0b;
}

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

.workflow-toggle-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s ease;
    border-radius: 4px;
}

.workflow-toggle-btn:hover {
    background: rgba(99, 102, 241, 0.1);
    color: #6366f1;
}

.workflow-toggle-btn svg {
    transition: transform 0.2s ease;
}

.workflow-toggle-btn.collapsed svg {
    transform: rotate(-90deg);
}

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

.workflow-progress-bar-container {
    height: 4px;
    background: rgba(99, 102, 241, 0.1);
    overflow: hidden;
}

.workflow-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6366f1, #8b5cf6, #a855f7);
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: width;
}

/* ===========================================
   STEPS CONTAINER
   =========================================== */

.workflow-steps-container {
    padding: 12px 16px;
    max-height: 300px;
    overflow-y: auto;
    transition: max-height 0.3s ease, padding 0.3s ease;
}

.workflow-steps-container.collapsed {
    max-height: 0;
    padding: 0 16px;
    overflow: hidden;
}

/* Custom scrollbar */
.workflow-steps-container::-webkit-scrollbar {
    width: 4px;
}

.workflow-steps-container::-webkit-scrollbar-track {
    background: transparent;
}

.workflow-steps-container::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.2);
    border-radius: 2px;
}

/* ===========================================
   INDIVIDUAL STEPS
   =========================================== */

.workflow-step {
    display: flex;
    gap: 12px;
    padding: 8px 0;
    animation: step-enter 0.3s ease-out forwards;
}

@keyframes step-enter {
    from {
        opacity: 0;
        transform: translateX(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step-indicator {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 24px;
    flex-shrink: 0;
}

.step-number {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 600;
    background: #e5e7eb;
    color: #6b7280;
    transition: all 0.3s ease;
    position: relative;
}

/* Step status styles */
.workflow-step.pending .step-number {
    background: #e5e7eb;
    color: #6b7280;
}

.workflow-step.running .step-number {
    background: #3b82f6;
    color: white;
    animation: pulse-step 1.5s ease-in-out infinite;
}

.workflow-step.completed .step-number {
    background: #10b981;
    color: white;
}

.workflow-step.completed .step-number::after {
    content: '✓';
    font-size: 12px;
}

/* Hide number when showing checkmark */
.workflow-step.completed .step-number {
    font-size: 0;
}

.workflow-step.failed .step-number {
    background: #ef4444;
    color: white;
}

.workflow-step.failed .step-number::after {
    content: '✕';
    font-size: 12px;
}

.workflow-step.failed .step-number {
    font-size: 0;
}

.workflow-step.skipped .step-number {
    background: #9ca3af;
    color: white;
}

@keyframes pulse-step {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
    }
}

.step-line {
    width: 2px;
    flex-grow: 1;
    background: #e5e7eb;
    margin-top: 4px;
    min-height: 16px;
    transition: background 0.3s ease;
}

.workflow-step.completed .step-line {
    background: #10b981;
}

.workflow-step.running .step-line {
    background: linear-gradient(180deg, #3b82f6 0%, #e5e7eb 100%);
}

/* Hide line for last step */
.workflow-step:last-child .step-line {
    display: none;
}

.step-content {
    flex-grow: 1;
    min-width: 0;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
}

.step-name {
    font-size: 13px;
    font-weight: 500;
    color: #1f2937;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.workflow-step.pending .step-name {
    color: #6b7280;
}

.workflow-step.running .step-name {
    color: #3b82f6;
}

.workflow-step.completed .step-name {
    color: #10b981;
}

.workflow-step.failed .step-name {
    color: #ef4444;
}

.step-status-icon {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.step-message {
    font-size: 12px;
    color: #6b7280;
    margin-top: 2px;
    line-height: 1.4;
}

.workflow-step.running .step-message {
    color: #3b82f6;
}

/* ===========================================
   SUBSTEPS
   =========================================== */

.step-substeps {
    margin-top: 8px;
    padding-left: 12px;
    border-left: 2px solid rgba(99, 102, 241, 0.2);
}

.step-substeps.hidden {
    display: none;
}

.substep {
    font-size: 11px;
    color: #6b7280;
    padding: 2px 0;
    animation: substep-enter 0.2s ease-out forwards;
}

@keyframes substep-enter {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===========================================
   SUMMARY
   =========================================== */

.workflow-summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: rgba(16, 185, 129, 0.05);
    border-top: 1px solid rgba(16, 185, 129, 0.1);
    animation: summary-enter 0.3s ease-out forwards;
}

.workflow-summary.hidden {
    display: none;
}

.workflow-summary.error {
    background: rgba(239, 68, 68, 0.05);
    border-top-color: rgba(239, 68, 68, 0.1);
}

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

.summary-text {
    font-size: 13px;
    font-weight: 500;
    color: #10b981;
}

.workflow-summary.error .summary-text {
    color: #ef4444;
}

.summary-time {
    font-size: 12px;
    color: #6b7280;
}

/* ===========================================
   DARK MODE SUPPORT
   =========================================== */

@media (prefers-color-scheme: dark) {
    .workflow-progress-container {
        background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
        border-color: rgba(99, 102, 241, 0.2);
    }

    .workflow-progress-header {
        background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
        border-bottom-color: rgba(99, 102, 241, 0.2);
    }

    .workflow-title {
        color: #f9fafb;
    }

    .step-number {
        background: #374151;
        color: #9ca3af;
    }

    .step-line {
        background: #374151;
    }

    .step-name {
        color: #f9fafb;
    }

    .workflow-step.pending .step-name {
        color: #9ca3af;
    }

    .step-message {
        color: #9ca3af;
    }

    .workflow-progress-bar-container {
        background: rgba(99, 102, 241, 0.2);
    }
}
