/**
 * 灵休 · 液态玻璃 —— 浮层（float）：侧滑详情抽屉、命令面板、通知气泡
 *
 * 行为由 assets/js/lx/glass-ui.js 提供：
 *   抽屉：<tr data-lg-drawer="#id"> 或 <button data-lg-drawer="#id"> 打开，[data-lg-close] / Esc / 点遮罩关闭
 *   面板：Ctrl/⌘ + K、/ 或点击 .lg-search 打开；条目来自 window.LG_PALETTE
 * 玻璃来自 .lg-glass（本文件不写 backdrop-filter）。同屏浮层只开一个。
 */

/* ---------- 遮罩（抽屉与面板共用，只变暗不模糊） ---------- */
.lg-scrim {
    position: fixed;
    inset: 0;
    z-index: calc(var(--lg-z-modal) - 1);
    background: var(--lg-scrim);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--lg-dur-3) var(--lg-ease);
}

.lg-scrim.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* ---------- 抽屉：桌面从右侧浮入的玻璃面板，手机变成底部面板 ---------- */
.lg-drawer {
    position: fixed;
    top: 14px;
    right: 14px;
    bottom: 14px;
    z-index: var(--lg-z-modal);
    width: min(460px, calc(100vw - 28px));
    display: flex;
    flex-direction: column;
    border-radius: var(--lg-r-xl);
    overflow: hidden;
    transform: translateX(calc(100% + 28px));
    visibility: hidden;
    transition: transform var(--lg-dur-3) var(--lg-spring), visibility 0s linear var(--lg-dur-3);
}

.lg-drawer.is-open {
    transform: none;
    visibility: visible;
    transition-delay: 0s;
}

.lg-drawer__head {
    flex: none;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 22px 22px 16px;
}

.lg-drawer__title { font-size: 20px; font-weight: 800; letter-spacing: -0.3px; color: var(--lg-text); }
.lg-drawer__sub { margin-top: 2px; font-size: var(--lg-fs-foot); color: var(--lg-text-3); }
.lg-drawer__head .modal-close { margin-left: auto; position: static; flex: none; }

.lg-drawer__body {
    flex: 1;
    overflow-y: auto;
    padding: 4px 22px 22px;
    overscroll-behavior: contain;
}

.lg-drawer__sec { margin-top: 22px; }
.lg-drawer__sec:first-child { margin-top: 0; }

.lg-drawer__sec > h4 {
    margin: 0 0 10px;
    font-size: var(--lg-fs-foot);
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--lg-text-3);
}

.lg-drawer__foot {
    flex: none;
    display: flex;
    gap: 10px;
    padding: 14px 22px calc(18px + var(--safe-bottom, 0px));
    border-top: 1px solid var(--lg-hairline);
}

.lg-drawer__foot .btn { flex: 1; justify-content: center; }

@media (max-width: 991.98px) {
    .lg-drawer {
        top: auto;
        left: 10px;
        right: 10px;
        bottom: calc(10px + var(--safe-bottom, 0px));
        width: auto;
        max-height: 82vh;
        transform: translateY(calc(100% + 24px));
    }

    .lg-drawer::before {
        content: "";
        display: block;
        flex: none;
        width: 38px;
        height: 5px;
        margin: 8px auto 0;
        border-radius: 3px;
        background: var(--lg-fill-2);
    }

    .lg-drawer__head { padding-top: 12px; }
}

/* ---------- 命令面板 ---------- */
.lg-palette {
    position: fixed;
    inset: 0;
    z-index: calc(var(--lg-z-modal) + 10);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 14vh 16px 16px;
    visibility: hidden;
    pointer-events: none;
}

.lg-palette.is-open {
    visibility: visible;
    pointer-events: auto;
}

.lg-palette::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--lg-scrim);
    opacity: 0;
    transition: opacity var(--lg-dur-3) var(--lg-ease);
}

.lg-palette.is-open::before {
    opacity: 1;
}

.lg-palette__box {
    position: relative;
    width: min(620px, 100%);
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    border-radius: var(--lg-r-xl);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-14px) scale(0.96);
    transition: transform var(--lg-dur-3) var(--lg-spring), opacity var(--lg-dur-2) var(--lg-ease);
}

.lg-palette.is-open .lg-palette__box {
    opacity: 1;
    transform: none;
}

.lg-palette__input {
    flex: none;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 16px 0 22px;
    height: 62px;
    border-bottom: 1px solid var(--lg-hairline);
}

.lg-palette__input i { color: var(--lg-text-3); }

.lg-palette__input input {
    flex: 1;
    min-width: 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--lg-text);
    font: inherit;
    font-size: 17px;
}

.lg-palette__input input::placeholder { color: var(--lg-text-3); }

.lg-palette__list {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    overscroll-behavior: contain;
}

.lg-palette__group {
    padding: 12px 14px 6px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: 0.6px;
    color: var(--lg-text-3);
}

.lg-palette__item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 14px;
    border-radius: var(--lg-r-md);
    color: var(--lg-text);
    font-size: var(--lg-fs-body);
    text-decoration: none;
    cursor: pointer;
    transition: background var(--lg-dur-1);
}

.lg-palette__item i {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: var(--lg-fill);
    color: var(--lg-text-2);
    font-size: 14px;
    transition: background var(--lg-dur-1), color var(--lg-dur-1);
}

