﻿html, body {
    height: 100vh;
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Main container - fixed height */
.container-fluid {
    height: calc(100vh - 60px);
    overflow: hidden;
}

    /* Make the row fill the container */
    .container-fluid > .row {
        height: 100%;
        margin: 0;
    }

/* Sidebar - fixed height with scroll */
.sidebar {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    background: #ffffff;
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: none !important;
}

/* Main content area - fixed height with scroll */
.col-md-8 {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ========== COMPACT UPLOAD BUTTON (IN HEADER) ========== */
.upload-btn-container {
    display: flex;
    align-items: center;
    gap: 10px;
}

#imageFile {
    display: none;
}

.btn-upload i {
        font-size: 16px;
    }

.upload-filename {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
}

/* ========== HIDE OLD UPLOAD CARD ========== */
.card.mb-3 {
    display: none;
}

/* ========== PROCESSING SPINNER (BETWEEN CARDS) ========== */
#loadingSpinner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100;
    background: rgba(255, 255, 255, 0.95);
    padding: 20px 30px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    text-align: center;
}

    #loadingSpinner .spinner-border {
        width: 2.5rem;
        height: 2.5rem;
        border-width: 3px;
    }

    #loadingSpinner p {
        font-size: 14px;
        margin-top: 12px;
        font-weight: 600;
        color: #1e293b;
    }

/* ========== IMAGE CARDS ROW - WITH RELATIVE POSITIONING ========== */
.row .col-md-6 {
    position: relative;
}

    .row .col-md-6 .card {
        height: 500px;
        display: flex;
        flex-direction: column;
    }

        .row .col-md-6 .card .card-header {
            padding: 10px 14px;
            font-size: 14px;
            font-weight: 600;
            flex-shrink: 0;
        }

        .row .col-md-6 .card .card-body {
            flex: 1;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            padding: 12px;
        }

/* Image container with fixed height */
.card-body .img-fluid {
    max-height: 380px !important;
    max-width: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    margin: 0 auto;
    display: block;
}

/* Dimensions text - always visible */
#inputDimensions,
#outputDimensions {
    font-size: 12px;
    margin-top: 8px;
    padding: 4px 8px;
    background: #f8fafc;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Output container handling */
#outputImagesContainer img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15); /* Stronger shadow instead of border */
    display: block;
    margin: 0 auto;
}

/* ========== THUMBNAIL PANEL - FIXED POSITION ========== */
#thumbnailPanel {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 140px;
    background: white;
    border-top: 2px solid #e2e8f0;
    z-index: 1000;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 10px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
}

    #thumbnailPanel.active {
        display: block;
    }

/* Adjust main content when thumbnails visible */
body.thumbnails-visible .container-fluid {
    height: calc(100vh - 200px);
}

/* Thumbnail container */
#thumbnailContainer {
    display: flex;
    gap: 10px;
    align-items: center;
}

    /* Individual thumbnails */
    #thumbnailContainer img {
        height: 100px;
        width: auto;
        object-fit: contain;
        border-radius: 6px;
        border: 2px solid #e2e8f0;
        cursor: pointer;
        transition: all 0.2s ease;
    }

        #thumbnailContainer img:hover {
            border-color: #6366f1;
            transform: scale(1.05);
        }

