/* =============================================
   换个说法工具 - 样式文件
   色系：紫罗兰 / Violet  前缀：rp-
   ============================================= */

/* ---- 主容器 ---- */
.rp-container {
    display: flex;
    flex-direction: column;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    overflow: hidden;
    min-height: 680px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    transition: all 0.3s ease;
}

.rp-container.is-fullscreen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 1000;
    border-radius: 0;
    border: none;
    min-height: 100vh;
    box-shadow: none;
}

/* ---- 工具栏 ---- */
.rp-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    background: linear-gradient(to bottom, #faf5ff, #f3e8ff);
    border-bottom: 1px solid #e9d5ff;
    flex-shrink: 0;
    flex-wrap: wrap;
}

.rp-toolbar .toolbar-group {
    display: flex;
    align-items: center;
    gap: 4px;
}

.rp-toolbar .toolbar-group + .toolbar-group {
    padding-left: 8px;
    border-left: 1px solid rgba(139, 92, 246, 0.2);
}

.rp-toolbar-title {
    flex: 1;
    justify-content: center;
    border-left: none !important;
    border-right: none !important;
}

.toolbar-title-text {
    font-size: 15px;
    font-weight: 600;
    color: #5b21b6;
    letter-spacing: 0.5px;
}

.rp-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 10px;
    background: #fff;
    border: 1px solid #ddd6fe;
    border-radius: 5px;
    font-size: 12.5px;
    color: #6d28d9;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.rp-toolbar-btn:hover {
    background: #f5f3ff;
    border-color: #8b5cf6;
    color: #5b21b6;
}

/* ---- 主内容区（三栏） ---- */
.rp-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* ---- 左侧历史面板 ---- */
.rp-history-panel {
    width: 185px;
    flex-shrink: 0;
    border-right: 1px solid #e9d5ff;
    display: flex;
    flex-direction: column;
    background: #faf5ff;
    overflow: hidden;
}

.rp-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #faf5ff, #f3e8ff);
    border-bottom: 1px solid #e9d5ff;
    flex-shrink: 0;
}

.rp-history-header h3 {
    margin: 0;
    font-size: 12.5px;
    font-weight: 600;
    color: #6d28d9;
    display: flex;
    align-items: center;
    gap: 4px;
}

.rp-history-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 16px;
    background: #7c3aed;
    color: #fff;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 700;
    padding: 0 4px;
    line-height: 16px;
}

.rp-history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 7px;
    border-radius: 3px;
    transition: all 0.15s;
}

.rp-history-clear-btn:hover { background: #fde8e8; }

.rp-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 0;
}

.rp-history-empty {
    text-align: center;
    padding: 28px 14px;
    color: #a78bfa;
}

.rp-history-empty-icon { font-size: 24px; margin-bottom: 8px; }
.rp-history-empty-text { font-size: 12px; }

.rp-history-item {
    padding: 8px 12px;
    cursor: pointer;
    border-left: 3px solid transparent;
    transition: all 0.15s;
    position: relative;
}

.rp-history-item:hover {
    background: #f5f3ff;
    border-left-color: #c4b5fd;
}

.rp-history-item.active {
    background: #ede9fe;
    border-left-color: #7c3aed;
}

.rp-history-item:focus-visible {
    outline: 2px solid #7c3aed;
    outline-offset: -2px;
    background: #f5f3ff;
    border-left-color: #c4b5fd;
}

.rp-history-item-title {
    font-size: 12px;
    font-weight: 500;
    color: #4c1d95;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 3px;
}

.rp-history-item-meta {
    font-size: 11px;
    color: #8b5cf6;
    display: flex;
    gap: 4px;
    align-items: center;
}

.rp-history-item-time {
    font-size: 10px;
    color: #a78bfa;
    margin-top: 2px;
}

