/* Fanyi2 可视化翻译编辑器样式 */

/* 编辑器工具栏 */
#fanyi2-editor-toolbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.fanyi2-toolbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px;
    background: linear-gradient(135deg, #1e3a5f, #2d5986);
    color: #fff;
    box-shadow: 0 2px 12px rgba(0,0,0,0.3);
}

.fanyi2-toolbar-logo {
    font-size: 15px;
    white-space: nowrap;
}

.fanyi2-toolbar-logo strong {
    font-size: 17px;
    color: #7ec8e3;
}

.fanyi2-toolbar-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.fanyi2-toolbar-select {
    padding: 6px 12px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 6px;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 13px;
    cursor: pointer;
}

.fanyi2-toolbar-select option {
    color: #333;
    background: #fff;
}

.fanyi2-toolbar-btn {
    padding: 7px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

.fanyi2-btn-primary {
    background: #3b82f6;
    color: #fff;
}
.fanyi2-btn-primary:hover {
    background: #2563eb;
}

.fanyi2-btn-success {
    background: #10b981;
    color: #fff;
}
.fanyi2-btn-success:hover {
    background: #059669;
}

.fanyi2-btn-info {
    background: #06b6d4;
    color: #fff;
}
.fanyi2-btn-info:hover {
    background: #0891b2;
}

.fanyi2-btn-secondary {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.fanyi2-btn-secondary:hover {
    background: rgba(255,255,255,0.3);
}

.fanyi2-btn-warning {
    background: #f59e0b;
    color: #fff;
}
.fanyi2-btn-warning:hover {
    background: #d97706;
}

/* 页面偏移，给工具栏腾出空间 */
body.fanyi2-editor-mode {
    margin-top: 50px !important;
}

/* 可点选文本高亮 */
body.fanyi2-editor-mode [data-fanyi2-editable] {
    position: relative;
    cursor: pointer;
    transition: outline 0.15s, background 0.15s;
}

body.fanyi2-editor-mode [data-fanyi2-editable]:hover {
    outline: 2px dashed #3b82f6;
    outline-offset: 2px;
    background: rgba(59, 130, 246, 0.08);
}

body.fanyi2-editor-mode [data-fanyi2-editable].fanyi2-selected {
    outline: 2px solid #10b981;
    outline-offset: 2px;
    background: rgba(16, 185, 129, 0.1);
}

body.fanyi2-editor-mode [data-fanyi2-editable].fanyi2-translated {
    outline: 2px solid #06b6d4;
    outline-offset: 1px;
}

/* 悬浮提示 */
.fanyi2-tooltip {
    position: absolute;
    top: -30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 10px;
    background: #1e3a5f;
    color: #fff;
    font-size: 11px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    z-index: 999998;
    opacity: 0;
    transition: opacity 0.15s;
}

[data-fanyi2-editable]:hover .fanyi2-tooltip {
    opacity: 1;
}

/* 翻译面板 */
#fanyi2-editor-panel {
    position: fixed;
    right: 0;
    top: 50px;
    width: 380px;
    max-height: calc(100vh - 50px);
    background: #fff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    z-index: 999998;
    overflow-y: auto;
    border-left: 3px solid #2271b1;
}

.fanyi2-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e7eb;
}

.fanyi2-panel-header h3 {
    margin: 0;
    font-size: 15px;
}

.fanyi2-panel-close-btn {
    background: none;
    border: none;
    font-size: 22px;
    cursor: pointer;
    color: #666;
    padding: 0;
    line-height: 1;
}

.fanyi2-panel-body {
    padding: 16px;
}

.fanyi2-panel-field {
    margin-bottom: 14px;
}

.fanyi2-panel-field label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 5px;
    color: #374151;
}

.fanyi2-panel-field textarea {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    line-height: 1.5;
    resize: vertical;
    box-sizing: border-box;
}

.fanyi2-panel-field textarea:focus {
    border-color: #3b82f6;
    outline: none;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}

.fanyi2-panel-field textarea[readonly] {
    background: #f9fafb;
    color: #6b7280;
}

.fanyi2-panel-actions {
    display: flex;
    gap: 8px;
}

/* 进度遮罩 */
#fanyi2-progress-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999999;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fanyi2-progress-box {
    background: #fff;
    padding: 30px 40px;
    border-radius: 12px;
    text-align: center;
    min-width: 350px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

.fanyi2-progress-box h3 {
    margin-top: 0;
    font-size: 18px;
}

.fanyi2-progress-bar {
    height: 24px;
    background: #e5e7eb;
    border-radius: 12px;
    overflow: hidden;
    margin: 15px 0;
}

.fanyi2-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #8b5cf6);
    border-radius: 12px;
    transition: width 0.3s ease;
}

.fanyi2-progress-text {
    color: #6b7280;
    font-size: 14px;
}

