/* ============================================ */
/* 🎨 AI 生图 - 尺寸/模型按钮 */
/* ============================================ */
.ai-size-btn, .ai-model-btn {
    background: #1f2937;
    border: 1px solid #374151;
    color: #d1d5db;
    padding: 8px 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 90px;
    text-align: center;
    box-sizing: border-box;
}
.ai-size-btn:hover, .ai-model-btn:hover {
    border-color: #fbbf24;
    background: #2d3748;
}
.ai-size-btn.active, .ai-model-btn.active {
    background: linear-gradient(135deg, #3d2e0a, #5c4414);
    border-color: #fbbf24;
    box-shadow: 0 0 12px rgba(251, 191, 36, 0.25);
}

/* —— 模型按钮卡片布局 —— */
.ai-model-btn {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    flex: 1 1 140px;
    min-width: 130px;
    max-width: 180px;
    padding: 8px;
    gap: 6px;
    text-align: center;
}
/* 图片外框：所有溢出/圆角都在这里 */
.ai-model-thumb-wrap {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    background: #0f172a;
    overflow: hidden;          /* 关键：裁掉图片放大时的溢出 */
    position: relative;
}
.ai-model-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.ai-model-btn:hover .ai-model-thumb {
    transform: scale(1.05);
}
.ai-model-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: #e5e7eb;
    line-height: 1.2;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ai-model-btn.active .ai-model-title {
    color: #fde68a;
}
.ai-model-sub {
    font-size: 0.65rem;
    color: #6b7280;
    font-family: monospace;
    line-height: 1.1;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* —— Lora 列表缩略图（大图模式） —— */
.lora-thumb-wrap {
    display: block;
    width: 100%;
    aspect-ratio: 1;
    border-radius: 6px;
    background: #0f172a;
    overflow: hidden;
    position: relative;
}
.lora-thumb {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.3s ease;
}
.lora-item:hover .lora-thumb {
    transform: scale(1.05);
}

/* —— Lora 列表：五列网格布局（桌面）—— */
#aiGenLoraList {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 10px;
}
@media (max-width: 768px) {
    #aiGenLoraList {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}
@media (max-width: 480px) {
    #aiGenLoraList {
        grid-template-columns: repeat(2, 1fr);
        gap: 6px;
    }
}

/* —— Lora 卡片（纵向布局，类似模型卡片）—— */
.lora-item {
    background: #111827;
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 8px;
    transition: all 0.2s;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
.lora-item:hover {
    border-color: #6b7280;
    background: #1e293b;
}
.lora-item.selected {
    background: rgba(251, 191, 36, 0.1);
    border-color: #fbbf24;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.15);
}
.lora-item.selected:hover {
    background: rgba(251, 191, 36, 0.14);
}
/* range 内部不触发卡片 cursor */
.lora-item input[type="range"] {
    cursor: pointer;
}
/* Lora 卡片标题区 */
.lora-item-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e5e7eb;
    line-height: 1.3;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
}
.lora-item.selected .lora-item-title {
    color: #fde68a;
}
/* Lora 卡片描述 */
.lora-item-desc {
    font-size: 0.6rem;
    color: #9ca3af;
    line-height: 1.3;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
/* Lora 权重区域 */
.lora-weight-area {
    padding-top: 4px;
    border-top: 1px solid #1f2937;
}

/* —— Lora range 滑块加厚易拖动 + 推荐区间染色 —— */
/* CSS 变量 --rec-min / --rec-max 由 JS 按 Lora 推荐区间计算百分比 */
.lora-weight-slider {
    height: 22px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    padding: 0;
    margin: 0;
}
/* WebKit（Chrome/Edge/Safari）轨道：三段渐变 —— 灰色、金色推荐区、灰色 */
.lora-weight-slider::-webkit-slider-runnable-track {
    height: 6px;
    background: linear-gradient(
        to right,
        #374151 0%,
        #374151 var(--rec-min, 0%),
        #fbbf24 var(--rec-min, 0%),
        #fbbf24 var(--rec-max, 100%),
        #374151 var(--rec-max, 100%),
        #374151 100%
    );
    border-radius: 3px;
}
/* Firefox 轨道 */
.lora-weight-slider::-moz-range-track {
    height: 6px;
    background: linear-gradient(
        to right,
        #374151 0%,
        #374151 var(--rec-min, 0%),
        #fbbf24 var(--rec-min, 0%),
        #fbbf24 var(--rec-max, 100%),
        #374151 var(--rec-max, 100%),
        #374151 100%
    );
    border-radius: 3px;
    border: none;
}
/* 圆形滑块头 */
.lora-weight-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #fff;
    border: 2px solid #fbbf24;
    border-radius: 50%;
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.6);
    transition: transform 0.1s;
}
.lora-weight-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #fff;
    border: 2px solid #fbbf24;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 6px rgba(251, 191, 36, 0.6);
}
.lora-weight-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}
.lora-weight-slider:active::-webkit-slider-thumb {
    transform: scale(1.25);
}
#aiGenerateBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(245, 158, 11, 0.5);
}
#aiGenerateBtn:disabled {
    background: #4b5563 !important;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

