/**
 * 提示词（指令）管理功能样式
 * 文件：prompt.css
 * Design Style: Digital Study (DS随心转)
 */

/* ================================
   变量定义
================================ */
:root {
    /* Color Palette */
    --prompt-primary: #2563EB;
    /* Ceramic Blue */
    --prompt-primary-dark: #1D4ED8;
    --prompt-primary-light: rgba(37, 99, 235, 0.08);
    --prompt-secondary: #E11D48;
    /* Cinnabar Red */

    --prompt-bg: #FAF9F6;
    /* Rice Paper White */
    --prompt-bg-card: #FFFFFF;
    --prompt-bg-hover: #F3F4F6;

    --prompt-text: #2B2B2B;
    /* Ink Black */
    --prompt-text-light: #666666;
    /* Stone Gray */
    --prompt-text-muted: #9CA3AF;

    --prompt-border: #E5E7EB;

    /* Shadows & Effects */
    --prompt-shadow-modal: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --prompt-shadow-card: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --prompt-shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.08);

    --prompt-radius: 16px;
    --prompt-radius-sm: 8px;

    /* Typography */
    --prompt-font-serif: "Noto Serif SC", "Source Han Serif", serif;
    --prompt-font-sans: "Inter", system-ui, -apple-system, sans-serif;
}

