/* ==============================================
   提示词诊断 - prompt_diagnosis.css
   ============================================== */

/* --- 通用隐藏 --- */
.pd-hidden { display: none; }

/* --- 提示栏 --- */
.pd-tip-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 10px;
    font-size: 13px;
    color: #1e40af;
    margin-bottom: 12px;
    line-height: 1.5;
}
.pd-tip-icon { font-size: 16px; flex-shrink: 0; }

/* --- 主布局 --- */
.pd-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    align-items: start;
}

/* =====================
   左侧输入面板
   ===================== */
.pd-input-panel {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.pd-input-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* 头部右侧容器 */
.pd-input-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pd-label {
    font-weight: 600;
    font-size: 14px;
    color: #374151;
}

.pd-char-counter {
    font-size: 12px;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
    transition: color 0.25s;
}

/* 字符计数颜色反馈 */
.pd-char-warning { color: #ef4444 !important; }
.pd-char-medium  { color: #f59e0b !important; }
.pd-char-good    { color: #10b981 !important; }

.pd-textarea {
    width: 100%;
    min-height: 260px;
    padding: 12px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.75;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    color: #1f2937;
    box-sizing: border-box;
    background: #fff;
}

.pd-textarea:focus {
    border-color: #6366f1;
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.12);
}

/* 快速示例 */
.pd-examples-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 13px;
}

.pd-examples-label {
    color: #9ca3af;
    white-space: nowrap;
    font-size: 12px;
}

.pd-example-btn {
    padding: 4px 10px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pd-example-btn:hover {
    background: #ede9fe;
    border-color: #a78bfa;
    color: #5b21b6;
}

/* 复制提示词按钮 */
.pd-copy-prompt-btn {
    padding: 3px 8px;
    background: #f3f4f6;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 12px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.pd-copy-prompt-btn:hover {
    background: #ede9fe;
    border-color: #a78bfa;
    color: #5b21b6;
}

/* 快捷键提示区 */
.pd-diagnose-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pd-shortcut-hint {
    font-size: 12px;
    color: #9ca3af;
    white-space: nowrap;
}

.pd-shortcut-hint kbd {
    display: inline-flex;
    align-items: center;
    padding: 1px 5px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 11px;
    font-family: monospace;
    color: #374151;
    box-shadow: 0 1px 0 #c8cdd5;
    line-height: 1.4;
}

/* 操作按钮区 */
.pd-actions-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 2px;
}

.pd-clear-btn {
    padding: 9px 18px;
    background: #f3f4f6;
    border: 1.5px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.pd-clear-btn:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    color: #dc2626;
}

.pd-diagnose-btn {
    padding: 9px 26px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    cursor: pointer;
    font-weight: 600;
    transition: box-shadow 0.2s, transform 0.15s;
    box-shadow: 0 2px 8px rgba(99, 102, 241, 0.3);
}

.pd-diagnose-btn:hover {
    box-shadow: 0 5px 18px rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.pd-diagnose-btn:active {
    transform: translateY(0);
}

/* =====================
   右侧结果面板
   ===================== */
.pd-results-panel {
    min-height: 380px;
    scrollbar-width: thin;
    scrollbar-color: #ccc transparent;
}

.pd-results-panel::-webkit-scrollbar { width: 4px; }
.pd-results-panel::-webkit-scrollbar-track { background: transparent; }
.pd-results-panel::-webkit-scrollbar-thumb { background: #ccc; border-radius: 2px; }

/* 空状态 */
.pd-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 340px;
    text-align: center;
}

.pd-empty-icon {
    font-size: 52px;
    opacity: 0.45;
    margin-bottom: 14px;
    animation: pdFloat 2.8s ease-in-out infinite;
}

.pd-empty-title {
    font-size: 16px;
    font-weight: 600;
    color: #9ca3af;
    margin-bottom: 6px;
}

.pd-empty-hint {
    font-size: 13px;
    color: #d1d5db;
    line-height: 1.5;
}

/* 结果内容 */
.pd-results-content {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* --------- 综合评分卡 --------- */
.pd-score-card {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #f0f0ff 0%, #faf5ff 100%);
    border: 1px solid #e0e7ff;
    border-radius: 14px;
    padding: 12px 14px;
    transition: border-color 0.45s ease;
}

/* SVG 圆环 */
.pd-score-ring-wrap {
    position: relative;
    width: 84px;
    height: 84px;
    flex-shrink: 0;
}

.pd-score-ring {
    width: 84px;
    height: 84px;
    transform: rotate(-90deg);
}

.pd-ring-bg {
    fill: none;
    stroke: #e5e7eb;
    stroke-width: 9;
}

.pd-ring-progress {
    fill: none;
    stroke: #6366f1;
    stroke-width: 9;
    stroke-linecap: round;
    stroke-dasharray: 263.89;
    stroke-dashoffset: 263.89;
    transition: stroke-dashoffset 0.7s cubic-bezier(.4,0,.2,1), stroke 0.35s ease;
}

.pd-score-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    line-height: 1.1;
}

.pd-score-number > span:first-child {
    font-size: 24px;
    font-weight: 800;
    color: #1f2937;
    display: block;
}

.pd-score-unit {
    font-size: 11px;
    color: #9ca3af;
    display: block !important;
    margin-top: 1px;
}

/* 评分信息 */
.pd-score-meta { flex: 1; }

.pd-score-level {
    display: inline-flex;
    align-items: center;
    padding: 3px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 8px;
    border: 1.5px solid transparent;
}

.pd-level-excellent { color: #065f46; background: #d1fae5; border-color: #6ee7b7; }
.pd-level-good      { color: #1e40af; background: #dbeafe; border-color: #93c5fd; }
.pd-level-fair      { color: #92400e; background: #fef3c7; border-color: #fcd34d; }
.pd-level-poor      { color: #9a3412; background: #ffedd5; border-color: #fb923c; }
.pd-level-bad       { color: #991b1b; background: #fee2e2; border-color: #f87171; }

.pd-score-desc {
    font-size: 13px;
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 6px;
}

.pd-score-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pd-score-bar-track {
    flex: 1;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.pd-score-bar-fill {
    width: 0;
    height: 100%;
    border-radius: 3px;
    transition: width 0.7s cubic-bezier(.4,0,.2,1), background 0.35s ease;
}

.pd-score-pct {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    min-width: 34px;
    text-align: right;
}

/* --------- Section 通用 --------- */
.pd-section {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 10px 12px;
}

.pd-section-title {
    font-weight: 600;
    font-size: 14px;
    color: #374151;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* --------- 维度评分 --------- */
.pd-dim-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.pd-dim-item {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 7px 10px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.pd-dim-item:hover {
    border: 2px solid #8b5cf6;
    box-shadow: 0 2px 6px rgba(139, 92, 246, 0.2);
}

.pd-dim-meta {
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.pd-dim-icon { font-size: 14px; margin-right: 7px; }

.pd-dim-name {
    flex: 1;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
}

.pd-dim-score {
    font-size: 12px;
    color: #9ca3af;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.pd-dim-bar-bg {
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    overflow: hidden;
}

.pd-dim-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.55s cubic-bezier(.4,0,.2,1);
}

/* --------- 改进建议 --------- */
.pd-sugg-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.pd-sugg-item {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    padding: 7px 10px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.55;
}

.pd-sugg-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.pd-sugg-warn {
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
}

.pd-sugg-info {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    color: #1e40af;
}

.pd-sugg-ok {
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    color: #166534;
}

.pd-sugg-icon {
    flex-shrink: 0;
    font-size: 14px;
    margin-top: 1px;
}

/* --------- 优化示范 --------- */
.pd-optimized-section { background: #fff; border-color: #ddd6fe; }

.pd-opt-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pd-apply-opt-btn {
    padding: 4px 10px;
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
    white-space: nowrap;
}

.pd-apply-opt-btn:hover {
    background: #dcfce7;
    border-color: #86efac;
    color: #14532d;
}

.pd-copy-opt-btn {
    padding: 4px 10px;
    background: #6366f1;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
    font-weight: 500;
}

.pd-copy-opt-btn:hover { background: #4f46e5; }

.pd-optimized-box {
    font-size: 13px;
    line-height: 1.75;
    color: #475569;
    white-space: pre-wrap;
    word-break: break-word;
    background: #fafafa;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px 14px;
    font-family: inherit;
}

/* --------- Toast --------- */
.pd-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 22px;
    border-radius: 24px;
    font-size: 14px;
    z-index: 9999;
    color: #fff;
    box-shadow: 0 4px 16px rgba(0,0,0,.18);
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.pd-toast-visible { opacity: 1; }

.pd-toast-success { background: #10b981; }
.pd-toast-warn    { background: #f59e0b; }
.pd-toast-error   { background: #ef4444; }

/* --------- 入场动画 --------- */
@keyframes pdFadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.pd-animate-in {
    animation: pdFadeIn 0.32s ease forwards;
}

/* --------- 空状态浮动动画 --------- */
@keyframes pdFloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-7px); }
}

/* --------- 评分卡动态配色 --------- */
.pd-card-excellent { background: linear-gradient(135deg,#ecfdf5,#f0fdf4) !important; border-color: #a7f3d0 !important; }
.pd-card-good      { background: linear-gradient(135deg,#eff6ff,#eef2ff) !important; border-color: #93c5fd !important; }
.pd-card-fair      { background: linear-gradient(135deg,#fffbeb,#fefce8) !important; border-color: #fde68a !important; }
.pd-card-poor      { background: linear-gradient(135deg,#fff7ed,#ffedd5) !important; border-color: #fed7aa !important; }
.pd-card-bad       { background: linear-gradient(135deg,#fef2f2,#fff1f2) !important; border-color: #fecaca !important; }

/* --------- 响应式 --------- */
@media (max-width: 820px) {
    .pd-layout {
        grid-template-columns: 1fr;
    }
    .pd-textarea {
        min-height: 180px;
    }
    .pd-score-card {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }
}
