/* ============================================
   历史文档横幅样式
   ============================================ */

/* 历史文档横幅容器 */
.history-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    margin-bottom: 24px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
    overflow: hidden;
    animation: slideDown 0.3s ease-out;
}

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

/* 横幅头部 */
.history-banner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
    transition: background 0.2s;
}

.history-banner-header:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* 标题区域 */
.history-banner-title {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
    font-weight: 600;
    font-size: 16px;
}

.history-banner-title svg {
    width: 22px;
    height: 22px;
}

/* 操作按钮组 */
.history-banner-actions {
    display: flex;
    gap: 8px;
}

.history-btn-icon {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}

.history-btn-icon:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.history-btn-icon svg {
    width: 18px;
    height: 18px;
    color: white;
}

/* 内容区域 */
.history-content {
    padding: 20px;
    background: white;
    max-height: 400px;
    overflow-y: auto;
    transition: all 0.3s;
}

.history-content.collapsed {
    max-height: 0;
    padding: 0 20px;
    opacity: 0;
}

/* 自定义滚动条 */
.history-content::-webkit-scrollbar {
    width: 8px;
}

.history-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.history-content::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.history-content::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* 历史记录列表 */
.history-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* ============================================
   🔥 修复：历史记录卡片样式
   使用 .history-card 而不是 .history-item
   ============================================ */

/* 历史记录卡片容器 */
.history-card {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-radius: 12px;
    padding: 20px;
    border-left: 4px solid #667eea;
    transition: all 0.3s;
    margin-bottom: 16px;
}

.history-card:hover {
    transform: translateX(4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    border-left-color: #764ba2;
}

/* 历史记录卡片头部 */
.history-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.history-card-title {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.history-card-icon {
    width: 20px;
    height: 20px;
    color: #667eea;
}

.history-card-title h3 {
    font-weight: 600;
    font-size: 18px;
    color: #2d3748;
    margin: 0;
}

.history-card-time {
    font-size: 13px;
    color: #718096;
    white-space: nowrap;
}

/* ============================================
   🔥 修复：文件列表样式
   使用 .history-card-files 而不是 .history-file-cards
   ============================================ */

/* 文件列表容器 */
.history-card-files {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

/* 单个文件项 */
.history-file-item {
    background: white;
    border-radius: 8px;
    padding: 12px 16px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border: 1px solid #e2e8f0;
}

.history-file-item:hover {
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.15);
    border-color: #667eea;
    transform: translateY(-2px);
}

/* 文件名 */
.history-file-name {
    font-size: 14px;
    font-weight: 500;
    color: #2d3748;
    flex: 1;
}

/* 文件操作按钮组 */
.history-file-actions {
    display: flex;
    gap: 8px;
}

/* ============================================
   🔥 修复：按钮样式
   ============================================ */

/* 文件操作按钮 */
.history-card-btn {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    white-space: nowrap;
}

.history-card-btn svg {
    width: 14px;
    height: 14px;
}

/* 预览按钮 */
.history-card-btn-preview {
    background: #667eea;
    color: white;
}

.history-card-btn-preview:hover {
    background: #5568d3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3);
}

/* 下载按钮 */
.history-card-btn-download {
    background: #48bb78;
    color: white;
}

.history-card-btn-download:hover {
    background: #38a169;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(72, 187, 120, 0.3);
}

/* 已下载状态 */
.history-card-btn-download.downloaded {
    background: #4CAF50;
    color: white;
    cursor: default;
    opacity: 0.8;
    pointer-events: none;
}

.history-card-btn-download.downloaded:hover {
    transform: none;
    box-shadow: none;
    background: #4CAF50;
}

/* 禁用状态 */
.history-card-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ============================================
   🔥 修复：底部操作按钮区域
   ============================================ */

/* 底部操作区域 */
.history-card-footer {
    display: flex;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #e2e8f0;
}

/* 底部操作按钮 */
.history-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    justify-content: center;
}

.history-btn svg {
    width: 16px;
    height: 16px;
}

/* 一键下载全部按钮 */
.history-btn-download-all {
    background: linear-gradient(135deg, #48bb78 0%, #38a169 100%);
    color: white;
}

.history-btn-download-all:hover {
    background: linear-gradient(135deg, #38a169 0%, #2f855a 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(72, 187, 120, 0.3);
}

/* 删除按钮 */
.history-btn-delete {
    background: #f56565;
    color: white;
}

.history-btn-delete:hover {
    background: #e53e3e;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(245, 101, 101, 0.3);
}

/* ============================================
   空状态
   ============================================ */

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: #a0aec0;
}

.history-empty svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.5;
}

.history-empty p {
    margin: 0;
    font-size: 14px;
}

/* ============================================
   加载动画
   ============================================ */

.history-loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.history-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* ============================================
   响应式设计
   ============================================ */

@media (max-width: 768px) {
    .history-banner-header {
        padding: 12px 16px;
    }

    .history-banner-title {
        font-size: 14px;
    }

    .history-banner-title svg {
        width: 18px;
        height: 18px;
    }

    .history-btn-icon {
        width: 28px;
        height: 28px;
    }

    .history-btn-icon svg {
        width: 16px;
        height: 16px;
    }

    .history-content {
        padding: 16px;
        max-height: 300px;
    }

    .history-card {
        padding: 16px;
    }

    .history-card-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .history-card-title h3 {
        font-size: 16px;
    }

    .history-card-time {
        font-size: 12px;
    }

    .history-file-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
        padding: 12px;
    }

    .history-file-name {
        font-size: 13px;
    }

    .history-file-actions {
        width: 100%;
        flex-direction: column;
    }

    .history-card-btn {
        width: 100%;
        padding: 8px 12px;
        font-size: 12px;
    }

    .history-card-btn svg {
        width: 12px;
        height: 12px;
    }

    .history-card-footer {
        flex-direction: column;
        gap: 8px;
    }

    .history-btn {
        padding: 10px 16px;
        font-size: 13px;
    }
}

/* 平板设备 */
@media (min-width: 769px) and (max-width: 1024px) {
    .history-card {
        padding: 18px;
    }

    .history-file-item {
        padding: 10px 14px;
    }
}