/* =============================================
   文章翻译 - article_translation.css
   三栏布局：历史 | 输入 | 结果
   主题：清新蓝绿 / 国际文化
   ============================================= */

/* ========== CSS 变量 ========== */
:root {
    --at-teal:          #0f766e;
    --at-teal-mid:      #0d9488;
    --at-teal-light:    #14b8a6;
    --at-teal-pale:     #99f6e4;
    --at-blue:          #1d4ed8;
    --at-blue-light:    #3b82f6;
    --at-bg:            #f0fdfa;
    --at-bg-panel:      #ffffff;
    --at-border:        #ccfbf1;
    --at-text:          #134e4a;
    --at-text-sub:      #0f766e;
    --at-text-muted:    #5eead4;
    --at-shadow:        rgba(15, 118, 110, 0.15);
    --at-gold:          #d97706;
    --at-gold-light:    #f59e0b;
}

/* ========== 主容器 ========== */
.at-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: var(--at-bg);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 12px var(--at-shadow);
    transition: all 0.3s ease;
    position: relative;
}

/* 全屏模式 */
.at-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
    min-height: unset;
}

/* ========== 顶部工具栏 ========== */
.at-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 12px;
    min-height: 38px;
    background: linear-gradient(135deg, #134e4a 0%, #0f766e 55%, #1d4ed8 100%);
    color: #fff;
    flex-wrap: wrap;
    gap: 6px;
    box-shadow: 0 2px 10px rgba(15, 118, 110, 0.5);
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}

/* 装饰线 */
.at-toolbar::before {
    content: '◈ ◇ ◈ ◇ ◈ ◇';
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    color: rgba(255, 255, 255, 0.18);
    letter-spacing: 4px;
    pointer-events: none;
}

.at-toolbar .toolbar-group {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 1;
}

.at-toolbar .toolbar-btn {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.88);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #0f766e;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.4;
}

.at-toolbar .toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.2);
}

.at-toolbar .toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.at-toolbar .toolbar-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

/* 主操作按钮（翻译） */
.at-toolbar .toolbar-btn-primary {
    background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.5);
}

.at-toolbar .toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(217, 119, 6, 0.6);
}

/* 翻译按钮 loading 流光动画 */
.at-toolbar .toolbar-btn-primary.at-btn-loading {
    background: linear-gradient(90deg, #d97706 0%, #fbbf24 35%, #d97706 65%, #b45309 100%);
    background-size: 200% 100%;
    animation: atBtnShimmer 1.4s ease-in-out infinite;
    cursor: not-allowed;
}

@keyframes atBtnShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.at-toolbar .toolbar-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.5px;
    margin-right: 4px;
}

/* ========== 主内容：三栏 ========== */
.at-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: var(--at-bg);
}

/* ========== 左栏：历史记录 ========== */
.at-history-panel {
    width: 200px;
    flex-shrink: 0;
    background: var(--at-bg-panel);
    border-right: 1px solid var(--at-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    background: linear-gradient(to bottom, #f0fdfa 0%, #ccfbf1 100%);
    border-bottom: 1px solid var(--at-border);
    flex-shrink: 0;
}

.history-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--at-text);
}

.history-count {
    font-size: 11px;
    color: var(--at-text-muted);
    font-weight: 400;
}

.history-clear-btn {
    background: #f0fdfa;
    border: none;
    color: #0f766e;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
}

.history-clear-btn:hover {
    background: #ccfbf1;
}

.history-search {
    padding: 8px 10px;
    border-bottom: 1px solid var(--at-border);
    flex-shrink: 0;
}

.history-search input {
    width: 100%;
    padding: 4px 8px;
    border: 1px solid var(--at-border);
    border-radius: 4px;
    font-size: 12px;
    color: var(--at-text);
    background: #f9fffe;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s;
}

.history-search input:focus {
    border-color: var(--at-teal-light);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 4px 0;
}

.history-list::-webkit-scrollbar {
    width: 4px;
}

.history-list::-webkit-scrollbar-thumb {
    background: var(--at-teal-pale);
    border-radius: 2px;
}

.history-list::-webkit-scrollbar-thumb:hover {
    background: var(--at-teal-light);
}

.history-empty {
    padding: 20px 12px;
    text-align: center;
    color: #a3a3a3;
    font-size: 12px;
    line-height: 1.8;
}

.history-item {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    cursor: pointer;
    border-bottom: 1px solid #f0fdfa;
    transition: background 0.15s;
    gap: 4px;
}

