﻿.prompt-header {
    display: flex;
    align-items: baseline; /* align text baselines rather than centers */
    gap: 6px;
}

.template-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    font-size: 10.5px;
    font-weight: 600;
    border-radius: 6px;
    background: rgba(88, 115, 255, 0.12);
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.prompt-warning {
    font-size: 12px;
    font-weight: 600;
    color: #b45309;
}

/* Enhanced formatting display in result viewer */
#result-formatted sup {
    font-size: 0.75em;
    vertical-align: super;
}

#result-formatted sub {
    font-size: 0.75em;
    vertical-align: sub;
}

#result-formatted s,
#result-formatted strike {
    text-decoration: line-through;
}

/* Highlight with subtle padding for better visibility */
#result-formatted [style*="background-color"] {
    padding: 2px 4px;
    border-radius: 2px;
}

/* App subtitle styling */
.app-subtitle {
    font-size: 0.6em;
    font-weight: normal;
    color: var(--text-secondary);
    margin-left: 4px;
}

/* Adjust for different contexts */
.view-title .app-subtitle {
    font-size: 0.65em;
    opacity: 0.8;
}

.card-title .app-subtitle {
    font-size: 0.75em;
    font-weight: 400;
}

/* Support page info/warning boxes */
.bg-warning {
    background-color: #fff3cd;
}

.bg-info {
    background-color: #d1ecf1;
}

.color-warning {
    color: #ffc107;
}

.color-info {
    color: #17a2b8;
}

/* Inline code styling */
code {
    background-color: #f4f4f4;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9em;
    color: #d63384;
}


/* ===== FORMATTED VIEW OPTIONS ===== */
.formatted-view-options {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
    cursor: pointer;
    user-select: none;
    margin: 0;
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-primary);
}

    .checkbox-label input[type="checkbox"] {
        cursor: pointer;
        width: 16px;
        height: 16px;
    }

    .checkbox-label:hover {
        color: var(--primary);
    }

/* ===== MARKDOWN RENDERED STYLES ===== */
.result-formatted-preview.markdown-rendered h1 {
    font-size: 24pt;
    font-weight: bold;
    margin: 16px 0 8px 0;
    color: var(--text-primary);
}

.result-formatted-preview.markdown-rendered h2 {
    font-size: 20pt;
    font-weight: bold;
    margin: 14px 0 7px 0;
    color: var(--text-primary);
}

.result-formatted-preview.markdown-rendered h3 {
    font-size: 16pt;
    font-weight: bold;
    margin: 12px 0 6px 0;
    color: var(--text-primary);
}

.result-formatted-preview.markdown-rendered ul,
.result-formatted-preview.markdown-rendered ol {
    margin: 8px 0;
    padding-left: 24px;
}

.result-formatted-preview.markdown-rendered li {
    margin: 4px 0;
    line-height: 1.6;
}

.result-formatted-preview.markdown-rendered p {
    margin: 8px 0;
    line-height: 1.6;
}

.result-formatted-preview.markdown-rendered code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 90%;
}

.result-formatted-preview.markdown-rendered pre {
    background: var(--bg-tertiary);
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    overflow-x: auto;
    margin: 8px 0;
}

    .result-formatted-preview.markdown-rendered pre code {
        background: none;
        padding: 0;
    }

.result-formatted-preview.markdown-rendered blockquote {
    border-left: 4px solid var(--primary);
    padding-left: var(--space-md);
    margin: 8px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.result-formatted-preview.markdown-rendered hr {
    border: none;
    border-top: 2px solid var(--border);
    margin: 16px 0;
}

.result-formatted-preview.markdown-rendered a {
    color: var(--primary);
    text-decoration: none;
}

    .result-formatted-preview.markdown-rendered a:hover {
        text-decoration: underline;
    }


/* ===== I/O TAB WITH SUB-TABS ===== */
.io-tabs {
    display: flex;
    gap: 4px;
    padding: var(--space-sm) var(--space-md) 0;
    background: var(--bg-secondary);
    border-bottom: 2px solid var(--border);
}

.io-tab-button {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: var(--space-sm) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    margin-bottom: -2px;
}

    .io-tab-button:hover {
        color: var(--text-primary);
        background: rgba(0, 0, 0, 0.03);
    }

    .io-tab-button.active {
        color: var(--primary);
        border-bottom-color: var(--primary);
        background: var(--bg-primary);
    }

/* I/O Content Sections */
.io-content {
    display: none;
    flex-direction: column;
    height: calc(100vh - 400px);
    min-height: 400px;
    max-height: 600px;
}

    .io-content.active {
        display: flex;
    }

.io-content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.io-content-title {
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
}

/* Better contrast dark theme for code */
.io-content-body {
    flex: 1;
    padding: var(--space-md);
    background: #2d2d30; /* ✅ Lighter dark background - VS Code dark+ theme */
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.8;
    overflow: auto;
}

/* Enhanced JSON syntax colors for better contrast */
#io-request-details .json-key,
#io-response-details .json-key {
    color: #9cdcfe; /* Light blue - better contrast */
    font-weight: normal;
}

