/* Workflow Page Styles */
.workflow-nav {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 1rem 0;
    margin-bottom: 2rem;
}

.workflow-nav .container {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.back-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    margin-right: 1rem;
}

.back-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.nav-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.nav-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.nav-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

/* Section Styling */
.workflow-section {
    display: none;
}

.workflow-section.active {
    display: block;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e0e0e0;
}

.section-header h2 {
    color: #333;
    margin: 0;
}

/* Search and Filter */
.search-bar {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.search-bar input {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    min-width: 250px;
}

.search-bar select {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: white;
}

/* Workflow Grid */
.workflow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 1.5rem;
    margin-top: 1rem;
}

.workflow-card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: all 0.3s ease;
    border: 1px solid #e0e0e0;
}

.workflow-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.workflow-card-header {
    padding: 1.5rem;
    border-bottom: 1px solid #f0f0f0;
}

.workflow-card-header h3 {
    margin: 0 0 0.5rem 0;
    color: #333;
    font-size: 1.2rem;
}

.workflow-card-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 1rem;
}

.workflow-card-description {
    color: #555;
    line-height: 1.5;
    margin-bottom: 1rem;
}

.workflow-card-tags {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.workflow-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.workflow-tag.synced {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

/* Workflow Progress */
.workflow-progress {
    margin: 1rem 0;
    padding: 0.5rem 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.progress-text {
    font-size: 0.85rem;
    color: #666;
}

/* Step Assignments */
.step-assignments {
    margin: 1rem 0;
    padding: 0.75rem;
    background: #f8f9fa;
    border-radius: 6px;
    border-left: 3px solid #667eea;
}

.assignments-header {
    font-weight: 600;
    color: #333;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.assignment-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
    font-size: 0.85rem;
}

.step-title {
    font-weight: 500;
    color: #333;
}

.assigned-to {
    color: #667eea;
    font-weight: 500;
}

.step-status {
    padding: 0.125rem 0.5rem;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-assigned {
    background: #cce5ff;
    color: #004085;
}

.status-in_progress {
    background: #d4edda;
    color: #155724;
}

.status-completed {
    background: #28a745;
    color: white;
}

.workflow-card-footer {
    padding: 1rem 1.5rem;
    background: #f9f9f9;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.workflow-stats {
    display: flex;
    gap: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.workflow-actions {
    display: flex;
    gap: 0.5rem;
}

.btn-small {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;
    border-radius: 6px;
}

/* Workflow List (for assigned workflows) */
.workflow-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.workflow-item {
    background: white;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #667eea;
}

.workflow-item-header {
    display: flex;
    justify-content: between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.workflow-item-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #333;
    margin: 0;
}

.workflow-item-status {
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.8rem;
    font-weight: 500;
}

.status-pending {
    background: #fff3cd;
    color: #856404;
}

.status-in-progress {
    background: #cce5ff;
    color: #004085;
}

.status-completed {
    background: #d4edda;
    color: #155724;
}

.workflow-progress {
    margin: 1rem 0;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    transition: width 0.3s ease;
}

.workflow-steps-preview {
    margin-top: 1rem;
}

.step-item {
    display: flex;
    align-items: center;
    padding: 0.5rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.step-status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    margin-right: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: white;
}

.step-completed {
    background: #28a745;
}

.step-current {
    background: #007bff;
}

.step-pending {
    background: #6c757d;
}

/* Form Styling */
.workflow-form {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 600;
    color: #333;
}

.form-group input,
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 1rem;
    box-sizing: border-box;
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.help-text {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.25rem;
    line-height: 1.4;
}

.workflow-step {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    border: 1px solid #e9ecef;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.step-number {
    background: #667eea;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.remove-step-btn {
    background: #dc3545;
    color: white;
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8rem;
}

.form-actions {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #e0e0e0;
}

/* Modal Styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 12px;
    width: 80%;
    max-width: 600px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
    padding: 1.5rem;
    border-bottom: 1px solid #e0e0e0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    color: #333;
}

.close {
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover {
    color: #000;
}

.modal-body {
    padding: 1.5rem;
}

.modal-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 1rem;
    justify-content: flex-end;
}

/* User Selection */
.user-list {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #ddd;
    border-radius: 6px;
    margin-top: 0.5rem;
}

.user-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.user-item:hover {
    background: #f8f9fa;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 0.9rem;
}

.user-info {
    flex: 1;
}

.user-name {
    font-weight: 600;
    color: #333;
}

.user-email {
    font-size: 0.9rem;
    color: #666;
}

.selected-users-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.selected-user-tag {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
}

.remove-user-btn {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-weight: bold;
    padding: 0;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* VFAI App Sync Styles */
.vfai-sync-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}

.sync-setup-card,
.sync-status-card,
.sync-results-card,
.synced-content-card {
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    border: 1px solid #e0e0e0;
}

.sync-setup-card {
    grid-column: 1;
}

.sync-status-card {
    grid-column: 2;
}

.sync-results-card {
    grid-column: 1 / -1;
    margin-top: 1rem;
}

.synced-content-card {
    grid-column: 1 / -1;
    margin-top: 1rem;
}

.sync-setup-card h3,
.sync-status-card h3,
.sync-results-card h3,
.synced-content-card h3 {
    margin: 0 0 1.5rem 0;
    color: #333;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.path-input-group {
    display: flex;
    gap: 0.5rem;
}

.path-input-group input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 6px;
}

.sync-actions {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid #f0f0f0;
}

.status-item:last-child {
    border-bottom: none;
}

.status-label {
    font-weight: 600;
    color: #333;
}

.status-value {
    color: #666;
    font-weight: 500;
}

.status-value.success {
    color: #28a745;
}

.status-value.error {
    color: #dc3545;
}

.sync-tabs {
    display: flex;
    border-bottom: 2px solid #e0e0e0;
    margin-bottom: 1rem;
}

.sync-tab-btn {
    background: none;
    border: none;
    padding: 1rem 2rem;
    cursor: pointer;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid transparent;
    transition: all 0.3s ease;
}

.sync-tab-btn:hover {
    color: #333;
    background: #f8f9fa;
}

.sync-tab-btn.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

.sync-tab-content {
    min-height: 200px;
}

.sync-tab-pane {
    display: none;
}

.sync-tab-pane.active {
    display: block;
}

.synced-items-list {
    display: grid;
    gap: 1rem;
}

.synced-item {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    border-left: 4px solid #667eea;
}

.synced-item.workflow {
    border-left-color: #28a745;
}

.synced-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.synced-item-title {
    font-weight: 600;
    color: #333;
    margin: 0;
}

.synced-item-type {
    background: #667eea;
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 500;
}

.synced-item.workflow .synced-item-type {
    background: #28a745;
}

.synced-item-description {
    color: #666;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 0.5rem;
}

.synced-item-meta {
    display: flex;
    gap: 1rem;
    font-size: 0.85rem;
    color: #888;
}

.sync-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    color: #666;
}

.sync-loading::before {
    content: "⏳";
    margin-right: 0.5rem;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.sync-error {
    background: #f8d7da;
    color: #721c24;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #dc3545;
    margin: 1rem 0;
}

.sync-success {
    background: #d4edda;
    color: #155724;
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid #28a745;
    margin: 1rem 0;
}

.sync-results-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.sync-result-stat {
    text-align: center;
    padding: 1rem;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.sync-result-number {
    font-size: 2rem;
    font-weight: bold;
    color: #667eea;
    display: block;
}

.sync-result-label {
    font-size: 0.9rem;
    color: #666;
    margin-top: 0.5rem;
}

.sync-errors-list {
    margin-top: 1rem;
}

.sync-error-item {
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #856404;
}

/* Responsive Design */
@media (max-width: 768px) {
    .vfai-sync-container {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .sync-setup-card,
    .sync-status-card {
        grid-column: 1;
    }
    
    .path-input-group {
        flex-direction: column;
    }
    
    .sync-actions {
        flex-direction: column;
    }
    
    .sync-tabs {
        flex-wrap: wrap;
    }
    
    .sync-tab-btn {
        padding: 0.75rem 1rem;
        flex: 1;
        min-width: 120px;
    }
    
    .sync-results-summary {
        grid-template-columns: 1fr;
    }
    
    .workflow-nav .container {
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    
    .nav-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
    
    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .search-bar {
        flex-direction: column;
        width: 100%;
    }
    
    .search-bar input {
        min-width: auto;
    }
    
    .workflow-grid {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    .form-actions {
        flex-direction: column;
    }
}