/* 移动端 AI 生图按钮适配 */
@media (max-width: 767px) {
    .ai-size-btn {
        flex: 1;
        min-width: 70px;
        padding: 6px 8px;
    }
    .ai-model-btn {
        flex: 1 1 calc(50% - 4px);
        min-width: 0;
        max-width: none;
        padding: 6px;
        gap: 5px;
    }
    .ai-model-title { font-size: 0.78rem; }
    .ai-model-sub { font-size: 0.6rem; }
    .lora-thumb-wrap { width: 44px; height: 44px; }
}

/* 超小屏幕（< 420px，比如 iPhone SE 横向有限） */
@media (max-width: 420px) {
    .ai-model-btn {
        padding: 5px;
    }
    .ai-model-title { font-size: 0.72rem; }
}


/* ========================================= */
/* 🎴 Lora 折叠头（v3.5.10 起，醒目卡片风） */
/* ========================================= */
.ai-lora-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(135deg, #2e1065 0%, #4338ca 100%);
    border: 1px solid #6366f1;
    border-radius: 10px 10px 0 0;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
    -webkit-user-select: none;
    box-shadow: 0 0 14px rgba(99, 102, 241, 0.18);
    position: relative;
    z-index: 1;
}
.ai-lora-header:hover {
    background: linear-gradient(135deg, #3b1598 0%, #5b4ddc 100%);
    box-shadow: 0 0 18px rgba(99, 102, 241, 0.3);
}
.ai-lora-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}
.ai-lora-icon {
    font-size: 1.1rem;
}
.ai-lora-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: #fff;
    letter-spacing: 0.5px;
}
.ai-lora-summary-badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: bold;
    background: rgba(255, 255, 255, 0.18);
    color: #e0e7ff;
    margin-left: 4px;
    white-space: nowrap;
    transition: all 0.2s;
}
.ai-lora-summary-badge.has-selection {
    background: #fbbf24;
    color: #1f1300;
    box-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}
.ai-lora-toggle-icon {
    font-size: 0.75rem;
    color: #c7d2fe;
    white-space: nowrap;
    margin-left: 8px;
}

/* 折叠起来时圆角改回去 */
.ai-lora-header.collapsed {
    border-radius: 10px;
}

@media (max-width: 480px) {
    .ai-lora-header { padding: 9px 12px; }
    .ai-lora-title { font-size: 0.82rem; }
    .ai-lora-summary-badge { font-size: 0.68rem; padding: 2px 8px; }
    .ai-lora-toggle-icon { font-size: 0.7rem; }
}