.lg-palette__item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-palette__item em { font-style: normal; font-size: var(--lg-fs-foot); color: var(--lg-text-3); }
.lg-palette__item .lg-kbd { opacity: 0; }

.lg-palette__item.is-active {
    background: var(--lg-lens);
    box-shadow: var(--lg-edge-soft);
}

.lg-palette__item.is-active i { background: var(--lg-brand-soft); color: var(--lg-brand-ink); }
.lg-palette__item.is-active .lg-kbd { opacity: 1; }

.lg-palette__empty {
    padding: 36px 16px;
    text-align: center;
    color: var(--lg-text-3);
    font-size: var(--lg-fs-call);
}

.lg-palette__foot {
    flex: none;
    display: flex;
    gap: 16px;
    padding: 10px 20px;
    border-top: 1px solid var(--lg-hairline);
    font-size: var(--lg-fs-foot);
    color: var(--lg-text-3);
}

@media (max-width: 600px) {
    .lg-palette { padding-top: calc(var(--safe-top, 0px) + 12px); }
    .lg-palette__foot { display: none; }
}

/* ---------- 通知气泡（挂在 .dropdown 里，复用 dropdown 的开合逻辑） ---------- */
body.lg .dropdown-menu.lg-pop {
    width: 360px;
    max-width: calc(100vw - 24px);
    padding: 6px;
}

.lg-pop__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px 8px;
    font-size: var(--lg-fs-call);
    font-weight: 700;
}

.lg-pop__head a,
.lg-pop__head button { font: inherit; font-size: var(--lg-fs-foot); font-weight: 600; color: var(--lg-brand-ink); border: 0; background: none; padding: 0; cursor: pointer; }
.lg-pop__foot { display: block; padding: 10px 14px 12px; text-align: center; font-size: var(--lg-fs-foot); font-weight: 600; color: var(--lg-brand-ink); border-top: 1px solid var(--lg-hairline); margin-top: 4px; }
.lg-pop__empty { padding: 26px 14px; text-align: center; color: var(--lg-text-3); font-size: var(--lg-fs-call); }
.lg-notice.is-read .lg-notice__title { font-weight: 500; color: var(--lg-text-2); }
.lg-notice.is-read .lg-notice__icon { background: var(--lg-fill); color: var(--lg-text-3); }

.lg-notice {
    display: flex;
    gap: 12px;
    padding: 12px 14px;
    border-radius: var(--lg-r-md);
    color: var(--lg-text);
    text-decoration: none;
    transition: background var(--lg-dur-1);
}

.lg-notice:hover { background: var(--lg-fill); }
.lg-notice__icon { flex: none; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; border-radius: 11px; background: var(--lg-brand-soft); color: var(--lg-brand-ink); font-size: 14px; }
.lg-notice__icon.is-blue { background: var(--lg-info-soft); color: var(--lg-info-ink); }
.lg-notice__icon.is-warn { background: var(--lg-warn-soft); color: var(--lg-warn-ink); }
.lg-notice__title { font-size: var(--lg-fs-call); font-weight: 600; }
.lg-notice__text { margin-top: 2px; font-size: var(--lg-fs-foot); color: var(--lg-text-3); line-height: 1.45; }
.lg-notice__time { flex: none; font-size: 11.5px; color: var(--lg-text-3); }

/* Toast 里的动作按钮（如“撤销”），由 LGUI.toast(msg, type, {label, action}) 生成 */
body.lg .toast .lg-toast-action {
    margin-left: 6px;
    padding: 5px 12px;
    border: 0;
    border-radius: var(--lg-r-pill);
    background: var(--lg-brand-soft);
    color: var(--lg-brand-ink);
    font: inherit;
    font-size: var(--lg-fs-call);
    font-weight: 700;
    cursor: pointer;
    transition: transform var(--lg-dur-1) var(--lg-spring);
}

body.lg .toast .lg-toast-action:active { transform: scale(0.92); }

/* ---------- 浮动操作条：选中内容后从底部弹出（手机上浮在悬浮导航之上） ----------
   用法：<div class="lg-actionbar lg-actionbar--float lg-actionbar--mobile lg-glass"> …加 .is-open 显示；
   --mobile 表示桌面端不用它（桌面端用页面里的侧栏摘要代替）。 */
.lg-actionbar--float {
    position: fixed;
    left: 14px;
    right: 14px;
    max-width: 460px;
    margin: 0 auto;
    bottom: calc(var(--lg-tabbar-h) + var(--lg-tabbar-gap) + var(--safe-bottom, 0px) + 14px);
    z-index: calc(var(--lg-z-tabbar) - 10);
    transform: translateY(180%);
    opacity: 0;
    pointer-events: none;
    transition: transform var(--lg-dur-3) var(--lg-spring), opacity var(--lg-dur-2) var(--lg-ease);
}

.lg-actionbar--float.is-open {
    transform: none;
    opacity: 1;
    pointer-events: auto;
}

.lg-actionbar__text {
    flex: 1.5 1 0;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding-left: 12px;
    line-height: 1.25;
}

.lg-actionbar__text b { font-size: var(--lg-fs-body); }
.lg-actionbar__text span { font-size: var(--lg-fs-foot); color: var(--lg-text-3); }

@media (min-width: 992px) {
    .lg-actionbar--mobile { display: none; }
}

#lxBellDot[hidden] { display: none; }
