/*
 * 管理模式（#results-div）：管理用户 / 管理课程 / 管理竞赛 / 数据导出
 * 与「星舱」驾驶舱同一套设计语言：卡片 + 分段导航 + 工具栏 + 现代表格 + 悬浮分页
 * 本文件加载在 exploration.css 之后，负责把旧版深蓝表格彻底换成当前风格
 */

#results-div {
    /* 亮色 */
    --adm-ink: #1f3346;
    --adm-ink-muted: #5d7288;
    --adm-surface: #ffffff;
    --adm-surface-2: #f1f6fb;
    --adm-border: #cfdcea;
    --adm-border-soft: rgba(31, 51, 70, 0.08);
    --adm-head: #e9f2fa;
    --adm-accent: #1f7fc4;
    --adm-accent-soft: rgba(31, 127, 196, 0.1);
    --adm-accent-ink: #ffffff;
    --adm-hover: rgba(31, 127, 196, 0.07);
    --adm-shadow: 0 14px 34px rgba(23, 48, 74, 0.12);
    --adm-radius: 16px;

    box-sizing: border-box;
    color: var(--adm-ink);
}

html[data-theme='dark'] #results-div {
    --adm-ink: #e8f0f8;
    --adm-ink-muted: #9db4ca;
    --adm-surface: #142941;
    --adm-surface-2: rgba(36, 66, 96, 0.55);
    --adm-border: #2f4d6b;
    --adm-border-soft: rgba(140, 180, 214, 0.12);
    --adm-head: rgba(36, 66, 96, 0.85);
    --adm-accent: #57c9f1;
    --adm-accent-soft: rgba(87, 201, 241, 0.14);
    --adm-accent-ink: #062234;
    --adm-hover: rgba(87, 201, 241, 0.1);
    --adm-shadow: 0 16px 38px rgba(0, 0, 0, 0.34);
}

/* 页头 + 分段导航 + 卡片的外壳：由 shipe.renderAdminShell 一次性创建
   底部留白给画布定位的悬浮分页，避免压住最后一行数据 */
#results-div .adm-shell {
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    gap: 14px;
    height: 100%;
    min-height: 0;
    padding: 6px 8px 46px;
}

/* ---------------- 页头 ---------------- */
#results-div .adm-head {
    flex: none;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    padding: 2px 2px 0;
}

#results-div .adm-eyebrow {
    margin: 0 0 4px;
    font-size: 12px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--adm-ink-muted);
}

#results-div .adm-title {
    margin: 0;
    font-size: 24px;
    line-height: 1.25;
    font-weight: 700;
    color: var(--adm-ink);
}

#results-div .adm-sub {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.6;
    color: var(--adm-ink-muted);
}

#results-div .adm-head-side {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: none;
}

#results-div .adm-chip {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--adm-border);
    border-radius: 999px;
    background: var(--adm-surface);
    color: var(--adm-ink-muted);
    font-size: 12.5px;
    white-space: nowrap;
}

#results-div .adm-refresh {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 34px;
    padding: 0 15px;
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    background: var(--adm-surface);
    color: var(--adm-accent);
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

#results-div .adm-refresh:hover {
    border-color: var(--adm-accent);
    background: var(--adm-accent-soft);
}

/* ---------------- 主分段导航（原图标标签） ---------------- */
#results-div #results-toggleTag.message-tag {
    flex: none;
    position: static;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: auto !important;
    margin: 0;
    padding: 0;
    height: auto;
    overflow: visible;
    list-style: none;
    border: 0;
    background: none;
}

#results-div #results-toggleTag li {
    position: static;
    float: none;
    width: auto;
    height: auto;
    margin: 0 !important;
    padding: 0 !important;
    background: none;
    border: 0;
}

#results-div #results-toggleTag li a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 40px;
    padding: 0 18px;
    border: 1px solid var(--adm-border);
    border-radius: 999px;
    background: var(--adm-surface);
    color: var(--adm-ink-muted) !important;
    font-size: 13.5px;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#results-div #results-toggleTag li a img {
    display: none;
}

