/* ============================================================================
 * 巡影织网 · 表格与控件增强层（xy-motion-kit.css）—— 2026-10-28
 * ----------------------------------------------------------------------------
 * 配色只用主题变量（theme.css 里 neon / light / aurora / sunset / scenery
 * 五套皮肤都重定义了同一批变量），因此本文件不需要任何皮肤特判。
 * 体积控制：全部为静态样式，无图片、无 data URI。
 * ========================================================================== */

/* ---------------------------------------------------------------- 通用 */
[hidden].xy-mk__panel,
[hidden].xy-mk__sug,
[hidden].xy-mk__batch { display: none !important; }

/* ------------------------------------------------- 一、工具栏（显示设置） */
.xy-mk__bar {
    position: relative;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    margin: 0 0 6px;
}

.xy-mk__tbtn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 28px;
    padding: 0 10px;
    font: inherit;
    font-size: 12px;
    line-height: 1;
    color: var(--text-secondary, var(--xy-fg-2));
    background: var(--xy-panel, transparent);
    border: 1px solid var(--xy-line, rgba(128, 128, 128, .28));
    border-radius: var(--radius-btn, 8px);
    cursor: pointer;
    transition: color .18s ease, border-color .18s ease, background-color .18s ease;
}

.xy-mk__tbtn:hover,
.xy-mk__bar.is-open .xy-mk__tbtn {
    color: var(--text-primary, var(--xy-fg));
    border-color: var(--xy-accent, currentColor);
}

.xy-mk__tbtn:focus-visible {
    outline: 2px solid var(--xy-accent, currentColor);
    outline-offset: 2px;
}

.xy-mk__panel {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    z-index: 1700;
    width: 248px;
    padding: 12px;
    background: var(--xy-panel, #14161c);
    border: 1px solid var(--xy-line, rgba(128, 128, 128, .28));
    border-radius: var(--radius-card, 12px);
    box-shadow: var(--shadow-card, 0 12px 32px rgba(0, 0, 0, .35));
}

.xy-mk__ph {
    margin: 0 0 6px;
    font-size: 11px;
    letter-spacing: .06em;
    color: var(--text-muted, var(--xy-fg-2));
}

.xy-mk__ph + .xy-mk__cols + .xy-mk__ph { margin-top: 12px; }

.xy-mk__cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px 10px;
    max-height: 220px;
    overflow-y: auto;
    overscroll-behavior: contain;
}

.xy-mk__ck {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary, var(--xy-fg-2));
    cursor: pointer;
    /* 列名可能很长，单行省略，避免面板被撑宽 */
    min-width: 0;
}

.xy-mk__ck span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.xy-mk__ck input {
    flex: 0 0 auto;
    accent-color: var(--xy-accent, currentColor);
    cursor: pointer;
}

.xy-mk__dens {
    display: flex;
    gap: 4px;
}

.xy-mk__dbtn {
    flex: 1;
    height: 26px;
    font: inherit;
    font-size: 12px;
    color: var(--text-secondary, var(--xy-fg-2));
    background: transparent;
    border: 1px solid var(--xy-line, rgba(128, 128, 128, .28));
    border-radius: 6px;
    cursor: pointer;
    transition: color .16s ease, border-color .16s ease, background-color .16s ease;
}

