/* ===================================================================
   AI中英文分离工具 - 样式文件
   风格：紫色/靛蓝主题，三栏布局，参考 k8s_config_generation.css
=================================================================== */

/* --- 主容器 --- */
.ces-container {
    display: flex;
    flex-direction: column;
    background: #f3f0f9;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(80,40,160,0.10);
    min-height: 660px;
    margin: 0 0 18px 0;
    transition: all 0.3s ease;
}

/* 全屏模式 */
.ces-container.fullscreen-mode {
    position: fixed !important;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 9000;
    border-radius: 0;
    margin: 0;
    min-height: 100vh;
}

/* --- 顶部工具栏 --- */
.ces-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #3d1a78 0%, #251050 100%);
    border-bottom: 2px solid #7c3aed;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    gap: 4px;
    align-items: center;
}

.toolbar-group + .toolbar-group {
    border-left: 1px solid rgba(255,255,255,0.15);
    padding-left: 8px;
    margin-left: 2px;
}

.toolbar-btn {
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.20);
    color: #e8dff8;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    transition: all 0.2s;
    letter-spacing: 0.2px;
}

.toolbar-btn:hover {
    background: rgba(124,58,237,0.45);
    border-color: #a78bfa;
    color: #fff;
    transform: translateY(-1px);
}

.toolbar-btn:active {
    transform: translateY(0);
}

.toolbar-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

/* 主操作按钮 - 金色高亮 */
.toolbar-btn-primary {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    border-color: #f59e0b !important;
    color: #fff !important;
    font-weight: 700 !important;
    box-shadow: 0 2px 8px rgba(245,158,11,0.40);
}

.toolbar-btn-primary:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b) !important;
    border-color: #fbbf24 !important;
    box-shadow: 0 4px 14px rgba(245,158,11,0.55) !important;
    transform: translateY(-1px);
}

/* --- 主内容三栏布局 --- */
.ces-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    min-height: 0;
}

/* --- 左侧历史面板 --- */
.ces-history-panel {
    width: 200px;
    min-width: 160px;
    background: #faf9fd;
    border-right: 1px solid #ddd0f0;
    border-left: 4px solid #7c3aed;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #f5f0fd, #ede8f9);
    border-bottom: 1px solid #ddd0f0;
    flex-shrink: 0;
}

.history-title {
    font-size: 12px;
    font-weight: 600;
    color: #5b2d9e;
}

.history-clear-btn {
    background: none;
    border: none;
    color: #e05c5c;
    cursor: pointer;
    font-size: 14px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: background 0.2s;
    line-height: 1;
}

.history-clear-btn:hover {
    background: #fee2e2;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 80px;
    color: #a78bfa;
    font-size: 12px;
    gap: 4px;
}

.history-item {
    padding: 9px 10px;
    border-radius: 6px;
    cursor: pointer;
    margin-bottom: 4px;
    border: 1px solid transparent;
    transition: all 0.18s;
    background: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    position: relative;
}

.history-item:hover {
    background: #ede8f9;
    border-color: #a78bfa;
    transform: translateX(2px);
}

.history-item:hover .history-item-del {
    display: flex;
}

.history-item-del {
    display: none;
    position: absolute;
    top: 5px;
    right: 5px;
    width: 18px;
    height: 18px;
    align-items: center;
    justify-content: center;
    background: #fee2e2;
    border: none;
    border-radius: 3px;
    color: #ef4444;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    transition: background 0.15s;
}

.history-item-del:hover {
    background: #fca5a5;
}

.history-item-title {
    font-size: 11px;
    color: #4c1d95;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 3px;
}

.history-item-meta {
    font-size: 10px;
    color: #8b5cf6;
}

/* --- 中间输入面板 --- */
.ces-input-panel {
    flex: 1;
    min-width: 0;
    background: #fff;
    border-right: 1px solid #e4d9f6;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.input-panel-header {
    padding: 12px 16px 8px;
    background: linear-gradient(to bottom, #faf8ff, #f3f0f9);
    border-bottom: 1px solid #e4d9f6;
    flex-shrink: 0;
}

.input-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.input-header-row h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #5b21b6;
}

