/* ==============================================
   提示词生成工具 - 样式
   ============================================== */

/* ---- 加载中遮罩层 ---- */
.pg-loading-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(255, 255, 255, 0.88);
    z-index: 8888;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

.pg-loading-overlay.show { display: flex; }

.pg-loading-spinner {
    width: 44px;
    height: 44px;
    border: 3px solid #dce8ff;
    border-top-color: #4096ff;
    border-radius: 50%;
    animation: pgSpin 0.8s linear infinite;
}

.pg-loading-text {
    font-size: 14px;
    color: #4a5568;
    font-weight: 500;
    margin: 0;
    letter-spacing: 0.3px;
}

/* ---- 错误提示 ---- */
.pg-error {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 7px 10px 7px 12px;
    background: #fff2f0;
    border: 1px solid #ffccc7;
    border-left: 3px solid #f5222d;
    border-radius: 6px;
    color: #cf1322;
    font-size: 13px;
    margin-bottom: 10px;
}

.pg-error-close {
    flex-shrink: 0;
    padding: 0 4px;
    font-size: 18px;
    line-height: 1;
    background: transparent;
    border: none;
    color: #cf1322;
    cursor: pointer;
    opacity: 0.5;
    transition: opacity 0.15s;
}

.pg-error-close:hover { opacity: 1; }

@keyframes pgErrorHide {
    to { opacity: 0; transform: translateY(-4px); }
}

.pg-error-hiding { animation: pgErrorHide 0.3s ease forwards; }

.pg-hidden { display: none !important; }

/* ---- 场景选择行 ---- */
.pg-scene-row {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.pg-row-label {
    font-size: 13px;
    color: #555;
    font-weight: 500;
    flex-shrink: 0;
    padding-top: 5px;
    min-width: 56px;
}

.pg-scene-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    flex: 1;
}

.pg-scene-label {
    cursor: pointer;
    line-height: 1;
}

.pg-scene-label input[type="radio"] {
    display: none;
}

.pg-scene-tag {
    display: inline-block;
    font-size: 12px;
    padding: 4px 11px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    color: #555;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.13s;
    user-select: none;
    white-space: nowrap;
}

.pg-scene-tag:hover {
    background: #e6f4ff;
    border-color: #91caff;
    color: #1677ff;
    transform: scale(1.04);
}

.pg-scene-label input[type="radio"]:checked + .pg-scene-tag {
    background: #1677ff;
    border-color: #1677ff;
    color: #fff;
    font-weight: 600;
    transform: scale(0.98);
    box-shadow: 0 2px 8px rgba(22, 119, 255, 0.35);
}

/* ---- 表单行 ---- */
.pg-form-row {
    margin-bottom: 8px;
}

.pg-form-row--sm {
    margin-bottom: 6px;
}

.pg-required {
    color: #f5222d;
    margin-left: 2px;
}

/* ---- 文本区 ---- */
.pg-textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 8px 11px;
    font-size: 13.5px;
    line-height: 1.65;
    border: 2px solid #d9d9d9;
    border-radius: 7px;
    resize: vertical;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    font-family: inherit;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
    display: block;
}

.pg-textarea::-webkit-scrollbar { width: 4px; }
.pg-textarea::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.pg-textarea:focus {
    outline: none;
    border-color: #4096ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
    transform: scale(1.01);
}

.pg-textarea--sm {
    font-size: 13px;
    padding: 6px 10px;
}

.pg-char-count {
    text-align: right;
    font-size: 11px;
    color: #bbb;
    margin-top: 2px;
}