#io-request-details .json-string,
#io-response-details .json-string {
    color: #ce9178; /* Salmon/orange - good contrast */
}

#io-request-details .json-number,
#io-response-details .json-number {
    color: #b5cea8; /* Light green */
}

#io-request-details .json-boolean,
#io-response-details .json-boolean {
    color: #569cd6; /* Blue */
    font-weight: bold;
}

#io-request-details .json-null,
#io-response-details .json-null {
    color: #569cd6; /* Blue */
    font-weight: bold;
}

/* Remove old styles */
.io-container,
.io-section,
.io-section-header,
.io-section-content {
    /* These are no longer needed */
}

/* ===== COMPREHENSIVE STATUS COLORS ===== */

/* Color-coded status badges in collapsed view */
.term-status-badge-inline {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 10px;
    font-weight: 600;
    flex-shrink: 0;
    margin-left: var(--space-xs);
    white-space: nowrap;
}

.term-status-badge-inline.status-preferred,
.term-translation.preferred {
    background: #e6ffed;
    color: #22863a;
}

/* Forbidden/Negative statuses - Red */
.term-status-badge-inline.status-forbidden,
.term-translation.forbidden {
    background: #ffeef0;
    color: #cb2431;
}

/* Draft/Caution statuses - Yellow */
.term-status-badge-inline.status-draft,
.term-translation.draft {
    background: #fff5b1;
    color: #d29922;
}

/* Neutral/Normal statuses - Gray */
.term-status-badge-inline.status-normal,
.term-translation.normal {
    background: var(--bg-secondary);
    color: var(--text-secondary);
}

/* Status icons in translations */
.term-translation.preferred .term-status-icon {
    color: #22863a;
}

.term-translation.forbidden .term-status-icon {
    color: #cb2431;
}

.term-translation.draft .term-status-icon {
    color: #d29922;
}

.term-translation.normal .term-status-icon {
    color: var(--text-disabled);
}


/* Collapsible term cards */
.term-entry-card.collapsible {
    cursor: pointer;
}

.term-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-sm);
}

.term-source-inline {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    flex: 1;
}

.term-arrow {
    color: var(--text-secondary);
    font-weight: bold;
}

.term-preferred {
    font-weight: 600;
    color: #22863a;
}

.term-count {
    background: var(--bg-secondary);
    padding: 2px 6px;
    border-radius: 10px;
    font-size: 10px;
    color: var(--text-secondary);
    font-weight: 600;
}

.term-expand-icon {
    font-size: 12px;
    color: var(--text-secondary);
    transition: transform 0.2s;
}

.term-card-body {
    padding: 0 var(--space-sm) var(--space-sm);
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
    }

    to {
        opacity: 1;
        max-height: 500px;
    }
}

/* ===== COMPACT TERMINOLOGY DISPLAY ===== */
.terminology-entries {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-height: 400px; /* Max height with scroll */
    overflow-y: auto;
    padding-right: var(--space-xs);
}

.term-entry-card {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm) var(--space-md); /* Reduced padding */
    transition: box-shadow 0.2s ease;
}

    .term-entry-card:hover {
        box-shadow: var(--shadow-sm);
    }

/* Compact horizontal layout for source term */
.term-source {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-sm); /* Reduced margin */
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid var(--border);
}

.term-source-content {
    flex: 1;
}

.term-label {
    font-size: 10px; /* Smaller label */
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 2px; /* Reduced margin */
}

.term-text {
    font-size: var(--font-size-md); /* ✅ Slightly smaller */
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px; /* Reduced margin */
}

.term-meta {
    display: flex;
    gap: var(--space-xs); /* Reduced gap */
    align-items: center;
    font-size: 10px; /* Smaller */
}