.history-item:hover {
    background: #f0fdfa;
}

.history-item.active {
    background: #ccfbf1;
    box-shadow: inset 3px 0 0 #3b82f6;
}

.history-item-main {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--at-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    display: flex;
    gap: 4px;
    align-items: center;
    margin-top: 2px;
    flex-wrap: wrap;
}

.history-item-badge {
    font-size: 10px;
    background: #ccfbf1;
    color: #0f766e;
    padding: 1px 4px;
    border-radius: 3px;
    font-weight: 500;
}

.history-item-badge-style {
    background: #dbeafe;
    color: #1d4ed8;
}

.history-item-time {
    font-size: 10px;
    color: #9ca3af;
    margin-top: 2px;
}

.history-item-del {
    background: none;
    border: none;
    color: #d1d5db;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.history-item-del:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* ========== 中栏：输入 ========== */
.at-input-panel {
    flex: 1;
    min-width: 0;
    background: var(--at-bg-panel);
    border-right: 1px solid var(--at-border);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(to bottom, #f0fdfa 0%, #ccfbf1 100%);
    border-bottom: 1px solid var(--at-border);
    flex-shrink: 0;
}

.panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--at-text);
}

.panel-tip {
    font-size: 11px;
    color: #0d9488;
}

.at-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.at-input-body::-webkit-scrollbar {
    width: 4px;
}

.at-input-body::-webkit-scrollbar-thumb {
    background: var(--at-teal-pale);
    border-radius: 2px;
}

.at-input-body::-webkit-scrollbar-thumb:hover {
    background: var(--at-teal-light);
}

.at-options-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.at-option-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.at-option-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--at-text-sub);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.at-option-tabs {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.at-option-tab {
    padding: 5px 10px;
    border: 1.5px solid var(--at-border);
    border-radius: 20px;
    font-size: 12px;
    color: #374151;
    cursor: pointer;
    transition: all 0.18s ease;
    background: #fff;
    white-space: nowrap;
    user-select: none;
}

.at-option-tab:hover {
    border-color: var(--at-teal-light);
    color: var(--at-teal);
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(13, 148, 136, 0.15);
}

.at-option-tab.selected {
    background: var(--at-teal-mid);
    border-color: var(--at-teal-mid);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.4);
    transform: translateY(-1px);
}

/* 选项提示 */
.at-option-hint {
    font-size: 11px;
    color: var(--at-teal);
    min-height: 16px;
    opacity: 0;
    transition: opacity 0.3s;
}

.at-option-hint.visible {
    opacity: 1;
}

/* ========== 文章输入区 ========== */
.at-text-box {
    flex: 1;
}

.at-textarea {
    width: 100%;
    height: 200px;
    padding: 10px 12px;
    border: 1.5px solid var(--at-border);
    border-radius: 8px;
    font-size: 14px;
    color: var(--at-text);
    background: #fafffe;
    resize: vertical;
    line-height: 1.7;
    font-family: inherit;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.at-textarea:focus {
    border-color: var(--at-teal-mid);
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.12);
    background: #fff;
}

.at-textarea::placeholder {
    color: #94a3b8;
    font-size: 13px;
}

.at-textarea.shake {
    animation: atShake 0.4s ease;
    border-color: #f87171;
}

@keyframes atShake {
    0%, 100% { transform: translateX(0); }
    20%  { transform: translateX(-5px); }
    40%  { transform: translateX(5px); }
    60%  { transform: translateX(-4px); }
    80%  { transform: translateX(4px); }
}

/* ========== 字数计数 ========== */
.at-char-counter {
    text-align: right;
    font-size: 11px;
    color: #9ca3af;
    margin-top: -6px;
}

.at-char-counter.warning {
    color: #f59e0b;
    font-weight: 600;
}

.at-char-counter.limit {
    color: #ef4444;
    font-weight: 700;
}

/* ========== 嵌入式翻译按钮 ========== */
.at-inline-translate-btn {
    width: 100%;
    padding: 10px;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 60%, #1d4ed8 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.5px;
    transition: all 0.2s;
    box-shadow: 0 3px 10px rgba(15, 118, 110, 0.35);
}

.at-inline-translate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 60%, #3b82f6 100%);
    box-shadow: 0 4px 14px rgba(15, 118, 110, 0.45);
    transform: translateY(-1px);
}

