/* Premium CSS variables & themes */
:root {
    --bg-main: #03120a; /* deep forest green */
    --bg-card: rgba(6, 18, 12, 0.62);
    --bg-card-hover: rgba(8, 24, 16, 0.76);
    --border-color: rgba(34, 197, 94, 0.06);
    --border-focus: rgba(34, 197, 94, 0.6);
    
    --primary: #22c55e;
    --primary-hover: #16a34a;
    --primary-glow: rgba(34, 197, 94, 0.35);
    --accent-primary: var(--primary);
    
    --success: #10b981;
    --success-bg: rgba(16, 185, 129, 0.12);
    --success-border: rgba(16, 185, 129, 0.28);
    
    --error: #f43f5e;
    --error-bg: rgba(244, 63, 94, 0.15);
    --error-border: rgba(244, 63, 94, 0.3);
    
    --warning: #f59e0b;
    --warning-bg: rgba(245, 158, 11, 0.15);
    
    --text-primary: #eafaf0;
    --text-secondary: #9ad7c2;
    --text-muted: #6b8676;
    
    --code-bg: #02110a;
    --bg-primary: rgba(4, 12, 8, 0.45);
    --sidebar-width: 420px;
    
    --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-body: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    
    --transition-fast: 0.15s ease;
    --transition-normal: 0.25s ease;
}

/* Reset and base styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: var(--font-body);
    min-height: 100vh;
    overflow-x: hidden;
    line-height: 1.5;
    background-image: 
        radial-gradient(at 0% 0%, rgba(16, 185, 129, 0.08) 0px, transparent 45%),
        radial-gradient(at 100% 100%, rgba(6, 120, 80, 0.04) 0px, transparent 45%);
    background-attachment: fixed;
}

/* App Layout */
.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
    max-height: 100vh;
    padding: 20px 24px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    flex-shrink: 0;
}

.header-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo-icon {
    font-size: 24px;
    color: var(--primary);
    filter: drop-shadow(0 0 8px var(--primary-glow));
    animation: pulseGlow 3s infinite ease-in-out;
}

.logo-text h1 {
    font-family: var(--font-heading);
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #fff 0%, var(--text-secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.logo-text .tagline {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Status Pill */
.status-pill {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 50px;
    font-size: 12px;
    font-weight: 500;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--success);
    box-shadow: 0 0 8px var(--success);
}

/* Header center — "How to Use" button */
.header-center {
    flex: 1;
    display: flex;
    justify-content: center;
}

.btn-help-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 18px;
    background: rgba(34, 197, 94, 0.10);
    border: 1px solid rgba(34, 197, 94, 0.25);
    border-radius: 50px;
    color: #bbf7d0;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.btn-help-link i { font-size: 12px; }

.btn-help-link:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: rgba(34, 197, 94, 0.45);
    color: #dcfce7;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px var(--primary-glow);
}

/* Header status pills wrapper */
.header-status {
    display: flex;
    align-items: center;
    gap: 10px;
}


.settings-bar-top {
    margin-bottom: 20px;
    flex-shrink: 0;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 20px;
    align-items: end;
}

.settings-grid .form-group {
    margin-bottom: 0px; /* Reset bottom margin */
}

/* Compact API Keys layout in grid */
.settings-grid .keys-group {
    grid-column: span 2;
}

.api-keys-textarea-compact {
    width: 100%;
    height: 38px;
    min-height: 38px;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    padding: 8px 12px;
    resize: vertical;
    transition: border-color var(--transition-fast), height var(--transition-normal);
}

.api-keys-textarea-compact:focus {
    height: 120px;
    outline: none;
    border-color: var(--border-focus);
}

.workspace-layout {
    display: grid;
    grid-template-columns: 580px 1fr;
    gap: 20px;
    flex-grow: 1;
    min-height: 0; /* Important for grid item overflow scrolling */
}

.left-prompt-column {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    padding-right: 4px;
}

.right-results-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
}

/* Glassmorphism Cards */
.glass-card {
    background: var(--bg-card);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
    transition: border-color var(--transition-normal), box-shadow var(--transition-normal);
}

