/**
 * æç«æµè§è®°å½ Pro - æ ·å¼
 * åå«ï¼æµè§è®°å½åè¡¨ + éè¯»è¿åº¦æ¡ + æ¢å¤æç¤ºå¼¹çª
 * éé Zibll ä¸»é¢
 * Version: 2.0.0
 */

/* ========== ä¸»å®¹å¨ ========== */
.xh-history-container { width: 100%; box-sizing: border-box; }
.xh-history-container * { box-sizing: border-box; }

/* ========== æ ç­¾æ  ========== */
.xh-history-tabs {
    display: flex; gap: 4px; margin-bottom: 12px; padding-bottom: 8px;
    border-bottom: 1px solid #f0f0f0; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
.xh-history-tab {
    flex-shrink: 0; padding: 4px 14px; border: none; background: transparent;
    color: #999; font-size: 13px; cursor: pointer; border-radius: 20px;
    transition: all 0.2s ease; white-space: nowrap;
}
.xh-history-tab:hover { background: #f5f5f5; color: #666; }
.xh-history-tab.active { background: var(--xh-primary, #ff6b35); color: #fff; font-weight: 500; }

/* ========== è®°å½åè¡¨ ========== */
.xh-history-list { display: flex; flex-direction: column; gap: 6px; }

/* ========== åæ¡è®°å½ ========== */
.xh-history-item {
    display: flex; align-items: flex-start; gap: 10px; padding: 8px;
    border-radius: 8px; background: #fafafa; position: relative;
    transition: background 0.2s ease, transform 0.15s ease;
}
.xh-history-item:hover { background: #f0f0f0; transform: translateX(2px); }

/* ========== ç¼©ç¥å¾ ========== */
.xh-history-item-thumb {
    flex-shrink: 0; width: 48px; height: 48px; border-radius: 6px; overflow: hidden;
    background: #eee; display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.xh-history-item-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.xh-history-thumb-placeholder { background: linear-gradient(135deg, #f0f0f0, #e8e8e8); color: #bbb; }

/* ========== åå®¹åºå ========== */
.xh-history-item-content { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-top: 2px; }
.xh-history-item-title {
    font-size: 14px; line-height: 1.4; color: #333; text-decoration: none;
    overflow: hidden; text-overflow: ellipsis; display: -webkit-box;
    -webkit-line-clamp: 2; -webkit-box-orient: vertical; transition: color 0.2s; word-break: break-word;
}
.xh-history-item-title:hover { color: var(--xh-primary, #ff6b35); }

/* ========== éè¯»è¿åº¦æ¡ ========== */
.xh-history-progress {
    width: 100%; height: 3px; background: #f0f0f0; border-radius: 2px; overflow: hidden; margin-top: 2px;
}
.xh-history-progress-bar {
    height: 100%; background: linear-gradient(90deg, #4a90e2, #5cb85c); border-radius: 2px;
    transition: width 0.3s ease;
}
.xh-history-progress-text { font-size: 11px; color: #999; }
.xh-history-read-complete { font-size: 11px; color: #5cb85c; font-weight: 500; }

/* ========== åä¿¡æ¯ ========== */
.xh-history-item-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.xh-history-type-badge {
    display: inline-flex; align-items: center; gap: 2px; padding: 1px 8px;
    border-radius: 10px; font-size: 11px; line-height: 1.6; font-weight: 500;
}
.xh-history-type-article { background: #e8f4fd; color: #4a90e2; }
.xh-history-type-product { background: #fff3e0; color: #ff8a3c; }
.xh-history-type-video { background: #fce4ec; color: #e91e63; }
.xh-history-type-page { background: #f3e5f5; color: #9c27b0; }
.xh-history-time { font-size: 12px; color: #bbb; }

/* ========== å é¤æé® ========== */
.xh-history-delete-btn {
    margin-left: auto; background: none; border: none; color: #ccc; font-size: 16px;
    cursor: pointer; padding: 0 4px; line-height: 1; opacity: 0; transition: all 0.2s;
}
.xh-history-item:hover .xh-history-delete-btn { opacity: 1; }
.xh-history-delete-btn:hover { color: #e74c3c; }

/* ========== ç©ºç¶æ/å è½½ ========== */
.xh-history-empty { text-align: center; padding: 30px 10px; color: #ccc; }
.xh-history-empty-icon { font-size: 36px; margin-bottom: 8px; opacity: 0.6; }
.xh-history-empty-text { font-size: 13px; color: #999; }
.xh-history-loading { text-align: center; padding: 20px; color: #999; font-size: 13px; }

/* ========== åºé¨æ¸ç©ºæé® ========== */
.xh-history-footer { text-align: center; padding-top: 8px; margin-top: 4px; border-top: 1px solid #f0f0f0; }
.xh-history-clear-btn {
    background: none; border: 1px solid #eee; color: #999; font-size: 12px;
    cursor: pointer; padding: 4px 16px; border-radius: 16px; transition: all 0.2s ease;
}
.xh-history-clear-btn:hover { background: #fff5f5; border-color: #ffcdd2; color: #e74c3c; }

/* ========== éè¯»æ¢å¤å¼¹çª ========== */
.xh-resume-overlay {
    position: fixed; bottom: 16px; right: 16px; z-index: 99999;
    opacity: 0; transform: translateY(20px); transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.xh-resume-overlay.xh-resume-show { opacity: 1; transform: translateY(0); pointer-events: auto; }

.xh-resume-dialog {
    background: #fff; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,0.12);
    padding: 12px 16px; max-width: 260px; width: calc(100vw - 32px);
    border: 1px solid #f0f0f0;
}
.xh-resume-icon { font-size: 22px; text-align: center; margin-bottom: 4px; }
.xh-resume-title { font-size: 13px; font-weight: 600; color: #333; text-align: center; margin-bottom: 4px; }
.xh-resume-text { font-size: 12px; color: #666; text-align: center; margin-bottom: 8px; line-height: 1.4; }
.xh-resume-text strong { color: var(--xh-primary, #ff6b35); font-size: 14px; }

.xh-resume-progress-bar {
    width: 100%; height: 4px; background: #f0f0f0; border-radius: 2px; overflow: hidden; margin-bottom: 10px;
}
.xh-resume-progress-fill {
    height: 100%; background: linear-gradient(90deg, #4a90e2, #5cb85c); border-radius: 2px;
    transition: width 0.5s ease;
}

.xh-resume-actions { display: flex; gap: 6px; flex-direction: row; }
.xh-resume-btn {
    padding: 5px 14px; border: none; border-radius: 6px; font-size: 12px; cursor: pointer;
    transition: all 0.2s ease; text-align: center; flex: 1;
}
.xh-resume-btn-primary {
    background: var(--xh-primary, #ff6b35); color: #fff; font-weight: 500;
}
.xh-resume-btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.xh-resume-btn-secondary { background: #f5f5f5; color: #666; }
.xh-resume-btn-secondary:hover { background: #eee; }

/* ========== ååºå¼ ========== */
@media (max-width: 768px) {
    .xh-history-item { padding: 6px; gap: 8px; }
    .xh-history-item-thumb { width: 40px; height: 40px; font-size: 16px; }
    .xh-history-item-title { font-size: 13px; -webkit-line-clamp: 1; }
    .xh-history-type-badge { font-size: 10px; padding: 1px 6px; }
    .xh-history-time { font-size: 11px; }
    .xh-history-tab { font-size: 12px; padding: 3px 10px; }

    .xh-resume-overlay { bottom: 10px; right: 10px; left: 10px; }
    .xh-resume-dialog { max-width: none; padding: 10px 14px; }
}

/* ========== Zibll æ·±è²æ¨¡å¼ ========== */
body.dark-mode .xh-history-item, body[data-theme="dark"] .xh-history-item { background: #2a2a2a; }
body.dark-mode .xh-history-item:hover, body[data-theme="dark"] .xh-history-item:hover { background: #333; }
body.dark-mode .xh-history-item-title, body[data-theme="dark"] .xh-history-item-title { color: #ddd; }
body.dark-mode .xh-history-tabs, body[data-theme="dark"] .xh-history-tabs { border-bottom-color: #333; }
body.dark-mode .xh-history-footer, body[data-theme="dark"] .xh-history-footer { border-top-color: #333; }
body.dark-mode .xh-history-thumb-placeholder, body[data-theme="dark"] .xh-history-thumb-placeholder { background: #333; color: #666; }
body.dark-mode .xh-history-progress, body[data-theme="dark"] .xh-history-progress { background: #333; }
body.dark-mode .xh-resume-dialog, body[data-theme="dark"] .xh-resume-dialog { background: #2a2a2a; border-color: #333; }
body.dark-mode .xh-resume-title, body[data-theme="dark"] .xh-resume-title { color: #ddd; }
body.dark-mode .xh-resume-text, body[data-theme="dark"] .xh-resume-text { color: #aaa; }
body.dark-mode .xh-resume-btn-secondary, body[data-theme="dark"] .xh-resume-btn-secondary { background: #333; color: #aaa; }

/* ========== ä¾§è¾¹æ å°å·¥å·éé ========== */
.widget .xh-history-container { padding: 0; }
.widget .xh-history-item { background: transparent; padding: 6px 4px; border-bottom: 1px solid #f5f5f5; border-radius: 0; }
.widget .xh-history-item:last-child { border-bottom: none; }
.widget .xh-history-item:hover { background: transparent; transform: none; }
.widget .xh-history-item-thumb { width: 40px; height: 40px; }
