/* =============================================
   翻译文言文 - translate_classical_chinese.css
   三栏布局：历史 | 输入 | 结果
   主色调：深海墨蓝 + 琥珀金点缀，契合古典文学气质
   ============================================= */

/* ========== 主容器 ========== */
.cc-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #f5f3ed;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.07);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.cc-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;
}

/* ========== 顶部工具栏 ========== */
.cc-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 12px;
    min-height: 36px;
    background: linear-gradient(135deg, #234068 0%, #1a2e4a 100%);
    color: #fff;
    flex-wrap: wrap;
    gap: 6px;
    box-shadow: 0 2px 8px rgba(35, 64, 104, 0.40);
    flex-shrink: 0;
}

.cc-toolbar .toolbar-group {
    display: flex;
    gap: 5px;
    align-items: center;
    flex-wrap: wrap;
}

.cc-toolbar .toolbar-btn {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.90);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #234068;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.4;
}

.cc-toolbar .toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.18);
}

.cc-toolbar .toolbar-btn:active:not(:disabled) { transform: translateY(0); }

.cc-toolbar .toolbar-btn:disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

/* 主操作按钮（翻译） */
.cc-toolbar .toolbar-btn-primary {
    background: linear-gradient(135deg, #c67c3a 0%, #a85c28 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(198, 124, 58, 0.45);
}

.cc-toolbar .toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #d98c44 0%, #c67c3a 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(198, 124, 58, 0.55);
}

/* 翻译按钮 loading 流光动画 */
.cc-toolbar .toolbar-btn-primary.cc-btn-loading {
    background: linear-gradient(90deg, #c67c3a 0%, #e8a060 35%, #c67c3a 65%, #a85c28 100%);
    background-size: 200% 100%;
    animation: ccBtnShimmer 1.4s ease-in-out infinite;
    cursor: not-allowed;
    box-shadow: 0 2px 10px rgba(198, 124, 58, 0.5);
}

@keyframes ccBtnShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* 工具栏标题 */
.cc-toolbar .toolbar-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.92);
    letter-spacing: 0.5px;
    margin-right: 4px;
}

/* ========== 主内容：三栏 ========== */
.cc-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #f5f3ed;
}

/* ========== 左栏：历史记录 ========== */
.cc-history-panel {
    width: 200px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #d8d0c5;
    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, #fdfaf6 0%, #f5f0e8 100%);
    border-bottom: 1px solid #d8d0c5;
    flex-shrink: 0;
}

.history-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #234068;
}

.history-count {
    font-size: 11px;
    color: #7a95b0;
    font-weight: 400;
}

.history-clear-btn {
    background: #e8eef8;
    border: none;
    color: #2e5c8e;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: background 0.2s;
    white-space: nowrap;
}