.glass-card:hover {
    border-color: rgba(255, 255, 255, 0.12);
}

/* Card Header */
.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    flex-shrink: 0;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}

.header-title i {
    color: var(--primary);
    font-size: 18px;
}

.header-title h2 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.2px;
}

/* Prompt Editor Card Specifics */
.prompt-editor-card {
    flex-shrink: 0;
}

.system-prompt-wrapper {
    margin-bottom: 16px;
    overflow: hidden;
    max-height: 250px;
    transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), margin-bottom 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    flex-shrink: 0;
}

.system-prompt-wrapper.collapsed {
    max-height: 0;
    margin-bottom: 0;
    opacity: 0;
    pointer-events: none;
}

.system-prompt-wrapper label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 6px;
    font-weight: 500;
}

.system-prompt-wrapper textarea {
    width: 100%;
    height: 60px;
    min-height: 60px;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    padding: 8px 12px;
    resize: vertical;
    transition: border-color var(--transition-fast);
}

.system-prompt-wrapper textarea:focus {
    outline: none;
    border-color: var(--border-focus);
}

.template-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wrapper-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.wrapper-header label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.wrapper-header .helper-text {
    font-size: 11px;
    color: var(--text-muted);
}

.wrapper-header .helper-text code {
    background: rgba(255, 255, 255, 0.05);
    padding: 1px 4px;
    border-radius: 4px;
    color: var(--primary);
    font-family: var(--font-mono);
}

.editor-container {
    display: flex;
    flex-direction: column;
}

.editor-container textarea {
    width: 100%;
    height: 320px;
    min-height: 200px;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    padding: 12px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.editor-container textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 10px rgba(34, 197, 94, 0.15);
}

.variable-detector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
}