/* ========== SIDEBAR STYLES ========== */
.sidebar-header {
    color: #1e293b;
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 6px;
}

    .sidebar-header::before {
        content: '';
        width: 3px;
        height: 18px;
        background: linear-gradient(135deg, #6366f1, #8b5cf6);
        border-radius: 2px;
    }

.workflow-search {
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    padding: 8px 12px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    background: #f8fafc;
}

    .workflow-search:focus {
        outline: none;
        border-color: #6366f1;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
        background: white;
    }

    .workflow-search::placeholder {
        color: #94a3b8;
    }

.workflow-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.workflow-item {
    border: 2px solid transparent !important;
    border-radius: 8px !important;
    padding: 8px 10px !important;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #f8fafc !important;
    display: flex !important;
    align-items: center;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

    .workflow-item::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        width: 3px;
        height: 100%;
        background: linear-gradient(135deg, #6366f1, #8b5cf6);
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .workflow-item:hover {
        background: white !important;
        border-color: #6366f1 !important;
        transform: translateX(3px);
        box-shadow: 0 2px 8px rgba(99, 102, 241, 0.15);
    }

        .workflow-item:hover::before {
            opacity: 1;
        }

    .workflow-item:active {
        transform: translateX(2px) scale(0.98);
    }

.workflow-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    font-size: 0.9rem;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.workflow-item:hover .workflow-icon {
    transform: scale(1.1) rotate(5deg);
}

.workflow-label {
    color: #1e293b;
    font-weight: 500;
    font-size: 0.85rem;
    flex: 1;
    line-height: 1.3;
}

/* Icon color variations */
.workflow-item:nth-child(1) .workflow-icon {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
}

.workflow-item:nth-child(2) .workflow-icon {
    background: linear-gradient(135deg, #ec4899, #f43f5e);
}

.workflow-item:nth-child(3) .workflow-icon {
    background: linear-gradient(135deg, #14b8a6, #06b6d4);
}

.workflow-item:nth-child(4) .workflow-icon {
    background: linear-gradient(135deg, #f59e0b, #f97316);
}

.workflow-item:nth-child(5) .workflow-icon {
    background: linear-gradient(135deg, #8b5cf6, #d946ef);
}

.workflow-item:nth-child(6) .workflow-icon {
    background: linear-gradient(135deg, #10b981, #14b8a6);
}

.workflow-item:nth-child(7) .workflow-icon {
    background: linear-gradient(135deg, #ef4444, #dc2626);
}

.workflow-item:nth-child(8) .workflow-icon {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
}

.workflow-item:nth-child(9) .workflow-icon {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

/* ========== STEPS PANEL ========== */
.steps-container {
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 16px;
    padding: 16px;
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
}

.steps-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

    .steps-header h6 {
        font-size: 16px;
        font-weight: 700;
        color: #1e293b;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }

        .steps-header h6::before {
            content: '';
            width: 4px;
            height: 20px;
            background: linear-gradient(135deg, #667eea, #764ba2);
            border-radius: 3px;
        }

.steps-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 16px;
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 700;
    min-width: 32px;
    text-align: center;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    flex-shrink: 0;
}

.steps-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.btn-run {
    padding: 10px 12px;
    border: none;
    border-radius: 10px;
    font-weight: 600;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.btn-run-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
}

    .btn-run-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 16px rgba(102, 126, 234, 0.4);
    }

.btn-run-secondary {
    background: white;
    color: #64748b;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
    font-size: 12px;
}

    .btn-run-secondary:hover {
        background: #f8fafc;
        border-color: #cbd5e1;
    }

.steps-list-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding-right: 4px;
}

#stepsList {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-drag-handle {
    color: #cbd5e1;
    font-size: 14px;
    cursor: grab;
    flex-shrink: 0;
    padding-top: 2px;
}

.step-content {
    flex: 1;
    min-width: 0;
}

.step-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 12px;
    margin-bottom: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-details {
    font-size: 10px;
    color: #64748b;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.step-delete-btn {
    background: linear-gradient(135deg, #fee, #fdd);
    color: #dc3545;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    flex-shrink: 0;
}

    .step-delete-btn:hover {
        background: #dc3545;
        color: white;
        transform: scale(1.1) rotate(90deg);
    }

.steps-empty {
    background: white;
    border: 2px dashed #e2e8f0;
    border-radius: 10px;
    color: #94a3b8;
    text-align: center;
    padding: 24px 12px;
    font-size: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

    .steps-empty i {
        font-size: 24px;
        opacity: 0.5;
    }

.btn-remove-all {
    width: 100%;
    padding: 8px;
    background: white;
    border: 2px solid #e2e8f0;
    color: #64748b;
    border-radius: 10px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    flex-shrink: 0;
}

    .btn-remove-all:hover {
        background: linear-gradient(135deg, #fee, #fdd);
        border-color: #dc3545;
        color: #dc3545;
    }

/* ========== SCROLLBAR STYLING ========== */
.steps-list-container::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.col-md-8::-webkit-scrollbar {
    width: 5px;
}

.steps-list-container::-webkit-scrollbar-track,
.sidebar::-webkit-scrollbar-track,
.col-md-8::-webkit-scrollbar-track {
    background: transparent;
}

.steps-list-container::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.col-md-8::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

    .steps-list-container::-webkit-scrollbar-thumb:hover,
    .sidebar::-webkit-scrollbar-thumb:hover,
    .col-md-8::-webkit-scrollbar-thumb:hover {
        background: #94a3b8;
    }

.template-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    background: white;
    padding: 6px;
    border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

#templateName {
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 13px;
    width: 180px;
    transition: all 0.3s ease;
}

    #templateName:focus {
        outline: none;
        border-color: #6366f1;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }

#saveTemplateBtn,
#loadTemplateBtn {
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    border-radius: 8px;
    border: 2px solid;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 6px;
}

#saveTemplateBtn {
    background: linear-gradient(135deg, #10b981, #059669);
    border-color: #10b981;
    color: white;
}

    #saveTemplateBtn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
    }

#loadTemplateBtn {
    background: white;
    border-color: #e2e8f0;
    color: #64748b;
}

    #loadTemplateBtn:hover {
        border-color: #cbd5e1;
        background: #f8fafc;
    }

/* ========== MODERN COINS DISPLAY ========== */
.coins-display {
    display: flex;
    align-items: center;
    gap: 8px;
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    padding: 8px 16px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
    transition: all 0.3s ease;
    cursor: pointer;
}

    .coins-display:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(251, 191, 36, 0.4);
    }

.coins-icon {
    width: 28px;
    height: 28px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #f59e0b;
    font-size: 14px;
    font-weight: 700;
}

.coins-amount {
    color: white;
    font-weight: 700;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.coins-label {
    font-size: 11px;
    opacity: 0.9;
    font-weight: 600;
}

/* Pulse animation for coins */
@keyframes pulse-coins {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

.coins-display.updated {
    animation: pulse-coins 0.5s ease;
}

#cropSubjectModal .modal-content {
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

#cropSubjectModal .modal-header {
    background: #f8fafc;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 20px;
}

#cropSubjectModal .modal-title {
    font-weight: 600;
    color: #1e293b;
}

    #cropSubjectModal .modal-title i {
        color: #64748b;
    }

#cropSubjectModal .modal-body {
    padding: 24px;
}

#cropSubjectModal .form-label {
    color: #1e293b;
    font-size: 14px;
    margin-bottom: 8px;
}

#cropSubjectModal .form-select {
    border-radius: 8px;
    border: 2px solid #e2e8f0;
    padding: 10px 14px;
    font-size: 14px;
    transition: all 0.3s ease;
}

    #cropSubjectModal .form-select:focus {
        border-color: #6366f1;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }

/* Crop Direction Options */
.crop-direction-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.crop-option {
    position: relative;
}

    .crop-option .btn-outline-primary {
        border: 2px solid #e2e8f0;
        border-radius: 12px;
        padding: 16px 12px;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 6px;
        transition: all 0.3s ease;
        background: white;
        color: #64748b;
        min-height: 120px;
    }

    .crop-option .btn-check:checked + .btn-outline-primary {
        background: #6366f1;
        border-color: #6366f1;
        color: white;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.25);
    }