.history-clear-btn:hover:not(:disabled) { background: #d0dcf0; }
.history-clear-btn:disabled { opacity: 0.38; cursor: not-allowed; }

.history-search {
    padding: 7px;
    border-bottom: 1px solid #d8d0c5;
    flex-shrink: 0;
}

.history-search input {
    width: 100%;
    padding: 5px 9px;
    border: 1px solid #c5d5e8;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    color: #1a2e4a;
    background: #fdfaf6;
}

.history-search input:focus {
    border-color: #2e5c8e;
    box-shadow: 0 0 0 2px rgba(46, 92, 142, 0.1);
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 5px;
}

.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list::-webkit-scrollbar-thumb { background: #c5d5e8; border-radius: 2px; }
.history-list::-webkit-scrollbar-thumb:hover { background: #2e5c8e; }

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 4px;
    padding: 8px 10px;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.18s;
    margin-bottom: 3px;
    border: 1px solid transparent;
}

.history-item-main { flex: 1; min-width: 0; }

.history-item:hover {
    background: #e8eef8;
    border-color: #c5d5e8;
}

.history-item.active {
    background: #dce7f5;
    border-color: #9ab5d4;
    border-left: 3px solid #2e5c8e;  /* 左侧选中标线 */
    padding-left: 8px;               /* 补偿 border-width 差异 */
}

.history-item-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a2e4a;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 10px;
    color: #7a95b0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.history-item-type {
    background: #dce7f5;
    color: #2e5c8e;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 10px;
}

.history-item-del {
    background: none;
    border: none;
    color: #9ab5d4;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 3px;
    transition: all 0.15s;
    line-height: 1;
    flex-shrink: 0;
    margin-top: 1px;
    opacity: 0;
}

.history-item:hover .history-item-del { opacity: 1; }
.history-item:hover .history-item-del:hover {
    color: #234068;
    background: #dce7f5;
}

.history-empty {
    text-align: center;
    color: #a0b4c8;
    font-size: 12px;
    padding: 24px 8px;
    line-height: 1.7;
}

/* ========== 中栏：输入面板 ========== */
.cc-input-panel {
    width: 300px;
    flex-shrink: 0;
    background: #fff;
    border-right: 1px solid #d8d0c5;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.panel-header {
    padding: 12px 14px 10px;
    border-bottom: 1px solid #d8d0c5;
    flex-shrink: 0;
    background: linear-gradient(to bottom, #fdfaf6 0%, #f5f0e8 100%);
}

.panel-header h3 {
    margin: 0 0 2px;
    font-size: 13px;
    font-weight: 600;
    color: #234068;
}

.panel-tip {
    font-size: 11px;
    color: #7a95b0;
    display: block;
}

.cc-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.cc-input-body::-webkit-scrollbar { width: 4px; }
.cc-input-body::-webkit-scrollbar-track { background: transparent; }
.cc-input-body::-webkit-scrollbar-thumb { background: #c5d5e8; border-radius: 2px; }
.cc-input-body::-webkit-scrollbar-thumb:hover { background: #2e5c8e; }

/* 文言文输入框 */
.cc-textarea-wrap { margin-bottom: 4px; }

.cc-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #c5d5e8;
    border-radius: 6px;
    font-size: 15px;
    font-family: "KaiTi", "楷体", "SimSun", "宋体", serif;
    color: #1a2e4a;
    background: #fdfaf6;
    outline: none;
    transition: all 0.2s;
    resize: vertical;
    line-height: 1.9;
    letter-spacing: 1px;
    box-sizing: border-box;
    min-height: 140px;
}

.cc-textarea:focus {
    border-color: #2e5c8e;
    box-shadow: 0 0 0 3px rgba(46, 92, 142, 0.12);
    background: #fff;
}

.cc-textarea::placeholder {
    font-size: 13px;
    color: #a0b4c8;
    letter-spacing: 0;
    font-family: inherit;
    font-weight: 400;
    line-height: 1.7;
}

/* 字数统计 */
.cc-char-counter {
    text-align: right;
    font-size: 11px;
    margin-bottom: 12px;
    line-height: 1;
    user-select: none;
}

.cc-char-num { color: #2980b9; font-weight: 500; transition: color 0.2s; }
.cc-char-num.cc-char-warning { color: #e67e22; font-weight: 600; }
.cc-char-num.cc-char-danger  { color: #c0392b; font-weight: 700; }
.cc-char-max { color: #a0b4c8; }

/* 翻译模式 */
.cc-mode-group { margin-bottom: 12px; }

.cc-mode-label {
    font-size: 12px;
    color: #3d5a7a;
    font-weight: 600;
    margin-bottom: 7px;
    display: block;
}

.cc-mode-options {
    display: flex;
    gap: 6px;
}

.cc-mode-option {
    flex: 1;
    padding: 7px 6px;
    text-align: center;
    border: 1.5px solid #c5d5e8;
    border-radius: 5px;
    cursor: pointer;
    font-size: 12px;
    color: #3d5a7a;
    transition: all 0.18s;
    user-select: none;
    background: #fdfaf6;
}

.cc-mode-option:hover {
    border-color: #2e5c8e;
    color: #2e5c8e;
    background: #e8eef8;
}

.cc-mode-option.selected {
    border-color: #2e5c8e;
    background: linear-gradient(135deg, #2e5c8e 0%, #1a3d6a 100%);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(46, 92, 142, 0.30);
}

.cc-mode-icon {
    font-size: 15px;
    display: block;
    margin-bottom: 2px;
}

/* 模式切换提示（隐藏时不占据布局空间） */
.cc-mode-hint {
    font-size: 11px;
    color: #2e5c8e;
    background: #e8eef8;
    border: 0 solid #c5d5e8;       /* border-width: 0 隐藏时不占据任何垂直空间 */
    border-radius: 4px;
    padding: 0 10px;
    margin-top: 0;
    margin-bottom: 0;
    display: block;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transform: translateY(-3px);
    transition: opacity 0.25s, transform 0.25s, max-height 0.28s, padding 0.25s, margin 0.25s, border-width 0.25s;
    pointer-events: none;
}

.cc-mode-hint.visible {
    opacity: 1;
    transform: translateY(0);
    max-height: 40px;
    padding: 4px 10px;
    margin-top: 2px;
    margin-bottom: 10px;
    border-width: 1px;
}

/* 快捷示例标签 */
.cc-quick-label {
    font-size: 12px;
    color: #3d5a7a;
    font-weight: 600;
    margin-bottom: 7px;
    display: block;
}

.cc-quick-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.cc-quick-tag {
    padding: 3px 10px;
    background: #e8eef8;
    border: 1px solid #c5d5e8;
    border-radius: 20px;
    font-size: 12px;
    color: #234068;
    cursor: pointer;
    transition: all 0.18s;
    font-family: "KaiTi", "楷体", serif;
    font-weight: 600;
    white-space: nowrap;
}

.cc-quick-tag:hover {
    background: #234068;
    border-color: #234068;
    color: #fff;
    transform: scale(1.04);
}

/* 使用提示 */
.cc-tips-box {
    background: linear-gradient(135deg, #f5f8fd 0%, #eff4fb 100%);
    border: 1px solid #d0dcf0;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 12px;
    color: #3d5a7a;
    line-height: 1.7;
}

.cc-tips-box p { margin: 0 0 4px; font-weight: 600; color: #234068; }
.cc-tips-box ul { margin: 0; padding-left: 16px; }
.cc-tips-box li { margin-bottom: 2px; }

/* ========== 右栏：翻译结果 ========== */
.cc-result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fdfaf6;
    min-width: 0;
}

.cc-result-header {
    padding: 10px 16px;
    border-bottom: 1px solid #d8d0c5;
    flex-shrink: 0;
    background: linear-gradient(to bottom, #fdfaf6 0%, #f5f0e8 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cc-result-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #234068;
}

.result-meta-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: #7a95b0;
}

.result-meta-title {
    font-size: 13px;
    font-weight: 700;
    color: #1a2e4a;
    font-family: "KaiTi", "楷体", serif;
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-mode-badge {
    background: #dce7f5;
    color: #2e5c8e;
    padding: 1px 7px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}

.cc-result-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
    display: flex;
    flex-direction: column;
}

.cc-result-body::-webkit-scrollbar { width: 5px; }
.cc-result-body::-webkit-scrollbar-track { background: transparent; }
.cc-result-body::-webkit-scrollbar-thumb { background: #c5d5e8; border-radius: 3px; }
.cc-result-body::-webkit-scrollbar-thumb:hover { background: #2e5c8e; }

/* 占位提示 */
.result-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #a0b4c8;
    text-align: center;
    padding: 40px;
    min-height: 180px;
}

.placeholder-icon { font-size: 52px; margin-bottom: 14px; opacity: 0.7; animation: placeholderFloat 3s ease-in-out infinite; }

@keyframes placeholderFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-7px); }
}
.placeholder-title { font-size: 16px; font-weight: 600; color: #7a95b0; margin: 0 0 8px; }
.placeholder-desc { font-size: 13px; color: #a0b4c8; margin: 3px 0; line-height: 1.6; }

/* 加载中 */
.result-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    min-height: 180px;
}

.loading-dots { display: flex; gap: 8px; }

.loading-dots span {
    width: 10px;
    height: 10px;
    background: #2e5c8e;
    border-radius: 50%;
    animation: dotBounce 1.2s ease-in-out infinite;
}

.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
    40% { transform: scale(1.1); opacity: 1; }
}

.loading-text { font-size: 13px; color: #7a95b0; margin: 0; animation: loadingPulse 1.8s ease-in-out infinite; }

@keyframes loadingPulse {
    0%, 100% { opacity: 0.6; }
    50%       { opacity: 1; }
}

/* ========== 翻译结果内容样式 ========== */
.result-content {
    animation: fadeInUp 0.35s ease;
    min-height: 0;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 出处横幅 */
.result-content .cc-source {
    background: linear-gradient(135deg, #1a2e4a 0%, #234068 60%, #2e5c8e 100%);
    color: rgba(255, 255, 255, 0.92);
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px 8px 0 0;
    letter-spacing: 0.5px;
    font-family: "KaiTi", "楷体", serif;
}

/* 条目根容器 */
.result-content .cc-entry {
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
    overflow: hidden;
}

/* 各节 */
.result-content .cc-section {
    padding: 14px 18px;
    border-bottom: 1px solid #eaedf5;
}

.result-content .cc-section:last-child { border-bottom: none; }

.result-content .cc-section h4 {
    margin: 0 0 9px;
    font-size: 13px;
    font-weight: 700;
    color: #234068;
    display: flex;
    align-items: center;
    gap: 6px;
}

.result-content .cc-section h4::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 14px;
    background: #c67c3a;
    border-radius: 2px;
    flex-shrink: 0;
}

/* 原文展示 */
.result-content .cc-original-text {
    font-family: "KaiTi", "楷体", "SimSun", "宋体", serif;
    font-size: 17px;
    color: #1a1a2e;
    line-height: 2.0;
    letter-spacing: 2px;
    background: #f8f5ee;
    border-left: 4px solid #c67c3a;
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
}

/* 字词注解列表 */
.result-content .cc-annotations {
    margin: 0;
    padding: 0;
    list-style: none;
}

.result-content .cc-annotations li {
    font-size: 13px;
    color: #3d5a7a;
    padding: 4px 10px 4px 8px;
    border-left: 2px solid #c5d5e8;
    margin-bottom: 5px;
    line-height: 1.7;
    border-radius: 0 4px 4px 0;
    background: #f5f8fd;
}

.result-content .cc-annotations li strong {
    color: #1a2e4a;
    font-weight: 700;
    margin-right: 4px;
}

/* 白话译文 */
.result-content .cc-translation {
    font-size: 15px;
    color: #2c3e50;
    line-height: 2.0;
    letter-spacing: 0.5px;
    background: #f8f5ee;
    border-left: 4px solid #2e5c8e;
    padding: 10px 14px;
    border-radius: 0 6px 6px 0;
    font-family: "SimSun", "宋体", serif;
}

/* 赏析节 */
.result-content .cc-remark { background: #fdfaf6; }

/* 深度赏析模式的出处节专属样式 */
.result-content .cc-source-section {
    background: linear-gradient(to right, #eef3fb 0%, #f8faff 100%);
    border-left: 4px solid #2e5c8e;
    padding-left: 14px;
}

.result-content .cc-source-section h4::before {
    background: #2e5c8e;
}

/* 通用 p / ul / li */
.result-content .cc-section p {
    margin: 0 0 7px;
    font-size: 13px;
    color: #3d5a7a;
    line-height: 1.85;
}

.result-content .cc-section ul {
    margin: 0;
    padding-left: 18px;
    font-size: 13px;
    color: #3d5a7a;
    line-height: 1.85;
}

.result-content .cc-section ul li { margin-bottom: 4px; }

.result-content .cc-section ul li::marker {
    color: #c67c3a;
    font-weight: 700;
}

.result-content .cc-section ol {
    margin: 0;
    padding-left: 22px;
    font-size: 13px;
    color: #3d5a7a;
    line-height: 1.85;
}

.result-content .cc-section ol li { margin-bottom: 4px; }

.result-content .cc-section ol li::marker {
    color: #2e5c8e;
    font-weight: 700;
}

/* h2/h3 子标题 */
.result-content .cc-section h2 {
    font-size: 15px;
    font-weight: 700;
    color: #1a2e4a;
    margin: 12px 0 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid #d0dcf0;
}

.result-content .cc-section h3 {
    font-size: 13px;
    font-weight: 700;
    color: #234068;
    margin: 10px 0 5px;
}

/* hr / blockquote */
.result-content .cc-section hr {
    border: none;
    border-top: 1px dashed #d0dcf0;
    margin: 10px 0;
}

.result-content .cc-section blockquote {
    margin: 8px 0;
    padding: 8px 14px;
    border-left: 4px solid #c67c3a;
    background: #fef9ef;
    border-radius: 0 6px 6px 0;
    font-size: 14px;
    color: #3d5a7a;
    font-style: italic;
    font-family: "KaiTi", "楷体", serif;
    line-height: 1.85;
    letter-spacing: 1px;
}

/* strong / em / a */
.result-content strong { color: #1a2e4a; font-weight: 700; }
.result-content em { color: #3d5a7a; font-style: italic; }

.result-content a {
    color: #2e5c8e;
    text-decoration: none;
    border-bottom: 1px solid rgba(46, 92, 142, 0.3);
    transition: border-color 0.15s, color 0.15s;
}

.result-content a:hover { color: #1a2e4a; border-bottom-color: #2e5c8e; }

/* table */
.result-content .cc-section table,
.result-content table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    margin: 8px 0;
    border-radius: 6px;
    overflow: hidden;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.result-content .cc-section table th,
.result-content table th {
    background: linear-gradient(135deg, #1a2e4a 0%, #234068 100%);
    color: #fff;
    padding: 8px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
}

.result-content .cc-section table td,
.result-content table td {
    padding: 7px 12px;
    color: #2c3e50;
    border-bottom: 1px solid #e0e8f0;
    line-height: 1.6;
}

.result-content .cc-section table tr:nth-child(even) td,
.result-content table tr:nth-child(even) td { background: #f5f8fd; }

.result-content .cc-section table tr:hover td,
.result-content table tr:hover td { background: #e8eef8; }

/* 错误提示 */
#ccResultError {
    flex-shrink: 0;   /* 防止被 Flex 父容器压缩（.cc-result-body 是 display:flex） */
}

.result-error {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px;
    text-align: center;
    min-height: 260px;   /* 确保错误内容在面板中垂直居中 */
}

.result-error .error-icon { font-size: 36px; margin-bottom: 10px; }
.result-error .error-msg { font-size: 14px; color: #c0392b; margin: 0 0 6px; font-weight: 600; }
.result-error .error-tip { font-size: 12px; color: #7a95b0; margin: 0 0 16px; }

/* 错误重试按钮 */
.error-retry-btn {
    padding: 7px 20px;
    background: linear-gradient(135deg, #2e5c8e 0%, #1a3d6a 100%);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(46, 92, 142, 0.30);
    letter-spacing: 0.3px;
}

.error-retry-btn:hover {
    background: linear-gradient(135deg, #3d6da0 0%, #2e5c8e 100%);
    box-shadow: 0 4px 12px rgba(46, 92, 142, 0.40);
    transform: translateY(-1px);
}

.error-retry-btn:active { transform: translateY(0); }

/* ========== Shake 抖动动画 ========== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    15%, 55%, 85% { transform: translateX(-5px); }
    35%, 70% { transform: translateX(5px); }
}

.cc-textarea.shake {
    animation: shake 0.45s ease-in-out;
    border-color: #e74c3c !important;
    box-shadow: 0 0 0 3px rgba(231, 76, 60, 0.15) !important;
}

/* ========== 示例导入模态框 ========== */
.cc-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(2px);
    z-index: 10000;
    display: none;
}

.cc-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.22);
    width: 720px;
    max-width: 95vw;
    max-height: 90vh;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.cc-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #1a2e4a 0%, #234068 100%);
    color: #fff;
    flex-shrink: 0;
}

.cc-modal-header h3 { margin: 0; font-size: 15px; font-weight: 700; }

.cc-modal-close {
    background: rgba(255, 255, 255, 0.18);
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    padding: 3px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.cc-modal-close:hover { background: rgba(255, 255, 255, 0.35); }

.cc-modal-body {
    overflow-y: auto;
    padding: 14px;
    flex: 1;
}

.cc-modal-body::-webkit-scrollbar { width: 5px; }
.cc-modal-body::-webkit-scrollbar-track { background: #f0f4fa; border-radius: 3px; }
.cc-modal-body::-webkit-scrollbar-thumb { background: #c5d5e8; border-radius: 3px; }
.cc-modal-body::-webkit-scrollbar-thumb:hover { background: #2e5c8e; }

.example-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.example-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }

.example-card {
    padding: 10px 12px;
    border: 1.5px solid #c5d5e8;
    border-radius: 7px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fdfaf6;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.example-card:hover {
    border-color: #2e5c8e;
    background: #e8eef8;
    box-shadow: 0 3px 10px rgba(46, 92, 142, 0.12);
    transform: translateY(-1px);
}

.example-icon {
    font-size: 22px;
    line-height: 1;
    flex-shrink: 0;
    background: #dce7f5;
    border-radius: 6px;
    padding: 4px 7px;
}

.example-info { flex: 1; min-width: 0; }

.example-preview {
    font-size: 13px;
    font-weight: 700;
    color: #1a2e4a;
    font-family: "KaiTi", "楷体", serif;
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.example-source-badge {
    display: inline-block;
    font-size: 10px;
    background: #dce7f5;
    color: #2e5c8e;
    padding: 1px 6px;
    border-radius: 8px;
    margin-bottom: 4px;
    border: 1px solid #c5d5e8;
}

.example-desc {
    font-size: 12px;
    color: #3d5a7a;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 示例加载中 / 加载失败样式 */
.example-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px;
    color: #7a95b0;
    font-size: 13px;
}

.example-load-error {
    grid-column: 1 / -1;
    text-align: center;
    padding: 32px;
}

.example-load-error p {
    color: #c0392b;
    font-size: 13px;
    margin: 0 0 14px;
}

.example-retry-btn {
    padding: 7px 20px;
    background: linear-gradient(135deg, #2e5c8e 0%, #1a3d6a 100%);
    color: #fff;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(46, 92, 142, 0.30);
}

.example-retry-btn:hover {
    background: linear-gradient(135deg, #3d6da0 0%, #2e5c8e 100%);
    box-shadow: 0 4px 12px rgba(46, 92, 142, 0.40);
    transform: translateY(-1px);
}

.example-retry-btn:active { transform: translateY(0); }

/* ========== 响应式布局 ========== */
@media (max-width: 960px) {
    .cc-history-panel { display: none; }
    .cc-input-panel { width: 260px; }
}

@media (max-width: 640px) {
    .cc-main-content { flex-direction: column; }
    .cc-input-panel {
        width: 100%;
        flex-shrink: 0;
        max-height: 260px;
        border-right: none;
        border-bottom: 1px solid #d8d0c5;
    }
    .cc-result-panel { flex: 1; min-height: 0; }
    .cc-toolbar { padding: 5px 8px; gap: 5px; }
    .cc-toolbar .toolbar-btn { padding: 3px 8px; font-size: 11px; }
    .example-grid { grid-template-columns: 1fr; }
    .example-grid > :last-child:nth-child(odd) { grid-column: auto; }
    .cc-modal { width: 96vw; }
}

/* ========== 打印样式 ========== */
@media print {
    .cc-toolbar,
    .cc-history-panel,
    .cc-input-panel { display: none !important; }
    .cc-container { height: auto !important; position: static !important; }
    .cc-result-panel { flex: 1; overflow: visible !important; }
    .cc-result-body { overflow: visible !important; padding: 0; }
    .result-content .cc-entry { box-shadow: none; border: 1px solid #ddd; }
}