.xy-mk__dbtn.is-on {
    color: var(--xy-fg, #fff);
    background: var(--xy-accent, rgba(120, 120, 255, .18));
    border-color: transparent;
}

.xy-mk__reset {
    width: 100%;
    margin-top: 10px;
    padding: 6px 0;
    font: inherit;
    font-size: 12px;
    color: var(--text-muted, var(--xy-fg-2));
    background: transparent;
    border: 0;
    border-top: 1px solid var(--xy-line, rgba(128, 128, 128, .2));
    cursor: pointer;
}

.xy-mk__reset:hover { color: var(--text-primary, var(--xy-fg)); }

/* ------------------------------------------------- 二、列宽拖拽 */
.xy-mk__grip {
    position: absolute;
    top: 0;
    right: -4px;
    width: 8px;
    height: 100%;
    cursor: col-resize;
    /* 平时完全透明，只有悬停才显形，避免表头变脏 */
    background: transparent;
    touch-action: none;
}

.xy-mk__grip::after {
    content: "";
    position: absolute;
    top: 22%;
    left: 3px;
    width: 2px;
    height: 56%;
    border-radius: 2px;
    background: var(--xy-accent, currentColor);
    opacity: 0;
    transition: opacity .16s ease;
}

.xy-mk__grip:hover::after,
.xy-mk-resizing .xy-mk__grip::after { opacity: .9; }

/* th 需要定位上下文，把手才能贴在右边界上（类由 JS 打，不用 :has） */
.xy-mk-th { position: relative; }
.xy-mk-resizing { user-select: none; cursor: col-resize; }
table.xy-mk-fixed { table-layout: fixed; }

/* ------------------------------------------------- 三、密度 */
.xy-mk-den-compact td,
.xy-mk-den-compact th { padding-top: 4px !important; padding-bottom: 4px !important; }

.xy-mk-den-loose td,
.xy-mk-den-loose th { padding-top: 14px !important; padding-bottom: 14px !important; }

table.data-table td, table.data-table th,
table.t-table td, table.t-table th,
table.xy-table td, table.xy-table th {
    transition: padding .22s ease;
}

/* ------------------------------------------------- 四、列显隐 */
.xy-mk-hide { display: none !important; }

/* ------------------------------------------------- 五、批量选择 */
.xy-mk__chkcol {
    width: 36px;
    min-width: 36px;
    text-align: center;
    padding-left: 10px !important;
    padding-right: 4px !important;
}

.xy-mk__chkcol input {
    accent-color: var(--xy-accent, currentColor);
    cursor: pointer;
    width: 14px;
    height: 14px;
}

.xy-mk-has-chk tbody tr:hover > .xy-mk__chkcol { background: transparent; }

.xy-mk__batch {
    position: fixed;
    left: 50%;
    bottom: 22px;
    z-index: 1700;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 10px 8px 16px;
    transform: translateX(-50%);
    background: var(--xy-panel, #14161c);
    border: 1px solid var(--xy-line, rgba(128, 128, 128, .3));
    border-radius: 999px;
    box-shadow: var(--shadow-card, 0 12px 32px rgba(0, 0, 0, .4));
    animation: xyMkRise .22s cubic-bezier(.2, .8, .2, 1);
}

@keyframes xyMkRise {
    from { opacity: 0; transform: translate(-50%, 8px); }
    to   { opacity: 1; transform: translate(-50%, 0); }
}

.xy-mk__bnum {
    font-size: 12.5px;
    color: var(--text-secondary, var(--xy-fg-2));
}

.xy-mk__bnum b {
    color: var(--xy-fg, var(--text-primary));
    font-variant-numeric: tabular-nums;
}

.xy-mk__bops { display: flex; gap: 6px; }

.xy-mk__bbtn {
    height: 28px;
    padding: 0 12px;
    font: inherit;
    font-size: 12px;
    color: var(--xy-fg, #fff);
    background: var(--xy-accent, rgba(120, 120, 255, .9));
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    transition: transform .14s ease, opacity .14s ease;
}

.xy-mk__bbtn:active { transform: scale(.97); }
.xy-mk__bbtn--ghost {
    color: var(--text-secondary, var(--xy-fg-2));
    background: transparent;
    border: 1px solid var(--xy-line, rgba(128, 128, 128, .3));
}

/* ------------------------------------------------- 六、行内展开 */
.xy-mk-row { cursor: pointer; }
.xy-mk-row:focus-visible { outline: 2px solid var(--xy-accent, currentColor); outline-offset: -2px; }
.xy-mk-is-open > td { background: var(--table-row-hover, rgba(128, 128, 128, .08)); }

.xy-mk-detail > td {
    padding: 0 !important;
    border-top: 0 !important;
    background: transparent;
}

.xy-mk__din {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows .26s cubic-bezier(.2, .8, .2, 1);
}

.xy-mk__din > * { overflow: hidden; }
.xy-mk__din.is-in { grid-template-rows: 1fr; }

.xy-mk__dl {
    display: grid;
    grid-template-columns: minmax(88px, max-content) 1fr;
    gap: 6px 16px;
    margin: 0;
    padding: 12px 14px;
    font-size: 12.5px;
    background: var(--xy-bg-1, rgba(0, 0, 0, .12));
    border-left: 2px solid var(--xy-accent, currentColor);
}

.xy-mk__dl dt {
    color: var(--text-muted, var(--xy-fg-2));
    white-space: nowrap;
}

.xy-mk__dl dd {
    margin: 0;
    color: var(--text-primary, var(--xy-fg));
    word-break: break-all;
}

/* ------------------------------------------------- 七、一键复制 */
.xy-mk-copyable { cursor: copy; }

.xy-mk__copied {
    position: fixed;
    z-index: 2300;
    padding: 3px 8px;
    font-size: 11.5px;
    line-height: 1.4;
    color: var(--xy-fg, #fff);
    background: var(--xy-panel, #14161c);
    border: 1px solid var(--xy-accent, rgba(128, 128, 128, .3));
    border-radius: 6px;
    pointer-events: none;
    transform: translate(-50%, -100%) scale(.94);
    opacity: 0;
    transition: opacity .16s ease, transform .16s ease;
}

.xy-mk__copied.is-in { opacity: 1; transform: translate(-50%, -100%) scale(1); }
.xy-mk__copied.is-bad { border-color: var(--neon-red, #e5484d); }

/* ------------------------------------------------- 八、横向滚动提示 */
.xy-mk-scrollbox { position: relative; }

.xy-mk-scrollbox::before,
.xy-mk-scrollbox::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 28px;
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease;
    z-index: 1;
}

.xy-mk-scrollbox::before {
    left: 0;
    background: linear-gradient(90deg, var(--xy-bg-0, rgba(0, 0, 0, .35)), transparent);
}

.xy-mk-scrollbox::after {
    right: 0;
    background: linear-gradient(270deg, var(--xy-bg-0, rgba(0, 0, 0, .35)), transparent);
}

.xy-mk-scrollbox.is-scroll-l::before,
.xy-mk-scrollbox.is-scroll-r::after { opacity: 1; }

/* ------------------------------------------------- 九、输入历史联想 */
.xy-mk-sugwrap { position: relative; }

.xy-mk__sug {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    z-index: 1700;
    max-height: 208px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 4px;
    background: var(--xy-panel, #14161c);
    border: 1px solid var(--xy-line, rgba(128, 128, 128, .3));
    border-radius: 8px;
    box-shadow: var(--shadow-card, 0 10px 26px rgba(0, 0, 0, .34));
}

.xy-mk__sugitem {
    padding: 5px 8px;
    font-size: 12.5px;
    color: var(--text-secondary, var(--xy-fg-2));
    border-radius: 5px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.xy-mk__sugitem:hover,
.xy-mk__sugitem.is-on {
    color: var(--text-primary, var(--xy-fg));
    background: var(--table-row-hover, rgba(128, 128, 128, .14));
}

/* ------------------------------------------------- 十、chip 可删除 */
.xy-ht-chip.has-x,
.xy-chip.has-x,
[data-xy-chip].has-x { position: relative; }

.xy-ht-chip.has-x::after,
.xy-chip.has-x::after,
[data-xy-chip].has-x::after {
    content: "×";
    margin-left: 5px;
    font-size: 13px;
    line-height: 1;
    opacity: .62;
    transition: opacity .16s ease;
}

.xy-ht-chip.has-x:hover::after,
.xy-chip.has-x:hover::after,
[data-xy-chip].has-x:hover::after { opacity: 1; }

/* ------------------------------------------------- 十一、长按确认 */
[data-xy-hold] { position: relative; }

.xy-mk__ring {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    overflow: hidden;
    pointer-events: none;
}

.xy-mk__ring::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: var(--neon-red, #e5484d);
    transform: scaleX(0);
    transform-origin: left center;
}

.xy-mk__ring.is-run::before {
    animation: xyMkHold var(--mk-ms, 600ms) linear forwards;
}

@keyframes xyMkHold {
    from { transform: scaleX(0); }
    to   { transform: scaleX(1); }
}

.xy-mk-holding { filter: brightness(.94); }
.xy-mk-holding::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 2px var(--neon-red, #e5484d); pointer-events: none; }

.xy-mk-shake { animation: xyMkShake .24s cubic-bezier(.4, 0, .6, 1); }

@keyframes xyMkShake {
    0%, 100% { transform: translateX(0); }
    30%      { transform: translateX(-3px); }
    60%      { transform: translateX(3px); }
}

/* ------------------------------------------------- 降动效 */
@media (prefers-reduced-motion: reduce) {
    .xy-mk__bar *,
    .xy-mk__panel *,
    .xy-mk__batch,
    .xy-mk__din,
    .xy-mk__copied,
    .xy-mk__sug,
    .xy-mk__ring::before,
    table.data-table td,
    table.data-table th,
    table.t-table td,
    table.t-table th,
    table.xy-table td,
    table.xy-table th {
        transition: none !important;
        animation: none !important;
    }

    /* 降动效下长按进度条不跑，但必须仍然显示出来，否则用户不知道该按多久 */
    .xy-mk__ring.is-run::before { transform: scaleX(1); opacity: .5; }
}

/* ------------------------------------------------- 移动端收窄 */
@media (max-width: 560px) {
    .xy-mk__panel { width: min(272px, calc(100vw - 24px)); }
    .xy-mk__batch {
        left: 12px;
        right: 12px;
        bottom: 12px;
        transform: none;
        justify-content: space-between;
        animation: none;
    }
    .xy-mk__dl { grid-template-columns: 1fr; gap: 2px; }
    .xy-mk__dl dt { margin-top: 6px; }
}
