/**
 * Cognitive Studio CSS - Complete Layout Structure Restored
 * Version: 2.3.0 - Iteration 129
 * Includes all layout, components, and visual programming enhancements
 */

/* ===================================
   1. DESIGN SYSTEM - VARIABLES
   =================================== */
:root {
    /* Spacing Scale - ITERATION 129: Reduced values */
    --space-1: 2px;
    --space-2: 4px;
    --space-3: 6px;
    --space-4: 8px;
    --space-5: 10px;  /* Reduced from 12px */
    --space-6: 12px;  /* Reduced from 16px */
    --space-7: 16px;  /* Reduced from 20px */
    --space-8: 20px;  /* Reduced from 24px */
    
    /* Colors */
    --bg-primary: #0f0f0f;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #2a2a2a;
    --border-color: #333;
    --text-primary: #f0f0f0;
    --text-secondary: #ccc;
    --text-muted: #888;
    --accent: #667eea;
    --success: #10b981;
    --warning: #f59e0b;
    --error: #ef4444;
    
    /* Typography */
    --font-size-sm: 11px;
    --font-size-md: 13px;
    --font-size-lg: 14px;
    --line-height-tight: 1.2;
    --line-height-normal: 1.4;
    
    /* Effects */
    --radius: 6px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    --transition: 0.2s ease;
}

/* ===================================
   2. RESET & BASE
   =================================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body.agent-studio-page {
    font-family: 'Segoe UI', system-ui, sans-serif;
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: var(--font-size-md);
    line-height: var(--line-height-normal);
    height: 100vh;
    overflow: hidden;
}

/* ===================================
   3. MAIN CONTAINER STRUCTURE
   =================================== */
#agent-studio-container {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.studio-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    background: var(--bg-primary);
}

/* ===================================
   4. STATUS BAR (TOP BAR) - ITERATION 129: Reduced padding
   =================================== */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 16px;  /* Reduced from 10px 20px */
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color);
    flex-shrink: 0;
    min-height: 40px;  /* Reduced from 50px */
}

.status-tabs {
    display: flex;
    gap: var(--space-2);
}

.status-tab {
    padding: var(--space-2) var(--space-5);  /* Reduced vertical padding */
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--radius);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    font-size: var(--font-size-md);
    font-weight: 500;
}

.status-tab:hover {
    background: var(--bg-tertiary);
    border-color: var(--border-color);
}

.status-tab.active {
    background: var(--bg-tertiary);
    border-color: var(--accent);
    color: var(--text-primary);
}

.status-indicators {
    display: flex;
    gap: 20px;
    align-items: center;
}

/* ===================================
   5. MAIN CONTENT AREA
   =================================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: var(--space-3);  /* Reduced from space-4 */
    overflow: hidden;
    min-height: 0;
}

/* Agent Display Block - ITERATION 129: Now inside prompt header */
.studio-agent-display {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4);
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

.agent-label {
    color: var(--text-muted);
    font-size: var(--font-size-sm);
}

.agent-name {
    color: var(--text-primary);
    font-weight: 600;
}


/* Prompt Section - ITERATION 129: Reduced padding */
.prompt-section {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-4);  /* Reduced from space-6 */
    margin-bottom: var(--space-3);  /* Reduced from space-4 */
    flex-shrink: 0;
}

.prompt-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);  /* Reduced from space-4 */
}

.prompt-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

/* ITERATION 129: New container for agent and generate button */
.agent-and-generate {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.prompt-textarea {
    width: 100%;
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-3);  /* Reduced from space-4 */
    color: var(--text-primary);
    font-size: var(--font-size-md);
    resize: vertical;
    min-height: 50px;  /* Reduced from 60px */
    font-family: inherit;
}

/* ===================================
   6. THREE COLUMN LAYOUT
   =================================== */
.three-column-layout {
    display: flex;
    gap: var(--space-3);  /* Reduced from space-4 */
    flex: 1;
    min-height: 0;
    margin-bottom: var(--space-3);  /* Reduced from space-4 */
}

.column {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
}

.column-left {
    flex: 0 0 300px;
    min-width: 250px;
}

.column-center {
    flex: 1;
    min-width: 400px;
}