.crop-icon {
    width: 48px;
    height: 48px;
    background: #f1f5f9;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #64748b;
    transition: all 0.3s ease;
}

.crop-option .btn-check:checked + .btn-outline-primary .crop-icon {
    background: rgba(255, 255, 255, 0.2);
    color: white;
}

.crop-label {
    font-size: 15px;
    font-weight: 600;
    margin-top: 4px;
}

.crop-desc {
    font-size: 11px;
    opacity: 0.8;
    text-align: center;
    display: block;
    line-height: 1.3;
}

/* Info Alert Styling */
#cropSubjectModal .alert-info {
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    color: #0c4a6e;
}

    #cropSubjectModal .alert-info ul {
        font-size: 12px;
    }

/* Button Styling */
#cropSubjectModal .btn-primary {
    background: #6366f1;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

    #cropSubjectModal .btn-primary:hover {
        background: #4f46e5;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
    }

#cropSubjectModal .btn-secondary {
    border-radius: 8px;
    padding: 10px 20px;
}
#partDropdownContainer,
#cropSubjectControls {
    display: none !important;
}

#specsTryOnModal .modal-content {
    border: none;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

#specsTryOnModal .modal-header {
    background: #f8fafc;
    color: #1e293b;
    border-bottom: 1px solid #e2e8f0;
    padding: 16px 20px;
}