.mode-label-hint {
    font-size: 11px;
    color: #8b5cf6;
    font-weight: 500;
    white-space: nowrap;
}

.mode-selector {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.mode-tab {
    padding: 4px 12px;
    border: 1px solid #c4b5fd;
    border-radius: 20px;
    cursor: pointer;
    font-size: 11px;
    font-weight: 500;
    color: #6d28d9;
    background: #f5f3ff;
    transition: all 0.2s;
    white-space: nowrap;
}

.mode-tab:hover {
    background: #ede9fe;
    border-color: #8b5cf6;
}

.mode-tab.active {
    background: #7c3aed;
    border-color: #7c3aed;
    color: #fff;
    box-shadow: 0 2px 6px rgba(124,58,237,0.30);
}

.input-text-area {
    flex: 1;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
}

.input-label {
    font-size: 12px;
    font-weight: 600;
    color: #5b21b6;
    margin-bottom: 4px;
}

.input-text-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.input-char-count {
    font-size: 11px;
    color: #8b5cf6;
    text-align: right;
    margin-top: 4px;
    transition: color 0.2s;
}

.input-char-count.char-count-warn {
    color: #f59e0b;
    font-weight: 500;
}

.input-char-count.char-count-limit {
    color: #ef4444;
    font-weight: 700;
}

#mainInput {
    width: 100%;
    box-sizing: border-box;
    flex: 1;
    min-height: 200px;
    resize: vertical;
    border: 1.5px solid #c4b5fd;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 14px;
    font-family: inherit;
    color: #1e1b4b;
    background: #fefcff;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    line-height: 1.7;
    display: block;
}

#mainInput:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

#mainInput.is-error {
    border-color: #ef4444;
    background: #fff5f5;
    box-shadow: 0 0 0 3px rgba(239,68,68,0.10);
}

.separate-btn-wrap {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid #e4d9f6;
    background: #faf8ff;
    flex-shrink: 0;
}

.separate-btn {
    flex: 1;
    padding: 9px 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.separate-btn-basic {
    background: #ede9fe;
    color: #5b21b6;
    border: 1.5px solid #c4b5fd;
}

.separate-btn-basic:hover {
    background: #ddd6fe;
    border-color: #8b5cf6;
    transform: translateY(-1px);
}

.separate-btn-ai {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    color: #fff;
    box-shadow: 0 2px 8px rgba(245,158,11,0.35);
}

.separate-btn-ai:hover {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    box-shadow: 0 4px 12px rgba(245,158,11,0.50);
    transform: translateY(-1px);
}

.separate-btn:active {
    transform: translateY(0);
}

.separate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    pointer-events: none;
}

/* --- 右侧结果面板 --- */
.ces-result-panel {
    flex: 1.2;
    min-width: 0;
    background: #fefcff;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.result-panel-header {
    padding: 12px 16px;
    background: linear-gradient(to bottom, #faf8ff, #f3f0f9);
    border-bottom: 1px solid #e4d9f6;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.result-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: #5b21b6;
}

.result-panel-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    background: #7c3aed;
    color: #fff;
    display: none;
}

.result-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 空状态 */
.ces-empty-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #a78bfa;
    font-size: 13px;
    gap: 8px;
}

.ces-empty-hint .empty-icon {
    font-size: 36px;
    opacity: 0.5;
}

.ces-empty-sub {
    font-size: 11px;
    color: #c4b5fd;
}

/* Loading 状态 */
.ces-loading {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    gap: 12px;
    color: #7c3aed;
}

.ces-loading-spin {
    width: 36px;
    height: 36px;
    border: 3px solid #e4d9f6;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.ces-loading-text {
    font-size: 13px;
    color: #6d28d9;
}

/* 错误区域 */
.ces-error-area {
    display: none;
    padding: 12px 14px;
    background: #fff5f5;
    border: 1px solid #fca5a5;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    color: #dc2626;
    font-size: 12px;
    line-height: 1.6;
}

/* 结果区块 */
.result-block {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0,0,0,0.07);
    transition: box-shadow 0.2s, transform 0.15s;
}

.result-block:hover {
    box-shadow: 0 4px 14px rgba(0,0,0,0.11);
    transform: translateY(-1px);
}

