/* ==========================================================================
   store.css  店铺管理页
   表格 筛选 多条输入 右键菜单 分页 悬浮按钮 缩放提示 新增弹窗 编辑浮层 的样式
   全部沿用选品管理的 selection.css（store.html 里先引入它），风格完全一致
   这里只放店铺页自己的部分
   ========================================================================== */

/* ---------- 公共导航栏适配（与选品管理页相同） ---------- */
:root { --top-nav-height: 64px; }
#mobile-menu-btn.mobile-only { display: none !important; }
@media (max-width: 768px) {
    #mobile-menu-btn.mobile-only { display: flex !important; }
}
#mobile-nav-menu { z-index: 1001; }
#global-toast-container { right: 88px; }
@media (max-width: 820px) { #global-toast-container { right: 72px; } }
td { position: relative; }

/* ---------- 筛选区 ---------- */
.filter-header { display: flex; justify-content: space-between; align-items: center; cursor: pointer; padding: 0.2rem 0; }
.filter-head-left { display: flex; align-items: center; gap: 20px; }
.filter-head-title { margin: 0; font-size: 1rem; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.filter-head-title i { color: var(--accent-color); }
#table-border-toggle-btn { height: 32px; padding: 0 12px; color: var(--text-secondary); }
#filter-icon { transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1); color: var(--text-secondary); }

.filter-collapse-wrapper { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1); }
.filter-collapse-wrapper.show { grid-template-rows: 1fr; }
.filter-collapse-inner { overflow: hidden; }

.filter-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 15px;
    margin-top: 15px;
}
.filter-box { display: flex; flex-direction: column; gap: 6px; }
.filter-title { font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); padding-left: 2px; }

/* 普通输入框：与多条输入同高，悬停 聚焦的描边同一套 */
.search-input-group {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    padding: 0 10px;
    box-sizing: border-box;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    transition: border-color 0.2s ease, box-shadow 0.28s ease;
}
.search-input-group > i { flex-shrink: 0; font-size: 0.75rem; color: var(--text-secondary); opacity: 0.6; transition: color 0.2s ease, opacity 0.2s ease; }
.search-input-group:hover { border-color: rgba(var(--mf-rgb, var(--accent-rgb)), 0.45); }
.search-input-group:focus-within {
    border-color: rgb(var(--mf-rgb, var(--accent-rgb)));
    box-shadow: 0 0 0 3px rgba(var(--mf-rgb, var(--accent-rgb)), 0.13);
}
.search-input-group:focus-within > i { color: rgb(var(--mf-rgb, var(--accent-rgb))); opacity: 1; }
.search-input-group input {
    flex: 1;
    min-width: 0;
    height: 100%;
    border: none;
    background: transparent;
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    outline: none;
}
.search-input-group input::placeholder { color: var(--text-secondary); opacity: 0.75; }

.filter-actions-box {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    padding-bottom: 5px;
    border-top: 1px dashed var(--glass-border);
}

/* 多条输入的主色：每个字段一个颜色，标题标签 条目 进度都用它 */
[data-mf="storeuser"] { --mf-rgb: 59, 130, 246; }
[data-mf="clientid"]  { --mf-rgb: 13, 148, 136; }
[data-mf="uuid"]      { --mf-rgb: 139, 92, 246; }
[data-mf="alias"]     { --mf-rgb: 217, 119, 6; }
[data-mf="comment"]   { --mf-rgb: 100, 116, 139; }
[data-theme="dark"] [data-mf="storeuser"] { --mf-rgb: 96, 165, 250; }
[data-theme="dark"] [data-mf="clientid"]  { --mf-rgb: 45, 212, 191; }
[data-theme="dark"] [data-mf="uuid"]      { --mf-rgb: 167, 139, 250; }
[data-theme="dark"] [data-mf="alias"]     { --mf-rgb: 251, 191, 36; }
[data-theme="dark"] [data-mf="comment"]   { --mf-rgb: 148, 163, 184; }

/* 徽章基础样式（selection.html 里原本是内联样式） */
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; white-space: nowrap; }

/* ---------- 分页栏提示 ---------- */
.pagination-tip { margin-left: 15px; font-weight: normal; font-size: 0.85em; opacity: 0.8; display: inline-flex; align-items: center; }
.tip-sep { display: inline-block; width: 3px; height: 3px; margin: 0 8px; border-radius: 50%; background: currentColor; opacity: 0.5; }

/* ---------- 表格 ---------- */
#store-table th { padding-left: 12px; padding-right: 12px; }
/* 选择框列：复选框加默认内边距会比 55px 宽，挤出一个省略号，这里去掉左右内边距 */
#store-table th.col-checkbox,
#store-table td.col-checkbox { padding-left: 0; padding-right: 0; text-overflow: clip; }
#store-table .cell-textarea { resize: vertical !important; }
.cell-input.is-mono { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace; font-size: 0.84rem; }