.detector-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.chip-container {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.empty-chips-placeholder {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.var-chip {
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: #bbf7d0;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 4px;
    animation: scaleIn 0.2s ease;
}

/* Results Card Specifics */
.results-card {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.results-meta-indicators {
    display: flex;
    gap: 10px;
    margin-left: auto;
    margin-right: 15px;
}

.meta-indicator {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.meta-indicator.info span { color: var(--text-primary); }
.meta-indicator.success span { color: var(--success); }
.meta-indicator.error span { color: var(--error); }

.table-scroll-container {
    flex-grow: 1;
    overflow-y: auto;
    overflow-x: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.1);
}

/* Custom modern table */
table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    text-align: left;
}

th {
    background: rgba(255, 255, 255, 0.02);
    padding: 10px 14px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border-color);
    color: var(--text-primary);
    vertical-align: top;
}

tr:hover td {
    background: rgba(255, 255, 255, 0.01);
}

.empty-table-row td {
    text-align: center;
    padding: 48px;
}

.empty-table-message {
    color: var(--text-muted);
}

.empty-icon {
    font-size: 32px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.cell-inputs {
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 200px;
}

.input-kv {
    font-size: 11px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 4px;
    padding: 2px 6px;
    border-left: 2px solid var(--primary);
    word-break: break-all;
}

.input-kv span {
    font-weight: 600;
    color: var(--text-secondary);
}

.cell-prompt-preview {
    max-width: 250px;
    cursor: pointer;
    position: relative;
}

.prompt-text-truncate {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--text-secondary);
    font-family: var(--font-mono);
    font-size: 11px;
}

.btn-expand-preview {
    font-size: 10px;
    color: var(--primary);
    background: none;
    border: none;
    cursor: pointer;
    margin-top: 4px;
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 0;
}

.btn-expand-preview:hover {
    text-decoration: underline;
}

.cell-output-container {
    max-width: 450px;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    position: relative;
    min-height: 40px;
}

.output-text-box {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: 6px;
    font-size: 0.85rem;
    line-height: 1.5;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 200px;
    overflow-y: auto;
    transition: all 0.2s ease;
}

.output-text-box.clickable {
    cursor: pointer;
}

.output-text-box.clickable:hover {
    border-color: var(--accent-primary);
    background: rgba(34, 197, 94, 0.05);
}

.output-text-box.idle-status {
    border-color: var(--border-color);
    color: var(--text-muted);
    font-style: italic;
    background: rgba(255, 255, 255, 0.01);
}

.output-text-box.loading {
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.output-text-box.error {
    border-color: var(--error-border);
    background: var(--error-bg);
    color: #fda4af;
}

.key-index-badge {
    position: absolute;
    top: -8px;
    right: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 50px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.output-actions-row {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 4px;
}

.btn-icon-action {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color var(--transition-fast), background var(--transition-fast);
}

.btn-icon-action:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Sidebar Styling */
.sidebar-card {
    margin-bottom: 0px; /* Managed by layout grid gap */
}

.sidebar-section-title {
    font-family: var(--font-heading);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-section-title i {
    color: var(--primary);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 14px;
}

.form-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-group label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
}

.label-with-action {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.btn-text-action {
    background: none;
    border: none;
    color: var(--primary);
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.btn-text-action:hover {
    color: var(--primary-hover);
}

.model-status {
    font-size: 9px;
    font-weight: 700;
    padding: 1px 6px;
    border-radius: 50px;
    text-transform: uppercase;
}

.model-status.fetched {
    background: var(--success-bg);
    color: var(--success);
    border: 1px solid var(--success-border);
}

.model-status.fallback {
    background: var(--warning-bg);
    color: var(--warning);
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.model-status.loading {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
}

/* Inputs & selects */
input[type="text"],
input[type="number"],
select,
.api-keys-textarea {
    width: 100%;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    padding: 8px 12px;
    transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.api-keys-textarea {
    font-family: var(--font-mono);
    height: 70px;
    resize: vertical;
    line-height: 1.4;
}

/* Obscured/masked input style */
.api-keys-textarea.masked,
.api-keys-textarea-compact.masked,
#api-keys.masked {
    -webkit-text-security: disc; /* Support for webkit key masking in textarea */
    text-security: disc;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.15);
}

/* Range input styling */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-color);
    outline: none;
    margin: 10px 0;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    box-shadow: 0 0 6px var(--primary-glow);
    transition: transform var(--transition-fast);
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-sm {
    font-size: 12px;
    padding: 6px 12px;
}

.btn-large {
    font-size: 15px;
    padding: 12px 24px;
    width: 100%;
    border-radius: var(--radius-md);
}

.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(34, 197, 94, 0.3);
}

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
    box-shadow: 0 6px 20px rgba(34, 197, 94, 0.45);
    transform: translateY(-1px);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0);
}

.btn-primary:disabled {
    background: rgba(34, 197, 94, 0.4);
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.6;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.04);
    border-color: var(--border-color);
    color: var(--text-secondary);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-secondary:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Input mode toggler */
.input-mode-toggle-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 3px;
    margin-bottom: 16px;
}

.toggle-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-body);
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toggle-btn.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* Input Panels */
.input-panel-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.sub-panel-title {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.fields-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 250px;
    overflow-y: auto;
    padding-right: 4px;
}

.fields-grid .form-group {
    margin-bottom: 0;
}

.no-vars-msg, .file-spec-hint {
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

/* CSV Drag Drop Zone */
.file-upload-zone {
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    padding: 24px 16px;
    text-align: center;
    background: rgba(255, 255, 255, 0.01);
    cursor: pointer;
    transition: all var(--transition-normal);
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.file-upload-zone:hover, .file-upload-zone.dragover {
    border-color: var(--primary);
    background: rgba(34, 197, 94, 0.03);
}

.file-upload-zone input[type="file"] {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    opacity: 0;
    cursor: pointer;
}

.upload-icon {
    font-size: 28px;
    color: var(--text-secondary);
    transition: color var(--transition-fast);
}

.file-upload-zone:hover .upload-icon {
    color: var(--primary);
}

.file-upload-zone p {
    font-size: 12px;
    color: var(--text-secondary);
}

/* Validation Box */
.validation-message-box {
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    line-height: 1.5;
}

.validation-message-box.success {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: #a7f3d0;
}

.validation-message-box.error {
    background: var(--error-bg);
    border: 1px solid var(--error-border);
    color: #fca5a5;
}

/* CSV Preview */
.csv-preview-wrapper {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.csv-preview-wrapper h5 {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
}

.mini-table-scroll {
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.2);
}

#csv-preview-table {
    font-size: 11px;
}

#csv-preview-table th {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.03);
    font-size: 10px;
}