.at-inline-translate-btn:active:not(:disabled) {
    transform: translateY(0);
}

.at-inline-translate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 提示框 ========== */
.at-tips-box {
    background: linear-gradient(135deg, #f0fdfa 0%, #e0f2fe 100%);
    border: 1px solid var(--at-border);
    border-radius: 8px;
    padding: 10px 14px;
}

.at-tips-box p {
    margin: 0 0 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--at-teal);
}

.at-tips-box ul {
    margin: 0;
    padding-left: 16px;
}

.at-tips-box li {
    font-size: 11px;
    color: #374151;
    line-height: 1.8;
}

/* ========== 右栏：翻译结果 ========== */
.at-result-panel {
    flex: 1.2;
    min-width: 0;
    background: var(--at-bg-panel);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.at-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    background: linear-gradient(to bottom, #f0fdfa 0%, #ccfbf1 100%);
    border-bottom: 1px solid var(--at-border);
    flex-shrink: 0;
}

.at-result-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--at-text);
}

.result-meta-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-badge {
    font-size: 11px;
    background: linear-gradient(135deg, #0f766e, #1d4ed8);
    color: #fff;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
}

.at-result-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.at-result-body::-webkit-scrollbar {
    width: 4px;
}

.at-result-body::-webkit-scrollbar-thumb {
    background: var(--at-teal-pale);
    border-radius: 2px;
}

.at-result-body::-webkit-scrollbar-thumb:hover {
    background: var(--at-teal-light);
}

/* ========== 占位 ========== */
.result-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
    color: #9ca3af;
}

.placeholder-icon {
    font-size: 48px;
    margin-bottom: 10px;
    animation: atGlobeSpin 6s linear infinite;
}

@keyframes atGlobeSpin {
    0%   { transform: scale(1); }
    50%  { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.placeholder-deco {
    font-size: 20px;
    letter-spacing: 8px;
    color: var(--at-teal-pale);
    margin-bottom: 8px;
}

.placeholder-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--at-text-sub);
    margin: 0 0 6px;
}

.placeholder-desc {
    font-size: 12px;
    color: #9ca3af;
    margin: 2px 0;
}

/* ========== 加载中 ========== */
.result-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 200px;
    text-align: center;
}

.loading-globe {
    font-size: 44px;
    animation: atLoadingPulse 1.2s ease-in-out infinite;
}

@keyframes atLoadingPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50%       { transform: scale(1.12); opacity: 0.75; }
}

.loading-dots {
    display: flex;
    gap: 6px;
    margin: 12px 0;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--at-teal-mid);
    border-radius: 50%;
    animation: atDotBounce 1.2s infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes atDotBounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40%            { transform: scale(1); opacity: 1; }
}

.loading-text {
    font-size: 13px;
    color: var(--at-text-sub);
    margin: 0;
}

/* ========== 翻译结果区内容样式 ========== */
.result-content {
    flex-shrink: 0; /* 防止结果内容被压缩 */
}

.result-content.result-content-enter {
    animation: atResultFadeIn 0.4s ease;
}