.pg-char-count.pg-char-warn { color: #fa8c16; }
.pg-char-count.pg-char-over { color: #f5222d; font-weight: 600; }

/* ---- 参数配置行 ---- */
.pg-config-row {
    display: flex;
    gap: 10px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    align-items: flex-end;
}

.pg-config-item {
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 110px;
}

.pg-config-item--wide {
    flex: 1;
    min-width: 160px;
}

.pg-config-label {
    font-size: 12px;
    color: #888;
    white-space: nowrap;
}

.pg-select {
    padding: 5px 8px;
    font-size: 13px;
    border: 1.5px solid #d9d9d9;
    border-radius: 6px;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: auto;
    outline: none;
}

.pg-select:focus {
    border-color: #4096ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
}

.pg-input {
    padding: 5px 9px;
    font-size: 13px;
    border: 1.5px solid #d9d9d9;
    border-radius: 6px;
    background: #fff;
    color: #333;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}

.pg-input:focus {
    border-color: #4096ff;
    box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1);
    transform: scale(1.01);
}

/* ---- 示例快填 ---- */
.pg-examples-row {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.pg-examples-label {
    font-size: 11px;
    color: #bbb;
    white-space: nowrap;
    flex-shrink: 0;
}

.pg-example-tag {
    font-size: 12px;
    padding: 3px 10px;
    background: #f5f5f5;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    color: #555;
    cursor: pointer;
    transition: background 0.18s, border-color 0.18s, color 0.18s, transform 0.13s;
    white-space: nowrap;
    user-select: none;
}

.pg-example-tag:hover {
    background: #e6f4ff;
    border-color: #91caff;
    color: #1677ff;
    transform: scale(1.04);
}

.pg-example-tag.pg-active {
    background: #bae0ff;
    border-color: #4096ff;
    color: #0958d9;
    transform: scale(0.97);
}

/* ---- 提交行 ---- */
.pg-submit-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 4px;
}

.pg-submit-btn {
    transition: opacity 0.2s, transform 0.1s;
}

.pg-submit-btn:active { transform: scale(0.97); }

.pg-submit-btn.loading {
    opacity: 0.75;
    cursor: not-allowed;
}

.pg-submit-btn.loading::after {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(255, 255, 255, 0.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pgSpin 0.7s linear infinite;
    margin-left: 5px;
    vertical-align: -2px;
}

@keyframes pgSpin { to { transform: rotate(360deg); } }

/* ---- 快捷键提示 ---- */
.pg-shortcut-tip {
    font-size: 11px;
    color: #c0c0c0;
    margin-bottom: 6px;
}

/* ---- 结果区 ---- */
.pg-result-block {
    margin-top: 14px;
    border: 1px solid #c8daff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(22, 119, 255, 0.12), 0 1px 4px rgba(22, 119, 255, 0.06);
    animation: pgFadeIn 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes pgFadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---- 设计思路栏 ---- */
.pg-summary-bar {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(to right, #eef4ff, #f5f8ff, #fafbff);
    border-bottom: 1px solid #d6e6ff;
    font-size: 13px;
    color: #4a5568;
    line-height: 1.7;
}

.pg-summary-icon {
    flex-shrink: 0;
    font-size: 14px;
    margin-top: 1px;
}

.pg-summary-text { flex: 1; }

/* ---- 通用 section ---- */
.pg-section {
    padding: 11px 16px;
    border-bottom: 1px solid #eef2ff;
    transition: background 0.15s;
}

.pg-section:hover {
    background: #fafcff;
}

.pg-section:last-child { border-bottom: none; }

.pg-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* ---- 主提示词文本框（已由 .pg-prompt-edit 替代） ---- */

/* ---- 变体提示词 ---- */
.pg-variant-list {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.pg-variant-item {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 8px 10px;
    background: #fafafa;
    border: 1px solid #eee;
    border-radius: 7px;
    transition: border-color 0.15s;
}

.pg-variant-item:hover { border-color: #91caff; }

.pg-variant-badge {
    flex-shrink: 0;
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    background: #e6f4ff;
    color: #1677ff;
    border-radius: 8px;
    border: 1px solid #91caff;
    white-space: nowrap;
    margin-top: 2px;
}

.pg-variant-text {
    flex: 1;
    font-size: 13px;
    color: #444;
    line-height: 1.65;
    word-break: break-word;
    white-space: pre-wrap;
}

/* ---- 使用技巧列表 ---- */
.pg-tips-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pg-tips-list li {
    font-size: 13px;
    line-height: 1.6;
    padding: 6px 11px 6px 13px;
    border-radius: 6px;
    background: linear-gradient(to right, #e8f4ff, #eef6ff);
    color: #0a4fa0;
    position: relative;
}

.pg-tips-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 70%;
    border-radius: 2px;
    background: linear-gradient(to bottom, #1677ff, #69b1ff);
    min-height: 14px;
}

/* ---- 复制按钮 ---- */
.pg-copy-btn {
    font-size: 11px;
    padding: 2px 8px;
    background: #f0f0f0;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    color: #555;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    flex-shrink: 0;
    white-space: nowrap;
}

.pg-copy-btn:hover {
    background: #e6f4ff;
    border-color: #91caff;
    color: #1677ff;
}

.pg-copy-btn.copied {
    background: #f6ffed;
    border-color: #b7eb8f;
    color: #389e0d;
}

.pg-copy-sm {
    padding: 1px 7px;
    margin-top: 2px;
}

/* 剪贴板辅助元素 */
.pg-copy-helper {
    position: fixed;
    top: -9999px;
    left: -9999px;
    opacity: 0;
    pointer-events: none;
}

/* ---- Toast ---- */
.pg-toast {
    position: fixed;
    bottom: 26px;
    right: 26px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.82);
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    border-radius: 7px;
    opacity: 0;
    pointer-events: none;
    transform: translateY(7px);
    transition: opacity 0.28s, transform 0.28s;
    z-index: 9999;
    white-space: nowrap;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
}

.pg-toast.show {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.pg-toast--success { background: rgba(82, 196, 26, 0.92); }
.pg-toast--warning { background: rgba(250, 173, 20, 0.92); color: #333; }
.pg-toast--error   { background: rgba(255, 77, 79, 0.92); }

/* 字符计数警告色（已合并到 .pg-char-count 组合选择器） */

.pg-prompt-count {
    font-size: 11px;
    color: #aaa;
    font-weight: normal;
    margin-left: auto;
    flex-shrink: 0;
    letter-spacing: 0.2px;
}

/* ---- 可编辑提示词框 ---- */
.pg-prompt-edit {
    width: 100%;
    box-sizing: border-box;
    font-size: 13.5px;
    color: #1a1a2e;
    line-height: 1.85;
    background: linear-gradient(to bottom, #f6f9ff, #f0f6ff);
    border-radius: 8px;
    padding: 12px 15px;
    border: 1.5px solid #c8daff;
    border-left: 3px solid #4096ff;
    min-height: 100px;
    max-height: 420px;
    resize: vertical;
    font-family: inherit;
    scrollbar-width: thin;
    scrollbar-color: #b0c8f8 transparent;
    transition: border-color 0.2s, box-shadow 0.2s;
    display: block;
}

.pg-prompt-edit::-webkit-scrollbar { width: 4px; }
.pg-prompt-edit::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

.pg-prompt-edit:focus {
    outline: none;
    border-color: #4096ff;
    box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.12);
}

.pg-editable-hint {
    font-size: 11px;
    color: #bbb;
    font-weight: normal;
    margin-left: 2px;
}

/* ---- 质量评估区 ---- */
.pg-quality-section { background: #f8fbff; }

.pg-quality-avg {
    display: inline-flex;
    align-items: center;
    font-size: 11.5px;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 10px;
    background: #e6f4ff;
    color: #1677ff;
    border: 1px solid #91caff;
    margin-left: 2px;
    line-height: 1.6;
}

.pg-quality-avg.pg-q-level-high { background: #f6ffed; color: #389e0d; border-color: #b7eb8f; }
.pg-quality-avg.pg-q-level-mid  { background: #fffbe6; color: #d48806; border-color: #ffe58f; }
.pg-quality-avg.pg-q-level-low  { background: #fff2f0; color: #cf1322; border-color: #ffccc7; }

.pg-quality-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 7px 14px;
    margin-bottom: 8px;
}

.pg-quality-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pg-quality-label {
    font-size: 12px;
    color: #888;
    font-weight: 500;
    white-space: nowrap;
}

.pg-quality-bar-track {
    height: 7px;
    background: #e8ecf5;
    border-radius: 4px;
    overflow: hidden;
}

.pg-quality-bar-fill {
    height: 100%;
    border-radius: 4px;
    width: 0;
    background: linear-gradient(90deg, #4096ff, #69b1ff);
    transition: width 0.75s cubic-bezier(0.4, 0, 0.2, 1);
}

.pg-quality-bar-fill.pg-q-high { background: linear-gradient(90deg, #52c41a, #73d13d); }
.pg-quality-bar-fill.pg-q-mid  { background: linear-gradient(90deg, #faad14, #ffc53d); }
.pg-quality-bar-fill.pg-q-low  { background: linear-gradient(90deg, #ff4d4f, #ff7875); }

.pg-quality-score {
    font-size: 11px;
    font-weight: 700;
    color: #444;
    text-align: right;
    line-height: 1;
}

.pg-quality-score.high { color: #389e0d; }
.pg-quality-score.mid  { color: #d48806; }
.pg-quality-score.low  { color: #cf1322; }

.pg-quality-suggestions {
    border-top: 1px solid #e0eaff;
    padding-top: 8px;
    margin-top: 4px;
}

.pg-quality-suggest-title {
    font-size: 12px;
    font-weight: 600;
    color: #666;
    margin-bottom: 5px;
}

.pg-quality-suggest-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.pg-quality-suggest-list li {
    font-size: 12px;
    color: #5c4a00;
    padding: 5px 10px 5px 12px;
    background: linear-gradient(to right, #fffbe6, #fffef5);
    border-left: 2px solid #faad14;
    border-radius: 5px;
    line-height: 1.6;
}

@media (max-width: 768px) {
    .pg-config-row {
        flex-direction: column;
    }
    .pg-config-item--wide {
        width: 100%;
    }
    .pg-scene-row {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (max-width: 600px) {
    .pg-quality-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .pg-scene-tags {
        gap: 5px;
    }
    .pg-scene-tag {
        padding: 3px 9px;
        font-size: 11.5px;
    }
    .pg-variant-item {
        flex-direction: column;
        gap: 5px;
    }
    .pg-variant-badge {
        align-self: flex-start;
    }
}
