/* 历史记录页面样式 */
.history-page {
    min-height: 100vh;
    background: linear-gradient(180deg, #f8f9ff 0%, #ffffff 100%);
    padding: 20px;
}

.history-header {
    max-width: 1200px;
    margin: 0 auto 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.history-header h2 {
    font-size: 28px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
}

.history-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-left: auto;
}

.history-header .back-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #374151;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.history-header .back-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #1f2937;
}

.history-header .back-btn .back-icon {
    font-size: 16px;
    line-height: 1;
}

.history-header .back-btn .back-text {
    line-height: 1;
}

.history-header .refresh-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    color: #374151;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.history-header .refresh-btn:hover {
    background: #f9fafb;
    border-color: #d1d5db;
    color: #3b82f6;
    transform: rotate(180deg);
}

.history-header .refresh-btn:active {
    transform: rotate(360deg);
}

.history-header .refresh-btn .refresh-icon {
    line-height: 1;
    transition: transform 0.3s;
}

.history-header .refresh-btn.refreshing .refresh-icon {
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

.history-header .logout-btn {
    color: #ef4444;
    display: flex;
    align-items: center;
    gap: 8px;
}

.history-header .logout-btn:hover {
    background: #fee2e2;
    color: #dc2626;
}

.history-filters {
    max-width: 1200px;
    margin: 0 auto 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.search-box {
    display: flex;
    gap: 12px;
    align-items: center;
}

.search-box input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 16px;
    transition: border-color 0.2s;
}

.search-box input:focus {
    outline: none;
    border-color: #3b82f6;
}

.search-btn {
    padding: 12px 24px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
    white-space: nowrap;
}

.search-btn:hover {
    background: #2563eb;
}

.time-filters {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.filter-btn {
    padding: 8px 16px;
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-btn:hover {
    border-color: #3b82f6;
    color: #3b82f6;
}

.filter-btn.active {
    background: #3b82f6;
    border-color: #3b82f6;
    color: #fff;
}

.custom-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.date-label {
    font-size: 13px;
    color: #4b5563;
}

.date-input-wrapper {
    position: relative;
}

.date-input-wrapper input[type="date"] {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
    font-size: 13px;
}

.date-separator {
    font-size: 13px;
    color: #6b7280;
}

.history-list {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* 加载中遮罩 */
.history-loading {
    position: fixed;
    left: 0;
    top: 0;
    right: 0;
    bottom: 0;
    background: rgba(255,255,255,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    font-size: 14px;
    color: #4b5563;
}

.history-loading::before {
    content: '';
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 3px solid #bfdbfe;
    border-top-color: #3b82f6;
    margin-right: 8px;
    animation: spin 1s linear infinite;
}

.history-item {
    background: #fff;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.history-item:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.item-icon {
    font-size: 32px;
    flex-shrink: 0;
}

.item-content {
    flex: 1;
    min-width: 0;
}

.item-title {
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.item-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}

.item-date {
    font-size: 14px;
    color: #6b7280;
}

.item-status {
    font-size: 12px;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: 500;
}

.status-completed {
    background: #d1fae5;
    color: #065f46;
}

.status-processing {
    background: #dbeafe;
    color: #1e40af;
}

.status-failed {
    background: #fee2e2;
    color: #991b1b;
}

.status-pending {
    background: #f3f4f6;
    color: #4b5563;
}

.item-summary {
    font-size: 14px;
    color: #6b7280;
    line-height: 1.5;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: #6b7280;
    font-size: 16px;
}

.load-more {
    text-align: center;
    padding: 20px;
}

.load-more button {
    padding: 12px 32px;
    background: #3b82f6;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s;
}

.load-more button:hover {
    background: #2563eb;
}

/* PC端和移动端区分 */
.pc-only {
    display: block;
}

.mobile-only {
    display: none;
}

@media (max-width: 767px) {
    .pc-only {
        display: none;
    }
    
    .mobile-only {
        display: block;
    }
    
    .history-page {
        padding: 10px;
    }
    
    .history-header h2 {
        font-size: 24px;
    }
    
    .history-header-actions {
        gap: 8px;
    }
    
    .history-header .back-btn {
        padding: 6px 12px;
        font-size: 13px;
    }
    
    .history-header .back-btn .back-icon {
        font-size: 14px;
    }
    
    .history-item {
        padding: 16px;
    }
    
    .item-title {
        font-size: 16px;
    }
    
    .item-icon {
        font-size: 24px;
    }
}

/* 自定义时间选择对话框 */
.custom-time-dialog {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.custom-time-dialog-content {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
}

.custom-time-dialog-content h3 {
    margin: 0 0 20px 0;
    font-size: 20px;
    font-weight: 600;
    color: #1f2937;
}

.date-inputs {
    display: flex;
    flex-direction: column;
    gap: 16px;
    margin-bottom: 24px;
}

.date-input-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.date-input-group label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.date-input-group input[type="date"] {
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.date-input-group input[type="date"]:focus {
    outline: none;
    border-color: #3b82f6;
}

.dialog-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.dialog-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.cancel-btn {
    background: #f3f4f6;
    color: #374151;
}

.cancel-btn:hover {
    background: #e5e7eb;
}

.confirm-btn {
    background: #3b82f6;
    color: #fff;
}

.confirm-btn:hover {
    background: #2563eb;
}

@media (max-width: 767px) {
    .custom-time-dialog-content {
        padding: 20px;
        max-width: 90%;
    }
    
    .date-inputs {
        gap: 12px;
    }
}