/* ---- 中间配置面板 ---- */
.rp-config-panel {
    width: 320px;
    flex-shrink: 0;
    border-right: 1px solid #e9d5ff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.rp-config-header {
    padding: 12px 16px;
    background: linear-gradient(to bottom, #faf5ff, #f5f3ff);
    border-bottom: 1px solid #e9d5ff;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 2;
}

.rp-config-header h3 {
    margin: 0 0 2px 0;
    font-size: 13px;
    font-weight: 600;
    color: #5b21b6;
}

.rp-panel-tip {
    font-size: 11px;
    color: #8b5cf6;
}

.rp-config-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

/* ---- 表单元素 ---- */
.rp-form-group { display: flex; flex-direction: column; gap: 6px; }

.rp-form-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 6px;
}

.rp-form-label.required::before {
    content: '*';
    color: #ef4444;
    font-size: 13px;
}

.rp-char-count {
    margin-left: auto;
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
}

.rp-char-count.warn { color: #f97316; font-weight: 600; }
.rp-char-count.danger { color: #ef4444; font-weight: 600; }

.rp-form-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #ddd6fe;
    border-radius: 7px;
    padding: 10px 12px;
    font-size: 13px;
    color: #1f2937;
    resize: vertical;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
    line-height: 1.6;
}

.rp-form-textarea:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.rp-section-hint {
    font-size: 11px;
    color: #9ca3af;
    line-height: 1.4;
}

/* ---- 按钮选择器 ---- */
.rp-btn-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.rp-sel-btn {
    padding: 5px 11px;
    border: 1px solid #ddd6fe;
    border-radius: 5px;
    background: #fff;
    font-size: 12px;
    color: #6d28d9;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
}

.rp-sel-btn:hover {
    border-color: #8b5cf6;
    background: #f5f3ff;
}

.rp-sel-btn.active {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
    font-weight: 600;
}

/* ---- 操作按钮 ---- */
.rp-form-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
}

.rp-generate-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 11px 16px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.35);
}

.rp-generate-btn:hover {
    background: linear-gradient(135deg, #6d28d9, #5b21b6);
    box-shadow: 0 4px 12px rgba(124, 58, 237, 0.45);
    transform: translateY(-1px);
}

.rp-generate-btn:disabled {
    background: #c4b5fd;
    box-shadow: none;
    transform: none;
    cursor: not-allowed;
}

.rp-btn-icon { font-size: 15px; }
.rp-btn-shortcut {
    font-size: 10px;
    background: rgba(255,255,255,0.2);
    padding: 1px 5px;
    border-radius: 3px;
}

.rp-cancel-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 11px 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    color: #6b7280;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.rp-cancel-btn:hover { background: #f9fafb; border-color: #d1d5db; }

.rp-draft-hint {
    font-size: 11px;
    color: #10b981;
    white-space: nowrap;
}

/* ---- 右侧输出面板 ---- */
.rp-output-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
}

.rp-output-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #faf5ff, #f5f3ff);
    border-bottom: 1px solid #e9d5ff;
    flex-shrink: 0;
}

.rp-output-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #5b21b6;
}

.rp-output-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.rp-style-badge {
    display: inline-flex;
    align-items: center;
    padding: 2px 9px;
    background: #ede9fe;
    color: #5b21b6;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.rp-regen-btn {
    padding: 4px 10px;
    background: #fff;
    border: 1px solid #ddd6fe;
    border-radius: 5px;
    color: #6d28d9;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s;
}

.rp-regen-btn:hover { background: #f5f3ff; border-color: #8b5cf6; }

.rp-regen-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    pointer-events: none;
}

