/* ============================================
   查询历史页面样式
   ============================================ */

.history-page {
    max-width: 1200px;
    margin: 80px auto 40px;
    padding: 0 24px;
}

.history-page-header {
    text-align: center;
    margin-bottom: 32px;
}

.history-page-header h1 {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.history-page-header p {
    font-size: 15px;
    color: var(--text-secondary);
    margin: 0;
}

/* Tab 切换 */
.history-tabs {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 28px;
}

.history-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-tab:hover {
    border-color: var(--accent-color, #667eea);
    color: var(--text-primary);
}

.history-tab.active {
    background: var(--accent-color, #667eea);
    border-color: var(--accent-color, #667eea);
    color: #fff;
}

.history-tab.active svg {
    color: #fff;
}

.history-tab-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: rgba(255,255,255,0.2);
    font-size: 12px;
    font-weight: 600;
}

.history-tab:not(.active) .history-tab-count {
    background: var(--bg-secondary);
}

/* 卡片网格 */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.history-grid-videos {
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
}

/* 单个卡片 */
.history-card {
    background: var(--bg-primary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    overflow: hidden;
    transition: all 0.2s ease;
}

.history-card:hover {
    border-color: var(--accent-color, #667eea);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
    transform: translateY(-2px);
}

/* 图片缩略图 */
.history-card-thumb {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    background: var(--bg-secondary);
    overflow: hidden;
    cursor: pointer;
}

.history-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}

.history-card-thumb:hover img {
    transform: scale(1.05);
}

.history-card-thumb-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.history-card-thumb:hover .history-card-thumb-overlay {
    opacity: 1;
}

.history-card-thumb-overlay svg {
    color: #fff;
    width: 32px;
    height: 32px;
}

/* 多图标记 */
.history-card-count {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 12px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

/* 视频播放器 */
.history-card-video {
    position: relative;
    width: 100%;
    aspect-ratio: 16/9;
    background: #000;
}

.history-card-video video {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 卡片信息 */
.history-card-info {
    padding: 14px 16px;
}

.history-card-prompt {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
    margin-bottom: 10px;
}

.history-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.history-card-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: var(--bg-secondary);
    border-radius: 6px;
    font-size: 11px;
    color: var(--text-secondary);
    gap: 4px;
}

.history-card-date {
    font-size: 12px;
    color: var(--text-tertiary, #999);
}

/* 卡片操作 */
.history-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 16px 14px;
}

.history-card-delete {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.history-card-delete:hover {
    background: #fee2e2;
    color: #ef4444;
}

/* 空状态 */
.history-empty {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.history-empty svg {
    margin-bottom: 16px;
    color: var(--text-secondary);
}

.history-empty p {
    font-size: 15px;
    margin: 0;
}

/* 加载更多 */
.history-load-more {
    display: block;
    width: 200px;
    margin: 28px auto 0;
    padding: 10px 20px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius-lg, 12px);
    background: var(--bg-primary);
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.history-load-more:hover {
    border-color: var(--accent-color, #667eea);
    color: var(--accent-color, #667eea);
}

/* Lightbox */
.history-lightbox {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.history-lightbox-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.85);
}

.history-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
}

.history-lightbox-content img {
    max-width: 90vw;
    max-height: 90vh;
    border-radius: 8px;
    object-fit: contain;
}

.history-lightbox-close {
    position: absolute;
    top: -40px;
    right: 0;
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.15);
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.history-lightbox-close:hover {
    background: rgba(255,255,255,0.3);
}

/* Toast */
.history-toast {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    padding: 10px 24px;
    background: #333;
    color: #fff;
    border-radius: 8px;
    font-size: 14px;
    z-index: 10001;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.history-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.history-toast.success { background: #10b981; }
.history-toast.error { background: #ef4444; }

/* 响应式 */
@media (max-width: 768px) {
    .history-page {
        padding: 0 16px;
        margin-top: 70px;
    }
    .history-page-header h1 {
        font-size: 22px;
    }
    .history-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
        gap: 14px;
    }
    .history-grid-videos {
        grid-template-columns: 1fr;
    }
    .history-tabs {
        gap: 6px;
    }
    .history-tab {
        padding: 8px 16px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .history-grid {
        grid-template-columns: 1fr;
    }
}
