/* 浏览历史记录 - 毛玻璃现代设计 v2.3.8 */

/* ---------- 导航栏触发按钮 ---------- */
.xwme-history-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    cursor: pointer;
    color: inherit;
    transition: opacity .16s cubic-bezier(0.33,1,0.68,1);
    position: relative;
    vertical-align: middle;
    flex-shrink: 0;
    padding: 8px 12px;
    outline: none;
    box-shadow: none;
    opacity: 1;
}
.xwme-history-nav-btn:hover {
    opacity: 0.7;
}
/* 点击时七彩渐变动画 */
@keyframes xwme-rainbow {
    0%   { color: #ff6b6b; }
    16%  { color: #feca57; }
    33%  { color: #48dbfb; }
    50%  { color: #ff9ff3; }
    66%  { color: #54a0ff; }
    83%  { color: #5f27cd; }
    100% { color: #ff6b6b; }
}
.xwme-history-nav-btn.is-active {
    animation: xwme-rainbow 10s linear infinite;
}
.xwme-history-nav-btn svg {
    width: 19px;
    height: 19px;
    stroke-width: 1.75;
}
.xwme-history-nav-badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #E53935;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    border-radius: 8px;
    display: none;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

/* ---------- 历史面板（毛玻璃卡片） ---------- */
.xwme-history-panel {
    position: fixed;
    width: 340px;
    max-width: 92vw;
    max-height: 500px;
    background: rgba(255, 255, 255, 0.78);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    backdrop-filter: blur(24px) saturate(180%);
    z-index: 9999;
    display: flex;
    flex-direction: column;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.75);
    box-shadow:
        0 20px 50px rgba(31, 41, 55, 0.18),
        0 4px 14px rgba(31, 41, 55, 0.08),
        inset 0 1px 0 rgba(255, 255, 255, 0.9);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px) scale(0.96);
    transition: opacity .25s ease, transform .25s ease, visibility .25s;
    overflow: hidden;
}
.xwme-history-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

/* ---------- 面板头部 ---------- */
.xwme-history-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(255, 255, 255, 0.55);
    border-bottom: 1px solid rgba(148, 163, 184, 0.25);
    flex-shrink: 0;
}
.xwme-history-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 400;
    color: #1e293b;
    letter-spacing: 0.2px;
}
.xwme-history-panel-title svg {
    width: 18px;
    height: 18px;
    color: #6366f1;
}
.xwme-history-clear {
    background: none;
    border: none;
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    padding: 5px 12px;
    border-radius: 8px;
    transition: all .15s;
    font-weight: 500;
}
.xwme-history-clear:hover {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
}

/* ---------- 面板内容滚动区 ---------- */
.xwme-history-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 10px 12px 14px;
    scrollbar-width: thin;
    scrollbar-color: rgba(148, 163, 184, 0.5) transparent;
}
.xwme-history-panel-body::-webkit-scrollbar {
    width: 5px;
}
.xwme-history-panel-body::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.45);
    border-radius: 3px;
}
.xwme-history-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

/* ---------- 历史项卡片 ---------- */
.xwme-history-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.xwme-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 14px;
    border: 1px solid rgba(148, 163, 184, 0.16);
    cursor: pointer;
    transition: transform .18s cubic-bezier(0.33,1,0.68,1), box-shadow .18s ease, border-color .18s ease, background .18s ease;
    text-decoration: none;
    color: inherit;
}
.xwme-history-item:hover {
    background: #fff;
    transform: translateY(-2px);
    border-color: rgba(99, 102, 241, 0.35);
    box-shadow: 0 8px 20px rgba(99, 102, 241, 0.14);
}
.xwme-history-item:active {
    transform: translateY(0);
}

/* 图标 */
.xwme-history-item-icon {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(236, 72, 153, 0.10));
    border: 1px solid rgba(148, 163, 184, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
    font-size: 18px;
}
.xwme-history-item-icon img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}
.xwme-history-item-icon svg {
    width: 18px;
    height: 18px;
    color: #94a3b8;
}

/* 信息区 */
.xwme-history-item-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.xwme-history-item-title {
    font-size: 14px;
    font-weight: 400;
    color: #1e293b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}
.xwme-history-item-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    min-height: 14px;
}
.xwme-history-item-time {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-size: 11px;
    color: #94a3b8;
    white-space: nowrap;
}
.xwme-history-item-time svg {
    width: 11px;
    height: 11px;
}