@keyframes atResultFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.result-content .at-result {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-content .at-result-header {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f0fdfa, #e0f2fe);
    border-radius: 8px;
    border: 1px solid var(--at-border);
    /* override the outer header style */
    position: static;
    margin: 0;
}

.result-content .at-lang-badge {
    background: linear-gradient(135deg, #0f766e, #0d9488);
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.result-content .at-style-badge {
    background: linear-gradient(135deg, #1d4ed8, #3b82f6);
    color: #fff;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.result-content .at-translation-block {
    padding: 14px 16px;
    background: #fafffe;
    border: 1px solid var(--at-border);
    border-left: 3px solid var(--at-teal-mid);
    border-radius: 8px;
    font-size: 14px;
    line-height: 1.9;
    color: var(--at-text);
    box-shadow: 0 1px 4px rgba(15, 118, 110, 0.06);
}

.result-content .at-translation-block p {
    margin: 0 0 10px;
}

.result-content .at-translation-block p:last-child {
    margin-bottom: 0;
}

.result-content .at-notes-block {
    padding: 12px 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 8px;
    font-size: 13px;
    color: #78350f;
}

.result-content .at-note-item {
    margin-bottom: 6px;
    padding-left: 14px;
    border-left: 2px solid #f59e0b;
    line-height: 1.6;
}

.result-content .at-note-item:last-child {
    margin-bottom: 0;
}

.result-content .at-translator-note {
    padding: 10px 14px;
    background: #f0f9ff;
    border: 1px solid #bae6fd;
    border-radius: 8px;
    font-size: 12px;
    color: #075985;
    font-style: italic;
}

.result-content .at-translator-note p {
    margin: 0;
}

/* ========== 错误区 ========== */
#atResultError {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 180px;
}

.result-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
}

.error-icon {
    font-size: 36px;
}

.error-msg {
    font-size: 14px;
    color: #dc2626;
    margin: 0;
    font-weight: 500;
}

.error-tip {
    font-size: 12px;
    color: #6b7280;
    margin: 0;
}

.retry-btn {
    margin-top: 8px;
    padding: 7px 18px;
    background: var(--at-teal-mid);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: background 0.2s;
}

.retry-btn:hover {
    background: var(--at-teal);
}

/* ========== 重新翻译按钮 ========== */
.at-re-translate-btn {
    padding: 3px 10px;
    background: linear-gradient(135deg, #f0fdfa, #e0f2fe);
    border: 1.5px solid var(--at-teal-mid);
    border-radius: 6px;
    color: var(--at-teal);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.at-re-translate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #ccfbf1, #bae6fd);
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(15, 118, 110, 0.2);
}

.at-re-translate-btn:active:not(:disabled) {
    transform: translateY(0);
}

.at-re-translate-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 译文字数 ========== */
.at-word-count {
    flex-shrink: 0;
    text-align: right;
    font-size: 11px;
    color: #94a3b8;
    padding: 8px 2px 0;
    font-style: italic;
    letter-spacing: 0.3px;
}

/* ========== result-content Markdown 标签样式 ========== */
.result-content strong {
    font-weight: 700;
    color: var(--at-text);
}

.result-content em {
    font-style: italic;
    color: var(--at-text-sub);
}

.result-content h3,
.result-content h4,
.result-content h5 {
    margin: 10px 0 6px;
    font-weight: 700;
    color: var(--at-text);
    line-height: 1.5;
}

.result-content h3 { font-size: 15px; }
.result-content h4 { font-size: 14px; }
.result-content h5 { font-size: 13px; }

.result-content code {
    font-family: 'Courier New', Courier, monospace;
    font-size: 13px;
    background: #e6fffa;
    color: #0f766e;
    padding: 1px 5px;
    border-radius: 4px;
    border: 1px solid #ccfbf1;
}

.result-content pre {
    background: #f0fdfa;
    border: 1px solid #ccfbf1;
    border-radius: 8px;
    padding: 12px 14px;
    overflow-x: auto;
    font-size: 13px;
    line-height: 1.6;
    color: var(--at-text);
    margin: 8px 0;
}

.result-content pre code {
    background: none;
    border: none;
    padding: 0;
    color: inherit;
}

.result-content blockquote {
    border-left: 3px solid var(--at-teal-mid);
    padding: 4px 12px;
    margin: 8px 0;
    background: #f0fdfa;
    border-radius: 0 6px 6px 0;
    color: #374151;
    font-style: italic;
}
.at-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 10001;
}

.at-modal {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(600px, 92vw);
    max-height: 75vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    z-index: 10002;
    flex-direction: column;
    overflow: hidden;
}

.at-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    background: linear-gradient(135deg, #134e4a 0%, #0f766e 60%, #1d4ed8 100%);
    color: #fff;
    flex-shrink: 0;
}

.at-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.at-modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.at-modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.at-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    align-content: start;
}

.at-modal-body::-webkit-scrollbar {
    width: 4px;
}

.at-modal-body::-webkit-scrollbar-thumb {
    background: var(--at-teal-pale);
    border-radius: 2px;
}

.example-card {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1.5px solid var(--at-border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafffe;
}

.example-card:hover {
    border-color: var(--at-teal-mid);
    background: #f0fdfa;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 118, 110, 0.15);
}

.example-icon {
    font-size: 22px;
    flex-shrink: 0;
}

.example-info {
    flex: 1;
    min-width: 0;
}

.example-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--at-text);
    margin-bottom: 3px;
}

.example-meta {
    display: flex;
    gap: 4px;
    margin-bottom: 4px;
}

.example-meta-badge {
    font-size: 10px;
    padding: 1px 5px;
    border-radius: 8px;
    font-weight: 500;
}

.example-meta-badge.dir-badge {
    background: #ccfbf1;
    color: #0f766e;
}