#results-div #results-toggleTag li a::after {
    content: attr(data-title);
}

#results-div #results-toggleTag li a:hover {
    border-color: var(--adm-accent);
    color: var(--adm-accent) !important;
}

#results-div #results-toggleTag li.active a,
#results-div #results-toggleTag li a.is-active {
    border-color: transparent;
    background: var(--adm-accent);
    color: var(--adm-accent-ink) !important;
    box-shadow: 0 8px 18px rgba(31, 127, 196, 0.26);
}

/* ---------------- 卡片 ---------------- */
#results-div .message-block.rectPanel {
    flex: 1 1 auto;
    min-height: 0;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: auto;
    border: 1px solid var(--adm-border);
    border-radius: var(--adm-radius);
    background: var(--adm-surface);
    box-shadow: var(--adm-shadow);
}

/* 旧版九宫格贴图装饰全部去掉 */
#results-div .rectPanel::before,
#results-div .rectPanel::after {
    content: none !important;
    display: none !important;
}

#results-div .rectPanelInner {
    display: block;
    height: auto !important;
    padding: 0;
}

#results-div .cascade-block,
#results-div .form-auto-v-center-wrap,
#results-div .form-auto-v-center {
    position: static !important;
    display: block;
    width: 100%;
    height: auto !important;
    margin: 0;
    overflow: visible;
}

#results-div .form.common.cascade.form-auto-v-content {
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: 100% !important;
    max-width: none;
    margin: 0;
    padding: 16px 18px 18px;
    box-sizing: border-box;
}

/* ---------------- 子页签 ---------------- */
#results-div ul.tab-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0 0 2px;
    list-style: none;
    border: 0;
}

#results-div ul.tab-row li {
    position: static;
    float: none;
    width: auto;
    height: auto;
    margin: 0 !important;
    padding: 0 !important;
    border: 0;
    background: none;
}

#results-div ul.tab-row li a {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 14px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: var(--adm-surface-2);
    color: var(--adm-ink-muted) !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

#results-div ul.tab-row li a:hover {
    color: var(--adm-accent) !important;
}

#results-div ul.tab-row li.active a {
    border-color: var(--adm-border);
    background: var(--adm-surface);
    color: var(--adm-accent) !important;
    box-shadow: inset 0 0 0 1px var(--adm-accent-soft);
}

/* ---------------- 命令工具栏 ---------------- */
#results-div .admin-page {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0;
    padding: 0;
    color: var(--adm-ink-muted);
    font-size: 13px;
}

#results-div .admin-page .set-cmd {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 36px;
    padding: 0 15px;
    border: 1px solid var(--adm-border);
    border-radius: 10px;
    background: var(--adm-surface-2);
    color: var(--adm-ink) !important;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}

#results-div .admin-page .set-cmd::before {
    content: '+';
    display: inline-grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 6px;
    background: var(--adm-accent-soft);
    color: var(--adm-accent);
    font-size: 13px;
    font-weight: 700;
    line-height: 1;
}

#results-div .admin-page .set-cmd:hover {
    border-color: var(--adm-accent);
    color: var(--adm-accent) !important;
}

/* 旧 PNG 小图标不再出现，统一用 CSS 圆角按钮 */
#results-div .admin-page img.admin-icon {
    display: none;
}

/* ---------------- 表格 ---------------- */
#results-div table.data-list {
    width: 100%;
    max-width: none;
    margin: 0;
    border-collapse: separate;
    border-spacing: 0;
    border: 0;
    color: var(--adm-ink);
    font-size: 14px;
}

#results-div table.data-list tr {
    height: auto;
    background: none;
}

#results-div table.data-list th {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 11px 14px;
    background: var(--adm-head);
    color: var(--adm-ink-muted) !important;
    font-size: 12.5px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-align: left;
    white-space: nowrap;
    border-bottom: 1px solid var(--adm-border);
}