/* 分类标签 */
.xwme-history-item-category {
    font-size: 11px;
    font-weight: 400;
    color: #6366f1;
    background: rgba(99, 102, 241, 0.1);
    padding: 3px 10px;
    border-radius: 20px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* 删除按钮 */
.xwme-history-item-delete {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(148, 163, 184, 0.14);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #94a3b8;
    transition: all .15s;
    flex-shrink: 0;
    opacity: 0;
}
.xwme-history-item:hover .xwme-history-item-delete {
    opacity: 1;
}
.xwme-history-item-delete:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #ef4444;
    transform: scale(1.08);
}
.xwme-history-item-delete svg {
    width: 13px;
    height: 13px;
}

/* ---------- 空状态 ---------- */
.xwme-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 46px 20px;
    text-align: center;
}
.xwme-history-empty-icon {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(236, 72, 153, 0.10));
    border: 1px dashed rgba(99, 102, 241, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.xwme-history-empty-icon svg {
    width: 28px;
    height: 28px;
    color: #818cf8;
}
.xwme-history-empty-title {
    font-size: 14px;
    font-weight: 600;
    color: #64748b;
    margin-bottom: 4px;
}
.xwme-history-empty-sub {
    font-size: 12px;
    color: #94a3b8;
}

/* ---------- 遮罩 ---------- */
.xwme-history-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 23, 42, 0.25);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity .2s ease;
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}
.xwme-history-overlay.is-visible {
    display: block;
    opacity: 1;
}

/* ---------- 深色模式 ---------- */
.dark .xwme-history-panel {
    background: rgba(30, 32, 40, 0.82);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 4px 14px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.dark .xwme-history-panel-header {
    background: rgba(38, 40, 48, 0.6);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}
.dark .xwme-history-panel-title {
    color: #e2e8f0;
}
.dark .xwme-history-panel-title svg {
    color: #818cf8;
}
.dark .xwme-history-clear {
    color: #64748b;
}
.dark .xwme-history-clear:hover {
    color: #f87171;
    background: rgba(239, 68, 68, 0.15);
}
.dark .xwme-history-item {
    background: rgba(48, 50, 58, 0.72);
    border-color: rgba(255, 255, 255, 0.06);
}
.dark .xwme-history-item:hover {
    background: rgba(56, 58, 68, 0.9);
    border-color: rgba(129, 140, 248, 0.4);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}
.dark .xwme-history-item-title {
    color: #e2e8f0;
}
.dark .xwme-history-item-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.14));
    border-color: rgba(255, 255, 255, 0.08);
}
.dark .xwme-history-item-time {
    color: #64748b;
}
.dark .xwme-history-item-category {
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.18);
}
.dark .xwme-history-item-delete {
    background: rgba(148, 163, 184, 0.12);
    color: #64748b;
}
.dark .xwme-history-item-delete:hover {
    background: rgba(239, 68, 68, 0.2);
    color: #f87171;
}
.dark .xwme-history-empty-icon {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.12));
    border-color: rgba(129, 140, 248, 0.4);
}
.dark .xwme-history-empty-icon svg {
    color: #818cf8;
}
.dark .xwme-history-empty-title {
    color: #94a3b8;
}
.dark .xwme-history-empty-sub {
    color: #64748b;
}
.dark .xwme-history-overlay {
    background: rgba(0, 0, 0, 0.5);
}

/* ---------- 移动端适配 ---------- */
@media (max-width: 480px) {
    .xwme-history-panel {
        position: fixed !important;
        width: calc(100vw - 16px) !important;
        max-width: 380px !important;
        border-radius: 18px !important;
        max-height: 420px !important;
        /* 不设置left/top/right/bottom，由JS动态控制 */
        /* 移动端不使用transform动画，避免影响定位 */
        transform: none !important;
        opacity: 0 !important;
        visibility: hidden !important;
        margin: 0 !important;
        transition: opacity .25s ease, visibility .25s !important;
    }
    .xwme-history-panel.is-open {
        transform: none !important;
        opacity: 1 !important;
        visibility: visible !important;
    }
    .xwme-history-item-delete {
        opacity: 1;
    }
    .xwme-history-overlay {
        z-index: 9998 !important;
        display: none;
    }
    .xwme-history-overlay.is-visible {
        display: block !important;
        opacity: 1 !important;
    }
    .xwme-history-panel {
        z-index: 9999 !important;
    }
}