#specsTryOnModal .modal-title {
    font-weight: 600;
    color: #1e293b;
}

    #specsTryOnModal .modal-title i {
        color: #8b5cf6;
    }

#specsTryOnModal .modal-body {
    padding: 24px;
}

/* Upload Area */
.specs-upload-area {
    border: 2px dashed #cbd5e1;
    border-radius: 12px;
    padding: 40px 20px;
    text-align: center;
    background: #f8fafc;
    transition: all 0.3s ease;
}

    .specs-upload-area:hover {
        border-color: #8b5cf6;
        background: #faf5ff;
    }

.btn-specs-upload {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 0;
}

.upload-icon {
    width: 64px;
    height: 64px;
    background: linear-gradient(135deg, #8b5cf6, #d946ef);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 28px;
    transition: all 0.3s ease;
}

.btn-specs-upload:hover .upload-icon {
    transform: scale(1.1);
}

.upload-text {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

    .upload-text strong {
        color: #1e293b;
        font-size: 16px;
    }

    .upload-text small {
        color: #64748b;
        font-size: 13px;
    }

/* Preview Area */
.specs-preview-area {
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    background: white;
}

.preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #e2e8f0;
}

    .preview-header strong {
        color: #1e293b;
        font-size: 14px;
    }

.btn-remove-specs {
    background: #fee;
    color: #dc3545;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

    .btn-remove-specs:hover {
        background: #dc3545;
        color: white;
    }

.preview-image-container {
    background: #f8fafc;
    border-radius: 8px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 150px;
    margin-bottom: 12px;
}

    .preview-image-container img {
        max-width: 100%;
        max-height: 200px;
        object-fit: contain;
        border-radius: 4px;
    }

.preview-info {
    display: flex;
    align-items: center;
    color: #64748b;
    font-size: 13px;
    padding: 8px 12px;
    background: #f8fafc;
    border-radius: 6px;
}

    .preview-info i {
        color: #8b5cf6;
    }

/* Alert Styling */
#specsTryOnModal .alert-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
}

#specsTryOnModal .alert-success {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #15803d;
    border-radius: 8px;
    padding: 12px;
    font-size: 14px;
}

/* Button Styling */
#confirmSpecsTryOn {
    background: #8b5cf6;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
}

    #confirmSpecsTryOn:hover:not(:disabled) {
        background: #7c3aed;
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
    }

    #confirmSpecsTryOn:disabled {
        background: #cbd5e1;
        cursor: not-allowed;
    }
#specs-tryon-panel {
    display: none !important;
}

/* ========== SIMPLE LOADING OVERLAY ========== */
.simple-loading-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    border-radius: 12px;
}

/* Spinning Circle Loader */
.spinner-circle {
    width: 80px;
    height: 80px;
    border: 6px solid #e2e8f0;
    border-top-color: #667eea;
    border-right-color: #764ba2;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Loading Text */
.loading-message {
    margin-top: 20px;
    font-size: 16px;
    font-weight: 600;
    color: #475569;
}

/* Progress Bar Style */
.progress-bar-container {
    width: 250px;
    height: 8px;
    background: #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 16px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 10px;
    animation: progress-animation 2s ease-in-out infinite;
}

@keyframes progress-animation {
    0% {
        width: 0%;
    }

    50% {
        width: 70%;
    }

    100% {
        width: 100%;
    }
}
/*.col-md-2.border-start.p-3 {
    display: flex;
    flex-direction: column;
    height: 100% !important;
    min-height: 0;
    overflow: hidden;
}*/

/*.steps-container {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
    min-height: 0;
}*/

/*.steps-list-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 6px;
}*/

#outputImagesContainer {
    min-height: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8f9fa;
    border-radius: 8px;
    padding: 20px;
}

/* Empty state styling */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* When images are present, change layout */
#outputImagesContainer:has(img) {
    background: transparent;
    padding: 0;
}