.term-language {
    background: var(--bg-secondary);
    padding: 2px 6px; /* Compact padding */
    border-radius: 10px;
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 10px;
}

.term-base {
    color: var(--text-secondary);
    font-size: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 200px;
}

/* Compact translations section */
.term-translations {
    /* No extra label needed */
}

.term-translation-list {
    display: flex;
    flex-direction: column;
    gap: 4px; 
}

.term-translation {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 6px var(--space-sm); /* Compact padding */
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    font-size: var(--font-size-sm);
}

    .term-translation.preferred {
        background: #e6ffed;
        border-left: 3px solid #22863a;
    }

    .term-translation.forbidden {
        background: #ffeef0;
        border-left: 3px solid #cb2431;
    }

    .term-translation.draft {
        background: #fff5b1;
        border-left: 3px solid #d29922;
    }

.term-status-icon {
    font-weight: bold;
    width: 16px; /* Smaller */
    text-align: center;
    font-size: 12px;
    flex-shrink: 0;
}

.term-translation.preferred .term-status-icon {
    color: #22863a;
}

.term-translation.forbidden .term-status-icon {
    color: #cb2431;
}

.term-translation.draft .term-status-icon {
    color: #d29922;
}

.term-translation-text {
    flex: 1;
    font-weight: 500; /* ✅ Lighter weight */
    color: var(--text-primary);
}

.term-status-badge {
    font-size: 10px; /* ✅ Smaller */
    padding: 2px 6px;
    border-radius: 10px;
    background: white;
    color: var(--text-secondary);
    font-weight: 600;
    flex-shrink: 0;
}

.term-no-translations {
    color: var(--text-secondary);
    font-style: italic;
    padding: var(--space-sm);
    font-size: var(--font-size-sm);
}