#csv-preview-table td {
    padding: 6px 10px;
    color: var(--text-secondary);
    word-break: break-all;
}

/* Execution Button Wrap */
.execution-actions {
    margin-top: 10px;
    padding-top: 0px;
    border-top: none;
    flex-shrink: 0;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(5, 8, 16, 0.75);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: opacity var(--transition-normal);
}

.modal-card {
    width: 600px;
    max-width: 90%;
    background: var(--bg-card);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: zoomIn 0.25s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 12px;
    margin-bottom: 16px;
}

.modal-header h3 {
    font-family: var(--font-heading);
    font-size: 16px;
    font-weight: 600;
}

.btn-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-size: 16px;
    transition: color var(--transition-fast);
}

.btn-close:hover {
    color: var(--error);
}

.modal-body pre {
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 16px;
    max-height: 350px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid var(--border-color);
}

/* Animations */
@keyframes pulseGlow {
    0%, 100% {
        transform: scale(1);
        filter: drop-shadow(0 0 4px var(--primary-glow));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 12px rgba(34, 197, 94, 0.6));
    }
}

@keyframes scaleIn {
    0% {
        transform: scale(0.9);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes zoomIn {
    0% {
        transform: scale(0.95);
        opacity: 0;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Helper Utilities */
.hidden {
    display: none !important;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.01);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Loading Spinner */
.spinner {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Clickable input variables in results table */
.input-kv.clickable {
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 4px;
    padding: 2px 4px;
}

.input-kv.clickable:hover {
    background: rgba(34, 197, 94, 0.1);
    color: var(--accent-primary);
}

/* Checkbox styling */
input[type="checkbox"] {
    accent-color: var(--accent-primary);
    cursor: pointer;
    width: 15px;
    height: 15px;
    border-radius: 4px;
}

/* Selected row styling */
tr.row-selected td {
    background: rgba(34, 197, 94, 0.04) !important;
}

/* Top settings bar row 2 for dynamic variable inputs */
.settings-row-inputs {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px dashed var(--border-color);
    display: flex;
    flex-direction: column;
}

.fields-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
}

.fields-row .form-group {
    flex: 1 1 150px;
    margin-bottom: 0;
}

/* Compact CSV Upload Strip */
.csv-horizontal-upload-container {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.file-upload-zone-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border: 1px dashed var(--border-color);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: all 0.2s ease;
    flex-grow: 1;
}

.file-upload-zone-compact:hover {
    border-color: var(--accent-primary);
    background: rgba(34, 197, 94, 0.05);
}

.file-upload-zone-compact input[type="file"] {
    display: none;
}

.file-upload-zone-compact .upload-icon {
    font-size: 16px;
    color: var(--primary);
}

.file-upload-zone-compact .upload-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
}

.file-upload-zone-compact .file-spec-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* Editable Table Cells */
.table-input-container {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 130px;
}

.table-input-field {
    flex-grow: 1;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 12px;
    padding: 6px 10px;
    width: 100%;
    transition: all 0.2s ease;
}

.table-input-field:focus {
    outline: none;
    border-color: var(--border-focus);
    background: rgba(34, 197, 94, 0.08);
    box-shadow: 0 0 8px rgba(34, 197, 94, 0.2);
}

.table-zoom-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 11px;
    padding: 6px;
    border-radius: 4px;
    transition: all 0.2s ease;
}

.table-zoom-btn:hover {
    color: var(--primary);
    background: rgba(255, 255, 255, 0.05);
}

/* Modal Textarea */
.modal-textarea {
    width: 100%;
    height: 250px;
    background: var(--code-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 13px;
    padding: 12px;
    line-height: 1.6;
    resize: vertical;
    transition: border-color var(--transition-fast);
}

.modal-textarea:focus {
    outline: none;
    border-color: var(--border-focus);
}
