/* 历史页面样式 */
.history-container {
    position: relative;
    height: 100%;
    width: 100%;
    background-color: #fafafa;
    margin: 0 auto;
    padding: 0px;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
}

[data-theme="dark"] .history-container {
    background-color: #161616;
}

[data-theme="dark"] .history-container div {
    background-color: #161616;
}

.history-header {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    flex-shrink: 0;
    padding: 30px 30px 10px;
}

/* 可滚动的内容区域 */
.history-content {
    position: relative;
    flex: 1;
    overflow-y: auto;
    padding: 0px 30px 20px;
    margin-bottom: 10px;
}

.history-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.sort-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sort-label {
    color: #6b7280;
    font-size: 14px;
    margin-right: 10px;
}

[data-theme="dark"] .sort-label {
    color: #9ca3af;
}

.sort-buttons {
    display: flex;
    align-items: center;
    gap: 20px;
}

.sort-btn {
    height: 40px;
    border: 1px solid #E5E7EB;
    border-radius: 4px;
    background-color: #FFFFFF;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    padding: 10px 30px;
}

.sort-btn:hover {
    border-color: #D1D5DB;
    background-color: #F9FAFB;
}

.sort-btn.active {
    border-color: #3B82F6;
    background-color: #EFF6FF;
}

.sort-btn img {
    width: 16px;
    height: 16px;
    opacity: 0.6;
}

.sort-btn.active img {
    opacity: 1;
}

[data-theme="dark"] .sort-btn {
    background-color: #212121;
    border-color: #404040;
}

[data-theme="dark"] .sort-btn:hover {
    border-color: #525252;
    background-color: #262626;
}

[data-theme="dark"] .sort-btn.active {
    border-color: #3B82F6;
    background-color: #1E3A8A;
}

/* 图片网格布局 - 固定宽度，自动换行 */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 15px;
    width: 100%;
    align-content: start;
    justify-content: flex-start;
}

/* 图片卡片样式 - 与首页内容卡片样式保持一致 */
.history-card {
    width: 100%;
    min-width: unset;
    min-height: auto;
    background-color: #fff;
    border-radius: 10px;
    padding: 10px 10px 20px;
    box-sizing: border-box;
    position: relative;
    border: 1px solid #F2F2F2;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .history-card {
    background: #212121;
    border: 1px solid #212121;
}

.history-card-image {
    width: 100%;
    height: 128px;
    background-color: #f6f6f6;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #999;
    font-size: 14px;
    flex-shrink: 0;
    margin-bottom: 20px;
}

[data-theme="dark"] .history-card-image {
    background-color: #404040;
}

.history-card-image img {
    /* width: 100%; */
    height: -webkit-fill-available;
    border-radius: 4px;
}

.history-card-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.history-card-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: auto;
    gap: 8px;
}

.history-delete-btn,
.history-edit-btn {
    width: 72px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: PingFangSC-Regular;
    font-size: 14px;
    letter-spacing: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    align-self: flex-end;
    border: 1px solid #E6E6E6;
    color: #666666;
    background: #FFFFFF;
}

.history-delete-btn:hover,
.history-edit-btn:hover {
    transform: scale(1.05);
}

[data-theme="dark"] .history-delete-btn,
[data-theme="dark"] .history-edit-btn {
    color: #fff; 
    background-color: #333333;
    border: none;
}

/* 加载和状态样式 */
.history-loading {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 999;
    backdrop-filter: blur(2px);
}

[data-theme="dark"] .history-loading {
    background-color: rgba(22, 22, 22, 0.8);
}

.history-loading-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid #e5e7eb;
    border-top: 4px solid #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

[data-theme="dark"] .history-loading-spinner {
    border: 4px solid #404040;
    border-top: 4px solid #60a5fa;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 空状态容器 */
#historyEmptyState {
    margin-top: 24px;
}

/* 错误提示样式 */
.history-error {
    background-color: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

[data-theme="dark"] .history-error {
    background-color: #292929;
    border-color: #404040;
    color: #ff6b6b;
}

/* ========== 响应式样式（按断点从大到小排列） ========== */

/* 1200px 及以下 */
@media (max-width: 1200px) {
    .history-header {
        padding: 25px 25px 10px;
    }
    .history-content {
        padding: 0px 25px 25px;
    }
    .history-grid {
        gap: 16px;
    }
}

/* 1050px 及以下 */
@media (max-width: 1050px) {
    .history-header {
        padding: 20px 20px 10px;
    }
    .history-content {
        padding: 0px 20px 20px;
    }
    .history-grid {
        gap: 15px;
    }
}

/* 900px 及以下 */
@media (max-width: 900px) {
    .history-header {
        padding: 18px 18px 10px;
    }
    .history-content {
        padding: 0px 18px 18px;
    }
    .history-grid {
        gap: 14px;
    }
}

/* 800px 及以下 */
@media (max-width: 800px) {
    .history-header {
        padding: 16px 16px 10px;
    }
    .history-content {
        padding: 0px 16px 16px;
    }
    .history-grid {
        gap: 12px;
    }
    .history-delete-btn,
    .history-edit-btn {
        width: 72px;
        height: 28px;
        font-size: 13px;
    }
}

/* 768px 及以下 */
@media (max-width: 768px) {
    .history-header {
        padding: 15px 15px 10px;
    }
    .history-content {
        padding: 0px 15px 15px;
    }
    .history-grid {
        gap: 10px;
    }
    .history-card {
        padding: 10px 10px 16px;
    }
    .history-card-image {
        margin-bottom: 12px;
    }
    .history-delete-btn,
    .history-edit-btn {
        width: 72px;
        height: 28px;
        font-size: 12px;
    }
}

/* 加载状态提示样式 */
#historyLoadingTip {
    text-align: center;
    padding: 20px;
    color: #c5c5c5;
    font-size: 14px;
}

#historyNoMoreTip {
    text-align: center;
    padding: 15px;
    color: #c5c5c5;
    font-size: 12px;
}

/* 深色主题下的加载状态样式 */
[data-theme="dark"] #historyLoadingTip {
    color: #666;
}

[data-theme="dark"] #historyNoMoreTip {
    color: #666;
}