/* ========================================= */
/* ✅ 选中状态 (点击后的固定样式) */
/* ========================================= */
.pay-package-item.active {
    background: rgba(16, 185, 129, 0.2) !important; /* 更明显的绿色背景 */
    border-color: #10b981 !important;                /* 高亮绿色边框 */
    transform: translateY(-2px) scale(1.02);         /* 浮起并微微放大 */
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.25); /* 绿色光晕 */
    z-index: 10; /* 保证浮起时不被遮挡 */
}


/* 保证选中时的文字颜色也亮起来 */
.pay-package-item.active .pkg-title { color: white; }
.pay-package-item.active .pkg-desc { color: #6ee7b7; }

/* ========================================= */
/* 🏅 2.0版：赛博文字头衔样式 */
/* ========================================= */

.badge-grid {
    display: grid;
    /* 改为每行 3 个，更宽的展示空间 */
    grid-template-columns: repeat(3, 1fr); 
    gap: 12px;
    background: #111827;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #374151;
    margin-top: 10px;
    max-height: 300px;
    overflow-y: auto;
    box-sizing: border-box;
}

.badge-item {
    /* 长方形铭牌 */
    padding: 10px 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.9rem;
    font-weight: bold;
    color: var(--text-sub);
    background: transparent;
    border: 1px solid #4b5563;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
    /* 🛡️ 防溢出：长徽章名允许换行/缩窄 */
    min-width: 0;
    text-align: center;
    word-break: break-word;
    overflow-wrap: anywhere;
    line-height: 1.2;
    box-sizing: border-box;
}

/* 鼠标悬停 */
.badge-item:hover {
    border-color: #6b7280;
    color: #f3f4f6;
    background: #2d3748;
    transform: translateY(-2px);
}

/* ✅ 选中状态 (高亮铭牌) */
.badge-item.active {
    color: #000; /* 文字变黑 */
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%); /* 金色渐变背景 */
    border-color: #fbbf24;
    box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4); /* 金色光晕 */
    transform: scale(1.05);
    z-index: 10;
}

/* 增加一点科技感的装饰线 */
.badge-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: transparent;
    transition: background 0.2s;
}

.badge-item.active::before {
    background: white; /* 选中时左侧亮条 */
}

/* 📱 移动端：徽章网格缩紧，防止 4 字徽章名撑爆格子 */
@media (max-width: 600px) {
    .badge-grid {
        padding: 10px;
        gap: 6px;
    }
    .badge-item {
        padding: 8px 2px;
        font-size: 0.7rem;
        letter-spacing: 0;
    }
    .badge-item.active {
        transform: scale(1.02);
    }
    /* 个人中心弹窗：内边距收缩 + 防横向溢出 */
    .profile-modal-inner {
        padding: 16px !important;
        border-radius: 12px !important;
    }
    .profile-modal-inner input,
    .profile-modal-inner button {
        max-width: 100%;
    }
}

/* ========================================= */
/* 🎨 个人中心弹窗 · 返回按钮                  */
/* ========================================= */
.profile-close-btn {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #374151;
    color: #d1d5db;
    border: 1px solid #4b5563;
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.1s;
    z-index: 5;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}
.profile-close-btn:hover {
    background: #4b5563;
    border-color: #6b7280;
    color: #fff;
}
.profile-close-btn:active {
    transform: scale(0.95);
}
@media (max-width: 600px) {
    .profile-close-btn {
        top: 10px;
        right: 10px;
        padding: 5px 10px;
        font-size: 0.75rem;
    }
}

/* ========================================= */
/* 🔘 开关样式 (Switch Toggle) */
/* ========================================= */
.switch {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 24px;
}

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

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #374151; /* 默认关闭颜色 */
  transition: .4s;
  border-radius: 24px;
  border: 1px solid #4b5563;
}

.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

/* 选中状态：变绿 */
input:checked + .slider {
  background-color: #10b981;
  border-color: #059669;
}

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

/* ========================================= */
/* 🛠️ Prompt 编辑器 (赛博积木风) */
/* ========================================= */
.prompt-editor-container {
    background: #111827; /* 深色底 */
    border: 1px solid #374151;
    border-radius: 8px;
    padding: 10px;
    margin-top: 10px;
}

