/* ========== 文章排版工具容器 ========== */
.at-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
    min-height: 600px;
    background: #f0f4ff;
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 2px 12px rgba(37, 99, 235, 0.10);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.at-container.fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw !important;
    height: 100vh !important;
    z-index: 9999;
    border-radius: 0;
    margin: 0;
}

/* ========== 顶部工具栏 ========== */
.at-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 5px 14px;
    background: linear-gradient(135deg, #2563EB 0%, #1d4ed8 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
    flex-shrink: 0;
    min-height: 36px;
}

.at-toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
}

.at-toolbar-title-group {
    flex: 1;
    justify-content: center;
}

.at-toolbar-title {
    font-size: 13px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.95);
    letter-spacing: 0.5px;
}

.at-toolbar-btn {
    padding: 4px 10px;
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #1d4ed8;
    transition: all 0.2s;
    white-space: nowrap;
}

.at-toolbar-btn:hover:not(:disabled) {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
}

.at-toolbar-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ========== 主内容区 ========== */
.at-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ========== 左侧历史面板 ========== */
.at-history-panel {
    width: 200px;
    background: white;
    border-right: 1px solid #c7d7f9;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

.at-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #f0f4ff, #e8eeff);
    border-bottom: 1px solid #c7d7f9;
    flex-shrink: 0;
}

.at-history-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1e3a6e;
}

.at-history-clear-btn {
    background: #f0f4ff;
    border: none;
    color: #2563EB;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    transition: all 0.2s;
}

.at-history-clear-btn:hover {
    background: #dbeafe;
    color: #1d4ed8;
}

/* 历史搜索框 */
.at-history-search {
    padding: 6px 8px 8px;
    background: linear-gradient(to bottom, #f0f4ff, #e8eeff);
    border-radius: 12px;
    margin: 6px 6px 4px;
}

.at-history-search input {
    width: 100%;
    padding: 5px 10px 5px 28px;
    border: 1px solid #c7d7f9;
    border-radius: 12px;
    background: #f8faff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24'%3E%3Ccircle cx='11' cy='11' r='8' stroke='%232563EB' stroke-width='2' fill='none'/%3E%3Cpath d='M21 21l-4.35-4.35' stroke='%232563EB' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 8px center;
    font-size: 12px;
    outline: none;
    box-sizing: border-box;
    transition: all 0.2s;
    color: #1e3a6e;
}

.at-history-search input:focus {
    background-color: white;
    border-color: #2563EB;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.15);
}

.at-history-search input::placeholder {
    color: #93c5fd;
}

.at-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.at-history-list:hover {
    scrollbar-color: #93c5fd transparent;
}

.at-history-list::-webkit-scrollbar { width: 4px; }
.at-history-list::-webkit-scrollbar-track { background: transparent; }
.at-history-list::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; }
.at-history-list:hover::-webkit-scrollbar-thumb { background: #93c5fd; }

.at-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px 10px;
    color: #93c5fd;
    font-size: 12px;
    gap: 4px;
    text-align: center;
}

.at-history-empty small {
    color: #bfdbfe;
    font-size: 11px;
}

.at-history-item {
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    margin: 3px 0;
    background: #f8faff;
    border: 1px solid #dbeafe;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.at-history-item:hover {
    background: #eff6ff;
    border-color: #93c5fd;
    transform: translateX(2px);
}

.at-history-item.active {
    background: #dbeafe;
    border-color: #2563EB;
    box-shadow: 0 1px 3px rgba(37, 99, 235, 0.2);
}

.at-history-item-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: #fee2e2;
    color: #ef4444;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    opacity: 0;
    transition: all 0.2s;
    cursor: pointer;
    border: none;
    line-height: 1;
}

.at-history-item:hover .at-history-item-del {
    opacity: 1;
}

.at-history-item-del:hover {
    background: #ef4444;
    color: white;
}

.at-history-item-title {
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 3px;
    color: #1e3a6e;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 20px;
}

.at-history-item-meta {
    display: flex;
    gap: 6px;
    align-items: center;
}

.at-history-item-style {
    font-size: 10px;
    color: #2563EB;
    background: #dbeafe;
    padding: 1px 5px;
    border-radius: 3px;
    flex-shrink: 0;
}