.example-meta-badge.style-badge {
    background: #dbeafe;
    color: #1d4ed8;
}

.example-desc {
    font-size: 11px;
    color: #6b7280;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.example-loading {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 30px 0;
}

/* ========== 暗黑模式 ========== */
body.dark .at-container {
    background: #0a1628;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
}

body.dark .at-toolbar {
    background: linear-gradient(135deg, #042f2e 0%, #134e4a 55%, #1e3a5f 100%);
}

body.dark .at-main-content {
    background: #0f1f3d;
}

body.dark .at-history-panel {
    background: #0f1f3d;
    border-right-color: #1e3a5f;
}

body.dark .history-panel-header {
    background: linear-gradient(to bottom, #0a1628 0%, #0f1f3d 100%);
    border-bottom-color: #1e3a5f;
}

body.dark .history-panel-header h3 {
    color: #5eead4;
}

body.dark .history-clear-btn {
    background: #0f2d2d;
    color: #5eead4;
}

body.dark .history-clear-btn:hover {
    background: #134e4a;
}

body.dark .history-search {
    border-bottom-color: #1e3a5f;
}

body.dark .history-search input {
    background: #0a1628;
    border-color: #1e3a5f;
    color: #d1d5db;
}

body.dark .history-search input:focus {
    border-color: #0d9488;
}

body.dark .history-search input::placeholder {
    color: #4b5563;
}

body.dark .history-list::-webkit-scrollbar-thumb {
    background: #1e3a5f;
}

body.dark .history-list::-webkit-scrollbar-thumb:hover {
    background: #0d9488;
}

body.dark .history-empty {
    color: #4b5563;
}

body.dark .history-item {
    border-bottom-color: #0f1f3d;
}

body.dark .history-item:hover {
    background: #0f2d2d;
}

body.dark .history-item.active {
    background: #0f2d2d;
    box-shadow: inset 3px 0 0 #3b82f6;
}

body.dark .history-item-title {
    color: #d1d5db;
}

body.dark .history-item-meta span {
    color: #4b5563;
}

body.dark .history-item-badge {
    background: #0f2d2d;
    color: #5eead4;
}

body.dark .history-item-badge-style {
    background: #0a1e3d;
    color: #7dd3fc;
}

body.dark .history-item-time {
    color: #4b5563;
}

body.dark .at-input-panel {
    background: #0f1f3d;
    border-right-color: #1e3a5f;
}

body.dark .panel-header {
    background: linear-gradient(to bottom, #0a1628 0%, #0f1f3d 100%);
    border-bottom-color: #1e3a5f;
}

body.dark .panel-header h3 {
    color: #5eead4;
}

body.dark .panel-tip {
    color: #0d9488;
}

body.dark .at-input-body {
    background: #0f1f3d;
}

body.dark .at-input-body::-webkit-scrollbar-thumb {
    background: #1e3a5f;
}

body.dark .at-option-label {
    color: #5eead4;
}

body.dark .at-option-tab {
    background: #0a1628;
    border-color: #1e3a5f;
    color: #9ca3af;
}

body.dark .at-option-tab:hover {
    border-color: #0d9488;
    color: #5eead4;
}

body.dark .at-option-tab.selected {
    background: #0d9488;
    border-color: #0d9488;
    color: #fff;
}

body.dark .at-option-hint {
    color: #5eead4;
}

body.dark .at-textarea {
    background: #0a1628;
    border-color: #1e3a5f;
    color: #d1d5db;
}

body.dark .at-textarea:focus {
    border-color: #0d9488;
    box-shadow: 0 0 0 3px rgba(13, 148, 136, 0.2);
    background: #0d1b36;
}

body.dark .at-textarea::placeholder {
    color: #374151;
}

body.dark .at-char-counter {
    color: #4b5563;
}

body.dark .at-char-counter.warning {
    color: #f59e0b;
}

body.dark .at-char-counter.limit {
    color: #ef4444;
}

body.dark .at-tips-box {
    background: linear-gradient(135deg, #0a2038 0%, #0a1628 100%);
    border-color: #1e3a5f;
}

body.dark .at-tips-box p {
    color: #5eead4;
}

body.dark .at-tips-box li {
    color: #9ca3af;
}

body.dark .at-result-panel {
    background: #0f1f3d;
}

body.dark .at-result-header {
    background: linear-gradient(to bottom, #0a1628 0%, #0f1f3d 100%);
    border-bottom-color: #1e3a5f;
}

body.dark .at-result-header h3 {
    color: #5eead4;
}

body.dark .at-result-body {
    background: #0f1f3d;
}

body.dark .at-result-body::-webkit-scrollbar-thumb {
    background: #1e3a5f;
}

body.dark .at-result-body::-webkit-scrollbar-thumb:hover {
    background: #0d9488;
}

body.dark .placeholder-title {
    color: #5eead4;
}

body.dark .placeholder-deco {
    color: #1e3a5f;
}

body.dark .placeholder-desc {
    color: #4b5563;
}

body.dark .result-content .at-translation-block {
    background: #0a1628;
    border-color: #1e3a5f;
    border-left-color: #0d9488; /* 保留左边强调色 */
    color: #d1d5db;
}

body.dark .result-content .at-notes-block {
    background: #1c1608;
    border-color: #78350f;
    color: #fde68a;
}

body.dark .result-content .at-translator-note {
    background: #071b26;
    border-color: #075985;
    color: #7dd3fc;
}

body.dark .result-content .at-result-header {
    background: linear-gradient(135deg, #0a2018, #0a1628);
    border-color: #1e3a5f;
}

body.dark .error-msg {
    color: #f87171;
}

body.dark .error-tip {
    color: #6b7280;
}

body.dark #atResultError {
    background: #0f1f3d;
}

body.dark .retry-btn {
    background: #0d9488;
    color: #fff;
}

body.dark .retry-btn:hover {
    background: #0f766e;
}

body.dark .result-content strong {
    color: #e2e8f0;
}

body.dark .result-content em {
    color: #5eead4;
}

body.dark .result-content h3,
body.dark .result-content h4,
body.dark .result-content h5 {
    color: #e2e8f0;
}

body.dark .result-content code {
    background: #0f2d2d;
    color: #5eead4;
    border-color: #134e4a;
}

body.dark .result-content pre {
    background: #0a1628;
    border-color: #1e3a5f;
    color: #d1d5db;
}

body.dark .result-content blockquote {
    border-left-color: #0d9488;
    background: #0f2d2d;
    color: #9ca3af;
}

body.dark .at-modal {
    background: #0f1f3d;
}

body.dark .at-modal-body {
    background: #0f1f3d;
}

body.dark .example-card {
    background: #0a1628;
    border-color: #1e3a5f;
}

body.dark .example-card:hover {
    background: #0f2d2d;
    border-color: #0d9488;
}

body.dark .example-title {
    color: #d1d5db;
}

body.dark .example-desc {
    color: #6b7280;
}

body.dark .example-meta-badge.dir-badge {
    background: #0f2d2d;
    color: #5eead4;
}

body.dark .example-meta-badge.style-badge {
    background: #0a1e3d;
    color: #7dd3fc;
}

body.dark .at-re-translate-btn {
    background: linear-gradient(135deg, #0f2d2d, #071b26);
    border-color: #0d9488;
    color: #5eead4;
}

body.dark .at-re-translate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #134e4a, #0a2038);
    box-shadow: 0 3px 8px rgba(13, 148, 136, 0.3);
}

body.dark .at-word-count {
    color: #4b5563;
}

/* ========== 响应式 ========== */
/* 640~899px：隐藏历史栏，保留中右双栏 */
@media (max-width: 900px) {
    .at-history-panel {
        display: none;
    }
}

/* ≤639px：纵向堆叠全部区域 */
@media (max-width: 639px) {
    .at-main-content {
        flex-direction: column;
    }

    .at-input-panel,
    .at-result-panel {
        flex: none;
        height: 50%;
    }

    .at-result-panel {
        border-right: none;
        border-top: 1px solid var(--at-border);
    }
}

@media (max-width: 600px) {
    .at-toolbar {
        padding: 4px 8px;
    }

    .at-toolbar .toolbar-title {
        display: none;
    }

    .at-modal-body {
        grid-template-columns: 1fr;
    }

    .at-options-row {
        gap: 6px;
    }

    .at-option-tabs {
        gap: 4px;
    }

    .at-option-tab {
        font-size: 11px;
        padding: 4px 8px;
    }
}

/* ========== 打印样式 ========== */
@media print {
    .at-toolbar,
    .at-history-panel,
    .at-input-panel {
        display: none !important;
    }

    .at-container {
        height: auto;
        box-shadow: none;
    }

    .at-result-panel {
        width: 100%;
        height: auto;
        overflow: visible;
    }
}