/* ✅ Summary at top */
.terminology-summary {
    background: var(--bg-secondary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    margin-bottom: var(--space-md);
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

    .terminology-summary strong {
        color: var(--text-primary);
    }


/* ===== BACKEND COMPARISON VIEWER ===== */
.comparison-viewer {
    padding: var(--space-md);
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    font-family: var(--font-family);
    font-size: var(--font-size-md);
    line-height: 1.8;
    max-height: 500px;
    overflow-y: auto;
}

/* Text states */
.text-identical {
    color: var(--text-primary);
}

.text-new {
    background: #f1f8ff;
    color: #0366d6;
    padding: 2px 4px;
    border-radius: 3px;
}

.text-removed {
    background: #ffeef0;
    color: #cb2431;
    text-decoration: line-through;
    padding: 2px 4px;
    border-radius: 3px;
}

.text-locked {
    background: #fff5b1;
    color: #24292e;
}

/* Term highlighting */
.term-highlight {
    border-bottom: 2px solid #0366d6;
    cursor: help;
}

/* Tags */
.tag {
    display: inline-block;
    padding: 2px 6px;
    margin: 0 2px;
    border-radius: 3px;
    font-family: 'Consolas', monospace;
    font-size: 11px;
    font-weight: 600;
}

.tag-identical {
    background: #f0f0f0;
    color: #a1a1a1;
    border: 1px solid #a3a3a3;
}

.tag-new {
    background: #f1f8ff;
    color: #0366d6;
    border: 1px solid #c8e1ff;
}

.tag-removed {
    background: #ffdce0;
    color: #cb2431;
    border: 1px solid #fdaeb7;
}

.tag-locked {
    background: #fffbdd;
    color: #735c0f;
    border: 1px solid #f9e577;
}

.tag-opening::before {
    content: '<';
}

.tag-closing::after {
    content: '>';
}

.tag-standalone::before {
    content: '<';
}

.tag-standalone::after {
    content: '/>';
}

/* ===== DIFF VIEW ===== */
.diff-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.diff-column {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.diff-header {
    background: var(--bg-secondary);
    padding: var(--space-sm) var(--space-md);
    font-weight: 600;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    border-bottom: 1px solid var(--border);
}

.diff-content {
    padding: var(--space-md);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: var(--font-size-sm);
    line-height: 1.8;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    background: var(--bg-tertiary);
}

.diff-stats {
    padding: var(--space-md);
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
}

.diff-stats-item {
    display: inline-block;
    margin-right: var(--space-lg);
    color: var(--text-secondary);
}

    .diff-stats-item strong {
        color: var(--text-primary);
    }

/* Diff highlighting */
.diff-added {
    background: #e6ffed;
    color: #24292e;
}

.diff-removed {
    background: #ffeef0;
    color: #24292e;
}

.diff-changed {
    background: #fff5b1;
    color: #24292e;
}



/* ===== ENHANCED JSON SYNTAX HIGHLIGHTING ===== */
#request-details,
#response-details {
    background: #1e1e1e; /* Dark background like VS Code */
    color: #d4d4d4;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 13px;
    line-height: 1.8;
    padding: var(--space-md);
    border-radius: var(--radius-sm);
    overflow-x: auto;
}

.json-key {
    color: #9cdcfe; /* Light blue for keys */
    font-weight: normal;
}

.json-string {
    color: #ce9178; /* Orange for string values */
}

.json-number {
    color: #b5cea8; /* Light green for numbers */
}

.json-boolean {
    color: #569cd6; /* Blue for booleans */
    font-weight: bold;
}

.json-null {
    color: #569cd6; /* Blue for null */
    font-weight: bold;
}

/* JSON with line numbers */
.json-with-lines {
    display: flex;
    background: #1e1e1e;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.json-line-numbers {
    background: #252526;
    color: #858585;
    padding: var(--space-md) var(--space-sm);
    text-align: right;
    user-select: none;
    border-right: 1px solid #3e3e42;
}

.json-line-number {
    line-height: 1.8;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 13px;
}

.json-content {
    flex: 1;
    overflow-x: auto;
}

    .json-content pre {
        margin: 0;
        padding: var(--space-md);
        background: transparent;
        color: #d4d4d4;
    }

/* JSON Tree View */
.json-tree {
    list-style: none;
    padding-left: 0;
    margin: 0;
}

    .json-tree li {
        padding: 2px 0;
    }

.json-array-index {
    color: #4ec9b0; /* Teal for array indices */
    font-weight: bold;
}

/* Collapsible JSON nodes */
.json-collapsible {
    cursor: pointer;
    user-select: none;
}

    .json-collapsible::before {
        content: '▼';
        display: inline-block;
        margin-right: 6px;
        transition: transform 0.2s;
    }

    .json-collapsible.collapsed::before {
        transform: rotate(-90deg);
    }

    .json-collapsible.collapsed + .json-tree {
        display: none;
    }


/* ===== RESULT SECTION TABS - BALANCED SIZE ===== */
.result-tabs {
    display: flex;
    gap: 4px;
    border-bottom: 2px solid var(--border);
    margin: 0 calc(-1 * var(--space-md)) var(--space-md);
    padding: 0 var(--space-md);
    background: var(--bg-secondary);
    flex-wrap: wrap;
    align-items: flex-end;
}

.result-tab-button {
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    padding: 6px 12px; /* Balanced - not too big, not too small */
    font-size: 13px; /* Slightly smaller than before */
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
    margin-bottom: -2px;
    flex-shrink: 0;
}

    .result-tab-button:hover {
        color: var(--text-primary);
        background: rgba(0, 0, 0, 0.03);
    }

    .result-tab-button.active {
        color: var(--primary);
        border-bottom-color: var(--primary);
        background: var(--bg-primary);
    }

.result-tab-content {
    display: none;
    animation: fadeIn 0.2s ease;
}

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

/* ===== VIEW TOGGLE BUTTONS ===== */
.result-view-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: var(--space-md);
    background: var(--bg-secondary);
    padding: 4px;
    border-radius: var(--radius-sm);
    width: fit-content;
}

.result-view-btn {
    background: transparent;
    border: none;
    padding: var(--space-xs) var(--space-md);
    font-size: var(--font-size-sm);
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
}

    .result-view-btn:hover {
        color: var(--text-primary);
        background: rgba(0, 0, 0, 0.05);
    }

    .result-view-btn.active {
        background: var(--bg-primary);
        color: var(--primary);
        box-shadow: var(--shadow-sm);
    }

/* ===== RESULT VIEWS ===== */
.result-view {
    display: none;
}

    /*.result-view.active {
        display: block;
    }*/

/* Instead, be explicit about both views */
#result-raw-view {
    display: block; /* Default to showing raw */
}

#result-formatted-view {
    display: none; /* Default to hiding formatted */
}