.at-history-item-time {
    color: #93c5fd;
    font-size: 10px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.at-history-footer {
    padding: 6px 10px;
    background: linear-gradient(to top, #f0f4ff, #e8eeff);
    border-top: 1px solid #dbeafe;
    flex-shrink: 0;
}

.at-history-count {
    font-size: 11px;
    color: #93c5fd;
}

/* ========== 中间输入面板 ========== */
.at-input-panel {
    width: 360px;
    flex-shrink: 0;
    background: white;
    border-right: 1px solid #c7d7f9;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.at-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #f8faff, #f0f4ff);
    border-bottom: 1px solid #dbeafe;
    flex-shrink: 0;
}

.at-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1e3a6e;
}

.at-input-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.at-input-scroll:hover {
    scrollbar-color: #93c5fd transparent;
}

.at-input-scroll::-webkit-scrollbar { width: 4px; }
.at-input-scroll::-webkit-scrollbar-track { background: transparent; }
.at-input-scroll::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; }
.at-input-scroll:hover::-webkit-scrollbar-thumb { background: #93c5fd; }

.at-section-divider {
    font-size: 12px;
    font-weight: 600;
    color: #2563EB;
    padding: 8px 0 6px;
    border-bottom: 1px solid #dbeafe;
    margin-bottom: 10px;
}

.at-required {
    color: #ef4444;
    font-size: 13px;
}

.at-form-row {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.at-form-field {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.at-field-wide {
    flex: 2;
}

.at-input-label {
    font-size: 12px;
    font-weight: 500;
    color: #475569;
}

.at-text-input {
    padding: 7px 10px;
    border: 1px solid #c7d7f9;
    border-radius: 6px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s;
    color: #1e293b;
    background: #f8faff;
}

.at-text-input:focus {
    border-color: #2563EB;
    background: white;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.at-text-input::placeholder {
    color: #93c5fd;
}

.at-textarea {
    padding: 8px 10px;
    border: 1px solid #c7d7f9;
    border-radius: 6px;
    font-size: 13px;
    line-height: 1.6;
    resize: none;
    outline: none;
    transition: all 0.2s;
    color: #1e293b;
    background: #f8faff;
    font-family: inherit;
    box-sizing: border-box;
    width: 100%;
    word-break: break-word;
}

.at-content-area {
    height: 180px;
}

.at-textarea:focus {
    border-color: #2563EB;
    background: white;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

.at-textarea::placeholder {
    color: #93c5fd;
}

/* 输入框错误状态 */
.at-textarea.at-input-error,
.at-text-input.at-input-error {
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.15) !important;
    background: #fff5f5 !important;
    animation: at-shake 0.35s ease;
}

@keyframes at-shake {
    0%, 100% { transform: translateX(0); }
    20%        { transform: translateX(-5px); }
    60%        { transform: translateX(5px); }
    80%        { transform: translateX(-3px); }
}

.at-char-count {
    text-align: right;
    font-size: 11px;
    color: #93c5fd;
    margin-top: 3px;
}

.at-select-input {
    padding: 7px 10px;
    border: 1px solid #c7d7f9;
    border-radius: 6px;
    font-size: 12px;
    outline: none;
    background: #f8faff;
    color: #1e293b;
    cursor: pointer;
    transition: all 0.2s;
}

.at-select-input:focus {
    border-color: #2563EB;
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.12);
}

/* 排版风格网格 */
.at-style-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

/* 末项奇数时独占一行 */
.at-style-grid > :last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.at-style-option {
    cursor: pointer;
}

.at-style-option input[type="radio"] {
    display: none;
}

.at-style-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 6px;
    border: 1.5px solid #c7d7f9;
    border-radius: 8px;
    background: #f8faff;
    transition: all 0.2s;
    gap: 2px;
    cursor: pointer;
    position: relative;
}

.at-style-card:hover {
    border-color: #60a5fa;
    background: #eff6ff;
}

.at-style-option input[type="radio"]:checked + .at-style-card {
    border-color: #2563EB;
    background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.2);
}

/* 选中状态勾选标记 */
.at-style-option input[type="radio"]:checked + .at-style-card::after {
    content: '\2713';
    position: absolute;
    top: 3px;
    right: 5px;
    font-size: 10px;
    font-weight: 700;
    color: #2563EB;
    line-height: 1;
}

.at-style-icon {
    font-size: 16px;
}

.at-style-name {
    font-size: 12px;
    font-weight: 600;
    color: #1e3a6e;
}

.at-style-desc {
    font-size: 10px;
    color: #64748b;
}

/* AI 增强选项 */
.at-options-section {
    margin-top: 4px;
    background: #f0f4ff;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 2px;
}

.at-options-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.at-options-title {
    font-size: 12px;
    font-weight: 600;
    color: #2563EB;
}

.at-options-quick-btns {
    display: flex;
    gap: 6px;
}

.at-quick-btn {
    background: white;
    border: 1px solid #c7d7f9;
    color: #2563EB;
    font-size: 11px;
    padding: 2px 7px;
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.2s;
}

.at-quick-btn:hover {
    background: #dbeafe;
    border-color: #2563EB;
}

.at-options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 6px;
}

