/* =============================================
   书籍介绍 - book_introduction.css
   深林绿图书馆主题配色，三栏布局
   暗黑模式使用 body.dark 作为父级选择器前缀
   ============================================= */

/* ========== 主容器 ========== */
.bi-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 200px);
    min-height: 600px;
    background: #f2faf5;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 16px rgba(27, 67, 50, 0.12);
    transition: all 0.3s ease;
}

/* 全屏模式 */
.bi-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;
}

/* ========== 顶部工具栏 ========== */
.bi-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 60%, #1a3a2a 100%);
    color: white;
    flex-wrap: wrap;
    gap: 8px;
    box-shadow: 0 2px 12px rgba(27, 67, 50, 0.4);
    flex-shrink: 0;
    border-bottom: 2px solid #52b788;
}

.bi-toolbar .toolbar-title {
    font-size: 13px;
    font-weight: 700;
    color: #d8f3dc;
    letter-spacing: 0.5px;
    margin-right: 8px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.toolbar-group {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    min-height: 28px;
}

/* 工具栏右对齐组 */
.toolbar-group--right {
    margin-left: auto;
}

.toolbar-btn {
    padding: 6px 12px;
    background: rgba(216, 243, 220, 0.9);
    border: 1px solid rgba(82, 183, 136, 0.45);
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    color: #1b4332;
    transition: all 0.2s;
    white-space: nowrap;
}

.toolbar-btn:hover:not(:disabled) {
    background: #d8f3dc;
    border-color: #52b788;
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(27, 67, 50, 0.2);
}

.toolbar-btn:active:not(:disabled) {
    transform: translateY(0);
}

.toolbar-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* 主操作按钮 */
.toolbar-btn-primary {
    background: linear-gradient(135deg, #52b788 0%, #2d6a4f 100%);
    color: #fff !important;
    border: none;
    font-weight: 700;
    font-size: 13px;
    box-shadow: 0 2px 8px rgba(82, 183, 136, 0.4);
}

.toolbar-btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #74c69d 0%, #40916c 100%);
    box-shadow: 0 4px 14px rgba(82, 183, 136, 0.5);
}

/* ========== 表单校验抖动 ========== */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 50%, 90% { transform: translateX(-5px); }
    30%, 70% { transform: translateX(5px); }
}

.bi-input.shake,
.bi-select.shake {
    animation: shake 0.5s ease-in-out;
    border-color: #ef4444 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12) !important;
}

/* ========== 主内容区：三栏 ========== */
.bi-main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
    background: #f2faf5;
}

/* ========== 左栏：历史记录 ========== */
.bi-history-panel {
    width: 200px;
    flex-shrink: 0;
    background: #e8f5e9;
    border-right: 1px solid #b7e4c7;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.history-panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: linear-gradient(to bottom, #f0faf3 0%, #e8f5e9 100%);
    border-bottom: 1px solid #b7e4c7;
    flex-shrink: 0;
}

.history-panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 600;
    color: #1b4332;
    border: none;
    padding: 0;
    background: none;
}

.history-count {
    font-size: 11px;
    color: #40916c;
    font-weight: 400;
}

.history-limit-footer {
    flex-shrink: 0;
    padding: 5px 8px;
    text-align: center;
    font-size: 10px;
    color: #74c69d;
    border-top: 1px solid #b7e4c7;
    background: #e8f5e9;
    letter-spacing: 0.2px;
    user-select: none;
}

.history-clear-btn {
    background: #fff0f0;
    border: none;
    color: #ef4444;
    font-size: 11px;
    cursor: pointer;
    padding: 2px 7px;
    border-radius: 3px;
    transition: background 0.2s;
    white-space: nowrap;
}

.history-clear-btn:hover {
    background: #fde8e8;
}

.history-search {
    padding: 8px;
    border-bottom: 1px solid #b7e4c7;
    flex-shrink: 0;
    position: relative;
}

.history-search input {
    width: 100%;
    padding: 6px 26px 6px 10px;
    border: 1px solid #b7e4c7;
    border-radius: 4px;
    font-size: 12px;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    color: #374151;
    background: #f5fdf8;
}

