/* ==========================================================================
   Abook Frontend Styles — 第九道场历史问答抽屉
   依赖 frontend.css 设计变量与 frontend-school.css 基础风格
   ========================================================================== */

/* ---------- 遮罩 ---------- */
.abook-history-mask {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(44, 44, 58, .35);
    z-index: 9998;
}

/* ---------- 抽屉容器 ---------- */
.abook-history-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(420px, 100vw);
    background: var(--paper-light);
    border-left: 1px solid var(--line);
    box-shadow: var(--shadow-lg);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform .22s ease;
    font-family: var(--sans);
}

.abook-history-drawer.open {
    transform: translateX(0);
}

/* ---------- 头部 ---------- */
.abook-history-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--paper);
}

.abook-history-head-left {
    display: flex;
    align-items: baseline;
    gap: 8px;
}

.abook-history-title {
    font-family: var(--serif);
    font-size: 16px;
    font-weight: 600;
    color: var(--ink);
}

.abook-history-tip {
    font-size: 11px;
    color: var(--ink-light);
}

.abook-history-close {
    border: none;
    background: transparent;
    font-size: 22px;
    line-height: 1;
    color: var(--ink-light);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: var(--radius-sm);
}

.abook-history-close:hover {
    color: var(--cinnabar);
    background: var(--paper-warm);
}

/* ---------- 日期筛选 ---------- */
.abook-history-filters {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-bottom: 1px solid var(--line-soft);
}

.abook-history-filters input[type="date"] {
    flex: 1;
    min-width: 0;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--paper-light);
    color: var(--ink);
    font-size: 12px;
}

.abook-history-dash {
    font-size: 12px;
    color: var(--ink-light);
}

.abook-history-search {
    padding: 5px 14px;
    border: 1px solid var(--cinnabar);
    border-radius: var(--radius-sm);
    background: var(--cinnabar);
    color: var(--paper);
    font-size: 12px;
    cursor: pointer;
    white-space: nowrap;
}

.abook-history-search:hover {
    background: var(--cinnabar-soft);
    border-color: var(--cinnabar-soft);
}

/* ---------- 记录列表 ---------- */
.abook-history-list {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px;
}

.abook-history-list::-webkit-scrollbar { width: 6px; }
.abook-history-list::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

.abook-history-empty {
    text-align: center;
    color: var(--ink-light);
    font-size: 13px;
    padding: 40px 0;
}

.abook-history-item {
    background: var(--paper);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius);
    margin-bottom: 8px;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.abook-history-item:hover {
    border-color: var(--line);
    box-shadow: var(--shadow-sm);
}

.abook-history-item.expanded {
    border-color: var(--cinnabar);
}

.abook-history-item-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
}

.abook-history-q {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    color: var(--ink);
    line-height: 1.5;
    word-break: break-all;
}

.abook-history-item-failed .abook-history-q {
    color: var(--ink-light);
}

.abook-history-time {
    flex-shrink: 0;
    font-size: 11px;
    color: var(--ink-light);
}

/* ---------- 展开的回答 ---------- */
.abook-history-answer {
    padding: 0 12px 12px;
    border-top: 1px dashed var(--line-soft);
    font-size: 13px;
    color: var(--ink-soft);
    line-height: 1.8;
    word-break: break-word;
}

.abook-history-answer p { margin: 8px 0 0; }
.abook-history-answer ul, .abook-history-answer ol { margin: 8px 0 0; padding-left: 20px; }

.abook-history-q-full {
    margin-top: 10px;
    font-family: var(--serif);
    font-weight: 600;
    color: var(--ink);
}

.abook-history-failed-tip {
    color: var(--cinnabar);
}

/* ---------- 翻页 ---------- */
.abook-history-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 16px;
    border-top: 1px solid var(--line-soft);
    background: var(--paper);
    font-size: 12px;
    color: var(--ink-soft);
}

.abook-history-pager:empty { display: none; }

.abook-history-total { color: var(--ink-light); }

.abook-history-pageinfo { font-weight: 600; color: var(--ink); }

.abook-history-page {
    padding: 4px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--paper-light);
    color: var(--ink-soft);
    font-size: 12px;
    cursor: pointer;
}

.abook-history-page:hover {
    color: var(--paper);
    background: var(--ink);
    border-color: var(--ink);
}
