/* ========== 语法检查工具容器 ========== */
.sc-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #f8fafc;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: all 0.3s ease;
}

.sc-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ========== 顶部工具栏 ========== */
.sc-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
    flex-shrink: 0;
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    min-height: 28px;
}

.toolbar-btn {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.9);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #059669;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover:not(:disabled) {
    background: #ffffff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.toolbar-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
}

.toolbar-btn-primary {
    background: #ffffff;
    color: #059669;
    font-weight: 600;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.toolbar-btn-primary:hover:not(:disabled) {
    background: #f0fdf4;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

/* ========== 主内容区三栏布局 ========== */
.sc-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #f8fafc;
}

/* ========== 左侧历史面板 ========== */
.sc-history-panel {
    width: 200px;
    background: white;
    border-right: 1px solid #e2e8f0;
    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, #fafafa 0%, #f5f5f5 100%);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.history-title {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #ef4444;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
    line-height: 1;
}

.history-clear-btn:hover {
    background: #fde8e8;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
}

.history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 24px 12px;
    color: #94a3b8;
    font-size: 12px;
    text-align: center;
}

.history-empty span:first-child {
    font-size: 22px;
}

.history-item {
    display: flex;
    flex-direction: column;
    padding: 10px 12px;
    margin-bottom: 6px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    animation: fadeIn 0.2s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

.history-item:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateX(2px);
}

.history-item.active {
    background: #ecfdf5;
    border-color: #10b981;
    box-shadow: 0 1px 3px rgba(16, 185, 129, 0.2);
}

.history-item-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: #fde8e8;
    color: #ef4444;
    border: none;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    cursor: pointer;
    opacity: 0;
    transition: all 0.2s;
    padding: 0;
    line-height: 1;
}

.history-item:hover .history-item-delete {
    opacity: 1;
}

.history-item-delete:hover {
    background: #ef4444;
    color: white;
}

.history-item-preview {
    font-size: 12px;
    font-weight: 500;
    color: #1e293b;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 4px;
    padding-right: 20px;
}

.history-item-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

.history-item-time {
    color: #94a3b8;
    font-size: 11px;
}

.history-item-score {
    font-size: 11px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 4px;
}

.history-item-score.score-good { background: #dcfce7; color: #16a34a; }
.history-item-score.score-ok { background: #fef9c3; color: #ca8a04; }
.history-item-score.score-bad { background: #fee2e2; color: #dc2626; }

/* ========== 中间输入面板 ========== */
.sc-input-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
    min-width: 300px;
    border-right: 1px solid #e2e8f0;
}

.input-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fafafa 0%, #f5f5f5 100%);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
    flex-wrap: wrap;
    gap: 8px;
}

.input-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.lang-selector {
    display: flex;
    gap: 4px;
}

.lang-tab {
    padding: 4px 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 12px;
    color: #64748b;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.lang-tab:hover {
    background: #e2e8f0;
    color: #475569;
}

.lang-tab.active {
    background: #059669;
    border-color: #059669;
    color: white;
    font-weight: 500;
}

.input-text-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

.input-text-wrapper textarea {
    flex: 1;
    padding: 16px 20px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.7;
    border: none;
    outline: none;
    resize: none;
    background: #fafafa;
    color: #374151;
    transition: background 0.2s;
}

.input-text-wrapper textarea:focus {
    background: #ffffff;
}

.input-text-wrapper textarea::placeholder {
    color: #9ca3af;
    line-height: 1.8;
}

.input-char-count {
    padding: 6px 20px;
    font-size: 11px;
    color: #9ca3af;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    text-align: right;
    flex-shrink: 0;
}

.input-char-count.warn {
    color: #f59e0b;
    font-weight: 500;
}

.check-btn-wrap {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.check-btn {
    width: 100%;
    padding: 11px 16px;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
    letter-spacing: 0.5px;
}

.check-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(5, 150, 105, 0.4);
    filter: brightness(1.05);
}

.check-btn:active:not(:disabled) {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(5, 150, 105, 0.3);
}

.check-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

/* ========== 右侧结果面板 ========== */
.sc-result-panel {
    width: 44%;
    min-width: 300px;
    display: flex;
    flex-direction: column;
    background: white;
    overflow: hidden;
}

.result-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #fafafa 0%, #f5f5f5 100%);
    border-bottom: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.result-panel-title {
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.result-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: #dcfce7;
    color: #16a34a;
}

.result-content {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
}

/* 空状态 */
.sc-empty-hint {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: #94a3b8;
    font-size: 14px;
    text-align: center;
    padding: 40px 20px;
}

.sc-empty-hint .empty-icon {
    font-size: 44px;
    opacity: 0.7;
}

.sc-empty-sub {
    font-size: 12px;
    color: #cbd5e1;
}

/* Loading 状态 */
.sc-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 40px 20px;
    min-height: 300px;
}

