/**
 * 浏览历史记录样式 - navw.cn 下拉弹出风格
 * 面板从导航栏按钮下方弹出
 */

/* 下拉面板 */
.xwme-history-panel {
    position: fixed;
    width: 360px;
    max-width: 90vw;
    max-height: 420px;
    background: #fff;
    z-index: 999999;
    display: flex;
    flex-direction: column;
    border-radius: 10px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 0 1px rgba(0, 0, 0, 0.08);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

.xwme-history-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 面板头部 */
.xwme-history-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    border-bottom: 1px solid #f0f1f3;
    flex-shrink: 0;
}

.xwme-history-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.xwme-history-panel-title svg {
    width: 16px;
    height: 16px;
    color: #999;
}

.xwme-history-panel-actions {
    display: flex;
    align-items: center;
}

/* 清空按钮 - 文字链接风格 */
.xwme-history-clear {
    background: none;
    border: none;
    color: #999;
    font-size: 13px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all 0.15s;
}

.xwme-history-clear:hover {
    color: #E53935;
    background: #fef2f2;
}

/* 关闭按钮 - 隐藏（下拉式不需要） */
.xwme-history-close {
    display: none;
}

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

/* 日期分组标题 */
.xwme-history-date-group {
    padding: 10px 18px 6px;
    font-size: 12px;
    font-weight: 500;
    color: #999;
    letter-spacing: 0.3px;
}

/* 历史记录项 */
.xwme-history-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 18px;
    cursor: pointer;
    transition: background 0.15s;
    text-decoration: none;
    color: inherit;
}

.xwme-history-item:hover {
    background: #f7f8fa;
}

.xwme-history-item-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: #f3f4f6;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}

.xwme-history-item-icon img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

.xwme-history-item-icon svg {
    width: 16px;
    height: 16px;
    color: #bbb;
}

.xwme-history-item-info {
    flex: 1;
    min-width: 0;
}

.xwme-history-item-title {
    font-size: 13px;
    font-weight: 400;
    color: #333;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.xwme-history-item-url {
    display: none;
}

.xwme-history-item-time {
    font-size: 11px;
    color: #ccc;
    flex-shrink: 0;
}

.xwme-history-item-delete {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 4px;
    color: #ddd;
    cursor: pointer;
    opacity: 0;
    transition: all 0.15s;
    flex-shrink: 0;
}

.xwme-history-item:hover .xwme-history-item-delete {
    opacity: 1;
}

.xwme-history-item-delete:hover {
    background: #fef2f2;
    color: #E53935;
}

/* 空状态 */
.xwme-history-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 48px 20px;
    color: #ccc;
}

.xwme-history-empty svg {
    width: 40px;
    height: 40px;
    margin-bottom: 10px;
}

.xwme-history-empty span {
    font-size: 13px;
    color: #999;
}

/* 遮罩 - 下拉式使用轻量遮罩 */
.xwme-history-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 999998;
    display: none;
}

/* 滚动条 */
.xwme-history-panel-body::-webkit-scrollbar {
    width: 4px;
}

.xwme-history-panel-body::-webkit-scrollbar-track {
    background: transparent;
}

.xwme-history-panel-body::-webkit-scrollbar-thumb {
    background: #e5e7eb;
    border-radius: 2px;
}

.xwme-history-panel-body::-webkit-scrollbar-thumb:hover {
    background: #d1d5db;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .xwme-history-panel {
        width: calc(100vw - 32px);
        max-width: calc(100vw - 32px);
        max-height: 60vh;
        left: 16px !important;
        right: 16px !important;
    }

    .xwme-history-item-delete {
        opacity: 1;
    }

    .xwme-history-item-url {
        display: block;
    }
}