.result-block-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 12px;
    font-size: 12px;
    font-weight: 600;
}

.result-block-body {
    padding: 12px 14px;
    font-size: 13px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 60px;
    background: #fff;
    color: #1e1b4b;
}

.result-block-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 6px 12px;
    gap: 8px;
    background: inherit;
    border-top: 1px solid rgba(0,0,0,0.06);
}

/* 中文结果区块 - 蓝紫边框 */
.result-block-chinese {
    border-left: 4px solid #7c3aed;
}

.result-block-chinese .result-block-header {
    background: linear-gradient(to right, #ede9fe, #f5f3ff);
    color: #5b21b6;
}

.result-block-chinese .result-block-footer {
    background: #f5f3ff;
}

/* 英文结果区块 - 蓝色边框 */
.result-block-english {
    border-left: 4px solid #3b82f6;
}

.result-block-english .result-block-header {
    background: linear-gradient(to right, #dbeafe, #eff6ff);
    color: #1d4ed8;
}

.result-block-english .result-block-footer {
    background: #eff6ff;
}

/* 翻译区块 - 绿色边框 */
.result-block-translation {
    border-left: 4px solid #10b981;
}

.result-block-translation .result-block-header {
    background: linear-gradient(to right, #d1fae5, #ecfdf5);
    color: #065f46;
}

.result-block-translation .result-block-footer {
    background: #ecfdf5;
}

/* 字数徽章 */
.word-badge {
    font-size: 11px;
    color: #6b7280;
    background: rgba(0,0,0,0.05);
    padding: 1px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* 结果统计栏 */
.ces-result-stats {
    font-size: 11px;
    color: #8b5cf6;
    text-align: center;
    padding: 8px 0 2px;
    border-top: 1px dashed #e4d9f6;
    margin-top: 4px;
    letter-spacing: 0.2px;
}

/* 复制按钮 */
.copy-btn {
    background: none;
    border: 1px solid currentColor;
    border-radius: 4px;
    padding: 2px 8px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.18s;
    font-weight: 500;
}

.result-block-chinese .copy-btn { color: #7c3aed; }
.result-block-chinese .copy-btn:hover { background: #ede9fe; }
.result-block-english .copy-btn { color: #3b82f6; }
.result-block-english .copy-btn:hover { background: #dbeafe; }
.result-block-translation .copy-btn { color: #10b981; }
.result-block-translation .copy-btn:hover { background: #d1fae5; }

/* --- AI辅助侧边栏 --- */
.ai-sidebar {
    position: fixed;
    top: 0;
    right: -420px;
    width: 400px;
    height: 100vh;
    background: #fff;
    box-shadow: -4px 0 20px rgba(80,40,160,0.15);
    z-index: 9500;
    display: flex;
    flex-direction: column;
    transition: right 0.3s ease;
}

.ai-sidebar.open {
    right: 0;
}

.ai-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #3d1a78, #251050);
    color: #e8dff8;
    flex-shrink: 0;
}

.ai-sidebar-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.ai-close-btn {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #e8dff8;
    cursor: pointer;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background 0.2s;
}

.ai-close-btn:hover {
    background: rgba(255,255,255,0.30);
}

.ai-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.ai-input-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #5b21b6;
    margin-bottom: 6px;
}

.ai-input-group textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1.5px solid #c4b5fd;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: inherit;
    color: #1e1b4b;
    resize: vertical;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ai-input-group textarea:focus {
    border-color: #7c3aed;
    box-shadow: 0 0 0 3px rgba(124,58,237,0.12);
}

.ai-input-group textarea.is-error {
    border-color: #ef4444;
    background: #fff5f5;
}

.ai-input-group textarea:disabled,
.ai-mode-select:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    background: #f5f3ff;
}

.ai-mode-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #5b21b6;
    margin-bottom: 6px;
}

.ai-mode-select {
    width: 100%;
    padding: 8px 10px;
    border: 1.5px solid #c4b5fd;
    border-radius: 6px;
    font-size: 13px;
    color: #1e1b4b;
    background: #fefcff;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}

.ai-mode-select:focus {
    border-color: #7c3aed;
}

.ai-actions {
    display: flex;
    gap: 8px;
}

/* AI 处理中指示器 */
.ai-processing-row {
    display: none;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
    border-left: 4px solid #7c3aed;
    border-radius: 6px;
    font-size: 12px;
    color: #6d28d9;
    font-weight: 500;
}

.ai-processing-spin {
    width: 16px;
    height: 16px;
    border: 2px solid #ddd6fe;
    border-top-color: #7c3aed;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    flex-shrink: 0;
}

.ai-btn {
    flex: 1;
    padding: 9px 0;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
}

.ai-btn-primary {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    box-shadow: 0 2px 8px rgba(124,58,237,0.30);
}

.ai-btn-primary:hover {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    box-shadow: 0 4px 12px rgba(124,58,237,0.45);
    transform: translateY(-1px);
}

.ai-btn-cancel {
    display: none;
    background: #f3f4f6;
    color: #6b7280;
    border: 1px solid #d1d5db;
}

.ai-btn-cancel:hover {
    background: #e5e7eb;
}

.ai-error-area {
    display: none;
    padding: 10px 12px;
    background: #fff5f5;
    border: 1px solid #fca5a5;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    color: #dc2626;
    font-size: 12px;
}

.ai-retry-btn {
    margin-top: 6px;
    background: #fee2e2;
    border: none;
    border-radius: 4px;
    color: #dc2626;
    font-size: 11px;
    padding: 4px 10px;
    cursor: pointer;
    transition: background 0.18s;
}

.ai-retry-btn:hover {
    background: #fca5a5;
}

.ai-tips {
    background: #f5f3ff;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 12px;
    color: #5b21b6;
}

.ai-tips p {
    margin: 0 0 6px;
    font-weight: 600;
}

.ai-tips ul {
    margin: 0;
    padding-left: 16px;
}

.ai-tips li {
    margin-bottom: 3px;
    line-height: 1.5;
}

/* AI遮罩层 */
.ai-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 9400;
    display: none;
}

.ai-overlay.open {
    display: block;
}

/* --- 模态框（示例选择） --- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9600;
    background: rgba(0,0,0,0.5);
    align-items: center;
    justify-content: center;
}

.modal.open {
    display: flex;
}

.modal-content {
    background: #fff;
    border-radius: 10px;
    width: 600px;
    max-width: 95vw;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 40px rgba(80,40,160,0.2);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #3d1a78, #251050);
    color: #e8dff8;
    border-radius: 10px 10px 0 0;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.modal-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #e8dff8;
    cursor: pointer;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background 0.2s;
}

.modal-close:hover {
    background: rgba(255,255,255,0.30);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 18px;
}

/* 示例网格 */
.example-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.example-item {
    border: 1.5px solid #c4b5fd;
    border-radius: 8px;
    padding: 12px 14px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fefcff;
}

.example-item:hover {
    border-color: #7c3aed;
    background: #f5f3ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(124,58,237,0.12);
}

.example-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #5b21b6;
    margin-bottom: 6px;
}

.example-item-preview {
    font-size: 11px;
    color: #6b7280;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
}

/* 复制成功 Toast */
.copy-toast {
    position: fixed;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #7c3aed;
    color: #fff;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 99999;
    pointer-events: none;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(124,58,237,0.4);
}

.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* 全屏按钮激活态 */
#fullscreenBtn.active {
    background: rgba(124,58,237,0.5) !important;
    border-color: #a78bfa !important;
}

/* 滚动条美化 */
.history-list::-webkit-scrollbar,
.result-content::-webkit-scrollbar,
.input-text-area::-webkit-scrollbar,
.ai-sidebar-body::-webkit-scrollbar {
    width: 5px;
}

.history-list::-webkit-scrollbar-track,
.result-content::-webkit-scrollbar-track,
.input-text-area::-webkit-scrollbar-track,
.ai-sidebar-body::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb,
.result-content::-webkit-scrollbar-thumb,
.input-text-area::-webkit-scrollbar-thumb,
.ai-sidebar-body::-webkit-scrollbar-thumb {
    background: #c4b5fd;
    border-radius: 3px;
}

/* 响应式 */
@media (max-width: 900px) {
    .ces-history-panel {
        display: none;
    }
    .example-grid {
        grid-template-columns: 1fr;
    }
}
