/* ================================
   悬浮面板：更大字号 + 移动端适配 + 防溢出
=================================== */

#ripro-history-popover {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: .5rem;
    width: 380px;
    max-width: min(92vw, 420px);
    background: var(--bs-body-bg, #fff);
    color: var(--bs-body-color, #212529);
    border: 1px solid rgba(0,0,0,.1);
    border-radius: .9rem;
    box-shadow: 0 .75rem 1.5rem rgba(0,0,0,.15);
    z-index: 1050;
    max-height: 70vh;
    overflow: hidden;
}

#ripro-history-popover.show { display: block; }
#ripro-history-popover[hidden] { display: none !important; }

#ripro-history-popover .card-header,
#ripro-history-popover .card-footer {
    border-color: rgba(0,0,0,.06);
}

.history-list {
    max-height: calc(70vh - 90px);
    overflow: auto;
}

/* 悬浮单项：修复长标题导致删除按钮错位与横向滚动 */
.history-item {
    border: 0;
    padding: .65rem .9rem;
    font-size: 0.98rem;
    line-height: 1.35;
    overflow: hidden;            /* 防止横向滚动条 */
    display: flex;               /* 保障布局一致 */
    align-items: center;
    justify-content: space-between;
}

/* 左侧容器允许压缩以触发省略号 */
.history-item .min-w-0,
.history-item .flex-grow-1 {
    min-width: 0 !important;
}

.history-thumb {
    width: 64px;
    height: 40px;
    object-fit: cover;
    flex: 0 0 64px;
    background: rgba(0,0,0,.05);
    border: 1px solid rgba(0,0,0,.06);
}

/* 标题单行省略（悬浮模式） */
.history-title {
    font-weight: 600;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* meta 行不撑宽度，避免横向滚动 */
.history-meta {
    font-size: .88rem;
    color: rgba(0,0,0,.6);
    margin-top: .15rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 删除按钮固定在右侧，红色更醒目，永不换行 */
.history-item .history-del {
    white-space: nowrap;
    flex-shrink: 0;
    color: #dc3545 !important;      /* 红色 */
    font-weight: 700;
}
.history-item .history-del i { font-size: 1.05rem; }

/* 暗色模式：文字纯白 */
html[data-bs-theme="dark"] #ripro-history-popover {
    background: #111;
    color: #fff;
    border-color: rgba(255,255,255,.12);
    box-shadow: 0 .75rem 1.5rem rgba(0,0,0,.6);
}
html[data-bs-theme="dark"] #ripro-history-popover .card-header,
html[data-bs-theme="dark"] #ripro-history-popover .card-footer {
    border-color: rgba(255,255,255,.12);
}
html[data-bs-theme="dark"] .history-meta {
    color: rgba(255,255,255,.9);
}

/* 小屏幕：面板改为固定定位，避免溢出 */
@media (max-width: 576px) {
    #ripro-history-popover {
        position: fixed;
        top: 64px;
        right: 8px;
        left: 8px;
        width: auto;
        max-width: none;
        margin-top: 0;
        border-radius: 1rem;
        max-height: 70vh;
    }
}

/* 永不显示红点（保留类名但强制隐藏） */
.toggle-history { position: relative; }
.toggle-history .badge-dot { display: none !important; }

/* ================================
   历史页面：更大字号、良好可读性 + 分页
=================================== */

.ripro-history-page-card .list-group-item {
    border-color: rgba(0,0,0,.06);
}

.history-item-lg {
    padding: .9rem 1rem;
    align-items: center;
    gap: .75rem;
    display: flex;
    justify-content: space-between;
    overflow: hidden;            /* 防止横向滚动条 */
}

.history-thumb-lg {
    width: 120px;
    height: 76px;
    object-fit: cover;
    flex: 0 0 120px;
    background: rgba(0,0,0,.05);
    border: 1px solid rgba(0,0,0,.06);
}

.history-title-lg {
    font-size: 1.05rem;
    font-weight: 700;
    color: inherit;
    word-break: break-word;
    display: -webkit-box;
    -webkit-line-clamp: 2;       /* 页面允许两行展示 */
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.history-meta-lg {
    margin-top: .25rem;
    font-size: .95rem;
    color: rgba(0,0,0,.66);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 删除按钮不挤压标题区域（页面） */
.history-del-page {
    flex-shrink: 0;
    color: #dc3545 !important;   /* 页面也使用红色 */
    font-weight: 700;
}
.history-del-page i { font-size: 1.05rem; }

/* 暗色：纯白文本 & 对比度提升 */
html[data-bs-theme="dark"] .ripro-history-page-card { color: #fff; }
html[data-bs-theme="dark"] .ripro-history-page-card .list-group-item {
    border-color: rgba(255,255,255,.14);
}
html[data-bs-theme="dark"] .history-meta-lg { color: rgba(255,255,255,.92); }

/* 页面在小屏下也不溢出 */
@media (max-width: 576px) {
    .history-thumb-lg { width: 96px; height: 64px; flex: 0 0 96px; }
    .history-item-lg { padding: .8rem .9rem; }
    .history-title-lg { font-size: 1rem; }
}

/* 悬浮/页面条目 hover 背景（明/暗适配） */
.history-item:hover,
.history-item-lg:hover {
    background: rgba(0,0,0,.03);
    text-decoration: none;
}
html[data-bs-theme="dark"] .history-item:hover,
html[data-bs-theme="dark"] .history-item-lg:hover {
    background: rgba(255,255,255,.08);
}

/* 分页导航样式靠主题（Bootstrap） */
#ripro-history-pagination .pagination { margin: 0; }