/* ===== FORMATTED PREVIEW (Enhanced for Copy/Paste) ===== */
.result-formatted-preview {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: var(--space-sm);
    font-family: 'Calibri', 'Arial', sans-serif; /* Match Word defaults */
    font-size: 11pt; /* Match Word default */
    line-height: 1.6;
    min-height: 100px;
    max-height: 400px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    user-select: text; /* Allow text selection */
    cursor: text;
}


    .result-formatted-preview .formatted-paragraph {
        margin: 0 0 var(--space-xs) 0; /* Reduced vertical spacing */
    }

        .result-formatted-preview .formatted-paragraph:last-child {
            margin-bottom: 0;
        }

    /* Compact table rendering in formatted views */
    .result-formatted-preview .result-table {
        margin: var(--space-xs) 0; /* Reduced margin */
    }

        .result-formatted-preview .result-table td,
        .result-formatted-preview .result-table th {
            padding: var(--space-xs); /* Reduced cell padding */
        }

    /* Ensure formatting elements are properly styled */
    .result-formatted-preview strong {
        font-weight: bold;
    }

    .result-formatted-preview em {
        font-style: italic;
    }

    .result-formatted-preview u {
        text-decoration: underline;
    }

    /* Make sure nested formatting works */
    .result-formatted-preview strong em {
        font-weight: bold;
        font-style: italic;
    }

    .result-formatted-preview strong u {
        font-weight: bold;
        text-decoration: underline;
    }

    .result-formatted-preview em u {
        font-style: italic;
        text-decoration: underline;
    }

    .result-formatted-preview strong em u {
        font-weight: bold;
        font-style: italic;
        text-decoration: underline;
    }

    /* Improve readability */
    .result-formatted-preview span {
        display: inline;
    }

/* Copy button in formatted view */
#copy-formatted-btn {
    box-shadow: var(--shadow-sm);
}

    #copy-formatted-btn:hover {
        box-shadow: var(--shadow-md);
        transform: translateY(-1px);
    }

/* Request/Response Details */
#request-details,
#response-details {
    background: var(--bg-tertiary);
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ===== SMALLER HEADER BUTTONS (Export & Copy) ===== */
#result-section .card-header button {
    padding: 4px 10px; /* Compact padding */
    font-size: 12px; /* Smaller font */
    font-weight: 600;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

/* Specifically target Export and Copy buttons */
#result-section .card-header .btn-secondary {
    padding: 4px 10px;
    font-size: 12px;
}


/* ===== SMALL BUTTON VARIANT (for I/O tabs) ===== */
.btn-sm {
    padding: 4px 10px !important; /* Compact */
    font-size: 12px !important;
    font-weight: 600;
}

/* Code highlighting in request/response */
.json-key {
    color: #881391;
}

.json-string {
    color: #1a1aa6;
}

.json-number {
    color: #1c00cf;
}

.json-boolean {
    color: #0000ff;
}

.json-null {
    color: #808080;
}


/* ===== TEMPLATE PLACEHOLDER HINTS ===== */
#edit-request-template {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.8;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: var(--space-md);
}

    #edit-request-template:focus {
        background: var(--bg-primary);
    }

/* Hint text styling */
.form-hint code {
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Consolas', monospace;
    font-size: 11px;
    color: var(--primary);
}


/* ===== CUSTOM API FORM ELEMENTS ===== */
.custom-header-row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
    margin-bottom: var(--space-sm);
}

    .custom-header-row input {
        flex: 1;
    }

    .custom-header-row .btn-icon {
        flex-shrink: 0;
    }

/* Request template textarea */
#edit-request-template {
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 12px;
    line-height: 1.6;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    padding: var(--space-md);
}

    #edit-request-template:focus {
        background: var(--bg-primary);
    }

/* Auth sections */
#auth-api-key-section,
#auth-bearer-section,
#auth-oauth2-section {
    margin-top: var(--space-md);
}

/* Custom API badge in connection card */
.connection-card-badge.badge-custom-api {
    background: #fff4e5;
    color: #7a5200;
}



/* ===== SMART SELECTION PREVIEW ===== */
.selection-preview-smart {
    position: relative;
    padding: var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    font-family: 'Consolas', 'Monaco', monospace;
    white-space: nowrap;
    overflow: hidden;
    min-height: 32px;
    display: flex;
    align-items: center;
}

    .selection-preview-smart:empty::before {
        content: 'No text selected';
        color: var(--text-disabled);
        font-style: italic;
        font-family: var(--font-family);
    }

