/* ============================================
   SillyTavern Preset Manager — Premium Dark UI
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
    /* Surface colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #12121a;
    --bg-card: #1a1a26;
    --bg-card-hover: #22222f;
    --bg-elevated: #252535;
    --bg-input: #16161f;

    /* Accent */
    --accent-primary: #7c5cfc;
    --accent-secondary: #a78bfa;
    --accent-glow: rgba(124, 92, 252, 0.15);
    --accent-gradient: linear-gradient(135deg, #7c5cfc 0%, #a78bfa 50%, #c4b5fd 100%);

    /* Status colors */
    --color-enabled: #34d399;
    --color-disabled: #6b7280;
    --color-marker: #38bdf8;
    --color-system: #f472b6;
    --color-custom: #fbbf24;
    --color-danger: #f87171;
    --color-danger-hover: #ef4444;

    /* Text */
    --text-primary: #f0f0f5;
    --text-secondary: #9ca3af;
    --text-muted: #6b7280;
    --text-on-accent: #ffffff;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-active: rgba(124, 92, 252, 0.4);

    /* Misc */
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 20px;
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 24px rgba(124, 92, 252, 0.12);
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-smooth: 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

/* ============ LAYOUT ============ */
.app-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    grid-template-rows: auto 1fr;
    height: 100vh;
    gap: 0;
}

.app-header {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 10;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.app-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1.1rem;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.app-logo svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.preset-name-display {
    font-size: 0.92rem;
    color: var(--text-secondary);
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    max-width: 300px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent-primary);
    color: var(--text-on-accent);
    box-shadow: 0 2px 8px rgba(124, 92, 252, 0.3);
}
.btn-primary:hover {
    background: var(--accent-secondary);
    box-shadow: var(--shadow-glow);
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--bg-card);
    color: var(--text-secondary);
    border: 1px solid var(--border-subtle);
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-active);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.1);
    color: var(--color-danger);
    border: 1px solid rgba(248, 113, 113, 0.2);
}
.btn-danger:hover {
    background: rgba(248, 113, 113, 0.2);
    color: var(--color-danger-hover);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
    padding: 6px 10px;
}
.btn-ghost:hover {
    background: var(--bg-card);
    color: var(--text-primary);
}

.btn svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ============ SIDEBAR ============ */
.sidebar {
    background: var(--bg-secondary);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-subtle);
}

.sidebar-header h3 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

/* Drop Zone */
.drop-zone {
    border: 2px dashed rgba(124, 92, 252, 0.25);
    border-radius: var(--radius-md);
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-smooth);
    background: rgba(124, 92, 252, 0.03);
    position: relative;
}

.drop-zone:hover,
.drop-zone.dragover {
    border-color: var(--accent-primary);
    background: var(--accent-glow);
    box-shadow: inset 0 0 20px rgba(124, 92, 252, 0.05);
}

.drop-zone-icon {
    width: 36px;
    height: 36px;
    margin: 0 auto 8px;
    opacity: 0.5;
    color: var(--accent-secondary);
}

.drop-zone p {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.drop-zone p strong {
    color: var(--accent-secondary);
}

.drop-zone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

/* Preset list */
.preset-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.preset-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-bottom: 2px;
    position: relative;
}

.preset-list-item:hover {
    background: var(--bg-card);
}

.preset-list-item.active {
    background: var(--accent-glow);
    border: 1px solid var(--border-active);
}

.preset-list-item .preset-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    flex-shrink: 0;
}

.preset-list-item .preset-info {
    flex: 1;
    min-width: 0;
}

.preset-list-item .preset-title {
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.preset-list-item .preset-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.preset-list-item .preset-remove {
    opacity: 0;
    transition: opacity var(--transition-fast);
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
}
.preset-list-item:hover .preset-remove {
    opacity: 1;
}
.preset-list-item .preset-remove:hover {
    color: var(--color-danger);
    background: rgba(248, 113, 113, 0.1);
}

.sidebar-actions {
    padding: 12px 16px;
    border-top: 1px solid var(--border-subtle);
}

/* ============ MAIN PANEL ============ */
.main-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--bg-primary);
}

/* Empty State */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    text-align: center;
    padding: 40px;
}

.empty-state svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.3;
    color: var(--accent-secondary);
}

