/* ============================================
   AI 提示词生成器 — 页面专用样式
   ============================================ */

/* ---- 能力亮点卡片 ---- */
.pg-features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.pg-feature-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 16px;
    text-align: center;
    transition: all 0.25s ease;
    position: relative;
    overflow: hidden;
}

.pg-feature-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: var(--card-accent, var(--primary-color));
    transform: scaleX(0);
    transition: transform 0.3s ease;
}

.pg-feature-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
    border-color: var(--card-accent, var(--primary-color));
}

.pg-feature-card:hover::before {
    transform: scaleX(1);
}

.pg-feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

.pg-feature-card:nth-child(1) .pg-feature-icon { background: #ede9fe; color: #7c3aed; }
.pg-feature-card:nth-child(2) .pg-feature-icon { background: #dbeafe; color: #2563eb; }
.pg-feature-card:nth-child(3) .pg-feature-icon { background: #d1fae5; color: #059669; }
.pg-feature-card:nth-child(4) .pg-feature-icon { background: #fef3c7; color: #d97706; }
.pg-feature-card:nth-child(1) { --card-accent: #7c3aed; }
.pg-feature-card:nth-child(2) { --card-accent: #2563eb; }
.pg-feature-card:nth-child(3) { --card-accent: #059669; }
.pg-feature-card:nth-child(4) { --card-accent: #d97706; }

.pg-feature-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.pg-feature-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* ---- 流程步骤条 ---- */
.pg-steps {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: var(--spacing-xl);
    padding: 16px 0;
}

.pg-step {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 18px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 24px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    white-space: nowrap;
    transition: all 0.3s ease;
}

.pg-step.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pg-step.done {
    background: #10b981;
    color: white;
    border-color: #10b981;
}

.pg-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--border-color);
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
}

.pg-step.active .pg-step-num,
.pg-step.done .pg-step-num {
    background: rgba(255,255,255,0.3);
    color: white;
}

.pg-step-arrow {
    color: var(--border-color);
    font-size: 1.1rem;
    margin: 0 4px;
    flex-shrink: 0;
}

/* ---- Tab 切换（生成 / 优化 / 收藏） ---- */
.pg-tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: 4px;
    margin-bottom: var(--spacing-xl);
}

.pg-tab {
    flex: 1;
    padding: 10px 16px;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.pg-tab:hover {
    color: var(--text-primary);
}

.pg-tab.active {
    background: white;
    color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.pg-tab-panel {
    display: none;
}

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

/* ---- 操作区（全宽两列） ---- */
.pg-action-area {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-xl);
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.pg-form-col {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.pg-info-col {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

/* ---- 表单控件 ---- */
.pg-form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pg-form-label {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.pg-form-label .step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary-color);
    color: white;
    font-size: 0.72rem;
    font-weight: 700;
}

/* ---- 平台选择器 ---- */
.pg-platform-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.pg-platform-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.pg-platform-btn:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

.pg-platform-btn.active {
    border-color: var(--btn-color, var(--primary-color));
    background: var(--btn-bg, #f0f4ff);
    color: var(--btn-color, var(--primary-color));
    font-weight: 600;
}

.pg-platform-btn i {
    font-size: 1.1rem;
}

/* ---- 场景选择器 ---- */
.pg-scene-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.pg-scene-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--bg-color);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}

.pg-scene-btn:hover {
    border-color: var(--primary-color);
    background: #f0f4ff;
}

.pg-scene-btn.active {
    border-color: var(--primary-color);
    background: linear-gradient(135deg, #ede9fe, #dbeafe);
    color: var(--primary-color);
}

.pg-scene-btn i {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.pg-scene-btn.active i {
    color: var(--primary-color);
}

.pg-scene-info {
    flex: 1;
}

.pg-scene-name {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pg-scene-btn.active .pg-scene-name {
    color: var(--primary-color);
}

.pg-scene-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ---- 关键词选择区 ---- */
.pg-keywords-area {
    background: var(--bg-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.pg-keyword-group-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    margin-top: 12px;
}

.pg-keyword-group-label:first-child {
    margin-top: 0;
}

.pg-keywords-wrap {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pg-keyword-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    font-size: 0.82rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.pg-keyword-tag:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pg-keyword-tag.selected {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

/* ---- 自由输入框 ---- */
.pg-extra-input {
    width: 100%;
    min-height: 80px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.88rem;
    line-height: 1.6;
    resize: vertical;
    transition: border-color 0.2s;
    font-family: inherit;
}

.pg-extra-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
}

.pg-extra-input::placeholder {
    color: var(--text-muted);
}

/* ---- 生成按钮 ---- */
.pg-generate-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 28px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    width: 100%;
}

.pg-generate-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(99, 102, 241, 0.35);
}

.pg-generate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ---- 信息卡片（右栏） ---- */
.pg-info-card {
    background: var(--bg-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.pg-info-card h5 {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--spacing-sm);
    display: flex;
    align-items: center;
    gap: 6px;
}

.pg-info-line {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.7;
    padding: 1px 0;
}

/* ---- 模板卡片网格 ---- */
.pg-template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: var(--spacing-md);
}

.pg-template-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.pg-template-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}

.pg-template-card.active {
    border-color: var(--primary-color);
    background: #f8f7ff;
}

.pg-template-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    background: #ede9fe;
    color: #7c3aed;
    margin-bottom: 10px;
}

.pg-template-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.pg-template-desc {
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.pg-template-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background: #dbeafe;
    color: #1d4ed8;
}

/* ---- 结果区域 ---- */
.pg-result-section {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.pg-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--spacing-lg);
}

.pg-result-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pg-result-actions {
    display: flex;
    gap: 8px;
}

.pg-action-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: white;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.pg-action-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background: #f8f7ff;
}

.pg-action-btn.primary {
    background: var(--primary-color);
    border-color: var(--primary-color);
    color: white;
}

.pg-action-btn.primary:hover {
    background: #5a56e8;
}

.pg-action-btn.save-btn {
    background: #10b981;
    border-color: #10b981;
    color: white;
}

.pg-action-btn.save-btn:hover {
    background: #059669;
}

/* ---- 结构化提示词展示 ---- */
.pg-prompt-block {
    background: var(--bg-color);
    border-radius: var(--radius-md);
    margin-bottom: var(--spacing-md);
    overflow: hidden;
}

.pg-prompt-block:last-child {
    margin-bottom: 0;
}

.pg-prompt-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: white;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    user-select: none;
}

.pg-prompt-block-label {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.pg-prompt-block-label i {
    color: var(--primary-color);
}

.pg-prompt-block-copy {
    padding: 3px 10px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    background: white;
    font-size: 0.75rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.pg-prompt-block-copy:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pg-prompt-block-body {
    padding: 14px 16px;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-secondary);
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* ---- 纯文本结果（回退） ---- */
.pg-prompt-raw {
    background: var(--bg-color);
    border-left: 4px solid var(--primary-color);
    padding: 20px;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.7;
    white-space: pre-wrap;
    word-wrap: break-word;
    color: var(--text-secondary);
}

/* ---- 加载状态 ---- */
.pg-loading {
    text-align: center;
    padding: 40px;
}

.pg-loading-spinner {
    border: 4px solid #f3f3f3;
    border-top: 4px solid var(--primary-color);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: pg-spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes pg-spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.pg-loading p {
    font-size: 0.9rem;
    color: var(--text-muted);
}

/* ---- 优化Tab面板 ---- */
.pg-optimize-area {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: var(--spacing-xl);
    margin-bottom: var(--spacing-xl);
}

.pg-optimize-input {
    width: 100%;
    min-height: 160px;
    padding: 16px;
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    line-height: 1.6;
    resize: vertical;
    font-family: inherit;
    transition: border-color 0.2s;
    margin-bottom: var(--spacing-md);
}

.pg-optimize-input:focus {
    outline: none;
    border-color: var(--primary-color);
    border-style: solid;
}

/* ---- 收藏Tab面板 ---- */
.pg-saved-list {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
}

.pg-saved-item {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
    transition: all 0.2s;
}

.pg-saved-item:hover {
    border-color: var(--primary-color);
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

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

.pg-saved-title {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
}

.pg-saved-meta {
    font-size: 0.75rem;
    color: var(--text-muted);
    display: flex;
    gap: 12px;
}

.pg-saved-preview {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.5;
    max-height: 60px;
    overflow: hidden;
    margin-bottom: 8px;
}

.pg-saved-actions {
    display: flex;
    gap: 8px;
}

.pg-empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.pg-empty-state i {
    font-size: 3rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.pg-empty-state p {
    font-size: 0.9rem;
}

/* ---- Toast 提示 ---- */
.pg-toast {
    position: fixed;
    top: 80px;
    left: 50%;
    transform: translateX(-50%) translateY(-20px);
    background: #1e293b;
    color: white;
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    z-index: 9999;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.pg-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ---- FAQ ---- */
.pg-faq-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--spacing-md);
    margin-bottom: var(--spacing-xl);
}

.pg-faq-card {
    background: white;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: var(--spacing-md);
}

.pg-faq-card summary {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pg-faq-card summary::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--primary-color);
    flex-shrink: 0;
}

.pg-faq-card summary::-webkit-details-marker { display: none; }

.pg-faq-card .faq-answer {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-top: var(--spacing-sm);
    padding-left: 14px;
}

/* ---- 响应式 ---- */
@media (max-width: 960px) {
    .pg-features { grid-template-columns: repeat(2, 1fr); }
    .pg-action-area { grid-template-columns: 1fr; }
    .pg-platform-grid { grid-template-columns: repeat(2, 1fr); }
    .pg-faq-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
    .pg-features { grid-template-columns: 1fr; }
    .pg-scene-grid { grid-template-columns: 1fr; }
    .pg-steps { flex-wrap: wrap; justify-content: center; }
    .pg-template-grid { grid-template-columns: 1fr; }
    .pg-tabs { flex-wrap: wrap; }
    .pg-result-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .pg-result-actions { width: 100%; flex-wrap: wrap; }
}