.at-option-checkbox {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    font-size: 12px;
    color: #334155;
    padding: 4px 6px;
    border-radius: 4px;
    transition: background 0.2s;
}

.at-option-checkbox:hover {
    background: #dbeafe;
}

.at-option-checkbox input[type="checkbox"] {
    accent-color: #2563EB;
    width: 13px;
    height: 13px;
    cursor: pointer;
    flex-shrink: 0;
}

.at-checkbox-label {
    font-size: 12px;
    white-space: nowrap;
}

/* ========== 操作按钮区 ========== */
.at-action-section {
    padding: 10px 14px;
    background: linear-gradient(to top, #f0f4ff, white);
    border-top: 1px solid #dbeafe;
    display: flex;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.at-quick-format-btn {
    flex: 0 0 auto;
    padding: 9px 14px;
    background: white;
    border: 1.5px solid #2563EB;
    border-radius: 6px;
    color: #2563EB;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.at-quick-format-btn:hover {
    background: #eff6ff;
    box-shadow: 0 2px 6px rgba(37, 99, 235, 0.15);
}

.at-quick-format-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    border-color: #c7d7f9;
    color: #93c5fd;
}

.at-generate-btn {
    flex: 1;
    padding: 10px 14px;
    background: linear-gradient(135deg, #2563EB 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.at-generate-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.35);
}

.at-generate-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.at-generate-btn.si-btn-generating {
    animation: btnPulse 0.8s ease-in-out infinite alternate;
}

@keyframes btnPulse {
    from { opacity: 1; }
    to { opacity: 0.72; }
}

.at-cancel-btn {
    flex: 0 0 auto;
    padding: 9px 14px;
    background: #fee2e2;
    color: #ef4444;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 4px;
}

.at-cancel-btn:hover {
    background: #fecaca;
}

.at-btn-icon {
    font-size: 14px;
}

/* ========== 右侧结果面板 ========== */
.at-result-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: #f8faff;
    overflow: hidden;
    min-width: 300px;
}

.at-result-panel-header {
    background: linear-gradient(to bottom, #f8faff, #f0f4ff) !important;
}

.at-result-actions {
    display: flex;
    gap: 6px;
    align-items: center;
}

.at-result-action-btn {
    padding: 4px 10px;
    background: white;
    border: 1px solid #c7d7f9;
    border-radius: 4px;
    font-size: 12px;
    color: #2563EB;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.at-result-action-btn:hover {
    background: #dbeafe;
    border-color: #2563EB;
}

/* ========== 占位符 ========== */
.at-result-placeholder {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 30px;
    text-align: center;
    color: #64748b;
}

.at-placeholder-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.6;
}

.at-placeholder-title {
    font-size: 16px;
    font-weight: 600;
    color: #1e3a6e;
    margin: 0 0 8px;
}

.at-placeholder-desc {
    font-size: 13px;
    color: #64748b;
    margin: 0 0 20px;
    line-height: 1.6;
    max-width: 380px;
}

.at-placeholder-tips {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 24px;
    text-align: left;
    max-width: 360px;
}

.at-tip-item {
    font-size: 12px;
    color: #64748b;
    padding: 5px 10px;
    background: white;
    border-left: 3px solid #2563EB;
    border-radius: 0 4px 4px 0;
}

.at-placeholder-quick-start {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.at-placeholder-btn {
    padding: 10px 20px;
    background: linear-gradient(135deg, #2563EB 0%, #1d4ed8 100%);
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.at-placeholder-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.at-placeholder-shortcut {
    font-size: 11px;
    color: #94a3b8;
}

/* ========== 加载状态 ========== */
.at-result-loading {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 14px;
}

.at-loading-animation {
    display: flex;
    gap: 8px;
    align-items: center;
}

.at-loading-dot {
    width: 10px;
    height: 10px;
    background: #2563EB;
    border-radius: 50%;
    animation: dotBounce 1.2s ease-in-out infinite;
}

.at-loading-dot:nth-child(2) { animation-delay: 0.2s; }
.at-loading-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.at-loading-text {
    font-size: 14px;
    font-weight: 500;
    color: #1e3a6e;
    margin: 0;
}

.at-loading-sub {
    font-size: 12px;
    color: #64748b;
    margin: 0;
}

/* ========== 结果内容区 ========== */
.at-result-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: transparent transparent;
}

.at-result-content:hover {
    scrollbar-color: #93c5fd transparent;
}

.at-result-content::-webkit-scrollbar { width: 4px; }
.at-result-content::-webkit-scrollbar-track { background: transparent; }
.at-result-content::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; }
.at-result-content:hover::-webkit-scrollbar-thumb { background: #93c5fd; }

/* ========== 结果区块 ========== */
.at-result-section {
    background: white;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.06);
}

.at-result-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 14px;
    background: linear-gradient(to right, #f0f4ff, #e8eeff);
    border-bottom: 1px solid #dbeafe;
    border-radius: 8px 8px 0 0;  /* 顶部圆角与父级 section 匹配 */
    cursor: pointer;
    user-select: none;
    transition: background 0.2s;
}

.at-result-section-header:hover {
    background: linear-gradient(to right, #e0eaff, #d8e4ff);
}

.at-section-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
}

.at-section-icon {
    font-size: 14px;
}

.at-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e3a6e;
}

.at-section-badge {
    font-size: 10px;
    color: #2563EB;
    background: #dbeafe;
    padding: 1px 7px;
    border-radius: 10px;
    font-weight: 500;
}

.at-section-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.at-section-copy-btn {
    background: white;
    border: 1px solid #c7d7f9;
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 11px;
    cursor: pointer;
    color: #2563EB;
    transition: all 0.2s;
}

.at-section-copy-btn:hover {
    background: #dbeafe;
}

.at-section-collapse-icon {
    font-size: 13px;
    color: #64748b;
    transition: transform 0.2s;
}

/* 折叠时 header 独占整个卡片，四角全部圆润，去掉底部分隔线 */
.at-result-section.collapsed .at-result-section-header {
    border-radius: 8px;
    border-bottom: none;
}

.at-result-section.collapsed > *:not(.at-result-section-header) {
    display: none !important;
}

/* 标题框 */
.at-title-box {
    padding: 12px 16px;
    font-size: 18px;
    font-weight: 700;
    color: #1e3a6e;
    line-height: 1.4;
    word-break: break-word;
}

/* 摘要框 */
.at-summary-box {
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.8;
    color: #334155;
    background: #f8faff;
    border-left: 3px solid #2563EB;
    margin: 8px 12px;
    border-radius: 0 4px 4px 0;
    word-break: break-word;
}

/* 建议框 */
.at-suggestions-box {
    margin: 8px 12px 12px;
    padding: 10px 14px;
    font-size: 13px;
    line-height: 1.8;
    color: #374151;
    background: #f0f9ff;
    border-radius: 6px;
    word-break: break-word;
}

/* 通用区块内容 */
.at-section-body {
    padding: 12px 16px;
    font-size: 13px;
    line-height: 1.8;
    color: #334155;
    word-break: break-word;
}

.at-section-body ul,
.at-section-body ol {
    margin: 8px 0;
    padding-left: 20px;
}

.at-section-body ul li::marker {
    color: #2563EB;
}

.at-section-body li {
    margin: 4px 0;
}

.at-section-body strong {
    color: #1e3a6e;
    font-weight: 600;
}

.at-section-body a {
    color: #2563EB;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.15s;
}

.at-section-body a:hover {
    color: #1d4ed8;
}

.at-section-body h3,
.at-section-body h4 {
    color: #1e3a6e;
    font-size: 14px;
    margin: 12px 0 6px;
}

/* 原始文本 */
.at-raw-text-body {
    white-space: pre-wrap;
    font-family: inherit;
    font-size: 13px;
}

/* ========== 排版正文（纸张预览） ========== */
.at-body-section:not(.collapsed) {
    min-height: 200px;
}

.at-paper-preview {
    padding: 24px 28px;
    background: white;
    word-break: break-word;
}

/* 纸张标题 */
.at-paper-title {
    font-size: 20px;
    font-weight: 700;
    color: #1e3a6e;
    text-align: center;
    margin-bottom: 18px;
    padding-bottom: 12px;
    border-bottom: 2px solid #dbeafe;
    line-height: 1.4;
}

/* 字体大小类 */
.at-paper-body.at-font-sm { font-size: 12px; }
.at-paper-body.at-font-md { font-size: 14px; }
.at-paper-body.at-font-lg { font-size: 16px; }

/* 行间距类 */
.at-paper-body.at-spacing-compact { line-height: 1.5; }
.at-paper-body.at-spacing-normal  { line-height: 1.9; }
.at-paper-body.at-spacing-relaxed { line-height: 2.3; }

/* 段落缩进类 */
.at-paper-body.at-indent-none p { text-indent: 0; }
.at-paper-body.at-indent-first p { text-indent: 2em; }
.at-paper-body.at-indent-first4 p { text-indent: 4em; }

/* 正文基础样式 */
.at-paper-body {
    color: #1e293b;
    word-break: break-word;
}

.at-paper-body p {
    margin: 0 0 12px;
    line-height: inherit;
}

.at-paper-body h2 {
    font-size: 1.15em;
    font-weight: 700;
    color: #1e3a6e;
    margin: 18px 0 10px;
    padding-left: 8px;
    border-left: 3px solid #2563EB;
}

.at-paper-body h3 {
    font-size: 1.05em;
    font-weight: 600;
    color: #1e3a6e;
    margin: 14px 0 8px;
}

.at-paper-body ul,
.at-paper-body ol {
    margin: 8px 0 12px;
    padding-left: 22px;
}

.at-paper-body ul li::marker {
    color: #2563EB;
}

.at-paper-body li {
    margin: 4px 0;
}

.at-paper-body blockquote {
    margin: 12px 0;
    padding: 10px 14px;
    background: #f0f4ff;
    border-left: 4px solid #2563EB;
    border-radius: 0 6px 6px 0;
    color: #475569;
    font-style: italic;
}

.at-paper-body strong {
    font-weight: 600;
    color: #1e3a6e;
}

.at-paper-body em {
    font-style: italic;
    color: #475569;
}

/* 排版风格主题 */
/* 商务正式 */
.at-paper-body.at-style-business {
    font-family: 'SimSun', '宋体', serif;
    color: #111827;
}
.at-paper-body.at-style-business p { text-indent: 2em; }
.at-paper-body.at-style-business h2 { border-left: none; padding-left: 0; font-size: 1.1em; }

/* 学术严谨 */
.at-paper-body.at-style-academic {
    font-family: 'Times New Roman', serif;
    color: #111827;
}
.at-paper-body.at-style-academic p { text-indent: 2em; }
.at-paper-body.at-style-academic blockquote {
    border-left: 2px solid #64748b;
    background: transparent;
    color: #374151;
}

/* 博客分享 */
.at-paper-body.at-style-blog {
    color: #374151;
}
.at-paper-body.at-style-blog p { margin-bottom: 16px; }
.at-paper-body.at-style-blog h2 { color: #2563EB; }

/* 新闻稿件 */
.at-paper-body.at-style-news {
    color: #111827;
}
.at-paper-body.at-style-news p { margin-bottom: 10px; }
.at-paper-body.at-style-news h2 {
    font-size: 1.1em;
    border-left: none;
    padding-left: 0;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 4px;
}

/* 公文通知 */
.at-paper-body.at-style-official {
    font-family: 'SimSun', '宋体', serif;
    color: #111827;
    letter-spacing: 0.03em;
}
.at-paper-body.at-style-official p { text-indent: 2em; margin-bottom: 8px; }
.at-paper-body.at-style-official h2 {
    border-left: none;
    padding-left: 0;
    font-size: 1.05em;
    text-align: center;
}

/* ========== 示例模态框 ========== */
.at-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);
}