.empty-state h2 {
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.empty-state p {
    font-size: 0.85rem;
    max-width: 320px;
}

/* Tabs */
.tab-bar {
    display: flex;
    padding: 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    gap: 0;
}

.tab-btn {
    padding: 12px 20px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.tab-btn:hover {
    color: var(--text-secondary);
}

.tab-btn.active {
    color: var(--accent-secondary);
    border-bottom-color: var(--accent-primary);
}

.tab-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.tab-panel {
    display: none;
    animation: fadeIn 200ms ease;
}

.tab-panel.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ============ PROMPT ORDER PANEL ============ */
.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.prompt-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-bottom: 32px;
}

/* Prompt Item */
.prompt-item {
    display: grid;
    grid-template-columns: 24px auto 1fr auto auto;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    cursor: grab;
    user-select: none;
}

.prompt-item:hover {
    background: var(--bg-card-hover);
    border-color: rgba(255, 255, 255, 0.1);
}

.prompt-item.dragging {
    opacity: 0.5;
    transform: scale(0.98);
    box-shadow: var(--shadow-lg);
}

.prompt-item.drag-over {
    border-color: var(--accent-primary);
    background: var(--accent-glow);
}

.prompt-item.disabled {
    opacity: 0.45;
}

.prompt-item .drag-handle {
    color: var(--text-muted);
    cursor: grab;
    display: flex;
    align-items: center;
}

.prompt-item .drag-handle svg {
    width: 14px;
    height: 14px;
}

/* Type badge */
.prompt-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.badge-marker {
    background: rgba(56, 189, 248, 0.12);
    color: var(--color-marker);
}

.badge-system {
    background: rgba(244, 114, 182, 0.12);
    color: var(--color-system);
}

.badge-custom {
    background: rgba(251, 191, 36, 0.12);
    color: var(--color-custom);
}

.prompt-item .prompt-name {
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.prompt-item .prompt-identifier {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    margin-left: 4px;
}

/* Toggle switch */
.toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--bg-elevated);
    border-radius: 20px;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.toggle-slider::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--text-muted);
    bottom: 3px;
    left: 3px;
    transition: all var(--transition-fast);
}

.toggle-switch input:checked + .toggle-slider {
    background: rgba(52, 211, 153, 0.2);
}

.toggle-switch input:checked + .toggle-slider::before {
    background: var(--color-enabled);
    transform: translateX(16px);
}

.prompt-edit-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: all var(--transition-fast);
}

.prompt-edit-btn:hover {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.prompt-edit-btn svg {
    width: 14px;
    height: 14px;
}

/* Info button for markers */
.prompt-info-btn {
    color: var(--color-marker);
    opacity: 0.6;
}
.prompt-info-btn:hover {
    opacity: 1;
    background: rgba(56, 189, 248, 0.1);
    color: var(--color-marker);
}

/* Source label for markers */
.prompt-source {
    font-size: 0.68rem;
    color: var(--color-marker);
    opacity: 0.7;
    margin-left: 8px;
    font-style: italic;
}

/* ============ PROMPT EDITOR MODAL ============ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-smooth);
}

.modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 680px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    transform: translateY(20px) scale(0.97);
    transition: all var(--transition-smooth);
}

.modal-overlay.visible .modal {
    transform: translateY(0) scale(1);
}

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

.modal-header h3 {
    font-size: 0.95rem;
    font-weight: 600;
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
    flex: 1;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--border-subtle);
}

/* Form elements */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    transition: border-color var(--transition-fast);
    outline: none;
}

.form-input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-textarea {
    width: 100%;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.82rem;
    line-height: 1.6;
    resize: vertical;
    min-height: 120px;
    transition: border-color var(--transition-fast);
    outline: none;
}

.form-textarea:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.form-select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
}

.form-select:focus {
    border-color: var(--accent-primary);
}

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

/* ============ SETTINGS PANEL ============ */

/* Sub-tab bar */
.sub-tab-bar {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 4px;
    border: 1px solid var(--border-subtle);
}

.sub-tab-btn {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.sub-tab-btn:hover {
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.03);
}

.sub-tab-btn.active {
    background: var(--accent-primary);
    color: var(--text-on-accent);
    box-shadow: 0 2px 8px rgba(124, 92, 252, 0.25);
}

.sub-tab-panel {
    display: none;
    animation: fadeIn 200ms ease;
}
.sub-tab-panel.active {
    display: block;
}

/* Param sections */
.param-section {
    margin-bottom: 28px;
}

.param-section-title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-subtle);
}