.sc-loading-spin {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #059669;
    border-radius: 50%;
    animation: scSpin 0.8s linear infinite;
}

@keyframes scSpin {
    to { transform: rotate(360deg); }
}

.sc-loading-text {
    font-size: 14px;
    color: #64748b;
}

/* 错误提示 */
.sc-error-area {
    background: #fff5f5;
    border: 1px solid #fed7d7;
    border-left: 4px solid #ef4444;
    border-radius: 6px;
    padding: 14px 16px;
    color: #c53030;
    font-size: 13px;
    line-height: 1.6;
}

/* 错误区重试按钮 */
.sc-retry-btn {
    display: inline-block;
    padding: 5px 12px;
    background: white;
    border: 1px solid #ef4444;
    color: #ef4444;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}
.sc-retry-btn:hover {
    background: #ef4444;
    color: white;
}

/* ========== 检查结果渲染区 ========== */
.check-result {
    display: flex;
    flex-direction: column;
    gap: 16px;
    animation: fadeIn 0.3s ease;
}

/* 评分区 */
.score-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: #f8fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}

.score-circle {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 3px solid;
    transition: border-color 0.3s, background 0.3s, box-shadow 0.3s;
    animation: scoreIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.score-circle.level-perfect { border-color: #10b981; background: #ecfdf5; }
.score-circle.level-good    { border-color: #22c55e; background: #f0fdf4; }
.score-circle.level-ok      { border-color: #f59e0b; background: #fffbeb; }
.score-circle.level-bad     { border-color: #ef4444; background: #fff5f5; }

.score-num {
    font-size: 22px;
    font-weight: 700;
    line-height: 1;
}

.score-circle.level-perfect .score-num { color: #059669; }
.score-circle.level-good    .score-num { color: #16a34a; }
.score-circle.level-ok      .score-num { color: #d97706; }
.score-circle.level-bad     .score-num { color: #dc2626; }

.score-pct {
    font-size: 11px;
    color: #94a3b8;
    margin-top: 1px;
}

.score-info {
    flex: 1;
    min-width: 0;
}

.score-level-label {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 3px;
}

.score-circle.level-perfect ~ .score-info .score-level-label { color: #059669; }
.score-circle.level-good    ~ .score-info .score-level-label { color: #16a34a; }
.score-circle.level-ok      ~ .score-info .score-level-label { color: #d97706; }
.score-circle.level-bad     ~ .score-info .score-level-label { color: #dc2626; }

.score-summary-text {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
}

.score-lang-tag {
    display: inline-block;
    margin-top: 5px;
    font-size: 11px;
    padding: 1px 7px;
    border-radius: 8px;
    background: #e0f2fe;
    color: #0369a1;
}

.score-stats {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex-shrink: 0;
}

.stat-chip {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 8px;
    white-space: nowrap;
}

.stat-chip.stat-error      { background: #fee2e2; color: #dc2626; }
.stat-chip.stat-warning    { background: #fef9c3; color: #ca8a04; }
.stat-chip.stat-suggestion { background: #dbeafe; color: #2563eb; }

/* 无问题状态 */
.no-issues-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
    border: 1px solid #a7f3d0;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    color: #065f46;
}

.no-issues-banner span:first-child {
    font-size: 24px;
}

/* 问题列表区 */
.issues-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.issues-title {
    margin: 0 0 8px 0;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
    display: flex;
    align-items: center;
    gap: 6px;
}

.issues-count-tag {
    font-size: 11px;
    background: #f1f5f9;
    color: #64748b;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
}

.issue-item {
    border: 1px solid;
    border-radius: 6px;
    padding: 12px 14px;
    transition: all 0.2s;
    animation: fadeIn 0.25s ease;
}

.issue-item.sev-error      { border-color: #fca5a5; background: #fff5f5; }
.issue-item.sev-warning    { border-color: #fcd34d; background: #fffbeb; }
.issue-item.sev-suggestion { border-color: #93c5fd; background: #eff6ff; }

.issue-item:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transform: translateX(2px);
}

.issue-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.issue-type-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 4px;
}

.type-grammar     { background: #ede9fe; color: #7c3aed; }
.type-spelling    { background: #fee2e2; color: #dc2626; }
.type-punctuation { background: #ffedd5; color: #c2410c; }
.type-word_choice { background: #dbeafe; color: #1d4ed8; }
.type-style       { background: #d1fae5; color: #065f46; }

.issue-sev-tag {
    font-size: 11px;
    padding: 1px 6px;
    border-radius: 4px;
    font-weight: 500;
}

.sev-tag-error      { background: #fee2e2; color: #dc2626; }
.sev-tag-warning    { background: #fef9c3; color: #ca8a04; }
.sev-tag-suggestion { background: #dbeafe; color: #2563eb; }

.issue-body {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 6px;
    flex-wrap: wrap;
}

.issue-original {
    font-size: 13px;
    background: rgba(239, 68, 68, 0.1);
    padding: 3px 7px;
    border-radius: 4px;
    text-decoration: line-through;
    color: #dc2626;
    font-family: 'Consolas', 'Monaco', monospace;
}

.issue-arrow {
    color: #9ca3af;
    font-size: 14px;
    line-height: 1.6;
    flex-shrink: 0;
}

.issue-suggestion {
    font-size: 13px;
    background: rgba(16, 185, 129, 0.1);
    padding: 3px 7px;
    border-radius: 4px;
    color: #059669;
    font-weight: 500;
    font-family: 'Consolas', 'Monaco', monospace;
}

.issue-explanation {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.5;
    padding-top: 2px;
}

/* 修正后文本区 */
.corrected-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.corrected-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.corrected-header h4 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #475569;
}

.copy-corrected-inline-btn {
    padding: 4px 10px;
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: 4px;
    font-size: 11px;
    color: #475569;
    cursor: pointer;
    transition: all 0.2s;
}

.copy-corrected-inline-btn:hover {
    background: #059669;
    border-color: #059669;
    color: white;
}

.corrected-box {
    background: #f0fdf4;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    padding: 14px 16px;
    font-size: 13px;
    line-height: 1.8;
    color: #064e3b;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 180px;
    overflow-y: auto;
}

/* ========== 模态框 ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100000;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(2px);
}

.modal.show {
    display: flex;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.modal-content {
    background: white;
    border-radius: 8px;
    max-width: 700px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    animation: modalSlideIn 0.2s ease-out;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    flex-shrink: 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
}

.modal-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
}

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

/* 示例网格 */
.example-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 12px;
}

.example-card {
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafafa;
}

.example-card:hover {
    border-color: #10b981;
    background: #f0fdf4;
    box-shadow: 0 2px 8px rgba(16, 185, 129, 0.12);
    transform: translateY(-2px);
}

.example-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.example-lang-badge {
    font-size: 10px;
    padding: 1px 6px;
    border-radius: 8px;
    font-weight: 500;
}

.example-lang-badge.lang-zh    { background: #dbeafe; color: #1d4ed8; }
.example-lang-badge.lang-en    { background: #ede9fe; color: #7c3aed; }
.example-lang-badge.lang-mixed { background: #fef9c3; color: #ca8a04; }

.example-card-preview {
    font-size: 12px;
    color: #64748b;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* ========== 统一细滚动条（5px） ========== */
.history-list::-webkit-scrollbar,
.result-content::-webkit-scrollbar,
.corrected-box::-webkit-scrollbar,
.input-text-wrapper textarea::-webkit-scrollbar {
    width: 5px;
    height: 5px;
}

.history-list::-webkit-scrollbar-track,
.result-content::-webkit-scrollbar-track,
.corrected-box::-webkit-scrollbar-track,
.input-text-wrapper textarea::-webkit-scrollbar-track {
    background: transparent;
}

.history-list::-webkit-scrollbar-thumb,
.result-content::-webkit-scrollbar-thumb,
.corrected-box::-webkit-scrollbar-thumb,
.input-text-wrapper textarea::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
    transition: background 0.2s;
}

.history-list::-webkit-scrollbar-thumb:hover,
.result-content::-webkit-scrollbar-thumb:hover,
.corrected-box::-webkit-scrollbar-thumb:hover,
.input-text-wrapper textarea::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========== 历史条目问题数角标 ========== */
.history-item-issue-count {
    font-size: 10px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 8px;
    background: #fee2e2;
    color: #dc2626;
    flex-shrink: 0;
}

/* ========== 评分圆圈入场动画 ========== */
@keyframes scoreIn {
    from { opacity: 0; transform: scale(0.6); }
    to   { opacity: 1; transform: scale(1); }
}

/* ========== 复制 Toast ========== */
.copy-toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e293b;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 999999;
    pointer-events: none;
    white-space: nowrap;
}

.copy-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