#results-div table.data-list th:first-child {
    border-top-left-radius: 10px;
}

#results-div table.data-list th:last-child {
    border-top-right-radius: 10px;
}

#results-div table.data-list td {
    padding: 11px 14px;
    color: var(--adm-ink) !important;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--adm-border-soft);
}

#results-div table.data-list th:first-child,
#results-div table.data-list td:first-child {
    width: 56px;
    text-align: center;
    color: var(--adm-ink-muted) !important;
    font-variant-numeric: tabular-nums;
}

#results-div table.data-list tr.alternate {
    background: transparent;
}

#results-div table.data-list tbody tr:hover,
#results-div table.data-list tr:hover {
    background: var(--adm-hover);
}

#results-div table.data-list tr:last-child td {
    border-bottom: 0;
}

/* 空状态 / 未开放提示 */
#results-div table.data-list td[colspan] {
    padding: 46px 16px;
    color: var(--adm-ink-muted) !important;
    text-align: center;
    font-size: 13.5px;
}

/* ---------------- 行内操作 ---------------- */
#results-div table.data-list td a.admin-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    margin: 2px 4px 2px 0;
    padding: 0 12px;
    border: 1px solid var(--adm-border);
    border-radius: 8px;
    background: var(--adm-surface);
    color: var(--adm-accent) !important;
    font-size: 12.5px;
    text-decoration: none;
    vertical-align: middle;
    white-space: nowrap;
}

#results-div table.data-list td a.admin-link:hover {
    border-color: var(--adm-accent);
    background: var(--adm-accent-soft);
}

#results-div table.data-list td a.admin-link img.admin-icon {
    width: 14px;
    height: 14px;
    margin: 0;
    opacity: 0.75;
}

/* ---------------- 分页（画布定位的兄弟节点） ---------------- */
#results-page .messages-page {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 5px 8px;
    border: 1px solid var(--adm-border, #cfdcea);
    border-radius: 999px;
    background: var(--adm-surface, #fff);
    box-shadow: 0 10px 24px rgba(23, 48, 74, 0.18);
}

html[data-theme='dark'] #results-page .messages-page {
    border-color: #2f4d6b;
    background: #142941;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.34);
}

#results-page a.page {
    display: inline-grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 999px;
    color: var(--adm-accent, #1f7fc4);
    text-decoration: none;
}

html[data-theme='dark'] #results-page a.page {
    color: #57c9f1;
}

#results-page a.page img {
    display: none;
}

#results-page a.page.prev::before {
    content: '‹';
    font-size: 20px;
    line-height: 1;
}

#results-page a.page.next::before {
    content: '›';
    font-size: 20px;
    line-height: 1;
}

#results-page a.page:hover {
    background: var(--adm-accent-soft, rgba(31, 127, 196, 0.1));
}

#results-page .pageNumber {
    min-width: 62px;
    padding: 0 6px;
    color: var(--adm-ink-muted, #5d7288) !important;
    font-size: 12.5px;
    line-height: 30px;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

#results-page .pageNumber b {
    color: var(--adm-ink, #1f3346);
}

html[data-theme='dark'] #results-page .pageNumber b {
    color: #e8f0f8;
}

/* ---------------- 响应式 ---------------- */
@media (max-width: 1100px) {
    #results-div .adm-head {
        align-items: flex-start;
        flex-direction: column;
        gap: 10px;
    }

    #results-div .adm-title {
        font-size: 21px;
    }
}

@media (max-width: 760px) {
    #results-div .adm-shell {
        padding: 4px 4px 0;
        gap: 10px;
    }

    #results-div .form.common.cascade.form-auto-v-content {
        padding: 12px 12px 14px;
    }

    #results-div #results-toggleTag li a {
        height: 36px;
        padding: 0 13px;
        font-size: 12.5px;
    }

    #results-div table.data-list th,
    #results-div table.data-list td {
        padding: 9px 10px;
        font-size: 13px;
    }
}