/* 店铺账户：头像首字母 + 名称，颜色按账户名哈希，同一个店铺永远同一个颜色 */
.store-chip { max-width: 100%; }

/* UUID：等宽字体，悬停这一行时右侧浮出复制按钮 */
.uuid-cell { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.uuid-text {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.2px;
    color: var(--text-primary);
}
.uuid-cell .icon-action-btn {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    font-size: 0.72rem;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.18s ease, transform 0.25s var(--ease-spring), color 0.2s ease,
                border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
}
.glass-table tbody tr:hover .uuid-cell .icon-action-btn { opacity: 1; transform: none; }
.glass-table tbody tr:hover .uuid-cell .icon-action-btn:hover { transform: translateY(-2px); }
.glass-table tbody tr:hover .uuid-cell .icon-action-btn:active { transform: scale(0.94); }
@media (hover: none) {
    .uuid-cell .icon-action-btn { opacity: 0.8; transform: none; }
}

/* 店铺ID：上面 ClientID（可改） 下面 CompanyID（只读，带锁） */
.glass-table td.StoreID { padding-top: 0.55rem; padding-bottom: 0.55rem; }
.sid-cell { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sid-line {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    height: 24px;
    margin: 0 -5px;
    padding: 0 5px;
    border-radius: 6px;
    transition: box-shadow 0.18s ease, background-color 0.18s ease;
}
.sid-k {
    flex-shrink: 0;
    width: 60px;
    height: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.3px;
}
.sid-line.is-client .sid-k { color: #0f766e; background: rgba(13, 148, 136, 0.12); }
.sid-line.is-company .sid-k { color: var(--text-secondary); background: rgba(148, 163, 184, 0.15); }
[data-theme="dark"] .sid-line.is-client .sid-k { color: #5eead4; background: rgba(45, 212, 191, 0.16); }
.sid-v {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
    font-size: 0.82rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text-primary);
}
.sid-line.is-company .sid-v { font-weight: 500; color: var(--text-secondary); }
.sid-v.is-empty { font-family: inherit; font-weight: 400; color: var(--text-secondary); opacity: 0.55; }
.sid-lock { flex-shrink: 0; margin-left: auto; font-size: 0.6rem; color: var(--text-secondary); opacity: 0.45; }
/* 悬停时只描出可修改的 ClientID 那一行，一眼看清哪部分能改 */
.glass-table td.StoreID[data-editable="true"]:hover { box-shadow: none; }
.glass-table td.StoreID:hover .sid-line.is-client { box-shadow: inset 0 0 0 1px var(--accent-color); }
.sid-input {
    flex: 1;
    min-width: 0;
    height: 24px;
    padding: 0 8px;
    box-sizing: border-box;
    border: 2px solid var(--accent-color);
    border-radius: 6px;
    background: var(--bg-color);
    color: var(--text-primary);
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
    font-size: 0.82rem;
    font-weight: 600;
    outline: none;
    box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.14);
    animation: optionIn 0.2s var(--ease-out);
}
.sid-input::placeholder { color: var(--text-secondary); opacity: 0.6; font-weight: 400; }

/* 别名：紫色标签 */
.alias-badge { max-width: 100%; }

/* 创建日期：日期加粗 时间淡一档 */
.time-cell { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; white-space: nowrap; font-variant-numeric: tabular-nums; }
.time-cell i { flex-shrink: 0; font-size: 0.72rem; color: var(--text-secondary); opacity: 0.55; }
.time-d { font-size: 0.86rem; font-weight: 600; color: var(--text-primary); }
.time-t { font-size: 0.78rem; color: var(--text-secondary); }

/* 注释：单行省略，悬停单元格看全文 */
.cmt-cell { display: flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; }
.cmt-icon { flex-shrink: 0; font-size: 0.72rem; color: #d97706; opacity: 0.7; }
[data-theme="dark"] .cmt-icon { color: #fbbf24; }
.cmt-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.86rem; }

/* 保存成功的格子闪一下淡绿色 */
.glass-table tbody td.cell-saved { animation: cellSaved 0.9s var(--ease-out); }
@keyframes cellSaved { from { background-color: rgba(16, 185, 129, 0.18); } }

/* 拉到新数据时，看得到的那几十行依次浮现；删除的行先向左淡出 */
.glass-table tbody tr.row-enter > td {
    animation: storeRowIn 0.36s var(--ease-out) backwards;
    animation-delay: calc(var(--i, 0) * 18ms);
}
@keyframes storeRowIn {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: none; }
}
.glass-table tbody tr.row-leaving > td { animation: storeRowOut 0.28s var(--ease-out) forwards; pointer-events: none; }
@keyframes storeRowOut { to { opacity: 0; transform: translateX(-16px); } }

/* 空数据 出错：一个圆形图标 + 一句话；跟随页面横向滚动保持在可视区里 */
.glass-table td.state-cell { padding: 0 !important; border-bottom: none !important; overflow: visible; }
.table-state {
    position: sticky;
    left: 1rem;
    max-width: calc(100vw - 4rem);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 3.2rem 1rem;
    box-sizing: border-box;
    text-align: center;
    white-space: normal;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    animation: fadeInUp 0.4s var(--ease-std);
}
.table-state-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    color: var(--accent-color);
    background: rgba(var(--accent-rgb), 0.1);
    animation: amIconPop 0.5s var(--ease-spring) 0.05s backwards;
}
.table-state.is-error { color: #dc2626; }
.table-state.is-error .table-state-icon { color: #ef4444; background: rgba(239, 68, 68, 0.1); }
[data-theme="dark"] .table-state.is-error { color: #fca5a5; }
.table-state .btn { margin-top: 2px; font-size: 0.82rem; }

/* ---------- 右上角「新增店铺」：往下滚动时也一直留着 ---------- */
.add-open-btn { animation-delay: 0.15s; }
.floating-btn-group.is-scrolled .floating-btn.keep-on-scroll:not(.top-btn) {
    opacity: 1;
    visibility: visible;
    transform: none;
    pointer-events: auto;
}
.floating-btn-group.is-scrolled .floating-btn.keep-on-scroll:not(.top-btn):hover { transform: translateY(-3px) scale(1.05); }
.floating-btn-group.is-scrolled .floating-btn.keep-on-scroll:not(.top-btn):active { transform: scale(0.94); }

/* ---------- 右键菜单 ---------- */
#menu-add    { --tone: 16, 185, 129; }
#menu-delete { --tone: 239, 68, 68; }
.context-menu .menu-item.is-danger:hover { color: #dc2626; }
[data-theme="dark"] .context-menu .menu-item.is-danger:hover { color: #fca5a5; }
.context-menu .menu-item .ctx-count {
    margin-left: auto;
    min-width: 20px;
    height: 18px;
    padding: 0 6px;
    box-sizing: border-box;
    border-radius: 9px;
    font-size: 0.68rem;
    font-weight: 800;
    line-height: 18px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    color: #fff;
    background: rgb(var(--tone));
    animation: popIn 0.3s var(--ease-spring);
}
.context-menu .menu-item .ctx-count:empty { display: none; }
.context-menu .menu-item.disabled .ctx-count {
    padding: 0;
    font-weight: 600;
    color: var(--text-secondary);
    background: transparent;
    animation: none;
}

/* ---------- 删除确认框 ---------- */
.dlg-stores { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 2px; }
.dlg-store {
    display: inline-flex;
    align-items: center;
    max-width: 160px;
    height: 24px;
    padding: 0 9px;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    border-radius: 6px;
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-primary);
    background: var(--hover-bg);
    border: 1px solid var(--glass-border);
    animation: optionIn 0.3s var(--ease-out) backwards;
}
.dlg-more { display: inline-flex; align-items: center; height: 24px; font-size: 0.76rem; color: var(--text-secondary); }
.dlg-warn { display: flex; align-items: center; gap: 6px; margin-top: 12px; font-size: 0.82rem; color: #ef4444; }
/* 删除用红色确认按钮 */
.g-dialog-icon.danger ~ .g-dialog-actions .g-dialog-btn.primary { background: #ef4444; border-color: #ef4444; }
.g-dialog-icon.danger ~ .g-dialog-actions .g-dialog-btn.primary:hover { background: #dc2626; border-color: #dc2626; }

/* ---------- 新增店铺弹窗 ---------- */
.am-head-titles .am-ed-sep,
.am-ed-sub .am-ed-sep { display: inline-block; vertical-align: middle; width: 3px; height: 3px; margin: 0 7px; }
.am-mono {
    display: block;
    overflow-wrap: anywhere;
    font-family: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--text-primary);
}
.am-empty.is-required { color: #dc2626; opacity: 0.9; }
.am-empty.is-required i { color: #ef4444; }
[data-theme="dark"] .am-empty.is-required { color: #fca5a5; }
.am-pop .am-ed-input.is-mono { font-family: ui-monospace, "SF Mono", "JetBrains Mono", Consolas, monospace; }
.am-col-chip.is-required { border-color: rgba(var(--accent-rgb), 0.45); }
.am-col-chip.is-required b { color: #fff; background: var(--accent-color); }

@media (max-width: 820px) {
    .filter-container { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
    .sid-k { width: 52px; }
}