.at-modal.show {
    display: flex;
}

.at-modal-content {
    background: white;
    border-radius: 10px;
    max-width: 680px;
    width: 100%;
    max-height: 80vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 8px 32px rgba(37, 99, 235, 0.15);
    animation: modalIn 0.2s ease-out;
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(-16px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.at-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 18px;
    background: linear-gradient(135deg, #2563EB 0%, #1d4ed8 100%);
    color: white;
    flex-shrink: 0;
}

.at-modal-header h3 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.at-modal-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.at-modal-close:hover {
    background: rgba(255,255,255,0.35);
}

.at-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    scrollbar-width: thin;
    scrollbar-color: #93c5fd transparent;
}

.at-modal-body::-webkit-scrollbar { width: 4px; }
.at-modal-body::-webkit-scrollbar-track { background: transparent; }
.at-modal-body::-webkit-scrollbar-thumb { background: #93c5fd; border-radius: 2px; }

.at-modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.3);
    z-index: 99999;
    backdrop-filter: blur(2px);
}

/* 示例分类 */
.at-example-category {
    margin-bottom: 16px;
    border: 1px solid #dbeafe;
    border-radius: 8px;
    overflow: hidden;
}

.at-example-category-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: linear-gradient(to right, #f0f4ff, #e8eeff);
    border-bottom: 1px solid #dbeafe;
}