/* ========= 表格弹窗 ========= */
.fanyi2-table-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999990;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.fanyi2-table-modal-content {
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 95vw;
    max-width: 1200px;
    height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.fanyi2-table-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    flex-shrink: 0;
}

.fanyi2-table-modal-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #fff;
}

.fanyi2-table-modal-actions {
    display: flex;
    gap: 8px;
}

.fanyi2-table-modal-actions .fanyi2-toolbar-btn {
    padding: 8px 16px;
    font-size: 13px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s;
}

.fanyi2-table-modal-actions .fanyi2-btn-success {
    background: #10b981;
    color: #fff;
}
.fanyi2-table-modal-actions .fanyi2-btn-success:hover {
    background: #059669;
}

.fanyi2-table-modal-actions .fanyi2-btn-primary {
    background: #3b82f6;
    color: #fff;
}
.fanyi2-table-modal-actions .fanyi2-btn-primary:hover {
    background: #2563eb;
}

.fanyi2-table-modal-actions .fanyi2-btn-secondary {
    background: rgba(255,255,255,0.2);
    color: #fff;
}
.fanyi2-table-modal-actions .fanyi2-btn-secondary:hover {
    background: rgba(255,255,255,0.35);
}

.fanyi2-table-modal-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 24px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    flex-shrink: 0;
}

.fanyi2-table-tip {
    color: #94a3b8;
    font-size: 12px;
}

/* ===== 批量复制粘贴区 ===== */
.fanyi2-batch-paste-area {
    display: flex;
    gap: 12px;
    padding: 12px 24px;
    background: #fefce8;
    border-bottom: 1px solid #fde68a;
    flex-shrink: 0;
    max-height: 200px;
}

.fanyi2-batch-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.fanyi2-batch-col-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    font-size: 12px;
}

.fanyi2-batch-textarea {
    flex: 1;
    width: 100%;
    min-height: 80px;
    max-height: 140px;
    padding: 8px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 12px;
    line-height: 1.6;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    resize: none;
    box-sizing: border-box;
    white-space: pre;
    overflow-wrap: normal;
    overflow-x: auto;
}

.fanyi2-batch-textarea:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);
}

.fanyi2-batch-textarea[readonly] {
    background: #f9fafb;
    color: #374151;
    cursor: default;
}

.fanyi2-mini-btn {
    padding: 3px 10px;
    font-size: 11px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: #fff;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s;
}

.fanyi2-mini-btn:hover {
    background: #f3f4f6;
}

.fanyi2-mini-btn-primary {
    background: #3b82f6;
    color: #fff;
    border-color: #3b82f6;
}

.fanyi2-mini-btn-primary:hover {
    background: #2563eb;
}

.fanyi2-batch-tip {
    padding: 6px 24px;
    font-size: 11px;
    color: #92400e;
    background: #fffbeb;
    border-bottom: 1px solid #fde68a;
    flex-shrink: 0;
}

.fanyi2-table-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 0;
}

/* 表格样式 */
.fanyi2-edit-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.fanyi2-edit-table thead {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #f1f5f9;
}

.fanyi2-edit-table th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #475569;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}

.fanyi2-edit-table td {
    padding: 8px 12px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

.fanyi2-col-num {
    width: 40px;
    text-align: center !important;
    color: #94a3b8;
}

.fanyi2-col-original {
    width: 40%;
}

.fanyi2-col-translated {
    width: 40%;
}

.fanyi2-col-actions {
    width: 80px;
    text-align: center !important;
    white-space: nowrap;
}

.fanyi2-cell-text {
    line-height: 1.5;
    word-break: break-word;
    max-height: 120px;
    overflow-y: auto;
    color: #374151;
}

.fanyi2-table-input {
    width: 100%;
    min-height: 32px;
    padding: 6px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.5;
    resize: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    box-sizing: border-box;
}

.fanyi2-table-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* 行操作按钮 */
.fanyi2-row-ai-btn,
.fanyi2-row-save-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.15s;
    background: #f1f5f9;
    margin: 0 2px;
}

.fanyi2-row-ai-btn:hover {
    background: #dbeafe;
}

.fanyi2-row-save-btn:hover {
    background: #d1fae5;
}

.fanyi2-row-ai-btn:disabled,
.fanyi2-row-save-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 行状态 */
.fanyi2-row-untranslated {
    background: #fff;
}

.fanyi2-row-untranslated .fanyi2-col-num {
    color: #ef4444;
    font-weight: 600;
}

.fanyi2-row-translated {
    background: #f0fdf4;
}

.fanyi2-row-translated .fanyi2-table-input {
    border-color: #86efac;
}

.fanyi2-row-saved {
    background: #eff6ff;
}

.fanyi2-row-saved .fanyi2-table-input {
    border-color: #93c5fd;
}

.fanyi2-row-saved .fanyi2-col-num {
    color: #3b82f6;
    font-weight: 600;
}

/* 表格行悬停 */
.fanyi2-edit-table tbody tr:hover {
    background: #f8fafc;
}