.tag-wall {
    background: #0f172a; /* 更深的底，突出标签 */
    border: 1px solid #1f2937;
    border-radius: 6px;
    padding: 10px;
    min-height: 80px;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-content: flex-start;
    margin-bottom: 5px;
}

.tag-chip {
    background: transparent; 
    border: 1px solid #4b5563;
    border-radius: 4px;
    padding: 4px 8px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    transition: all 0.15s;
    user-select: none;
    position: relative;
    min-width: 40px;
    /* 🛡️ 长标签自动换行，防止溢出 */
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    box-sizing: border-box;
}
/* 确保文字颜色不会太亮 */
.tag-chip .en, .tag-chip .cn {
    color: var(--text-sub); /* 字体使用浅灰色 */
}

/* 悬停浮起 */
.tag-chip:hover {
    background: #374151 !important; /* 悬停时忽略背景色 */
    border-color: #9ca3af !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.3);
    z-index: 10;
}

/* 激活状态 (JS 会注入颜色) */
.tag-chip.active {
    /* 默认 active 状态只用 CSS 效果，颜色由 JS 注入的 style 负责 */
    box-shadow: 0 0 5px rgba(255,255,255,0.1); 
}

/* 禁用状态 (变灰+删除线) */
.tag-chip.disabled {
    opacity: 0.5;
    filter: grayscale(1);
    background: #000 !important;
    border-style: dashed;
    border-color: #333 !important;
}
.tag-chip.disabled .en { text-decoration: line-through; color: #666; }

/* 字体排版 */
.tag-chip .en {
    font-family: 'Consolas', monospace;
    font-size: 0.85rem;
    color: #e2e8f0;
    font-weight: 600;
    text-align: center;
}

.tag-chip .cn {
    font-size: 0.7rem; /* 中文小一点 */
    color: #94a3b8;
    margin-top: 2px;
    font-weight: normal;
}

/* 右上角删除小按钮 */
.tag-del-btn {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 14px;
    height: 14px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    line-height: 14px;
    text-align: center;
    display: none; /* 默认隐藏 */
    z-index: 20;
    box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.tag-chip:hover .tag-del-btn {
    display: block; /* 悬停卡片时显示 */
}
.tag-del-btn:hover {
    background: #b91c1c;
    transform: scale(1.2);
}

/* ========================================= */
/* 📝 最终组合 Prompt · 标题栏 & 复制按钮       */
/* ========================================= */
.final-prompt-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}
.final-prompt-title {
    font-size: 1.1rem;
    font-weight: bold;
    color: #fff;
    display: inline-flex;
    align-items: baseline;
    gap: 8px;
    flex-wrap: wrap;
    line-height: 1.3;
}
.final-prompt-hint {
    font-size: 0.7rem;
    font-weight: normal;
    color: #6b7280;
    white-space: nowrap;
}
.final-prompt-copy-btn {
    width: auto !important;
    height: auto !important;
    border-radius: 6px;
    background: #10b981;
    border: 1px solid #059669;
    padding: 6px 12px;
    color: #fff;
    font-size: 0.9rem;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.1s;
}
.final-prompt-copy-btn:hover {
    background: #059669;
}
.final-prompt-copy-btn:active {
    transform: scale(0.96);
}

/* 移动端：标题 + 按钮更紧凑，按钮铺满右侧，文字缩小 */
@media (max-width: 600px) {
    .final-prompt-header {
        gap: 8px;
        margin-bottom: 10px;
        align-items: center;
    }
    .final-prompt-title {
        font-size: 0.95rem;
        flex: 1 1 auto;
        min-width: 0;
    }
    .final-prompt-hint {
        font-size: 0.62rem;
        color: #6b7280;
        display: block; /* 小屏换到下一行，不挤标题 */
        margin-top: 2px;
    }
    .final-prompt-copy-btn {
        padding: 6px 10px;
        font-size: 0.8rem;
        flex-shrink: 0;
    }
}


/* ========================================= */
/* 🆕 Prompt 批量编辑工具 列表样式修正 */
/* ========================================= */

/* 1. 列表容器样式 */
.scroll-list {
    /* 确保内部元素能正常垂直堆叠 */
    display: flex;
    flex-direction: column;
}

/* 2. 单个列表行样式 */
.ungrouped-item-row {
    /* 启用 Grid 布局，使其能够按照 JS 中定义的 grid-template-columns 分栏 */
    display: grid;
    /* 默认的行间距和底部分隔线 */
    padding: 8px 10px;
    border-bottom: 1px solid #1f2937;
    cursor: pointer;
    align-items: center; /* 垂直居中内容 */
    transition: background-color 0.15s, border-left 0.15s;
}

.ungrouped-item-row:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* 3. 选中状态的视觉反馈 */
.ungrouped-item-row.selected {
    background-color: rgba(16, 185, 129, 0.15); /* 绿色强调色 */
    border-left: 3px solid #10b981;
    padding-left: 7px; /* 补偿 border 宽度，保持内容对齐 */
}

/* 4. 详情展开区域的样式修正 */
.prompt-detail-view {
    /* 确保它作为列表行容器的兄弟元素，可以正常显示 */
    margin: 0;
    padding: 10px 15px 15px;
}

/* 5. 确保输入框和按钮的统一外观（如果之前没定义） */
.input-modern {
    background: #111;
    border: 1px solid #4b5563;
    color: white;
    padding: 8px;
    border-radius: 6px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.9rem;
    color: #9ca3af;
}
/* ========================================= */
/* 💳 支付二维码区域样式 */
/* ========================================= */
#payment-section {
    width: 100%;
    max-width: 380px;
    margin: 20px auto 0;
    padding: 20px;
    text-align: center;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #4b5563;
    border-radius: 12px;
    box-sizing: border-box;
}