.history-search input:focus {
    border-color: #52b788;
    box-shadow: 0 0 0 2px rgba(82, 183, 136, 0.15);
}

/* 历史搜索清除按钮 */
.history-search-clear {
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #74c69d;
    cursor: pointer;
    font-size: 15px;
    padding: 0 2px;
    line-height: 1;
    transition: color 0.15s;
    user-select: none;
}

.history-search-clear:hover {
    color: #1b4332;
}

.history-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

.history-list::-webkit-scrollbar { width: 4px; }
.history-list::-webkit-scrollbar-track { background: transparent; }
.history-list:hover::-webkit-scrollbar-track { background: #d8f3dc; }
.history-list::-webkit-scrollbar-thumb { background: #95d5b2; border-radius: 2px; }
.history-list::-webkit-scrollbar-thumb:hover { background: #52b788; }

/* 历史列表加载禁用态 */
.history-list.bi-list-loading {
    pointer-events: none;
    opacity: 0.45;
    transition: opacity 0.2s;
}

.history-empty {
    text-align: center;
    color: #40916c;
    font-size: 12px;
    padding: 24px 8px;
    user-select: none;
    opacity: 0.7;
}

@keyframes biFadeIn {
    from { opacity: 0; transform: translateX(-4px); }
    to   { opacity: 1; transform: translateX(0); }
}

.history-item {
    display: flex;
    flex-direction: column;
    padding: 9px 11px;
    margin: 3px 0;
    background: #f5fdf8;
    border: 1px solid #b7e4c7;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    animation: biFadeIn 0.2s ease;
}

.history-item:hover {
    background: #e8f5e9;
    border-color: #52b788;
    transform: translateX(2px);
    box-shadow: inset 3px 0 0 #52b788;
}

.history-item.active {
    background: #d8f3dc;
    border-color: #52b788;
    box-shadow: inset 3px 0 0 #40916c, 0 1px 6px rgba(82, 183, 136, 0.25);
}

.history-item-del {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 18px;
    height: 18px;
    background: #fde8e8;
    color: #ef4444;
    border: none;
    border-radius: 3px;
    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-del {
    opacity: 1;
}

.history-item-del:hover {
    background: #ef4444;
    color: #fff;
}

.history-item-name {
    font-size: 12px;
    font-weight: 700;
    color: #1b4332;
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding-right: 20px;
}

.history-item-meta {
    font-size: 11px;
    color: #40916c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin-bottom: 2px;
}

.history-item-time {
    font-size: 10px;
    color: #74c69d;
}

/* ========== 中栏：表单输入 ========== */
.bi-input-panel {
    width: 320px;
    flex-shrink: 0;
    background: #f8fdf9;
    border-right: 1px solid #b7e4c7;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* ========== 右栏：结果展示 ========== */
.bi-result-panel {
    flex: 1;
    background: #f8fdf9;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 300px;
}

/* ========== 通用面板头部 ========== */
.panel-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: linear-gradient(to bottom, #f0faf3 0%, #e8f5e9 100%);
    border-bottom: 1px solid #b7e4c7;
    flex-shrink: 0;
    box-shadow: 0 1px 4px rgba(27, 67, 50, 0.07);
}

.panel-header h3 {
    margin: 0;
    font-size: 13px;
    font-weight: 700;
    color: #1b4332;
    white-space: nowrap;
    border-left: 4px solid #52b788;
    padding-left: 8px;
}

.panel-tip {
    font-size: 11px;
    color: #40916c;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.result-meta {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex-shrink: 1;
}

.result-book-tag {
    font-size: 11px;
    color: #1b4332;
    background: #d8f3dc;
    padding: 2px 10px;
    border-radius: 10px;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex-shrink: 1;
    border: 1px solid #b7e4c7;
}

.result-time {
    font-size: 11px;
    color: #40916c;
    white-space: nowrap;
    flex-shrink: 0;
}

.result-regen-btn {
    flex-shrink: 0;
    padding: 3px 9px;
    background: rgba(82, 183, 136, 0.1);
    border: 1px solid rgba(82, 183, 136, 0.4);
    border-radius: 4px;
    color: #1b4332;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    line-height: 1.6;
}

.result-regen-btn:hover {
    background: rgba(82, 183, 136, 0.22);
    border-color: #52b788;
    transform: translateY(-1px);
}

/* 结果区纯文本字数展示 */
.result-word-count {
    font-size: 11px;
    color: #74c69d;
    white-space: nowrap;
    flex-shrink: 0;
    padding: 1px 7px;
    background: rgba(82, 183, 136, 0.08);
    border-radius: 8px;
    border: 1px solid rgba(82, 183, 136, 0.2);
}

/* ========== 输入区 ========== */
.bi-input-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.bi-input-body::-webkit-scrollbar { width: 4px; }
.bi-input-body::-webkit-scrollbar-track { background: transparent; }
.bi-input-body:hover::-webkit-scrollbar-track { background: #e8f5e9; }
.bi-input-body::-webkit-scrollbar-thumb { background: #95d5b2; border-radius: 2px; }
.bi-input-body::-webkit-scrollbar-thumb:hover { background: #52b788; }

.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: #1b4332;
    margin-bottom: 5px;
}

.required-mark {
    color: #ef4444;
    margin-left: 2px;
}

.label-tip {
    font-size: 11px;
    font-weight: 400;
    color: #9ca3af;
}

.bi-input,
.bi-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid #b7e4c7;
    border-radius: 5px;
    font-size: 13px;
    color: #374151;
    background: #f5fdf8;
    outline: none;
    transition: all 0.2s;
    box-sizing: border-box;
    font-family: inherit;
}

.bi-input:focus,
.bi-select:focus {
    border-color: #52b788;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.15);
}

.bi-input:hover:not(:focus),
.bi-select:hover:not(:focus) {
    border-color: #74c69d;
    background: #fff;
}

.bi-input::placeholder {
    color: #74c69d;
    font-style: italic;
}

.bi-select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2340916c'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-color: #f5fdf8;
    padding-right: 28px;
}

/* 禁用态 */
.bi-input:disabled,
.bi-select:disabled {
    background: #edf7f0 !important;
    color: #95b8a8 !important;
    cursor: not-allowed !important;
    opacity: 0.7;
    border-color: #b7e4c7 !important;
    box-shadow: none !important;
}

/* ========== 快捷书籍标签 ========== */
.quick-book-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
}

.quick-tag {
    padding: 4px 10px;
    background: #e8f5e9;
    border: 1px solid #b7e4c7;
    border-radius: 12px;
    font-size: 11px;
    color: #1b4332;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: 500;
}

.quick-tag:hover {
    background: #52b788;
    border-color: #2d6a4f;
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(82, 183, 136, 0.35);
}

.quick-tag.selected {
    background: #2d6a4f;
    border-color: #1b4332;
    color: #d8f3dc;
    box-shadow: 0 2px 8px rgba(27, 67, 50, 0.4);
    font-weight: 700;
    transform: scale(0.97);
}

.bi-generate-hint {
    margin-top: 8px;
    text-align: right;
}

.bi-hint-text {
    font-size: 11px;
    color: #74c69d;
    user-select: none;
    font-style: italic;
}

/* 分析模式实时说明提示 */
.bi-mode-hint {
    font-size: 11px;
    color: #2d6a4f;
    margin-top: 6px;
    padding: 5px 8px;
    background: rgba(82, 183, 136, 0.08);
    border-radius: 4px;
    border-left: 2px solid rgba(82, 183, 136, 0.4);
    line-height: 1.55;
    min-height: 22px;
    transition: opacity 0.2s;
}

/* 输入字符计数预警 */
.bi-char-count {
    font-size: 10px;
    text-align: right;
    margin-top: 3px;
    color: #9ca3af;
    min-height: 14px;
    line-height: 1;
    transition: color 0.2s;
}

.bi-char-count.warn {
    color: #f97316;
    font-weight: 600;
}

.bi-char-count.error {
    color: #ef4444;
    font-weight: 700;
}

/* ========== 结果区域 ========== */
.bi-result-body {
    flex: 1;
    overflow-y: auto;
    position: relative;
    display: flex;
    flex-direction: column;
    background: #f8fdf9;
}

.bi-result-body::-webkit-scrollbar { width: 5px; }
.bi-result-body::-webkit-scrollbar-track { background: transparent; }
.bi-result-body:hover::-webkit-scrollbar-track { background: #e8f5e9; }
.bi-result-body::-webkit-scrollbar-thumb { background: #95d5b2; border-radius: 3px; }
.bi-result-body::-webkit-scrollbar-thumb:hover { background: #52b788; }

/* 占位提示 */
.result-placeholder {
    flex: 1;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 30px;
    text-align: center;
    user-select: none;
}

@keyframes biBookFloat {
    0%, 100% { transform: translateY(0) rotate(-2deg);  opacity: 0.85; }
    50%       { transform: translateY(-8px) rotate(2deg); opacity: 1;    }
}

.placeholder-icon {
    font-size: 60px;
    margin-bottom: 18px;
    animation: biBookFloat 3.2s ease-in-out infinite;
    display: inline-block;
}

.placeholder-title {
    font-size: 18px;
    font-weight: 700;
    color: #1b4332;
    margin: 0 0 10px;
}

.placeholder-desc {
    font-size: 13px;
    color: #40916c;
    margin: 4px 0;
    line-height: 1.65;
}

.placeholder-quote {
    margin-top: 26px;
    font-size: 14px;
    font-style: italic;
    color: #2d6a4f;
    padding: 12px 22px;
    border-left: 3px solid #52b788;
    text-align: left;
    background: linear-gradient(135deg, rgba(82, 183, 136, 0.1) 0%, rgba(27, 67, 50, 0.05) 100%);
    border-radius: 0 6px 6px 0;
    max-width: 360px;
    font-family: "楷体", "KaiTi", serif;
}

/* 加载动画 */
.result-loading {
    flex: 1;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
}

@keyframes bookOpen {
    0%, 100% { transform: scaleX(1) translateY(0);   opacity: 0.85; }
    50%       { transform: scaleX(1.08) translateY(-8px); opacity: 1; }
}

.loading-book {
    margin-bottom: 20px;
}

.book-icon {
    font-size: 50px;
    animation: bookOpen 1.8s ease-in-out infinite;
    display: inline-block;
}

/* 进度光条动画 */
@keyframes biShimmer {
    0%   { background-position: -400px 0; }
    100% { background-position: 400px 0; }
}

.bi-loading-bar {
    width: 220px;
    height: 4px;
    border-radius: 2px;
    margin: 0 auto 18px;
    background: linear-gradient(
        to right,
        rgba(82, 183, 136, 0.2) 0%,
        rgba(82, 183, 136, 0.8) 40%,
        rgba(27, 67, 50, 0.9) 60%,
        rgba(82, 183, 136, 0.2) 100%
    );
    background-size: 400px 4px;
    animation: biShimmer 1.4s linear infinite;
}

.loading-text {
    font-size: 13px;
    color: #40916c;
    font-weight: 500;
    margin: 0;
    font-family: "楷体", "KaiTi", serif;
}

/* 结果内容（Markdown 渲染区） */
@keyframes biResultFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.result-content {
    flex: 1;
    min-height: 0;
    padding: 24px 30px;
    font-size: 14px;
    line-height: 1.9;
    color: #374151;
    word-break: break-word;
    overflow-wrap: break-word;
    border-left: 4px solid #52b788;
    background: linear-gradient(to bottom, #f5fdf8 0%, #fff 60%);
}

/* 结果淡入动画 */
.result-content.bi-result-enter {
    animation: biResultFadeIn 0.35s ease-out forwards;
}

/* Markdown 内容样式 */
.result-content h1 {
    font-size: 20px;
    font-weight: 700;
    color: #1b4332;
    border-bottom: 2px solid rgba(82, 183, 136, 0.5);
    padding-bottom: 10px;
    margin: 4px 0 16px;
    letter-spacing: 0.5px;
}

.result-content h2 {
    font-size: 16px;
    font-weight: 700;
    color: #1b4332;
    border-left: 4px solid #52b788;
    padding-left: 8px;
    margin: 20px 0 10px;
}

.result-content h3 {
    font-size: 14px;
    font-weight: 700;
    color: #2d6a4f;
    margin: 16px 0 8px;
    padding-left: 4px;
}

.result-content p {
    margin: 0 0 1.1em;
    line-height: 1.9;
}

.result-content p:last-child {
    margin-bottom: 0;
}

.result-content ul, .result-content ol {
    padding-left: 20px;
    margin: 8px 0 12px;
}

.result-content ul li, .result-content ol li {
    margin-bottom: 6px;
    line-height: 1.75;
}

.result-content ul li::marker {
    color: #52b788;
}

.result-content ol li::marker {
    color: #2d6a4f;
    font-weight: 600;
}

.result-content blockquote {
    margin: 14px 0;
    padding: 12px 18px;
    border-left: 4px solid #52b788;
    background: linear-gradient(to right, rgba(82, 183, 136, 0.1) 0%, rgba(82, 183, 136, 0.02) 100%);
    border-radius: 0 6px 6px 0;
    font-style: italic;
    color: #2d6a4f;
    font-family: "楷体", "KaiTi", serif;
    font-size: 13.5px;
}

.result-content hr {
    border: none;
    border-top: 1px solid rgba(82, 183, 136, 0.3);
    margin: 18px 0;
}

.result-content code {
    background: rgba(82, 183, 136, 0.12);
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 13px;
    color: #2d6a4f;
    font-family: monospace;
}

.result-content strong {
    color: #1b4332;
    font-weight: 700;
}

/* 错误状态 */
.result-content.result-content--error {
    border-left: none;
    display: flex;
    flex-direction: column;
    padding: 0;
    background: #f8fdf9;
    animation: none;
}

.result-error-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    text-align: center;
    flex: 1;
    min-height: 200px;
}

.result-error-icon {
    font-size: 40px;
    margin-bottom: 16px;
    color: #f87171;
    line-height: 1;
}

.result-error-title {
    font-size: 14px;
    font-weight: 600;
    color: #dc2626;
    margin: 0 0 8px;
}

.result-error-hint {
    font-size: 12px;
    color: #9ca3af;
    margin: 0;
}

.bi-retry-btn {
    margin-top: 18px;
    padding: 9px 24px;
    background: linear-gradient(135deg, #52b788 0%, #1b4332 100%);
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(82, 183, 136, 0.35);
}

.bi-retry-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(82, 183, 136, 0.5);
}

/* ========== 示例模态框 ========== */
.bi-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 100000;
    backdrop-filter: blur(2px);
}

.bi-modal {
    position: fixed;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    z-index: 100001;
    width: 90%;
    max-width: 780px;
    max-height: 82vh;
    background: #f2faf5;
    border-radius: 10px;
    box-shadow: 0 12px 40px rgba(27, 67, 50, 0.22);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: biModalIn 0.22s ease-out;
}

@keyframes biModalIn {
    from { opacity: 0; transform: translate(-50%, calc(-50% - 16px)); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

.bi-modal-content {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.bi-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 2px solid #52b788;
    flex-shrink: 0;
    background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 100%);
    color: #d8f3dc;
}

.bi-modal-header h3 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: #d8f3dc;
}

.bi-modal-close {
    background: rgba(216, 243, 220, 0.2);
    border: none;
    color: #d8f3dc;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bi-modal-close:hover {
    background: rgba(216, 243, 220, 0.35);
}

.bi-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
    align-content: start;
    background: #f2faf5;
}

.bi-modal-body::-webkit-scrollbar { width: 4px; }
.bi-modal-body::-webkit-scrollbar-track { background: transparent; }
.bi-modal-body:hover::-webkit-scrollbar-track { background: #e8f5e9; }
.bi-modal-body::-webkit-scrollbar-thumb { background: #95d5b2; border-radius: 2px; }
.bi-modal-body::-webkit-scrollbar-thumb:hover { background: #52b788; }

/* 示例卡片 */
.example-card {
    border: 1px solid #b7e4c7;
    border-radius: 8px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.2s;
    background: #f5fdf8;
    position: relative;
    overflow: hidden;
}

.example-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 3px; height: 100%;
    background: linear-gradient(to bottom, #52b788 0%, #1b4332 100%);
    opacity: 0;
    transition: opacity 0.2s;
}

.example-card:hover {
    border-color: #52b788;
    background: #e8f5e9;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(82, 183, 136, 0.2);
}

.example-card:hover::before {
    opacity: 1;
}

.example-card-title {
    font-size: 13px;
    font-weight: 700;
    color: #1b4332;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.example-card-badge {
    font-size: 10px;
    font-weight: 500;
    background: #e8f5e9;
    color: #2d6a4f;
    padding: 1px 7px;
    border-radius: 10px;
    border: 1px solid #b7e4c7;
    white-space: nowrap;
}

.example-card-desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.55;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    margin: 4px 0 8px;
}

.example-card-import {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    color: #1b4332;
    background: #e8f5e9;
    border: 1px solid #b7e4c7;
    border-radius: 4px;
    padding: 3px 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.example-card-import:hover {
    background: #52b788;
    border-color: #2d6a4f;
    color: #fff;
}

/* ========== 响应式布局 ========== */
@media (min-width: 900px) {
    .bi-history-panel { display: flex; }
    .bi-input-panel { display: flex; }
}

@media (max-width: 899px) and (min-width: 640px) {
    .bi-history-panel { display: none; }
    .bi-input-panel { width: 280px; }
}

@media (max-width: 639px) {
    .bi-main-content { flex-direction: column; overflow-y: auto; }
    .bi-history-panel { width: 100%; max-height: 150px; border-right: none; border-bottom: 1px solid #b7e4c7; }
    .bi-input-panel { width: 100%; border-right: none; border-bottom: 1px solid #b7e4c7; max-height: 380px; }
    .bi-result-panel { width: 100%; min-height: 300px; }
    .bi-modal-body { grid-template-columns: 1fr; }
}

/* ========== 打印样式 ========== */
@media print {
    .bi-toolbar,
    .bi-history-panel,
    .bi-input-panel,
    #resultPlaceholder,
    #resultLoading { display: none !important; }
    .bi-container,
    .bi-container.fullscreen { position: static !important; height: auto; box-shadow: none; }
    .bi-main-content { display: block; }
    .bi-result-panel { width: 100%; }
    .bi-result-body { overflow: visible; }
    .result-content { padding: 0; border-left: none; }
}

/* =============================================
   暗黑模式（body.dark）- 深夜图书馆主题
   ============================================= */
body.dark .bi-container {
    background: #0a1f14;
}

body.dark .bi-main-content {
    background: #0a1f14;
}

body.dark .bi-history-panel {
    background: #0d1e16;
    border-color: rgba(82, 183, 136, 0.12);
}

body.dark .bi-input-panel,
body.dark .bi-result-panel {
    background: #0f2218;
    border-color: rgba(82, 183, 136, 0.12);
}

body.dark .history-panel-header {
    background: linear-gradient(to bottom, #122a1e 0%, #0d1e16 100%);
    border-color: rgba(82, 183, 136, 0.1);
}

body.dark .history-panel-header h3 {
    color: #74c69d;
}

body.dark .history-limit-footer {
    background: #0a1f14;
    border-color: rgba(82, 183, 136, 0.1);
    color: #2d6a4f;
}

body.dark .history-clear-btn {
    background: rgba(239, 68, 68, 0.1);
    color: #f87171;
}

body.dark .history-clear-btn:hover {
    background: rgba(239, 68, 68, 0.2);
}

body.dark .history-search input {
    background: #122a1e;
    border-color: rgba(82, 183, 136, 0.2);
    color: #a7f3d0;
}

body.dark .history-search input:focus {
    border-color: #52b788;
}

body.dark .history-search input::placeholder {
    color: #2d6a4f;
}

body.dark .history-list:hover::-webkit-scrollbar-track {
    background: #122a1e;
}

body.dark .history-item {
    background: #122a1e;
    border-color: rgba(82, 183, 136, 0.15);
}

body.dark .history-item:hover {
    background: #193a26;
    border-color: rgba(82, 183, 136, 0.4);
    box-shadow: inset 3px 0 0 #52b788;
}

body.dark .history-item.active {
    background: #1d4530;
    border-color: #52b788;
    box-shadow: inset 3px 0 0 #74c69d, 0 1px 6px rgba(82, 183, 136, 0.2);
}

body.dark .history-item-name {
    color: #95d5b2;
}

body.dark .history-item-meta {
    color: #2d6a4f;
}

body.dark .history-item-time {
    color: #2d6a4f;
}

body.dark .history-empty {
    color: #2d6a4f;
}

body.dark .panel-header {
    background: linear-gradient(to bottom, #122a1e 0%, #0d1e16 100%);
    border-color: rgba(82, 183, 136, 0.12);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

body.dark .panel-header h3 {
    color: #95d5b2;
    border-left-color: #52b788;
}

body.dark .panel-tip {
    color: #2d6a4f;
}

body.dark .bi-input-body:hover::-webkit-scrollbar-track {
    background: #122a1e;
}

body.dark .form-group label {
    color: #95d5b2;
}

body.dark .label-tip {
    color: #2d6a4f;
}

body.dark .bi-input,
body.dark .bi-select {
    background: #122a1e;
    border-color: rgba(82, 183, 136, 0.2);
    color: #a7f3d0;
}

body.dark .bi-input:focus,
body.dark .bi-select:focus {
    border-color: #52b788;
    background: #193a26;
    box-shadow: 0 0 0 3px rgba(82, 183, 136, 0.12);
}

body.dark .bi-input:hover:not(:focus),
body.dark .bi-select:hover:not(:focus) {
    border-color: rgba(82, 183, 136, 0.4);
    background: #152e20;
}

body.dark .bi-input::placeholder {
    color: #2d6a4f;
}

body.dark .bi-select {
    background-color: #122a1e;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%2352b788'/%3E%3C/svg%3E");
}

body.dark .bi-select option {
    background: #122a1e;
    color: #a7f3d0;
}

body.dark .bi-input:disabled,
body.dark .bi-select:disabled {
    background: #0d1e16 !important;
    color: #1d4530 !important;
    border-color: rgba(82, 183, 136, 0.08) !important;
}

body.dark .quick-tag {
    background: #122a1e;
    border-color: rgba(82, 183, 136, 0.2);
    color: #95d5b2;
}

body.dark .quick-tag:hover {
    background: #52b788;
    border-color: #2d6a4f;
    color: #0a1f14;
}

body.dark .quick-tag.selected {
    background: #2d6a4f;
    border-color: #1b4332;
    color: #d8f3dc;
    box-shadow: 0 2px 8px rgba(27, 67, 50, 0.5);
}

body.dark .bi-hint-text {
    color: #2d6a4f;
}

body.dark .bi-result-body {
    background: #0f2218;
}

body.dark .bi-result-body:hover::-webkit-scrollbar-track {
    background: #122a1e;
}

body.dark .result-placeholder {
    background: #0f2218;
}

body.dark .placeholder-title {
    color: #95d5b2;
}

body.dark .placeholder-desc {
    color: #2d6a4f;
}

body.dark .placeholder-quote {
    color: #52b788;
    border-left-color: #52b788;
    background: rgba(82, 183, 136, 0.06);
}

body.dark .result-loading {
    background: #0f2218;
}

body.dark .loading-text {
    color: #40916c;
}

body.dark .bi-loading-bar {
    background: linear-gradient(
        to right,
        rgba(82, 183, 136, 0.08) 0%,
        rgba(82, 183, 136, 0.45) 40%,
        rgba(82, 183, 136, 0.65) 60%,
        rgba(82, 183, 136, 0.08) 100%
    );
    background-size: 400px 4px;
}

body.dark .result-content {
    color: #a7f3d0;
    background: linear-gradient(to bottom, #102418 0%, #0f2218 60%);
    border-left-color: #52b788;
}

body.dark .result-content h1 {
    color: #95d5b2;
    border-bottom-color: rgba(82, 183, 136, 0.35);
}

body.dark .result-content h2 {
    color: #95d5b2;
    border-left-color: #52b788;
}

body.dark .result-content h3 {
    color: #74c69d;
}

body.dark .result-content ul li::marker {
    color: #52b788;
}

body.dark .result-content ol li::marker {
    color: #74c69d;
}

body.dark .result-content blockquote {
    border-left-color: #52b788;
    background: rgba(82, 183, 136, 0.07);
    color: #74c69d;
}

body.dark .result-content hr {
    border-top-color: rgba(82, 183, 136, 0.18);
}

body.dark .result-content code {
    background: rgba(82, 183, 136, 0.1);
    color: #95d5b2;
}

body.dark .result-content strong {
    color: #95d5b2;
}

body.dark .result-book-tag {
    background: #122a1e;
    border-color: rgba(82, 183, 136, 0.2);
    color: #a7f3d0;
}

body.dark .result-time {
    color: #2d6a4f;
}

body.dark .result-regen-btn {
    background: rgba(82, 183, 136, 0.08);
    border-color: rgba(82, 183, 136, 0.25);
    color: #a7f3d0;
}

body.dark .result-regen-btn:hover {
    background: rgba(82, 183, 136, 0.18);
    border-color: #52b788;
}

/* 暗黑模式 - 示例模态框 */
body.dark .bi-modal {
    background: #0d1e16;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
}

body.dark .bi-modal-body {
    background: #0d1e16;
}

body.dark .bi-modal-body:hover::-webkit-scrollbar-track {
    background: #122a1e;
}

body.dark .example-card {
    background: #122a1e;
    border-color: rgba(82, 183, 136, 0.15);
}

body.dark .example-card:hover {
    background: #193a26;
    border-color: rgba(82, 183, 136, 0.4);
}

body.dark .example-card-title {
    color: #95d5b2;
}

body.dark .example-card-badge {
    background: #193a26;
    border-color: rgba(82, 183, 136, 0.2);
    color: #74c69d;
}

body.dark .example-card-desc {
    color: #2d6a4f;
}

body.dark .example-card-import {
    background: #193a26;
    border-color: rgba(82, 183, 136, 0.2);
    color: #a7f3d0;
}

body.dark .example-card-import:hover {
    background: #52b788;
    border-color: #2d6a4f;
    color: #0a1f14;
}

/* 暗黑模式 - 错误区域 */
body.dark .result-content.result-content--error {
    background: #0f2218;
}

body.dark .result-error-block {
    background: #0f2218;
}

body.dark .result-error-icon {
    color: #f87171;
}

body.dark .result-error-title {
    color: #f87171;
}

body.dark .result-error-hint {
    color: #40916c;
}

body.dark .bi-retry-btn {
    background: linear-gradient(135deg, #2d6a4f 0%, #1b4332 100%);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

body.dark .bi-retry-btn:hover {
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

/* 暗黑模式 - 分析模式说明 + 搜索清除按钮 */
body.dark .bi-mode-hint {
    color: #52b788;
    background: rgba(82, 183, 136, 0.06);
    border-left-color: rgba(82, 183, 136, 0.3);
}

body.dark .history-search-clear {
    color: #2d6a4f;
}

body.dark .history-search-clear:hover {
    color: #95d5b2;
}

/* 暗黑模式 - 字符计数预警 + 结果字数 */
body.dark .bi-char-count {
    color: #2d6a4f;
}

body.dark .bi-char-count.warn {
    color: #f97316;
}

body.dark .bi-char-count.error {
    color: #f87171;
}

body.dark .result-word-count {
    color: #52b788;
    background: rgba(82, 183, 136, 0.06);
    border-color: rgba(82, 183, 136, 0.15);
}