.at-example-category-header .at-cat-icon { font-size: 16px; }
.at-example-category-header .at-cat-name {
    font-size: 13px;
    font-weight: 600;
    color: #1e3a6e;
    flex: 1;
}
.at-example-category-header .at-cat-count {
    font-size: 11px;
    color: #64748b;
    background: #dbeafe;
    padding: 1px 8px;
    border-radius: 8px;
}

.at-example-items {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.at-example-item {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    cursor: pointer;
    transition: background 0.2s;
    border-bottom: 1px solid #f0f4ff;
}

.at-example-item:last-child { border-bottom: none; }

.at-example-item:hover { background: #f0f4ff; }

.at-example-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.at-example-item-title {
    font-size: 13px;
    font-weight: 600;
    color: #1e3a6e;
}

.at-example-item-meta {
    display: flex;
    gap: 6px;
    align-items: center;
}

.at-example-style-tag {
    font-size: 10px;
    color: #2563EB;
    background: #dbeafe;
    padding: 1px 7px;
    border-radius: 3px;
    white-space: nowrap;
}

.at-example-item-preview {
    font-size: 12px;
    color: #64748b;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

/* ========== 结果区块左侧色标 ========== */
#sectionTitle        { border-left: 3px solid #10b981; }
#sectionSummary      { border-left: 3px solid #2563EB; }
#sectionKeyPoints    { border-left: 3px solid #f59e0b; }
#sectionBody         { border-left: 3px solid #8b5cf6; }
#sectionSuggestions  { border-left: 3px solid #06b6d4; }
#sectionRawText      { border-left: 3px solid #94a3b8; }

/* ========== 打印样式 ========== */
@media print {
    .at-toolbar,
    .at-history-panel,
    .at-input-panel,
    .at-result-placeholder,
    .at-result-loading,
    .at-result-actions,
    .at-result-section-header,
    .at-section-copy-btn,
    .at-modal,
    .at-modal-overlay,
    #resultPlaceholder,
    #resultLoading {
        display: none !important;
    }

    .at-container {
        position: static !important;
        height: auto !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }

    .at-main-content { display: block !important; }
    .at-result-panel { width: 100% !important; overflow: visible !important; }
    .at-result-section.collapsed > *:not(.at-result-section-header) { display: block !important; }
    .at-paper-preview { max-height: none !important; overflow: visible !important; }
    .at-result-content { overflow: visible !important; }
}

/* ========== 响应式 ========== */
@media (max-width: 900px) {
    .at-history-panel { display: none; }
    .at-input-panel { width: 320px; }
}

@media (max-width: 680px) {
    .at-main-content { flex-direction: column; }
    .at-input-panel { width: 100%; border-right: none; border-bottom: 1px solid #c7d7f9; max-height: 55vh; }
    .at-result-panel { min-width: unset; }
    .at-content-area { height: 100px; }
}