.param-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 12px;
    line-height: 1.5;
}
.param-hint code {
    color: var(--accent-secondary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
}

/* Param row — horizontal layout for multiple small sliders */
.param-row {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

/* Param field — for text inputs within sections */
.param-field {
    margin-top: 4px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
    margin-bottom: 12px;
}

.setting-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
    transition: border-color var(--transition-fast);
}

.setting-card:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.setting-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.setting-card-header label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.setting-card-header label .param-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    border: 1.5px solid var(--accent-secondary);
    opacity: 0.6;
    flex-shrink: 0;
}

.setting-card-header .setting-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--accent-secondary);
    font-family: 'JetBrains Mono', monospace;
    min-width: 45px;
    text-align: right;
    background: rgba(124, 92, 252, 0.08);
    padding: 2px 8px;
    border-radius: var(--radius-sm);
}

.setting-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
}

.setting-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-primary);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(124, 92, 252, 0.3);
    transition: transform var(--transition-fast);
}

.setting-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.setting-slider::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent-primary);
    border: none;
    cursor: pointer;
}

/* Text input card */
.setting-text-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.setting-text-card label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.setting-text-card input,
.setting-text-card textarea {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    outline: none;
    transition: border-color var(--transition-fast);
}

.setting-text-card input:focus,
.setting-text-card textarea:focus {
    border-color: var(--accent-primary);
}

.setting-text-card textarea {
    resize: vertical;
    min-height: 70px;
    line-height: 1.5;
}

/* Sampler Order List */
.sampler-order-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.sampler-order-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    cursor: grab;
    user-select: none;
    transition: all var(--transition-fast);
}

.sampler-order-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
    background: var(--bg-card-hover);
}

.sampler-order-item.dragging {
    opacity: 0.5;
}

.sampler-order-item.drag-over {
    border-color: var(--accent-primary);
    background: var(--accent-glow);
}

.sampler-order-item .order-handle {
    color: var(--text-muted);
    display: flex;
    align-items: center;
}
.sampler-order-item .order-handle svg {
    width: 14px;
    height: 14px;
}

.sampler-order-item .order-index {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    background: var(--accent-glow);
    color: var(--accent-secondary);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    flex-shrink: 0;
}

.sampler-order-item .order-name {
    flex: 1;
    font-size: 0.82rem;
    font-weight: 500;
}

.sampler-order-item .order-id {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
}

/* Boolean Flags Grid */
.bool-flags-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 8px;
}

.bool-flag-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition-fast);
}

.bool-flag-item:hover {
    border-color: rgba(255, 255, 255, 0.1);
}

.bool-flag-item .flag-label {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

/* Select card for dropdown type */
.setting-select-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.setting-select-card label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.setting-select-card select {
    width: 100%;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

/* (styles moved to the redesigned settings panel section above) */

/* ============ ADD PROMPT BUTTON ============ */
.add-prompt-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 12px;
    background: transparent;
    border: 2px dashed var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
    margin-top: 8px;
}

.add-prompt-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-secondary);
    background: var(--accent-glow);
}

.add-prompt-btn svg {
    width: 16px;
    height: 16px;
}

/* ============ JSON PREVIEW ============ */
.json-preview-container {
    position: relative;
}

.json-preview {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: 16px;
    max-height: 500px;
    overflow: auto;
}

.json-preview pre {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    line-height: 1.6;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-break: break-all;
}

.json-preview .json-key {
    color: var(--color-marker);
}

.json-preview .json-string {
    color: var(--color-enabled);
}

.json-preview .json-number {
    color: var(--color-custom);
}

.json-preview .json-boolean {
    color: var(--color-system);
}

.json-preview .json-null {
    color: var(--text-muted);
}

.copy-json-btn {
    position: absolute;
    top: 8px;
    right: 8px;
}

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

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

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

/* ============ TOAST NOTIFICATION ============ */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    font-weight: 500;
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    box-shadow: var(--shadow-lg);
    animation: slideIn 300ms ease, fadeOut 300ms ease 2.5s forwards;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.success {
    border-color: rgba(52, 211, 153, 0.3);
    background: rgba(52, 211, 153, 0.1);
    color: var(--color-enabled);
}

.toast.error {
    border-color: rgba(248, 113, 113, 0.3);
    background: rgba(248, 113, 113, 0.1);
    color: var(--color-danger);
}

@keyframes slideIn {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes fadeOut {
    to { opacity: 0; transform: translateX(40px); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
    .app-layout {
        grid-template-columns: 1fr;
    }
    .sidebar {
        display: none;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
}