.column-right {
    flex: 0 0 280px;
    min-width: 240px;
}

/* Resize Handles */
.resize-handle {
    width: 4px;
    background: var(--border-color);
    cursor: col-resize;
    position: relative;
    transition: background var(--transition);
}

.resize-handle:hover {
    background: var(--accent);
}

/* ===================================
   7. PANELS - ITERATION 129: Reduced padding
   =================================== */
.panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.panel-header {
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border-color);
    padding: var(--space-3) var(--space-4);  /* Reduced from space-5 */
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.panel-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
}

.panel-actions {
    display: flex;
    gap: var(--space-3);
}

.panel-footer {
    padding: var(--space-3);  /* Reduced from space-4 */
    border-top: 1px solid var(--border-color);
    background: var(--bg-tertiary);
    display: flex;
    gap: var(--space-3);
    flex-shrink: 0;
}

/* ===================================
   8. INTENT EDITOR (LEFT COLUMN)
   =================================== */
.json-editor {
    flex: 1;
    background: var(--bg-primary);
    border: none;
    padding: var(--space-4);  /* Reduced from space-5 */
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: var(--font-size-sm);
    resize: none;
    outline: none;
    overflow-y: auto;
}

.json-editor.error {
    background: rgba(239, 68, 68, 0.05);
}

.json-editor.modified {
    background: rgba(245, 158, 11, 0.05);
}

/* ===================================
   9. PROGRAM DISPLAY (CENTER COLUMN) - ITERATION 129: Reduced padding
   =================================== */
.program-display {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);  /* Reduced from space-5 */
    background: var(--bg-primary);
}

.empty-program {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: var(--space-6);  /* Reduced from space-8 */
}

.empty-icon {
    font-size: 48px;
    margin-bottom: var(--space-4);
    opacity: 0.5;
}

.empty-subtitle {
    font-size: var(--font-size-sm);
    margin-top: var(--space-2);
}

/* ===================================
   10. INTENT BLOCKS (RIGHT COLUMN) - ITERATION 129: Reduced padding
   =================================== */
.blocks-search {
    width: 100%;
    padding: var(--space-2) var(--space-3);  /* Reduced padding */
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.blocks-content {
    flex: 1;
    overflow-y: auto;
    padding: var(--space-3);  /* Reduced from space-4 */
}

.intent-category-group {
    margin-bottom: var(--space-4);  /* Reduced from space-6 */
}

.category-header {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    margin-bottom: var(--space-2);  /* Reduced from space-3 */
    padding: var(--space-1) var(--space-2);  /* Reduced padding */
    background: var(--bg-tertiary);
    border-radius: var(--radius);
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
}

.category-blocks {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);  /* Reduced from space-2 */
}

/* ===================================
   11. CONSOLE (BOTTOM) - ITERATION 129: Hidden by default
   =================================== */
.console-section {
    height: 150px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.console-section.hidden {
    display: none;
}

.console-header {
    background: var(--bg-tertiary);
    padding: var(--space-2) var(--space-4);  /* Reduced padding */
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.console-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-primary);
}

.console-actions {
    display: flex;
    gap: var(--space-3);
}

.console-output {
    flex: 1;
    background: var(--bg-primary);
    padding: var(--space-3);  /* Reduced from space-4 */
    overflow-y: auto;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: var(--font-size-sm);
}

.console-line {
    margin-bottom: var(--space-2);
    display: flex;
    gap: var(--space-3);
}

.console-timestamp {
    color: var(--text-muted);
    font-size: 10px;
    white-space: nowrap;
}

.console-message {
    color: var(--text-secondary);
    flex: 1;
}

.console-message.info { color: var(--accent); }
.console-message.success { color: var(--success); }
.console-message.warning { color: var(--warning); }
.console-message.error { color: var(--error); }

/* ITERATION 129: Console toggle button */
.console-toggle {
    display: flex;
    justify-content: center;
    padding: var(--space-2) 0;
}

.console-toggle-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-4);
    color: var(--text-secondary);
    font-size: var(--font-size-sm);
    cursor: pointer;
    transition: all var(--transition);
}