/* ================================
   入口按钮
================================ */
.prompt-entry-btn {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0 12px;
    height: 32px;
    border: 1px solid rgba(77, 107, 254, 0.28);
    border-radius: 999px;
    background: linear-gradient(135deg, #FFFFFF 0%, #F3F6FF 100%);
    color: #2F3B8F;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    letter-spacing: 0.2px;
    white-space: nowrap;
    cursor: pointer;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease, background 0.16s ease;
    font-family: var(--prompt-font-sans);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    box-shadow: 0 1px 2px rgba(23, 48, 171, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    flex-shrink: 0;
}

.prompt-entry-btn:hover {
    border-color: rgba(77, 107, 254, 0.45);
    background: linear-gradient(135deg, #FFFFFF 0%, #EEF3FF 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(77, 107, 254, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.95);
}

.prompt-entry-btn:active {
    transform: translateY(0);
    box-shadow: 0 1px 3px rgba(77, 107, 254, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.prompt-entry-btn:focus-visible {
    outline: none;
    border-color: rgba(77, 107, 254, 0.55);
    box-shadow: 0 0 0 2px rgba(77, 107, 254, 0.18), 0 1px 2px rgba(23, 48, 171, 0.08);
}

.prompt-entry-btn i {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #FFFFFF 0%, #E6ECFF 40%, #CDD9FF 100%);
    font-size: 12px;
    line-height: 1;
    font-style: normal;
    color: #4D6BFE;
    transition: transform 0.16s ease;
}

.prompt-entry-btn:hover i {
    transform: scale(1.04);
}

.prompt-entry-btn>span {
    font-size: 13px;
    line-height: 1;
}

/* ================================
   指令管理弹窗
================================ */
.prompt-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.prompt-modal.show {
    display: flex;
}

.prompt-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(43, 43, 43, 0.4);
    backdrop-filter: blur(2px);
}

.prompt-modal-content {
    position: relative;
    width: 70vw;
    height: 80vh;
    background: var(--prompt-bg);
    border-radius: var(--prompt-radius);
    box-shadow: var(--prompt-shadow-modal);
    display: flex;
    overflow: hidden;
    animation: promptModalFadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(255, 255, 255, 0.6);
}

/* iframe 嵌入模式：占满容器，由外层弹窗提供遮罩与边距 */
.prompt-modal.prompt-modal-embedded {
    align-items: stretch;
    justify-content: stretch;
}

.prompt-modal.prompt-modal-embedded .prompt-modal-overlay {
    display: none;
}

.prompt-modal.prompt-modal-embedded .prompt-modal-content {
    width: 100%;
    height: 100%;
    border-radius: 0;
    box-shadow: none;
    border: none;
    animation: none;
}

@keyframes promptModalFadeUp {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.98);
    }

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

/* 左侧分类导航 */
.prompt-sidebar {
    width: 200px;
    background: #F8F7F4;
    /* Slightly darker rice paper */
    border-right: 1px solid var(--prompt-border);
    padding: 20px 12px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prompt-sidebar-title {
    padding: 0 12px 12px;
    font-family: var(--prompt-font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--prompt-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.prompt-category-item {
    padding: 10px 12px;
    font-size: 14px;
    color: var(--prompt-text-light);
    cursor: pointer;
    transition: all 0.2s ease;
    border-radius: 8px;
    font-family: var(--prompt-font-sans);
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 8px;
}

.prompt-category-item:hover {
    background: rgba(0, 0, 0, 0.03);
    color: var(--prompt-text);
}

.prompt-category-item.active {
    background: white;
    color: var(--prompt-primary);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-weight: 600;
}

.prompt-category-divider {
    height: 1px;
    background: var(--prompt-border);
    margin: 8px 12px;
    opacity: 0.6;
}

/* 右侧主内容区 */
.prompt-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--prompt-bg);
}

.prompt-header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--prompt-border);
    background: rgba(250, 249, 246, 0.8);
    backdrop-filter: blur(8px);
}

.prompt-search {
    flex: 1;
    padding: 10px 16px;
    border: 1px solid var(--prompt-border);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    color: var(--prompt-text);
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.prompt-search:focus {
    outline: none;
    border-color: var(--prompt-primary);
    box-shadow: 0 0 0 3px var(--prompt-primary-light);
}

.prompt-create-btn {
    padding: 10px 20px;
    background: var(--prompt-primary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
    display: flex;
    align-items: center;
    gap: 6px;
}

.prompt-create-btn:hover {
    background: var(--prompt-primary-dark);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

/* 指令列表 */
.prompt-list {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    align-content: start;
}

/* 大屏提升信息密度：四列 */
@media (min-width: 1680px) {
    .prompt-list {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* 指令卡片 - 新版设计 */
.prompt-card {
    background: var(--prompt-bg-card);
    border: 1px solid var(--prompt-border);
    border-radius: 16px;
    padding: 20px;
    padding-top: 30px;
    cursor: default;
    /* Card itself is not clickable anymore, button is */
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    box-shadow: var(--prompt-shadow-card);
    height: 100%;
}

.prompt-card:hover {
    border-color: var(--prompt-primary);
    box-shadow: var(--prompt-shadow-hover);
    transform: translateY(-4px);
}

/* 1. 头部：图标 + 标题 */
.prompt-card-header {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 16px;
}

.prompt-card-icon {
    width: 40px;
    height: 40px;
    background: #EFF6FF;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--prompt-primary);
    flex-shrink: 0;
}

.prompt-card-header-info {
    flex: 1;
}

.prompt-card-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 4px;
}

.prompt-card-title {
    font-family: var(--prompt-font-serif);
    font-size: 16px;
    font-weight: 700;
    color: var(--prompt-text);
    line-height: 1.3;
    margin: 0;
}

/* 智能填空标签 */
.prompt-smart-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    background: linear-gradient(135deg, #FFF7ED 0%, #FFEDD5 100%);
    color: #C2410C;
    border-radius: 4px;
    border-top-left-radius: 16px;
    font-size: 10px;
    font-weight: 600;
    font-family: var(--prompt-font-sans);
    line-height: 1.2;
    border: 1px solid rgba(251, 146, 60, 0.2);
    white-space: nowrap;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
}

/* 2. 中部：简介 + 数据 */
.prompt-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.prompt-card-desc {
    font-family: var(--prompt-font-sans);
    font-size: 13px;
    color: var(--prompt-text-light);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    height: 40px;
}

.prompt-card-stats {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 12px;
    color: var(--prompt-text-muted);
    margin-top: auto;
}

.prompt-stat-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.prompt-author-item {
    max-width: 48%;
    min-width: 0;
    gap: 8px;
}

.prompt-author-avatar {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #EEF2FF;
    border: 1px solid #E2E8F0;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.prompt-author-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.prompt-author-avatar-fallback {
    font-size: 11px;
    color: #1E293B;
    font-weight: 600;
    line-height: 1;
}

.prompt-author-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.prompt-favorite-toggle {
    border: none;
    background: transparent;
    padding: 0;
    cursor: pointer;
    color: var(--prompt-text-muted);
    transition: color 0.2s ease, transform 0.2s ease;
}

.prompt-favorite-toggle:hover {
    color: #F59E0B;
    transform: translateY(-1px);
}

.prompt-favorite-toggle.is-active {
    color: #F59E0B;
}

/* 3. 底部：行动按钮 */
.prompt-card-footer {
    display: flex;
    align-items: center;
    gap: 12px;
}

.prompt-use-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: #EFF6FF;
    color: var(--prompt-primary);
    border: 1px solid transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.prompt-use-btn:hover {
    background: var(--prompt-primary);
    color: white;
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.2);
    transform: translateY(-1px);
}

/* 菜单按钮位置调整 */
.prompt-card-menu {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
}

.prompt-card-menu-btn {
    background: transparent;
    border: none;
    color: var(--prompt-text-muted);
    width: 20px;
    height: 20px;
}

.prompt-card-menu-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    color: var(--prompt-text);
}

.prompt-card-dropdown {
    display: none;
    position: absolute;
    top: 28px;
    right: 0;
    min-width: 120px;
    background: white;
    border: 1px solid var(--prompt-border);
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    z-index: 10;
    margin-top: 4px;
    padding: 6px;
    transform-origin: top right;
}

.prompt-card-dropdown.show {
    display: block;
    animation: dropdownFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.prompt-card-dropdown-item {
    padding: 8px 12px;
    font-size: 13px;
    color: var(--prompt-text);
    cursor: pointer;
    transition: background 0.1s ease;
    border-radius: 6px;
    font-family: var(--prompt-font-sans);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.prompt-card-dropdown-item:hover {
    background: var(--prompt-bg-hover);
}

.prompt-card-dropdown-item.danger {
    color: var(--prompt-secondary);
}

.prompt-card-dropdown-item.danger:hover {
    background: #FEF2F2;
}

/* 空状态 */
.prompt-empty {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px;
    color: var(--prompt-text-muted);
}

.prompt-empty-icon {
    font-size: 56px;
    margin-bottom: 20px;
    opacity: 0.3;
    animation: float 3s ease-in-out infinite;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.prompt-empty-text {
    font-size: 15px;
    font-family: var(--prompt-font-sans);
}

/* ================================
   编辑弹窗
================================ */
.prompt-editor-modal,
.variable-fill-modal,
.prompt-add-category-modal,
.prompt-confirm-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10001;
    align-items: center;
    justify-content: center;
}

.prompt-editor-modal.show,
.variable-fill-modal.show,
.prompt-add-category-modal.show,
.prompt-confirm-modal.show {
    display: flex;
}

.prompt-editor-content,
.variable-fill-content {
    position: relative;
    width: 600px;
    max-width: 90vw;
    max-height: 85vh;
    background: var(--prompt-bg);
    /* Rice paper */
    border-radius: var(--prompt-radius);
    box-shadow: var(--prompt-shadow-modal);
    display: flex;
    flex-direction: column;
    animation: promptModalFadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.prompt-editor-header,
.variable-fill-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 24px;
    border-bottom: 1px solid var(--prompt-border);
    background: white;
    border-radius: var(--prompt-radius) var(--prompt-radius) 0 0;
}

.prompt-editor-header h3,
.variable-fill-header h3 {
    margin: 0;
    font-family: var(--prompt-font-serif);
    font-size: 20px;
    font-weight: 700;
    color: var(--prompt-text);
}

.prompt-editor-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    font-size: 20px;
    color: var(--prompt-text-muted);
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.prompt-editor-close:hover {
    background: var(--prompt-bg-hover);
    color: var(--prompt-text);
}

.prompt-editor-body,
.variable-fill-body {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: var(--prompt-bg);
}

.prompt-form-group {
    margin-bottom: 24px;
}

.prompt-form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 14px;
    font-family: var(--prompt-font-sans);
    font-weight: 600;
    color: var(--prompt-text);
}

.prompt-form-group label .required {
    color: var(--prompt-secondary);
    margin-left: 4px;
}

.prompt-form-input,
.prompt-form-select,
.prompt-form-textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--prompt-border);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--prompt-font-sans);
    background: white;
    color: var(--prompt-text);
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02);
}

.prompt-form-input:focus,
.prompt-form-select:focus,
.prompt-form-textarea:focus {
    outline: none;
    border-color: var(--prompt-primary);
    box-shadow: 0 0 0 3px var(--prompt-primary-light);
}

.prompt-form-textarea {
    min-height: 180px;
    line-height: 1.6;
    resize: vertical;
}

.prompt-category-row {
    display: flex;
    gap: 12px;
    align-items: center;
}

.prompt-category-row .prompt-form-select {
    flex: 1;
}

.prompt-add-category-btn {
    padding: 12px 16px;
    background: white;
    color: var(--prompt-primary);
    border: 1px solid var(--prompt-primary);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    font-weight: 500;
}

.prompt-add-category-btn:hover {
    background: var(--prompt-primary-light);
}

/* 内容编辑器 */
.prompt-editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.prompt-insert-var-btn {
    padding: 6px 12px;
    background: #EFF6FF;
    color: var(--prompt-primary);
    border: 1px solid transparent;
    /* Cleaner look */
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.prompt-insert-var-btn:hover {
    background: #DBEAFE;
    color: var(--prompt-primary-dark);
}

.prompt-variable-preview {
    margin-top: 12px;
    padding: 12px 16px;
    background: #F8F7F4;
    border-radius: 8px;
    border: 1px dashed var(--prompt-border);
    font-size: 13px;
    color: var(--prompt-text-light);
    display: flex;
    gap: 8px;
    align-items: baseline;
}

.prompt-variable-preview .label {
    color: var(--prompt-text-muted);
    font-weight: 500;
}

.prompt-variable-preview .var-list {
    color: var(--prompt-primary);
    font-family: monospace;
    font-weight: 500;
    background: rgba(37, 99, 235, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
}

/* 开关组 */
.prompt-toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
}

.prompt-toggle-group label {
    margin-bottom: 0;
}

.prompt-toggle {
    position: relative;
    width: 48px;
    height: 26px;
}

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

.prompt-toggle-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--prompt-border);
    border-radius: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.prompt-toggle-slider:before {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.prompt-toggle input:checked+.prompt-toggle-slider {
    background: var(--prompt-primary);
}

.prompt-toggle input:checked+.prompt-toggle-slider:before {
    transform: translateX(22px);
}

.prompt-editor-footer,
.variable-fill-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid var(--prompt-border);
    background: white;
    border-radius: 0 0 var(--prompt-radius) var(--prompt-radius);
}

.prompt-btn-cancel {
    padding: 10px 20px;
    background: white;
    color: var(--prompt-text-light);
    border: 1px solid var(--prompt-border);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
}

.prompt-btn-cancel:hover {
    background: var(--prompt-bg-hover);
    color: var(--prompt-text);
    border-color: #d1d5db;
}

.prompt-btn-save {
    padding: 10px 24px;
    background: var(--prompt-primary);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(37, 99, 235, 0.2);
}

.prompt-btn-save:hover {
    background: var(--prompt-primary-dark);
    box-shadow: 0 4px 8px rgba(37, 99, 235, 0.3);
    transform: translateY(-1px);
}

.prompt-btn-save:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ================================
   Mode Banner（模式条）
================================ */
.chat-mode-banner {
    width: 100%;
    padding: 12px 16px;
    background: linear-gradient(to right, #EFF6FF, #F5F3FF);
    border: 1px solid rgba(37, 99, 235, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 16px 0;
    animation: bannerFade in 0.4s ease;
}

.chat-mode-banner i {
    color: var(--prompt-primary);
    font-size: 18px;
}

.chat-mode-banner span {
    color: var(--prompt-text);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--prompt-font-sans);
}

/* ================================
   Variable Card（变量卡片）
================================ */
.chat-variable-card {
    background: white;
    border: 1px solid var(--prompt-border);
    border-radius: 12px;
    margin: 16px 0;
    overflow: hidden;
    box-shadow: var(--prompt-shadow-card);
    animation: promptModalFadeUp 0.4s ease;
}

.chat-variable-card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #F8FAFC;
    color: var(--prompt-text);
    font-size: 14px;
    font-weight: 600;
    border-bottom: 1px solid var(--prompt-border);
}

.chat-variable-card-header i {
    color: var(--prompt-primary);
    font-size: 16px;
}

.chat-variable-card-body {
    padding: 16px;
    background: white;
}

.chat-variable-item {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #F1F5F9;
}

.chat-variable-item:last-child {
    border-bottom: none;
}

.chat-variable-name {
    width: 120px;
    flex-shrink: 0;
    font-size: 13px;
    color: var(--prompt-text-light);
    font-weight: 500;
}

.chat-variable-value {
    flex: 1;
    font-size: 13px;
    color: var(--prompt-text);
}

/* Inline form styles */
.prompt-form-group.inline-group {
    display: flex;
    align-items: center;
    gap: 16px;
}

.prompt-form-group.inline-group label:not(.prompt-toggle) {
    margin-bottom: 0;
    width: 80px;
    /* Fixed width for labels */
    flex-shrink: 0;
}

.prompt-form-group.inline-group .prompt-form-input,
.prompt-form-group.inline-group .prompt-category-row {
    flex: 1;
}

.prompt-form-group.inline-group.align-top {
    align-items: flex-start;
}

.prompt-form-group.inline-group.align-top label {
    margin-top: 8px;
    /* Align label with input top */
}

.variable-inline-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.variable-inline-group label {
    width: 96px;
    margin-bottom: 0;
    flex-shrink: 0;
    position: relative;
    overflow: visible;
}

.variable-inline-group .variable-label-text {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.variable-inline-group label[data-tooltip]:not([data-tooltip=""])::after {
    content: attr(data-tooltip);
    position: absolute;
    left: calc(100% + 10px);
    top: 50%;
    width: max-content;
    max-width: min(360px, calc(100vw - 80px));
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(31, 41, 55, 0.96);
    color: #fff;
    font-size: 12px;
    line-height: 1.4;
    white-space: normal;
    word-break: break-all;
    box-shadow: 0 6px 24px rgba(0, 0, 0, 0.18);
    opacity: 0;
    visibility: hidden;
    transform: translateY(calc(-50% + 4px));
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 1200;
    pointer-events: none;
}

.variable-inline-group label[data-tooltip]:not([data-tooltip=""])::before {
    content: '';
    position: absolute;
    left: calc(100% + 4px);
    top: 50%;
    border: 6px solid transparent;
    border-right-color: rgba(31, 41, 55, 0.96);
    opacity: 0;
    visibility: hidden;
    transform: translateY(calc(-50% + 4px));
    transition: opacity 0.18s ease, transform 0.18s ease;
    z-index: 1201;
    pointer-events: none;
}

.variable-inline-group label[data-tooltip]:not([data-tooltip=""]):hover::after,
.variable-inline-group label[data-tooltip]:not([data-tooltip=""]):hover::before {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%);
}

.variable-inline-group .prompt-form-input {
    flex: 1;
}

.prompt-form-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.prompt-editor-toolbar {
    margin-bottom: 0;
    display: flex;
    justify-content: flex-end;
}

/* Small Modal (Add Category) */
/* Small Modal Content (Add Category) */
.prompt-modal-small-content {
    position: relative;
    width: 360px;
    background: white;
    border-radius: var(--prompt-radius);
    box-shadow: var(--prompt-shadow-modal);
    display: flex;
    flex-direction: column;
    animation: promptModalFadeUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.prompt-modal-small-content .prompt-editor-header {
    padding: 16px 20px;
}

.prompt-modal-small-content .prompt-editor-body {
    padding: 20px;
    flex: 1;
}

.prompt-modal-small-content .prompt-editor-footer {
    padding: 16px 20px;
}

/* 删除确认弹窗 */
.prompt-confirm-content {
    position: relative;
    width: 420px;
    max-width: 90vw;
    background: var(--prompt-bg);
    border-radius: var(--prompt-radius);
    box-shadow: var(--prompt-shadow-modal);
    border: 1px solid rgba(0, 0, 0, 0.04);
    animation: promptModalFadeUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.prompt-confirm-header {
    padding: 18px 20px 10px;
}

.prompt-confirm-header h3 {
    margin: 0;
    font-family: var(--prompt-font-serif);
    font-size: 18px;
    color: var(--prompt-text);
}

.prompt-confirm-body {
    padding: 0 20px 18px;
    color: var(--prompt-text-light);
    font-family: var(--prompt-font-sans);
    line-height: 1.6;
    word-break: break-word;
}

.prompt-confirm-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 6px 20px 6px;
    border-top: 1px solid var(--prompt-border);
    background: rgba(255, 255, 255, 0.6);
    border-radius: 0 0 var(--prompt-radius) var(--prompt-radius);
}

.prompt-btn-danger {
    padding: 10px 20px;
    background: var(--prompt-secondary);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(225, 29, 72, 0.25);
}

.prompt-btn-danger:hover {
    background: #BE123C;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(225, 29, 72, 0.3);
}

/* 变量填写弹窗：实时预览片段 */
.variable-preview-panel {
    margin-top: 8px;
    background: #FFFFFF;
    border: 1px solid var(--prompt-border);
    border-radius: 10px;
    overflow: hidden;
}

.variable-preview-title {
    padding: 10px 14px;
    font-size: 12px;
    color: var(--prompt-text-muted);
    border-bottom: 1px solid var(--prompt-border);
    background: #F8FAFC;
    font-family: var(--prompt-font-sans);
    font-weight: 600;
}

.variable-preview-content {
    padding: 12px 14px;
    max-height: 220px;
    overflow: auto;
    line-height: 1.65;
    color: var(--prompt-text);
    font-size: 13px;
    white-space: normal;
    word-break: break-word;
    font-family: var(--prompt-font-sans);
}

.preview-var-filled {
    display: inline;
    background: rgba(37, 99, 235, 0.10);
    color: var(--prompt-primary-dark);
    border-radius: 4px;
    padding: 1px 4px;
    font-weight: 600;
}

.preview-var-missing {
    display: inline;
    background: #FEF2F2;
    color: #B91C1C;
    border: 1px dashed #FCA5A5;
    border-radius: 4px;
    padding: 1px 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.preview-empty {
    color: var(--prompt-text-muted);
}