/* ===== 历史记录侧栏 / 移动端历史抽屉 ===== */
/* ========== History Sidebar ========== */
.history-sidebar {
    width: 240px;
    flex-shrink: 0;
    height: 100%;
    background: var(--card-bg);
    border: 2px solid var(--border-light);
    border-radius: var(--radius-card);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(61, 52, 40, 0.04);
}

.history-sidebar-header {
    padding: 12px 14px;
    border-bottom: 1.5px solid var(--border-light);
    font-size: 13px;
    font-weight: 700;
    color: var(--text-heading);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-sidebar-header .history-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: var(--radius-btn);
    font-size: 10px;
    font-weight: 700;
}

.history-sidebar-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.history-sidebar-body .history-item {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 7px 9px;
    background: var(--bg);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.history-sidebar-body .history-item:hover {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 2px 6px rgba(25, 200, 185, 0.1);
}

.history-sidebar-body .history-item.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

/* 历史记录骨架屏加载 */
.history-skeleton {
    display: flex;
    align-items: center;
    padding: 7px 9px;
    background: var(--bg);
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    flex-shrink: 0;
}

.history-skeleton .skeleton-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.history-skeleton .skeleton-line {
    height: 12px;
    background: linear-gradient(90deg, var(--border-light) 25%, #e8e2d0 50%, var(--border-light) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.6s ease-in-out infinite;
    border-radius: 4px;
}

.history-skeleton .skeleton-line.short {
    width: 50%;
}

@keyframes skeletonShimmer {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* 移动端专属元素默认隐藏（桌面端不可见） */
.mobile-history-btn,
.mobile-bottom-bar,
.mobile-history-overlay,
.mobile-history-drawer {
    display: none;
}

.history-sidebar-body .history-info {
    flex: 1;
    min-width: 0;
    overflow: hidden;
}

.history-sidebar-body .history-prompt {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-heading);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 1px;
}

.history-sidebar-body .history-meta {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 来自「对话创作」的生成记录：给一个轻量标记，和单次创作区分开 */
.history-chat-badge {
    display: inline-block;
    padding: 0 5px;
    border: 1px solid var(--ds-primary-soft);
    border-radius: 5px;
    background: var(--ds-primary-soft);
    color: var(--ds-primary);
    font-size: 9px;
    line-height: 14px;
    vertical-align: 1px;
}

/* 历史记录缩略图（无结果图时展示占位图标） */
.history-sidebar-body .history-thumb,
.mobile-drawer-body .history-thumb {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    border: 1px solid var(--border-light);
    border-radius: 8px;
    background: #fff;
    color: var(--text-muted);
}

.history-sidebar-body .history-thumb.is-empty,
.mobile-drawer-body .history-thumb.is-empty {
    background: var(--bg);
}

.history-sidebar-body .history-thumb img,
.mobile-drawer-body .history-thumb img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.history-sidebar-body .history-thumb svg,
.mobile-drawer-body .history-thumb svg {
    width: 20px;
    height: 20px;
    opacity: .45;
}

.history-sidebar-body .history-load-more {
    padding: 4px 0;
    text-align: center;
    flex-shrink: 0;
}

.history-sidebar-body .history-load-more button {
    padding: 5px 14px;
    background: var(--bg);
    color: var(--primary);
    border: 1.5px solid var(--primary);
    border-radius: var(--radius-btn);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    letter-spacing: 0.02em;
    transition: var(--transition);
}

.history-sidebar-body .history-load-more button:hover {
    background: var(--primary-light);
}

.history-sidebar-body .history-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    gap: 4px;
    padding: 16px 8px;
    text-align: center;
}

.history-sidebar-body .history-empty-icon {
    font-size: 28px;
    opacity: 0.6;
}

.history-sidebar-body .history-empty-text {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
}