#outputImagesContainer img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

/* Download button styling */
#downloadZipBtn {
    transition: all 0.3s ease;
    gap: 6px;
    display: inline-flex;
    align-items: center;
}

    #downloadZipBtn:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(25, 135, 84, 0.3);
    }

    #downloadZipBtn i {
        margin-right: 4px;
    }

/* Fade & Scale Animation */
@keyframes fadeScale {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.step-card.step-adding {
    animation: fadeScale 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Optional: Highlight flash after animation */
@keyframes highlightFlash {
    0%, 100% {
        background-color: transparent;
    }

    50% {
        background-color: rgba(107, 70, 193, 0.1);
    }
}

.step-card.step-highlight {
    animation: highlightFlash 1s ease-in-out;
}

/* Badge pop animation */
@keyframes badgePop {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }

    100% {
        transform: scale(1);
    }
}

#stepCount.badge-pop {
    animation: badgePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ========================================
   HEADER STYLES
   ======================================== */

.main-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e0e0e0;
    padding: 12px 24px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.header-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    max-width: 1600px;
    margin: 0 auto;
}

/* ========================================
   LOGO SECTION
   ======================================== */

.logo-section {
    flex-shrink: 0;
}

.logo {
    height: 40px;
    width: auto;
    display: block;
}

/* ========================================
   CONTROLS SECTION (Upload & Templates)
   ======================================== */

.controls-section {
    display: flex;
    align-items: center;
    gap: 24px;
    flex: 1;
}

.upload-control {
    flex-shrink: 0;
}

.template-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Input Field */
.input-template-name {
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    width: 200px;
    transition: border-color 0.2s;
}

    .input-template-name:focus {
        outline: none;
        border-color: #6366f1;
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
    }

    .input-template-name::placeholder {
        color: #9ca3af;
    }

/* ========================================
   BUTTONS
   ======================================== */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

    .btn i {
        font-size: 14px;
    }

/* Upload Button */
.btn-upload {
    background-color: #6366f1;
    color: white;
}

    .btn-upload:hover {
        background-color: #4f46e5;
        transform: translateY(-1px);
        box-shadow: 0 4px 6px rgba(99, 102, 241, 0.25);
    }

/* Save Button */
.btn-save {
    background-color: #10b981;
    color: white;
}

    .btn-save:hover {
        background-color: #059669;
        transform: translateY(-1px);
        box-shadow: 0 4px 6px rgba(16, 185, 129, 0.25);
    }

/* Load Button */
.btn-load {
    background-color: #f59e0b;
    color: white;
}

    .btn-load:hover {
        background-color: #d97706;
        transform: translateY(-1px);
        box-shadow: 0 4px 6px rgba(245, 158, 11, 0.25);
    }

/* Login Button */
.btn-login {
    background-color: #10b981;
    color: white;
    text-decoration: none;
}

    .btn-login:hover {
        background-color: #059669;
        transform: translateY(-1px);
        box-shadow: 0 4px 6px rgba(16, 185, 129, 0.25);
        text-decoration: none;
        color: white;
    }

/* Logout Button */
.btn-logout {
    background-color: #ef4444;
    color: white;
}

    .btn-logout:hover {
        background-color: #dc2626;
        transform: translateY(-1px);
        box-shadow: 0 4px 6px rgba(239, 68, 68, 0.25);
    }

/* ========================================
   USER SECTION (Credits & Auth)
   ======================================== */