.console-toggle-btn:hover {
    background: var(--bg-secondary);
    border-color: var(--accent);
    color: var(--text-primary);
}

/* ===================================
   12. BUTTONS
   =================================== */
.btn,
.panel-btn,
.generate-btn,
.execute-btn,
.save-macro-btn {
    background: linear-gradient(135deg, var(--accent) 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: var(--radius);
    padding: var(--space-2) var(--space-4);  /* Reduced padding */
    font-size: var(--font-size-sm);
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    white-space: nowrap;
}

.btn:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-secondary {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.btn-sm {
    padding: var(--space-1) var(--space-3);  /* Reduced padding */
    font-size: var(--font-size-sm);
}

/* ===================================
   13. INTENT BLOCK STYLES - ITERATION 129: Reduced padding
   =================================== */
.intent-block {
    display: flex;
    background: linear-gradient(135deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    cursor: grab;
    transition: all var(--transition);
    overflow: hidden;
}

.intent-block:hover {
    border-color: var(--accent);
    transform: translateX(2px);
}

.intent-block.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.intent-block-content {
    flex: 1;
    padding: var(--space-3) var(--space-4);  /* Reduced padding */
    min-width: 0;
}

.intent-block-name {
    font-weight: 600;
    color: var(--text-primary);
    font-size: var(--font-size-md);
    margin-bottom: 0;  /* Removed margin */
}

.intent-block-description {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    line-height: var(--line-height-tight);
}

.intent-block-icon-container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 var(--space-4);  /* Reduced from space-5 */
    background: rgba(255, 255, 255, 0.05);
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    min-width: 50px;  /* Reduced from 50px */
}

.intent-block-icon {
    font-size: 45px;  /* Reduced from 20px */
}

/* ===================================
   14. SCROLLBARS
   =================================== */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* ===================================
   15. RESPONSIVE
   =================================== */
@media (max-width: 1400px) {
    .column-left { flex: 0 0 280px; }
    .column-right { flex: 0 0 260px; }
}

@media (max-width: 1200px) {
    .three-column-layout {
        flex-direction: column;
    }
    
    .column {
        flex: 1;
        width: 100%;
        max-height: 33vh;
    }
    
    .column-left,
    .column-center,
    .column-right {
        flex: 1;
    }
}

/* ===================================
   16. LOADING STATES
   =================================== */
.loading-blocks {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: var(--space-6);  /* Reduced from space-8 */
    color: var(--text-muted);
}

.loading-spinner {
    font-size: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* ===================================
   17. STATUS INDICATORS - ITERATION 129: Reduced padding
   =================================== */
.signalr-status,
.backend-status {
    display: flex;
    align-items: center;
    gap: 6px;  /* Reduced from 8px */
    padding: 4px 10px;  /* Reduced from 6px 12px */
    background: rgba(255, 255, 255, 0.05);
    border-radius: 20px;
    font-size: 12px;  /* Reduced from 13px */
    transition: all 0.3s ease;
}

.status-dot {
    width: 6px;  /* Reduced from 8px */
    height: 6px;  /* Reduced from 8px */
    border-radius: 50%;
    background: #666;
    transition: all 0.3s ease;
}

.status-dot-green {
    background: #4ade80;
    box-shadow: 0 0 8px rgba(74, 222, 128, 0.6);
}

.status-dot-yellow {
    background: #fbbf24;
    box-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
    animation: pulse 1.5s infinite;
}

.status-dot-red {
    background: #ef4444;
    box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.status-label {
    color: #888;
    font-weight: 500;
}

.status-text {
    color: #ccc;
}

/* User Actions */
.user-actions {
    margin-left: auto;
    padding-right: var(--space-3);  /* Reduced from space-4 */
}

.logout-button {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);  /* Reduced padding */
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    color: #ef4444;
    text-decoration: none;
    font-size: var(--font-size-sm);
    transition: all 0.2s ease;
}

.logout-button:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
}

/* ==========================================
   ITERATION 129: Update Visualization Button
   ========================================== */

/* Update Visualization button styling */
.update-visualization-btn {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 6px 14px;  /* Reduced from 8px 16px */
    border-radius: 4px;
    font-size: 13px;  /* Reduced from 14px */
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-right: 6px;  /* Reduced from 8px */
    display: inline-flex;
    align-items: center;
    gap: 4px;  /* Reduced from 6px */
}

.update-visualization-btn:hover:not(.disabled) {
    background-color: #0056b3;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.update-visualization-btn:active:not(.disabled) {
    transform: translateY(0);
    box-shadow: none;
}

/* Disabled state for Update Visualization button */
.update-visualization-btn.disabled {
    background-color: #e0e0e0;
    color: #999;
    cursor: not-allowed;
    opacity: 0.6;
}

.update-visualization-btn.disabled:hover {
    background-color: #e0e0e0;
    transform: none;
    box-shadow: none;
}

/* Visual indicator for unsaved editor changes */
.json-editor.has-changes {
    border-color: #ffc107;
    box-shadow: 0 0 0 1px #ffc107;
}

/* Optional: Add a subtle animation when button becomes enabled */
@keyframes enableButton {
    0% {
        transform: scale(0.95); 
        opacity: 0.6;
    }
    50% {
        transform: scale(1.02);
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.update-visualization-btn:not(.disabled) {
    animation: enableButton 0.3s ease-out;
}

/* Ensure proper button spacing in panel actions */
.panel-actions {
    display: flex;
    gap: 6px;  /* Reduced from 8px */
    align-items: center;
}

/* Adjust execute button to ensure consistent styling */
.execute-btn {
    margin-left: 0; /* Remove any left margin since we're using gap */
}

/* ===================================
   AGENT INTENT DETAILS PANEL FIXES - ITERATION 129
   =================================== */

/* Fix code blocks in intent details */
.agent-intent-details-panel .code-block,
.intent-details-content .code-block {
    background: var(--bg-primary) !important;  /* Same as other text boxes */
    color: var(--text-primary) !important;    /* Same as other text */
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-3) !important;        /* Reasonable padding (6px) */
    margin: var(--space-3) 0;
    overflow-x: auto;
}

/* Fix pre tags inside code blocks */
.agent-intent-details-panel .code-block pre,
.intent-details-content .code-block pre {
    margin: 0 !important;                      /* Remove default margins */
    padding: 0 !important;                     /* Remove the 30px padding */
    background: transparent !important;         /* Inherit from parent */
    color: inherit !important;                 /* Inherit from parent */
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: var(--font-size-sm);
    white-space: pre-wrap;                     /* Allow wrapping */
    word-wrap: break-word;                     /* Break long lines */
}

/* If there are nested code elements */
.agent-intent-details-panel .code-block code,
.intent-details-content .code-block code {
    background: transparent !important;
    color: inherit !important;
    padding: 0 !important;
    font-size: inherit;
}

/* Ensure consistent styling for all code/pre elements in intent details */
.intent-details-content pre {
    background: var(--bg-primary) !important;
    color: var(--text-primary) !important;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    padding: var(--space-3) !important;
    margin: var(--space-3) 0;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: var(--font-size-sm);
    overflow-x: auto;
}

/* JSON syntax highlighting if needed */
.intent-details-content .json-key {
    color: #9333EA; /* purple-600 */
}

.intent-details-content .json-string {
    color: #059669; /* green-600 */
}

.intent-details-content .json-number {
    color: #D97706; /* amber-600 */
}

.intent-details-content .json-boolean {
    color: #2563EB; /* blue-600 */
}

.intent-details-content .json-null {
    color: #6B7280; /* gray-500 */
}

/* *******************************************
 INTENT GUIDE 
 ******************************************** 
 */




/* Iteration 131: Intent Guide Panel Styles */
.intent-guide-panel {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--panel-bg, #1a1a1a);
    border: 1px solid var(--border-color, #333);
    border-radius: 8px;
    z-index: 100;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    box-shadow: -4px 0 20px rgba(0, 0, 0, 0.5);
}

.intent-guide-panel.active {
    transform: translateX(0);
}

.guide-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border-color, #333);
    background: var(--header-bg, #252525);
}

.guide-panel-header h2 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--text-primary, #fff);
}

.guide-close-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary, #999);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.25rem 0.5rem;
    line-height: 1;
    transition: color 0.2s;
}

.guide-close-btn:hover {
    color: var(--text-primary, #fff);
}

.guide-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem;
}

/* Guide menu item styling */
.guide-section {
    margin-bottom: 0.5rem;
}

/* Make guide item text bright white and bold */
.guide-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-radius: 6px;
    transition: background-color 0.2s;
    font-weight: 700; /* Bold */
    color: #ffffff; /* Bright white */
}

.guide-item:hover {
    background: rgba(255, 255, 255, 0.15); /* Slightly brighter on hover */
    color: #ffffff; /* Keep white on hover */
}

/* Make the guide icon pop a bit more */
.guide-icon {
    font-size: 2.25rem;
    filter: brightness(1.2); /* Make emoji slightly brighter */
}

.menu-separator {
    height: 1px;
    background: var(--border-color, #333);
    margin: 0.5rem 0;
}

/* Loading state */
.guide-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: var(--text-secondary, #999);
}

.guide-loading .loading-spinner {
    font-size: 2rem;
    animation: spin 1s linear infinite;
}

/* Error state */
.guide-error {
    text-align: center;
    padding: 2rem;
    color: var(--error-color, #ff6b6b);
}

.error-details {
    margin-top: 0.5rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

/* Make guide content from backend look good */
.intent-guide {
    color: var(--text-primary, #fff);
}

/* Ensure allowed values in code tags are visible */
.intent-guide .allowed-values-row code {
    color: #60cdff; /* Light blue for allowed values */
    background: rgba(96, 205, 255, 0.1);
}

.intent-guide h2, .intent-guide h3, .intent-guide h4 {
    margin-top: 1.5rem;
    margin-bottom: 0.75rem;
}

.intent-guide .parameters-table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}

.intent-guide .parameters-table th {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color, #333);
}


/* Make table text generally lighter too */
.intent-guide .parameters-table td {
    color: #d0d0d0; /* Light gray for regular table text */
}

.intent-guide .parameters-table th {
    background: var(--header-bg, #252525);
    font-weight: 600;
}


/* Also fix code in table cells specifically */
.intent-guide .parameters-table code {
    background: rgba(255, 255, 255, 0.08); /* Even subtler in tables */
    color: #f0f0f0; /* Bright light text */
    border: none;
}

/* Fix code elements in the guide */
.intent-guide code {
    background: rgba(255, 255, 255, 0.1); /* Subtle background */
    padding: 0.125rem 0.375rem;
    border-radius: 3px;
    font-family: var(--font-mono, monospace);
    font-size: 0.9em;
    color: #e0e0e0; /* Light gray text */
    border: none; /* Remove any border */
}

.intent-guide pre {
    background: var(--code-bg, #2a2a2a);
    padding: 1rem;
    border-radius: 6px;
    overflow-x: auto;
}

.intent-guide .badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: 500;
}

.intent-guide .badge-danger {
    background: var(--danger-bg, #ff4444);
    color: white;
}

.intent-guide .badge-secondary {
    background: var(--secondary-bg, #666);
    color: white;
}
/* Iteration 133: Resizable Variables Panel */
.variables-panel-wrapper {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 80vh; /* Default to 80% vertical */
    max-height: 90vh;
    min-height: 200px;
    background: var(--panel-bg);
    border-top: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    transition: none; /* Remove transition for smooth dragging */
    z-index: 100;
}

/* Resize handle for variables panel */
.variables-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 6px;
    background: transparent;
    cursor: ns-resize;
    z-index: 101;
}

.variables-resize-handle:hover {
    background: var(--primary-color);
    opacity: 0.3;
}

.variables-resize-handle.dragging {
    background: var(--primary-color);
    opacity: 0.5;
}

/* Adjust the main agent container when variables panel is open */
.agents-container-wrapper.with-variables {
    padding-bottom: 80vh; /* Match the panel height */
}

/* Make the panel content scrollable */
.variables-panel {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.variables-panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

/* Improve variable display */
.variable-item {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.variable-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(14, 165, 233, 0.1);
}

.variable-value {
    margin-top: 8px;
    padding: 8px;
    background: var(--code-bg);
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', monospace;
    font-size: 12px;
    overflow-x: auto;
}

/* Value type styling */
.value-string { color: #10b981; }
.value-number { color: #3b82f6; }
.value-boolean { color: #f59e0b; }
.value-null { color: #6b7280; }
.value-array { color: #8b5cf6; }
.value-object { color: #ec4899; }

/* Iteration 133: Fix variables panel content sizing */
.variables-section,
.objects-section {
    flex: 1;
    min-height: 0; /* Important for flex children */
    display: flex;
    flex-direction: column;
}

.variables-list,
.objects-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    min-height: 100px;
}

/* Ensure the grid takes full height */
.variables-panel-content {
    flex: 1;
    overflow: hidden; /* Let children handle scrolling */
    padding: 20px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    min-height: 0; /* Important for proper sizing */
}

/* Make sections fill their grid cells */
.variables-panel-content > div {
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* Execution button states - ITERATION 142 */
.execute-btn.executing {
    background-color: #3b82f6;
    cursor: not-allowed;
    opacity: 0.7;
}

.execute-btn.error {
    background-color: #ef4444;
    color: white;
    animation: shake 0.3s ease-in-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

/* ITERATION 143: Agent response styling */
.value-agent-response {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.agent-content {
    padding: 8px;
    background: rgba(74, 222, 128, 0.1);
    border-radius: 4px;
    border-left: 3px solid #4ade80;
}

.agent-metadata {
    font-size: 0.85em;
    color: #64748b;
}

.agent-metadata summary {
    cursor: pointer;
    user-select: none;
    padding: 4px 0;
}

.agent-metadata summary:hover {
    color: #94a3b8;
}

.metadata-content {
    padding: 8px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    margin-top: 4px;
}

.metadata-content > div {
    padding: 2px 0;
}

/* Parameter sections */
.parameter-template,
.parameter-resolved {
    margin-bottom: 12px;
}

.parameter-template h5,
.parameter-resolved h5 {
    margin: 8px 0;
    color: #94a3b8;
    font-size: 0.9em;
}

.parameter-resolved .code-block {
    background: rgba(74, 222, 128, 0.05);
    border: 1px solid rgba(74, 222, 128, 0.2);
}

/* Full object display */
.object-full {
    margin-top: 8px;
}

.object-full summary {
    cursor: pointer;
    user-select: none;
    color: #64748b;
    font-size: 0.85em;
    padding: 4px 0;
}

.object-full summary:hover {
    color: #94a3b8;
}

.object-full .code-block {
    margin-top: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.persistent-console-section {
    position: relative;
    min-height: 100px;
    max-height: 80vh;
    resize: vertical;
    overflow: auto;
}

.console-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 5px;
    background: transparent;
    cursor: ns-resize;
    z-index: 10;
}

.console-resize-handle:hover,
.console-resize-handle.dragging {
    background: rgba(59, 130, 246, 0.5);
}

.console-output {
    height: calc(100% - 40px); /* Subtract header height */
    overflow-y: auto;
}

/* ITERATION 150: Emoji Reference Modal */
.emoji-reference-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    max-width: 800px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    padding: 20px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 20px;
    color: #1f2937;
}

.modal-close {
    background: none;
    border: none;
    font-size: 28px;
    color: #6b7280;
    cursor: pointer;
    padding: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: #1f2937;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

/* ITERATION 183: Parameter Input Overlay Styles */
.parameter-input-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    z-index: 1000005;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.parameter-input-overlay.active {
    opacity: 1;
}

.parameter-input-container {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 8px;
    padding: 24px;
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transform: scale(0.9);
    transition: transform 0.2s ease;
}

.parameter-input-overlay.active .parameter-input-container {
    transform: scale(1);
}

.parameter-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.parameter-input-header h3 {
    margin: 0;
    font-size: 18px;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.param-input-close {
    background: none;
    border: none;
    color: #666;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.param-input-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.parameter-input-description {
    color: #999;
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.parameter-input-field {
    margin-bottom: 20px;
}

.param-input {
    width: 100%;
    background: #2a2a2a;
    border: 1px solid #444;
    color: #fff;
    padding: 12px;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
}

.param-input:focus {
    outline: none;
    border-color: #0066cc;
    background: #333;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2);
}

.param-textarea {
    resize: vertical;
    min-height: 80px;
    font-family: inherit;
}

.param-select {
    cursor: pointer;
}

.parameter-input-actions {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.parameter-input-actions .btn {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.parameter-input-actions .btn-primary {
    background: #0066cc;
    color: #fff;
}

.parameter-input-actions .btn-primary:hover {
    background: #0052a3;
}

.parameter-input-actions .btn-secondary {
    background: #444;
    color: #fff;
}

.parameter-input-actions .btn-secondary:hover {
    background: #555;
}

.parameter-input-hint {
    color: #666;
    font-size: 12px;
    text-align: center;
}

.param-type-indicator {
    font-size: 16px;
}

/* Menu section enhancement */
.parameter-item {
    position: relative;
    cursor: pointer;
    transition: all 0.2s;
}

.parameter-item:hover {
    background: rgba(0, 102, 204, 0.1);
    padding-left: 20px;
}

.parameter-item .param-type-indicator {
    opacity: 0.6;
    margin-right: 4px;
}

/* Input error */
.input-error {
    color: #ff4444;
    font-size: 12px;
    margin-top: 4px;
    animation: shake 0.3s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}


/**
 * ITERATION 292: Prompt Section Layout
 * Add this to agent-studio.css
 */

/* Main prompt section container */
.prompt-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px;
    background: rgba(30, 30, 30, 0.6);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* Header row - title on left, controls on right */
.prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* Agent Purpose title */
.prompt-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
}

/* Container for all header controls (agent selector + doc buttons) */
.header-controls {
    display: flex;
    gap: 16px;
    align-items: center;
    flex-wrap: wrap;
}

/* Agent display and selector */
.studio-agent-display {
    display: flex;
    gap: 8px;
    align-items: center;
    white-space: nowrap;
    background: rgba(40, 40, 40, 0.8);
    padding: 6px 12px;
    border-radius: 4px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.agent-label {
    color: #888;
    font-size: 13px;
}

.agent-name {
    color: #0ea5e9;
    font-weight: 500;
    font-size: 13px;
}

/* Documentation buttons container */
.documentation-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
}

/* Individual documentation buttons */
.documentation-btn,
.generate-btn {
    background: rgba(14, 165, 233, 0.1);
    border: 1px solid rgba(14, 165, 233, 0.3);
    color: #0ea5e9;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.documentation-btn:hover,
.generate-btn:hover {
    background: rgba(14, 165, 233, 0.2);
    border-color: rgba(14, 165, 233, 0.5);
    transform: translateY(-1px);
}

/* Input row - textarea and generate button */
.prompt-input-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

/* Prompt textarea */
.prompt-textarea {
    flex: 1;
    min-height: 80px;
    max-height: 200px;
    resize: vertical;
    background: rgba(40, 40, 40, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #fff;
    padding: 12px;
    font-size: 14px;
    line-height: 1.5;
    font-family: inherit;
}

.prompt-textarea:focus {
    outline: none;
    border-color: rgba(14, 165, 233, 0.5);
    background: rgba(40, 40, 40, 0.8);
}

.prompt-textarea::placeholder {
    color: #666;
}

/* Main generate button */
.generate-main {
    align-self: flex-end;
    white-space: nowrap;
    min-width: 150px;
    height: fit-content;
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(99, 102, 241, 0.2));
    border: 1px solid rgba(14, 165, 233, 0.5);
}

.generate-main:hover {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.3), rgba(99, 102, 241, 0.3));
    border-color: rgba(14, 165, 233, 0.7);
    box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}
.sub-tab-panel {
    display: none;
}

.sub-tab-panel.active {
    display: block;
    height: 100%;
}
/* Responsive adjustments */
@media (max-width: 1200px) {
    .prompt-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .header-controls {
        width: 100%;
        justify-content: flex-start;
    }
}

@media (max-width: 768px) {
    .prompt-input-row {
        flex-direction: column;
    }
    
    .generate-main {
        align-self: stretch;
        width: 100%;
    }
}