/* ================================
   易学64 · 公共历史卦例组件
   ================================ */

.history-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s, visibility 0.25s;
}

.history-overlay.show {
    opacity: 1;
    visibility: visible;
}


/* ================================
   历史侧边栏
   ================================ */

.history-sidebar {
    position: fixed;
    top: 58px;
    right: 0;
    bottom: 0;

    width: 390px;
    max-width: 92vw;

    background: #ffffff;

    z-index: 1999;

    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.15);

    transform: translateX(100%);
    transition: transform 0.28s ease;

    display: flex;
    flex-direction: column;
}

.history-sidebar.show {
    transform: translateX(0);
}


/* ================================
   顶部
   ================================ */

.history-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;

    padding: 18px 18px 14px;

    border-bottom: 1px solid #e2e9f0;

    background: #f8fafd;

    flex-shrink: 0;
}

.history-sidebar-title {
    color: #1e2b3c;
    font-size: 18px;
    font-weight: 600;
}

.history-sidebar-tip {
    color: #8a9cb0;
    font-size: 11px;
    margin-top: 2px;
}

.history-close-btn {
    width: 34px;
    height: 34px;

    border: none;
    border-radius: 50%;

    background: #e7edf4;
    color: #4a5f73;

    font-size: 22px;
    line-height: 34px;

    cursor: pointer;

    flex-shrink: 0;
}

.history-close-btn:hover {
    background: #dbe4ee;
}


/* ================================
   历史列表
   ================================ */

.history-list {
    flex: 1;

    overflow-y: auto;

    padding: 14px;

    -webkit-overflow-scrolling: touch;
}

.history-empty {
    text-align: center;

    padding: 50px 20px;

    color: #8a9cb0;

    font-size: 14px;
}


/* ================================
   单条历史记录
   ================================ */

.history-item {
    background: #f8fafd;

    border: 1px solid #dbe5ef;

    border-radius: 14px;

    padding: 13px 12px;

    margin-bottom: 10px;

    transition:
        border-color 0.2s,
        box-shadow 0.2s;
}

.history-item:hover {
    border-color: #b9cde1;

    box-shadow:
        0 3px 10px rgba(0, 0, 0, 0.05);
}


/* ================================
   历史内容
   ================================ */

.history-item-main {
    cursor: pointer;

    min-width: 0;
}

.history-item-name {
    color: #1e3c5a;

    font-size: 16px;

    font-weight: 600;

    word-break: break-all;
}

.history-item-time {
    color: #71849a;

    font-size: 13px;

    margin-top: 4px;

    word-break: break-all;
}

.history-item-yao {
    color: #71849a;

    font-size: 13px;

    margin-top: 2px;

    word-break: break-all;
}


/* ================================
   三个按钮区域
   ================================ */

.history-item-actions {
    display: flex;

    align-items: center;

    gap: 8px;

    width: 100%;

    margin-top: 11px;
}


/* ================================
   三个按钮公共样式
   ================================ */

.history-item-actions button {
    flex: 1 1 0;

    min-width: 0;

    height: 34px;

    padding: 0 8px;

    border: none;

    border-radius: 18px;

    font-size: 13px;

    line-height: 34px;

    text-align: center;

    white-space: nowrap;

    cursor: pointer;

    box-sizing: border-box;

    transition:
        background 0.2s,
        opacity 0.2s,
        transform 0.1s;
}

.history-item-actions button:active {
    transform: scale(0.97);
}


/* ================================
   查看
   ================================ */

.history-view-btn {
    background: #2b4b6f;

    color: #ffffff;
}

.history-view-btn:hover {
    background: #1d3c5a;
}


/* ================================
   改名
   ================================ */

.history-rename-btn {
    background: #e7edf4;

    color: #36506a;
}

.history-rename-btn:hover {
    background: #d9e3ed;
}


/* ================================
   删除
   ================================ */

.history-delete-btn {
    background: #fbe8e8;

    color: #b84a4a;
}

.history-delete-btn:hover {
    background: #f5d4d4;
}


/* ================================
   手机端
   ================================ */

@media (max-width: 768px) {

    .history-sidebar {
        top: 54px;

        width: 92vw;

        max-width: 390px;
    }

    .history-sidebar-header {
        padding: 14px 14px 12px;
    }

    .history-list {
        padding: 12px;
    }

    .history-item {
        padding: 13px;
    }

    .history-item-actions {
        gap: 7px;

        margin-top: 10px;
    }

    .history-item-actions button {
        height: 36px;

        padding: 0 6px;

        font-size: 13px;

        line-height: 36px;
    }
}


/* ================================
   很窄的手机
   ================================ */

@media (max-width: 360px) {

    .history-item-actions {
        gap: 5px;
    }

    .history-item-actions button {
        padding: 0 4px;

        font-size: 12px;
    }
}