.user-section {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

/* Credits Display */
.credits-display {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    border-radius: 20px;
    color: white;
    font-weight: 600;
    cursor: help;
    box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

    .credits-display i {
        font-size: 16px;
    }

.credits-amount {
    font-size: 16px;
}

.credits-label {
    font-size: 12px;
    opacity: 0.9;
}

/* Auth Controls */
.auth-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.user-greeting {
    font-size: 14px;
    color: #374151;
    font-weight: 500;
}

.logout-form {
    margin: 0;
    display: inline-block;
}

/* ========================================
   RESPONSIVE DESIGN
   ======================================== */

@media (max-width: 1200px) {
    .header-container {
        gap: 20px;
    }

    .controls-section {
        gap: 16px;
    }

    .input-template-name {
        width: 160px;
    }
}

@media (max-width: 992px) {
    .header-container {
        flex-wrap: wrap;
        gap: 16px;
    }

    .controls-section {
        flex: 1 1 100%;
        order: 3;
    }

    .user-section {
        margin-left: auto;
    }
}

@media (max-width: 768px) {
    .main-header {
        padding: 12px 16px;
    }

    .btn span {
        display: none;
    }

    .btn {
        padding: 8px 12px;
    }

    .input-template-name {
        width: 140px;
        font-size: 13px;
    }

    .user-greeting {
        display: none;
    }

    .credits-label {
        display: none;
    }
}
.btn-cancel {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s ease;
}

    .btn-cancel:hover {
        background: linear-gradient(135deg, #dc2626, #b91c1c);
        transform: translateY(-2px);
        box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
    }

    .btn-cancel:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.spinner {
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-top: 4px solid #6366f1;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 0 auto 20px;
}

/* Toast notification animation */
@keyframes slideInRight {
    from {
        transform: translateX(400px);
        opacity: 0;
    }

    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast-notification {
    animation: slideInRight 0.3s ease;
}

/* Parent Column - Use Bootstrap's natural width */
.col-md-2.border-start {
    display: flex !important;
    flex-direction: column;
    height: 100% !important;
    padding: 10px !important;
    background: #f8f9fa;
    border-left: 1px solid #dee2e6 !important;
    box-sizing: border-box;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    /* Remove min-width and max-width to let Bootstrap grid handle it */
}

/* Main Steps Container */
.steps-container {
    display: flex;
    flex-direction: column;
    height: 100%;
    background: linear-gradient(135deg, #667eea15 0%, #764ba215 100%);
    border-radius: 12px;
    padding: 16px;
    gap: 12px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    overflow: visible;
}

/* Header Section */
.steps-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 2px solid #e9ecef;
    flex-shrink: 0;
}

    .steps-header h6 {
        font-size: 16px;
        font-weight: 700;
        color: #1e293b;
        margin: 0;
        display: flex;
        align-items: center;
        gap: 8px;
    }

        .steps-header h6::before {
            content: '';
            width: 4px;
            height: 20px;
            background: linear-gradient(135deg, #667eea, #764ba2);
            border-radius: 3px;
        }

.steps-badge {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    border-radius: 16px;
    min-width: 32px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    flex-shrink: 0;
}

/* Control Buttons */
.steps-controls {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

.btn-run {
    width: 100%;
    padding: 10px 16px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    white-space: nowrap;
}

.btn-run-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

    .btn-run-primary:hover {
        transform: translateY(-2px);
        box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
    }

    .btn-run-primary:active {
        transform: translateY(0);
    }

.btn-run-secondary {
    background: white;
    color: #64748b;
    border: 2px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.04);
}

    .btn-run-secondary:hover {
        background: #f8fafc;
        border-color: #cbd5e1;
        transform: translateY(-1px);
    }

/* Scrollable Steps List Container */
.steps-list-container {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    margin-right: -4px;
}

    .steps-list-container::-webkit-scrollbar {
        width: 6px;
    }

    .steps-list-container::-webkit-scrollbar-track {
        background: #e9ecef;
        border-radius: 10px;
    }

    .steps-list-container::-webkit-scrollbar-thumb {
        background: #adb5bd;
        border-radius: 10px;
    }

        .steps-list-container::-webkit-scrollbar-thumb:hover {
            background: #6c757d;
        }

/* Steps List */
#stepsList {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Empty State */
.steps-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #adb5bd;
    text-align: center;
    background: white;
    border-radius: 10px;
    border: 2px dashed #dee2e6;
}

    .steps-empty i {
        font-size: 32px;
        margin-bottom: 12px;
        opacity: 0.5;
    }

    .steps-empty span {
        font-size: 13px;
        font-weight: 500;
    }


/* Step Header (Row 1: Drag + Name + Edit) - Tighter spacing */
.step-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 10px;
    min-height: 36px;
    flex-shrink: 0;
}

.step-drag-handle {
    color: #cbd5e1;
    cursor: grab;
    font-size: 14px;
    transition: color 0.3s ease;
    flex-shrink: 0;
}

    .step-drag-handle:hover {
        color: #667eea;
    }

    .step-drag-handle:active {
        cursor: grabbing;
    }

/* Step Name - Allow wrapping with smaller font */
.step-name {
    flex: 1 1 auto;
    font-size: 12px; /* Reduced from 13px */
    font-weight: 600;
    color: #1e293b;
    line-height: 1.3;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 130px; /* Limit width to prevent overflow */
}


/* Step Footer (Row 2: Details + Delete) - Force visibility */
.step-footer {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 6px 10px 8px 30px;
    border-top: 1px solid #f1f3f5;
    min-height: 32px;
    flex-shrink: 0;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Step Details - Force visibility and wrapping */
.step-details {
    flex: 1 1 auto;
    font-size: 10px;
    color: #64748b;
    line-height: 1.3;
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 130px;
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    white-space: normal !important;
}

/* Delete Button - UPDATED */
.step-delete-btn {
    background: linear-gradient(135deg, #fee, #fdd);
    color: #dc3545;
    border: none;
    border-radius: 6px;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 13px;
    flex-shrink: 0;
    z-index: 10;
}

    .step-delete-btn:hover {
        background: #dc3545;
        color: white;
        transform: scale(1.1) rotate(90deg);
    }

/* Remove All Button */
.btn-remove-all {
    width: 100%;
    padding: 10px 16px;
    background: white;
    color: #64748b;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    flex-shrink: 0;
    margin-top: auto;
}

    .btn-remove-all:hover {
        background: linear-gradient(135deg, #fee, #fdd);
        border-color: #dc3545;
        color: #dc3545;
    }

    .btn-remove-all:active {
        transform: translateY(0);
    }

/* Animations */
@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.step-card {
    animation: slideIn 0.3s ease;
}

@keyframes badgePop {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.3);
    }
}

#stepCount.badge-pop {
    animation: badgePop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* Responsive Adjustments */
@media (max-width: 768px) {
    .col-md-2.border-start {
        min-width: 100%;
        width: 100%;
    }

    .steps-container {
        height: auto;
        min-height: 400px;
    }

    .step-name {
        font-size: 12px;
    }

    .step-details {
        font-size: 10px;
    }
}



/*//////////////////////////////////////////////////////////////////*/
/* ============================================
   COMPACT STEP CARD MODIFICATIONS
   ============================================ */

/* ============================================
   COMPACT STEP CARD MODIFICATIONS
   ============================================ */

/* Step Card - More Compact */
.step-card {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px; /* Reduced from 10px */
    padding: 0;
    transition: all 0.3s ease;
    cursor: move;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06); /* Lighter shadow */
    position: relative;
    overflow: visible !important;
    min-height: auto !important;
    height: auto !important;
    display: flex;
    flex-direction: column;
}

    .step-card::before {
        content: '';
        position: absolute;
        left: 0;
        top: 0;
        width: 3px;
        height: 100%;
        background: linear-gradient(135deg, #667eea, #764ba2);
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .step-card:hover {
        transform: translateX(3px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
        border-color: #667eea;
    }

        .step-card:hover::before {
            opacity: 1;
        }

    .step-card.dragging {
        opacity: 0.5;
        transform: rotate(2deg);
    }

/* Step Header - Tighter */
.step-header {
    display: flex;
    align-items: center;
    gap: 4px; /* Reduced from 6px */
    padding: 6px 8px; /* Reduced from 8px 10px */
    min-height: 32px; /* Reduced from 36px */
    flex-shrink: 0;
    justify-content: space-between; /* Ensure proper spacing */
}

.step-drag-handle {
    color: #cbd5e1;
    cursor: grab;
    font-size: 12px; /* Reduced from 14px */
    transition: color 0.3s ease;
    flex-shrink: 0;
}

/* Step Name - Smaller font */
.step-name {
    flex: 1 1 auto;
    font-size: 11px; /* Reduced from 12px */
    font-weight: 600;
    color: #1e293b;
    line-height: 1.2; /* Tighter line height */
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: none; /* Remove max-width restriction */
    margin-right: 8px; /* Add space before buttons */
}

/* Button Container - Keep edit and delete together */
.step-header-buttons {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

/* Edit Button - Smaller */
.step-edit-btn {
    background: transparent;
    border: none;
    color: #667eea;
    cursor: pointer;
    padding: 4px 6px; /* Reduced from 6px 8px */
    border-radius: 5px; /* Reduced from 6px */
    transition: all 0.2s ease;
    font-size: 11px; /* Reduced from 13px */
    flex-shrink: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .step-edit-btn:hover {
        background: #f0f3ff;
        color: #5568d3;
    }

/* Step Footer - Tighter */
.step-footer {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 4px; /* Reduced from 6px */
    padding: 4px 8px 6px 26px; /* Reduced padding */
    border-top: 1px solid #f1f3f5;
    min-height: 28px; /* Reduced from 32px */
    flex-shrink: 0;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Step Details - Smaller */
.step-details {
    flex: 1 1 auto;
    font-size: 9px; /* Reduced from 10px */
    color: #64748b;
    line-height: 1.2; /* Tighter */
    min-width: 0;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 120px; /* Reduced from 130px */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    white-space: normal !important;
}

/* Delete Button - Smaller */
.step-delete-btn {
    background: linear-gradient(135deg, #fee, #fdd);
    color: #dc3545;
    border: none;
    border-radius: 5px; /* Reduced from 6px */
    width: 24px; /* Reduced from 28px */
    height: 24px; /* Reduced from 28px */
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 11px; /* Reduced from 13px */
    flex-shrink: 0;
    z-index: 10;
}

/* Gap between cards */
#stepsList {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Reduced from 10px */
}

/* ===================================
   WORKFLOW SEARCH - CSS FIX
   =================================== */

/* Workflow List Container */
.workflow-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 8px; /* Consistent spacing between items */
}

/* Workflow Item - Default visible state */
.workflow-item {
    display: flex !important;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    margin-bottom: 0 !important; /* Remove any default margin */
}

    /* Hidden state for search - IMPORTANT! */
    .workflow-item.hidden {
        display: none !important;
        height: 0 !important;
        padding: 0 !important;
        margin: 0 !important;
        border: none !important;
        opacity: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
    }

/* Override any Bootstrap list-group-item display */
.list-group-item.workflow-item.hidden {
    display: none !important;
}

/* Hover effect */
.workflow-item:hover {
    background: #f8f9fa;
    border-color: #667eea;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

/* Workflow icon */
.workflow-icon {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    font-size: 16px;
    flex-shrink: 0;
}

/* Workflow label */
.workflow-label {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #1e293b;
}

/* Search input styling */
.workflow-search {
    margin-bottom: 12px !important;
    border-radius: 8px;
    border: 2px solid #e9ecef;
    padding: 8px 12px;
    font-size: 13px;
    transition: all 0.2s ease;
}

    .workflow-search:focus {
        border-color: #667eea;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
        outline: none;
    }

/* Search container wrapper */
.search-container {
    position: relative;
    margin-bottom: 12px;
}

/* Clear search button */
#clearSearchBtn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #6c757d;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.2s ease;
    z-index: 10;
}

    #clearSearchBtn:hover {
        background: #e9ecef;
        color: #495057;
    }

/* No results message */
#noWorkflowResults {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
    background: #f8f9fa;
    border-radius: 8px;
    border: 2px dashed #dee2e6;
}

    #noWorkflowResults i {
        display: block;
        font-size: 2.5rem;
        margin-bottom: 12px;
        opacity: 0.5;
    }

    #noWorkflowResults p {
        margin: 0;
        font-size: 14px;
        font-weight: 600;
    }

    #noWorkflowResults small {
        display: block;
        margin-top: 4px;
        font-size: 12px;
    }


.profile-dropdown-container {
    z-index: 1200 !important;
    position: relative;
}

.profile-dropdown-menu {
    z-index: 1201 !important;
}

.main-header {
    z-index: 999 !important;
    position: relative;
}

.simple-loading-overlay {
    z-index: 1000 !important;
}

/* Modals appear above header */
.modal {
    z-index: 1100 !important;
}

.modal-backdrop {
    z-index: 1050 !important;
}

.main-header {
    z-index: 999;
    position: relative;
}