/* 浏览历史记录 - 新设计风格 */

/* 导航栏按钮 */
.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: 17px;
    height: 17px;
}
.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: 320px;
    max-width: 92vw;
    max-height: 480px;
    background: #f8f9fa;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.08);
    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: 12px 16px;
    background: #fff;
    border-bottom: 1px solid #e8eaed;
    flex-shrink: 0;
}
.xwme-history-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #1a1a1a;
}
.xwme-history-panel-title svg {
    width: 18px;
    height: 18px;
    color: #666;
}
.xwme-history-clear {
    background: none;
    border: none;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    transition: all .15s;
    font-weight: 500;
}
.xwme-history-clear:hover {
    color: #e53935;
    background: #fef2f2;
}

/* 面板内容 */
.xwme-history-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 6px;
}

/* 历史列表 - 新卡片设计 */
.xwme-history-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* 历史项 - 卡片风格 */
.xwme-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 6px;
    background: #fff;
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s ease;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
    border: 1px solid transparent;
}
.xwme-history-item:hover {
    background: #fff;
    box-shadow: 0 4px 12px rgba(0,0,0,.08);
    transform: translateY(-1px);
    border-color: #e8eaed;
}

/* 图标 */
.xwme-history-item-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: #f0f2f5;
    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: #999;
}

/* 信息区域 */
.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: 500;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}
.xwme-history-item-url {
    font-size: 11px;
    color: #999;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: none;
}

/* 分类标签 */
.xwme-history-item-category {
    font-size: 11px;
    font-weight: 500;
    color: #888;
    background: #f0f2f5;
    padding: 3px 10px;
    border-radius: 20px;
    flex-shrink: 0;
    white-space: nowrap;
}

/* 删除按钮 */
.xwme-history-item-delete {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f0f2f5;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    color: #999;
    transition: all .15s;
    flex-shrink: 0;
    opacity: 0;
}
.xwme-history-item:hover .xwme-history-item-delete {
    opacity: 1;
}
.xwme-history-item-delete:hover {
    background: #fee;
    color: #e53935;
}
.xwme-history-item-delete svg {
    width: 14px;
    height: 14px;
}

/* 空状态 */
.xwme-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 50px 20px;
    color: #bbb;
    text-align: center;
}
.xwme-history-empty-icon {
    width: 64px;
    height: 64px;
    background: #e8eaed;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
}
.xwme-history-empty-icon svg {
    width: 28px;
    height: 28px;
    color: #aaa;
}
.xwme-history-empty-text {
    font-size: 14px;
    color: #999;
}

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

/* 暗色模式 */
.dark .xwme-history-panel {
    background: #1e1e1e;
}
.dark .xwme-history-panel-header {
    background: #252525;
    border-color: #333;
}
.dark .xwme-history-panel-title {
    color: #e8e8e8;
}
.dark .xwme-history-panel-title svg {
    color: #888;
}
.dark .xwme-history-item {
    background: #252525;
    box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.dark .xwme-history-item:hover {
    background: #2a2a2a;
    border-color: #333;
    box-shadow: 0 4px 12px rgba(0,0,0,.3);
}
.dark .xwme-history-item-title {
    color: #e8e8e8;
}
.dark .xwme-history-item-icon {
    background: #333;
}
.dark .xwme-history-item-category {
    background: #333;
    color: #888;
}
.dark .xwme-history-item-delete {
    background: #333;
    color: #666;
}
.dark .xwme-history-item-delete:hover {
    background: #442222;
}
.dark .xwme-history-empty-icon {
    background: #333;
}
.dark .xwme-history-overlay {
    background: rgba(0,0,0,.5);
}

/* 移动端适配 */
@media (max-width: 480px) {
    .xwme-history-panel {
        position: fixed !important;
        width: calc(100vw - 16px) !important;
        max-width: 380px !important;
        /* 不设置left/top/right/bottom，由JS动态控制 */
        border-radius: 16px !important;
        max-height: 400px !important;
        /* 移动端不使用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;
    }
}