/* Smart ellipsis container */
.selection-text-smart {
    display: flex;
    width: 100%;
    overflow: hidden;
}

.selection-text-start {
    flex-shrink: 0;
    color: var(--text-primary);
}

.selection-text-ellipsis {
    flex-shrink: 0;
    padding: 0 4px;
    color: var(--text-secondary);
}

.selection-text-end {
    flex-shrink: 0;
    color: var(--text-primary);
    text-align: right;
    margin-left: auto;
}


/* ===== CONFIRMATION MODAL ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.modal-dialog {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-width: 400px;
    width: 90%;
    animation: slideUp 0.3s ease;
}

.modal-header {
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

    .modal-header h3 {
        margin: 0;
        color: var(--text-primary);
    }

.modal-body {
    padding: var(--space-lg);
    color: var(--text-primary);
    line-height: 1.6;
}

    .modal-body p {
        margin: 0;
        white-space: pre-line; /* Preserve \n line breaks */
    }

.modal-footer {
    padding: var(--space-lg);
    border-top: 1px solid var(--border);
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

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

/* ===== CONNECTION CARD ===== */
.connection-card {
    background: var(--bg-primary);
    border: 2px solid var(--border);
    border-radius: var(--radius-md);
    padding: var(--space-md);
    margin-bottom: var(--space-md);
    transition: all var(--transition-fast);
    cursor: pointer;
}

    .connection-card:hover {
        border-color: var(--primary);
        box-shadow: var(--shadow-md);
        transform: translateY(-2px);
    }

    .connection-card.active {
        border-color: var(--primary);
        background: linear-gradient(to right, #f0f7ff, #ffffff);
    }

.connection-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: var(--space-sm);
}

.connection-card-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.connection-card-badge {
    display: inline-block;
    font-size: var(--font-size-xs);
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
}

.badge-chat {
    background: #e3f2fd;
    color: #0078d4;
}

.badge-reasoning {
    background: #f3e5f5;
    color: #7b1fa2;
}

.connection-card-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-sm);
}

.connection-card-meta {
    display: flex;
    gap: var(--space-md);
    font-size: var(--font-size-xs);
    color: var(--text-secondary);
    flex-wrap: wrap;
}

.connection-card-meta-item {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

    .connection-card-meta-item::before {
        content: "•";
        color: var(--border-hover);
    }

.connection-card-actions {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

    .connection-card-actions button {
        flex: 1;
        padding: var(--space-sm);
        font-size: var(--font-size-sm);
    }

/* ===== CONNECTION EDITOR ===== */
.connection-editor {
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: var(--space-lg);
}

.connection-editor-section {
    margin-bottom: var(--space-lg);
}

    .connection-editor-section:last-child {
        margin-bottom: 0;
    }

.section-title {
    font-size: var(--font-size-md);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--border);
}

/* ===== TEMPLATE CATEGORIES ===== */
.template-category {
    margin-bottom: var(--space-lg);
}

.category-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid var(--border);
}


/* ===== CONNECTION TEST RESULT ===== */
.connection-test-result {
    margin-top: var(--space-md);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-size: var(--font-size-sm);
    border-left-width: 4px;
    border-left-style: solid;
    animation: slideDown var(--transition-fast);
}

@keyframes slideDown {
    from {
        opacity: 0;
        max-height: 0;
        padding-top: 0;
        padding-bottom: 0;
    }

    to {
        opacity: 1;
        max-height: 100px;
        padding-top: var(--space-sm);
        padding-bottom: var(--space-sm);
    }
}

.connection-test-result strong {
    display: block;
    margin-bottom: var(--space-xs);
}

.connection-test-result small {
    color: inherit;
    opacity: 0.9;
}




/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-secondary);
}

.empty-state-icon {
    font-size: 48px;
    margin-bottom: var(--space-md);
    opacity: 0.5;
}

.empty-state-title {
    font-size: var(--font-size-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-sm);
}

.empty-state-description {
    font-size: var(--font-size-sm);
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

/* ===== LOADING SPINNER ===== */
.spinner {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ===== BADGE ===== */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: var(--font-size-xs);
    font-weight: 600;
}

.badge-primary {
    background: #e1f5fe;
    color: #0078d4;
}

.badge-success {
    background: #f1faf1;
    color: #107c10;
}

.badge-warning {
    background: #fff4e5;
    color: #7a5200;
}

.badge-error {
    background: #fef0f0;
    color: #8b1f1f;
}
