/* ============================================================================
   Iteration Workspace Styles
   EXTRACTED FROM: iteration-workspace-manager.js getWorkspaceCSS()
   ============================================================================ */

/* Enhanced Iteration Workspace Styles */
.iteration-workspace-enhanced {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: #0f172a;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.iteration-workspace-enhanced.hidden {
    display: none;
}

/* NEW: Troubleshoot Mode Styles */
.iteration-workspace-enhanced.troubleshoot-mode {
    background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
}

.iteration-workspace-enhanced.troubleshoot-mode .workspace-header-enhanced {
    background: linear-gradient(135deg, #4c1d95, #6b21a8);
    border-bottom-color: #7c3aed;
}

.workspace-header-enhanced {
    background: linear-gradient(135deg, #1e293b, #334155);
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.workspace-header-enhanced h2 {
    color: #f1f5f9;
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.workspace-controls {
    display: flex;
    gap: 8px;
}

.workspace-control-btn {
    background: #374151;
    color: #d1d5db;
    border: none;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.workspace-control-btn:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.workspace-control-btn.close {
    background: #ef4444;
    color: white;
}

.workspace-control-btn.close:hover {
    background: #dc2626;
}

.workspace-content-enhanced {
    flex: 1;
    display: flex;
    height: calc(100vh - 80px);
}

.content-panel-enhanced,
.chat-panel-enhanced {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.content-panel-enhanced {
    border-right: 1px solid #334155;
    max-width: 50%;
}

.panel-header-enhanced {
    background: #1e293b;
    padding: 1rem;
    border-bottom: 1px solid #334155;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.panel-header-enhanced h3 {
    color: #f1f5f9;
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
}

.content-tabs-enhanced {
    display: flex;
    gap: 6px;
}

.tab-btn-enhanced {
    padding: 6px 12px;
    background: #374151;
    color: #d1d5db;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
}

.tab-btn-enhanced.active {
    background: #3b82f6;
    color: white;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.tab-btn-enhanced:hover:not(.active) {
    background: #4b5563;
}

.content-display-enhanced {
    flex: 1;
    overflow: hidden;
    background: #0f172a;
}

.tab-content-enhanced {
    display: none;
    padding: 1rem;
    height: 100%;
    overflow: auto;
}

.tab-content-enhanced.active {
    display: block;
}

.tab-content-enhanced pre {
    background: #1e293b;
    padding: 1rem;
    border-radius: 8px;
    overflow: auto;
    margin: 0;
    height: calc(100% - 2rem);
    border: 1px solid #334155;
}

.tab-content-enhanced code {
    color: #e2e8f0;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    line-height: 1.5;
}

/* NEW: Troubleshoot Mode Toggle */
.troubleshoot-toggle-container {
    padding: 12px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    margin-bottom: 12px;
}

.troubleshoot-toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    color: #e2e8f0;
    font-weight: 500;
}

.troubleshoot-checkbox {
    display: none;
}

.toggle-switch {
    position: relative;
    width: 44px;
    height: 24px;
    background: #374151;
    border-radius: 12px;
    transition: all 0.3s;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s;
}

.troubleshoot-checkbox:checked+.toggle-switch {
    background: #7c3aed;
}

.troubleshoot-checkbox:checked+.toggle-switch::after {
    transform: translateX(20px);
}

.troubleshoot-info {
    margin-top: 4px;
    color: #94a3b8;
    font-size: 11px;
}

/* NEW: Continue Button */
.continue-button-container {
    padding: 12px;
    background: linear-gradient(135deg, #4c1d95, #6b21a8);
    border-radius: 8px;
    border: 1px solid #7c3aed;
    margin-bottom: 12px;
    text-align: center;
}

.continue-btn {
    background: white;
    color: #4c1d95;
    border: none;
    border-radius: 6px;
    padding: 12px 24px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.continue-btn:disabled {
    background: #6b7280;
    color: #9ca3af;
    cursor: not-allowed;
    opacity: 0.7;
}

.continue-btn.active:not(:disabled) {
    background: #10b981;
    color: white;
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.continue-btn.active:not(:disabled):hover {
    background: #059669;
    transform: translateY(-1px);
}

.continue-btn.processing {
    pointer-events: none;
}

.pass-info {
    margin-top: 8px;
    color: #e2e8f0;
    font-size: 12px;
}

/* Pass Indicator in Content Panel */
.pass-indicator {
    background: linear-gradient(135deg, #4c1d95, #6b21a8);
    color: white;
    padding: 8px 16px;
    margin-bottom: 12px;
    border-radius: 6px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    font-weight: 500;
}

.pass-name {
    font-weight: 600;
    text-transform: capitalize;
}

.pass-progress {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 11px;
}

.quick-actions-enhanced {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.quick-btn-enhanced {
    padding: 6px 10px;
    background: #374151;
    color: #d1d5db;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    transition: all 0.2s;
    white-space: nowrap;
}

.quick-btn-enhanced:hover {
    background: #4b5563;
    transform: translateY(-1px);
}

.chat-messages-enhanced {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    background: #0f172a;
}

.chat-message-enhanced {
    display: flex;
    margin-bottom: 1rem;
    gap: 12px;
    align-items: flex-start;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-avatar-enhanced {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #374151;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.message-content-enhanced {
    flex: 1;
    padding: 12px 16px;
    border-radius: 12px;
    background: #1e293b;
    color: #e2e8f0;
    line-height: 1.5;
    border: 1px solid #334155;
    word-wrap: break-word;
}

.chat-message-enhanced.user .message-content-enhanced {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border-color: #2563eb;
}

.chat-message-enhanced.system .message-content-enhanced {
    background: #374151;
    color: #d1d5db;
    font-style: italic;
    border-color: #4b5563;
}

.message-time-enhanced {
    font-size: 10px;
    color: #64748b;
    margin-top: 6px;
    text-align: right;
}

.welcome-message-enhanced {
    background: linear-gradient(135deg, #1e293b, #334155);
    border: 1px solid #3b82f6;
    border-radius: 12px;
    padding: 1.5rem;
    color: #e2e8f0;
    text-align: center;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.chat-input-area-enhanced {
    background: #1e293b;
    padding: 1rem;
    border-top: 1px solid #334155;
}

.input-container-enhanced {
    display: flex;
    gap: 12px;
    margin-bottom: 1rem;
}

.input-container-enhanced textarea {
    flex: 1;
    background: #0f172a;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px;
    color: #e2e8f0;
    resize: vertical;
    min-height: 80px;
    max-height: 200px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.4;
    transition: border-color 0.2s;
}

.input-container-enhanced textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.send-btn-enhanced {
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 100px;
}

.send-btn-enhanced:hover {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.4);
}

.send-btn-enhanced:disabled {
    background: #374151;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-text {
    font-weight: 600;
}

.btn-shortcut {
    font-size: 10px;
    opacity: 0.7;
    margin-top: 2px;
}

.iteration-controls-enhanced {
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
}

.control-btn-enhanced {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 500;
    font-size: 14px;
    transition: all 0.2s;
}

.control-btn-enhanced.approve {
    background: linear-gradient(135deg, #10b981, #059669);
    color: white;
}

.control-btn-enhanced.approve:hover {
    background: linear-gradient(135deg, #059669, #047857);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

.control-btn-enhanced.approve:disabled {
    background: #374151;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    opacity: 0.5;
}

.control-btn-enhanced.secondary {
    background: #374151;
    color: #d1d5db;
}

.control-btn-enhanced.secondary:hover {
    background: #4b5563;
}

.iteration-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    font-size: 12px;
    color: #64748b;
}

.thinking-dots-enhanced {
    display: inline-flex;
    gap: 4px;
    margin-right: 8px;
}

.thinking-dots-enhanced span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #64748b;
    animation: thinking-pulse 1.4s infinite ease-in-out;
}

.control-btn-enhanced.regenerate {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-right: 8px;
}

.control-btn-enhanced.regenerate:hover:not(:disabled) {
    background: linear-gradient(135deg, #d97706, #b45309);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.3);
}

.control-btn-enhanced.regenerate:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.iteration-controls-enhanced {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 12px;
    padding: 12px;
    background: rgba(30, 41, 59, 0.5);
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.2);
}

.thinking-dots-enhanced span:nth-child(1) {
    animation-delay: -0.32s;
}

.thinking-dots-enhanced span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes thinking-pulse {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .workspace-content-enhanced {
        flex-direction: column;
    }

    .content-panel-enhanced {
        border-right: none;
        border-bottom: 1px solid #334155;
        max-height: 40vh;
        max-width: none;
    }

    .chat-panel-enhanced {
        flex: 1;
    }

    .quick-actions-enhanced {
        flex-direction: column;
        gap: 4px;
    }

    .iteration-controls-enhanced {
        flex-direction: column;
        gap: 8px;
    }

    .input-container-enhanced {
        flex-direction: column;
        gap: 8px;
    }
}

/* Scrollbar styling */
.chat-messages-enhanced::-webkit-scrollbar,
.content-display-enhanced::-webkit-scrollbar,
.tab-content-enhanced::-webkit-scrollbar {
    width: 8px;
}

.chat-messages-enhanced::-webkit-scrollbar-track,
.content-display-enhanced::-webkit-scrollbar-track,
.tab-content-enhanced::-webkit-scrollbar-track {
    background: #1e293b;
    border-radius: 4px;
}

.chat-messages-enhanced::-webkit-scrollbar-thumb,
.content-display-enhanced::-webkit-scrollbar-thumb,
.tab-content-enhanced::-webkit-scrollbar-thumb {
    background: #374151;
    border-radius: 4px;
}

.chat-messages-enhanced::-webkit-scrollbar-thumb:hover,
.content-display-enhanced::-webkit-scrollbar-thumb:hover,
.tab-content-enhanced::-webkit-scrollbar-thumb:hover {
    background: #4b5563;
}

/* ============================================================================
   DIRECT EDIT FEATURE (NEW)
   ============================================================================ */

/* Edit Button */
.edit-json-btn-enhanced {
    padding: 6px 12px;
    background: #10b981;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s;
    margin-left: 12px;
}

.edit-json-btn-enhanced:hover {
    background: #059669;
    transform: translateY(-1px);
}

.edit-json-btn-enhanced.editing {
    background: #ef4444;
}

.edit-json-btn-enhanced.editing::before {
    content: '💾 ';
}

/* JSON Editor Textarea */
.json-editor-enhanced {
    width: 100%;
    height: 100%;
    min-height: 400px;
    background: #0f172a;
    color: #e2e8f0;
    border: 2px solid #334155;
    border-radius: 4px;
    padding: 12px;
    font-family: 'Courier New', 'Monaco', 'Menlo', monospace;
    font-size: 13px;
    line-height: 1.5;
    resize: vertical;
    transition: border-color 0.2s;
}

.json-editor-enhanced:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.json-editor-enhanced.error {
    border-color: #ef4444;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1);
}

/* Format Button */
#format-json-btn {
    background: #8b5cf6;
    margin-left: 8px;
}

#format-json-btn:hover {
    background: #7c3aed;
}

/* Cancel Button */
#cancel-edit-btn {
    background: #64748b;
    margin-left: 8px;
}

#cancel-edit-btn:hover {
    background: #475569;
}

/* Prettified Markdown Styles */
.markdown-content {
    padding: 20px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #e0e0e0;
}

.markdown-content h1 {
    font-size: 2em;
    font-weight: 600;
    margin-top: 24px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 2px solid #3b82f6;
    color: #60a5fa;
}

.markdown-content h2 {
    font-size: 1.5em;
    font-weight: 600;
    margin-top: 20px;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #475569;
    color: #93c5fd;
}

.markdown-content h3 {
    font-size: 1.25em;
    font-weight: 600;
    margin-top: 16px;
    margin-bottom: 8px;
    color: #bfdbfe;
}

.markdown-content p {
    margin: 12px 0;
}

.markdown-content ul,
.markdown-content ol {
    margin: 12px 0;
    padding-left: 30px;
}

.markdown-content li {
    margin: 6px 0;
}

.markdown-content code {
    background: #1e293b;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.9em;
    color: #fbbf24;
}

.markdown-content pre {
    background: #1e293b;
    padding: 16px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 16px 0;
}

.markdown-content pre code {
    background: none;
    padding: 0;
    color: #e0e0e0;
}

.markdown-content blockquote {
    border-left: 4px solid #3b82f6;
    padding-left: 16px;
    margin: 16px 0;
    color: #94a3b8;
    font-style: italic;
}

.markdown-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
}

.markdown-content th {
    background: #1e293b;
    padding: 12px;
    border: 1px solid #475569;
    font-weight: 600;
    text-align: left;
}

.markdown-content td {
    padding: 10px 12px;
    border: 1px solid #475569;
}

.markdown-content a {
    color: #60a5fa;
    text-decoration: none;
}

.markdown-content a:hover {
    text-decoration: underline;
}

.markdown-content strong {
    font-weight: 600;
    color: #fff;
}

.markdown-content em {
    font-style: italic;
}

.markdown-content hr {
    border: none;
    border-top: 1px solid #475569;
    margin: 24px 0;
}

/* Inline SVG in markdown */
.inline-svg-container {
    margin: 24px 0;
    padding: 20px;
    background: #0f172a;
    border-radius: 8px;
    border: 1px solid #475569;
    overflow-x: auto;
}

.inline-svg-container svg {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
}

.control-btn-enhanced.reject {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: white;
}

.control-btn-enhanced.reject:hover {
    background: linear-gradient(135deg, #dc2626, #b91c1c);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}