/* ---- 空状态 ---- */
.rp-empty-state {
    flex: 1;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

@keyframes rp-pulse {
    0%, 100% { transform: scale(1); opacity: 0.6; }
    50%       { transform: scale(1.1); opacity: 0.85; }
}

.rp-empty-icon { font-size: 52px; margin-bottom: 14px; opacity: 0.6; animation: rp-pulse 2.8s ease-in-out infinite; }
.rp-empty-title { font-size: 17px; font-weight: 600; color: #374151; margin-bottom: 8px; }
.rp-empty-desc { font-size: 13px; color: #9ca3af; line-height: 1.7; margin-bottom: 24px; }

.rp-empty-features {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    max-width: 360px;
}

.rp-feature-item {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 6px 14px;
    background: #f5f3ff;
    border: 1px solid #ede9fe;
    border-radius: 20px;
    font-size: 12px;
    color: #6d28d9;
}

.rp-feature-icon { font-size: 14px; }

/* ---- 加载状态 ---- */
.rp-loading-state {
    flex: 1;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

.rp-loading-rings {
    position: relative;
    width: 56px;
    height: 56px;
    margin-bottom: 20px;
}

.rp-loading-ring {
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 3px solid transparent;
    border-top-color: #7c3aed;
    animation: rp-spin 1.2s linear infinite;
}

.rp-loading-ring:nth-child(2) {
    inset: 8px;
    border-top-color: #a78bfa;
    animation-duration: 0.9s;
    animation-direction: reverse;
}

.rp-loading-ring:nth-child(3) {
    inset: 16px;
    border-top-color: #ddd6fe;
    animation-duration: 0.6s;
}

@keyframes rp-spin { to { transform: rotate(360deg); } }

.rp-loading-text { font-size: 15px; font-weight: 600; color: #5b21b6; margin-bottom: 6px; }
.rp-loading-sub { font-size: 12.5px; color: #8b5cf6; margin-bottom: 14px; }

.rp-loading-dots { display: flex; gap: 5px; }

.rp-loading-dots span {
    width: 7px; height: 7px;
    background: #a78bfa;
    border-radius: 50%;
    animation: rp-dot-bounce 1.2s infinite ease-in-out;
}

.rp-loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.rp-loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes rp-dot-bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* ---- 结果区域 ---- */
.rp-result-area {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

@keyframes rp-card-in {
    from { opacity: 0; transform: translateY(10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.rp-version-card {
    border: 1px solid #e9d5ff;
    border-radius: 8px;
    overflow: hidden;
    transition: box-shadow 0.15s;
    animation: rp-card-in 0.25s ease both;
}

.rp-version-card:nth-child(2) { animation-delay: 0.08s; }
.rp-version-card:nth-child(3) { animation-delay: 0.16s; }

.rp-version-card:hover { box-shadow: 0 2px 10px rgba(124, 58, 237, 0.12); }

.rp-version-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 14px;
    background: linear-gradient(to right, #f5f3ff, #faf5ff);
    border-bottom: 1px solid #ede9fe;
}

.rp-version-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #5b21b6;
    display: flex;
    align-items: center;
    gap: 5px;
}

.rp-version-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    background: #7c3aed;
    color: #fff;
    border-radius: 50%;
    font-size: 11px;
    font-weight: 700;
}

.rp-version-copy-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 9px;
    background: #fff;
    border: 1px solid #ddd6fe;
    border-radius: 4px;
    color: #6d28d9;
    font-size: 11.5px;
    cursor: pointer;
    transition: all 0.15s;
}

.rp-version-copy-btn:hover { background: #f5f3ff; border-color: #8b5cf6; }
.rp-version-copy-btn.copied { background: #10b981; border-color: #10b981; color: #fff; }

.rp-version-card:hover .rp-version-copy-btn {
    background: #f5f3ff;
    border-color: #8b5cf6;
}

/* ---- 版本卡片底栏（字数） ---- */
.rp-version-card-footer {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 5px 14px;
    background: #faf5ff;
    border-top: 1px solid #ede9fe;
}

.rp-version-char-count {
    font-size: 11px;
    color: #a78bfa;
}

.rp-version-card-body {
    padding: 14px;
    font-size: 13.5px;
    color: #1f2937;
    line-height: 1.75;
    white-space: pre-wrap;
    word-break: break-word;
    background: #fff;
}

/* ---- 错误状态 ---- */
.rp-error-state {
    flex: 1;
    min-height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

.rp-error-icon { font-size: 40px; margin-bottom: 12px; }
.rp-error-text { font-size: 14px; color: #ef4444; margin-bottom: 16px; }

.rp-retry-btn {
    padding: 8px 20px;
    background: #fff;
    border: 1px solid #fca5a5;
    border-radius: 6px;
    color: #ef4444;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.15s;
}

.rp-retry-btn:hover { background: #fef2f2; border-color: #ef4444; }

/* ---- 示例抽屉 ---- */
.rp-drawer {
    position: fixed;
    top: 0; right: -420px;
    width: 420px;
    height: 100%;
    background: #fff;
    z-index: 2000;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    transition: right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.rp-drawer.is-open { right: 0; }

.rp-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 1999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.rp-drawer-overlay.is-visible { opacity: 1; pointer-events: auto; }

.rp-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: linear-gradient(to bottom, #faf5ff, #f3e8ff);
    border-bottom: 1px solid #e9d5ff;
    flex-shrink: 0;
}

.rp-drawer-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #5b21b6;
}

.rp-drawer-close-btn {
    background: none;
    border: none;
    font-size: 16px;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s;
}

.rp-drawer-close-btn:hover { background: #f3f4f6; color: #374151; }

.rp-drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rp-example-card {
    border: 1px solid #e9d5ff;
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
}

.rp-example-card:hover {
    border-color: #7c3aed;
    background: #faf5ff;
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.1);
}

.rp-example-card-title {
    font-size: 13.5px;
    font-weight: 600;
    color: #4c1d95;
    margin-bottom: 6px;
}

.rp-example-card-preview {
    font-size: 12.5px;
    color: #6b7280;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin-bottom: 8px;
}

.rp-example-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.rp-example-tag {
    padding: 2px 8px;
    background: #ede9fe;
    color: #5b21b6;
    border-radius: 10px;
    font-size: 11px;
}

/* ---- 滚动条美化 ---- */
.rp-history-list::-webkit-scrollbar,
.rp-config-body::-webkit-scrollbar,
.rp-result-area::-webkit-scrollbar,
.rp-drawer-body::-webkit-scrollbar { width: 5px; }

.rp-history-list::-webkit-scrollbar-track,
.rp-config-body::-webkit-scrollbar-track,
.rp-result-area::-webkit-scrollbar-track,
.rp-drawer-body::-webkit-scrollbar-track { background: transparent; }

.rp-history-list::-webkit-scrollbar-thumb,
.rp-config-body::-webkit-scrollbar-thumb,
.rp-result-area::-webkit-scrollbar-thumb,
.rp-drawer-body::-webkit-scrollbar-thumb {
    background: #ddd6fe;
    border-radius: 3px;
}

/* ---- 响应式适配 ---- */
@media (max-width: 900px) {
    .rp-history-panel { display: none; }
    .rp-config-panel { width: 280px; }
}

/* ---- 工作日 / 周末主题背景 ---- */
.rp-container.is-weekend .rp-toolbar {
    background: linear-gradient(to bottom, #fff8f0, #fde8d0);
    border-bottom-color: #fed7aa;
}

.rp-container.is-weekend .rp-toolbar .toolbar-group + .toolbar-group {
    border-left-color: rgba(234, 88, 12, 0.2);
}

.rp-container.is-weekend .toolbar-title-text { color: #9a3412; }

.rp-container.is-weekend .rp-toolbar-btn {
    border-color: #fed7aa;
    color: #c2410c;
}

.rp-container.is-weekend .rp-toolbar-btn:hover {
    background: #fff7ed;
    border-color: #f97316;
    color: #9a3412;
}

/* ---- 输入框抖动反馈 ---- */
@keyframes rp-shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-5px); }
    40% { transform: translateX(5px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

.rp-shake { animation: rp-shake 0.5s ease; }

@media (max-width: 640px) {
    .rp-config-panel { width: 100%; border-right: none; border-bottom: 1px solid #e9d5ff; }
    .rp-main-content { flex-direction: column; }
    .rp-output-panel { min-height: 300px; }
}