#pay-status {
    color: #fbbf24;
    font-weight: bold;
    font-size: 1rem;
    margin-bottom: 15px;
}

#qrcode {
    width: 180px;
    height: 180px;
    margin: 0 auto 15px;
    background: white;
    padding: 10px;
    border-radius: 8px;
    display: inline-block;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

#qrcode img {
    width: 100%;
    height: 100%;
    display: block;
}

/* ============================================ */


/* ================================================
   ☁️ 云控：模型 / Lora 灰化（2026-07-09）
   当 model_availability 表中 available=false 时，
   前端保留可见但显示为不可点击的灰化状态
   ================================================ */
.ai-model-btn.ai-model-btn-disabled,
.ai-model-btn[disabled] {
    opacity: 0.4;
    filter: grayscale(0.85);
    cursor: not-allowed !important;
    pointer-events: none;  /* 直接屏蔽点击，避免 alert */
    position: relative;
}
.ai-model-btn.ai-model-btn-disabled::after,
.ai-model-btn[disabled]::after {
    content: "维护中";
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 10px;
    background: rgba(239, 68, 68, 0.85);
    color: white;
    padding: 1px 6px;
    border-radius: 6px;
    font-weight: 600;
    letter-spacing: 0.5px;
    pointer-events: none;
}
.ai-model-btn.ai-model-btn-disabled:hover,
.ai-model-btn[disabled]:hover {
    border-color: inherit;
    background: inherit;
    transform: none;
}

/* Lora 卡片灰化（内联样式已经处理了 opacity/pointer-events，这里补一个角标） */
.lora-item.lora-item-disabled {
    position: relative;
}
.lora-item.lora-item-disabled::after {
    content: "维护中";
    position: absolute;
    top: 4px;
    right: 4px;
    font-size: 9px;
    background: rgba(239, 68, 68, 0.85);
    color: white;
    padding: 1px 5px;
    border-radius: 5px;
    font-weight: 600;
    pointer-events: none;
    z-index: 2;
}
