/* ==================== 全局样式 ==================== */
@import url('design-tokens.css');

/* ==================== 跳过导航链接（可访问性） ==================== */
.skip-to-content {
    position: absolute;
    top: -100%;
    left: 0;
    background: var(--accent);
    color: var(--text-on-accent);
    padding: var(--space-2) var(--space-4);
    z-index: 10001;
    font-weight: 600;
    text-decoration: none;
    border-radius: 0 0 var(--radius-md) 0;
    transition: top 0.2s;
}
.skip-to-content:focus {
    top: 0;
}

/* ==================== 全局顶部进度条 ==================== */
.global-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    z-index: 10001;
    background: var(--accent-muted);
    overflow: hidden;
}
.global-progress-fill {
    height: 100%;
    width: 0%;
    background: var(--accent);
    transition: width 0.3s ease;
}

/* ==================== 骨架屏 ==================== */
.skeleton-text {
    display: inline-block;
    width: 40px;
    height: 18px;
    background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-sm);
    vertical-align: middle;
}
@keyframes skeletonShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ==================== 全局错误边界 ==================== */
.global-error-boundary {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 17, 20, 0.92);
    z-index: 10002;
    display: none !important;
    align-items: center;
    justify-content: center;
}
.global-error-boundary.is-visible {
    display: flex !important;
}
/* 确保 hidden 不被其它 display 规则盖掉 */
[hidden] {
    display: none !important;
}
.error-boundary-content {
    text-align: center;
    color: var(--text-primary);
}
.error-boundary-content i {
    font-size: 48px;
    color: var(--warning);
    margin-bottom: var(--space-4);
}
.error-boundary-content p {
    font-size: var(--font-lg);
    margin-bottom: var(--space-5);
}
.btn-retry {
    background: var(--accent);
    color: var(--text-on-accent);
    border: none;
    padding: 10px 24px;
    border-radius: var(--radius-md);
    font-size: var(--font-md);
    cursor: pointer;
    font-weight: 500;
}

/* ==================== 焦点可见样式（可访问性） ==================== */
*:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
    box-shadow: 0 0 0 4px var(--accent-muted);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-sans);
    background: var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
}

::selection {
    background: var(--accent-muted);
    color: var(--text-primary);
}

/* ==================== 动画 ====================  */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ==================== 导航栏 ==================== */
.navbar {
    background: var(--bg-elevated);
    display: flex;
    flex-direction: column;
    padding: var(--space-4) var(--space-5);
    position: fixed;
    width: 100%;
    top: 0;
    z-index: 1000;
    box-shadow: none;
    border-bottom: 1px solid var(--border);
}

.navbar-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.navbar-row-top {
    margin-bottom: var(--space-3);
    position: relative;
}

.navbar-row-bottom {
    padding-top: var(--space-3);
    border-top: 1px solid var(--border);
}

.navbar-brand .logo {
    color: var(--text-primary);
    text-decoration: none;
    font-size: var(--font-xl);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: color 0.15s ease;
    white-space: nowrap;
    text-shadow: none;
}

.navbar-brand .logo:hover {
    transform: none;
    color: var(--accent);
    text-shadow: none;
}

.navbar-brand .logo i {
    font-size: var(--font-xl);
    color: var(--accent);
}

.navbar-menu {
    flex: 1;
    display: flex;
    justify-content: center;
    /* 允许内部 nav-links 换行，避免末尾菜单项（如"游戏日志"/"节点代理"）在窄屏下被挤出视口 */
    overflow-x: visible;
    overflow-y: visible;
    scrollbar-width: none;
    margin: 0 20px;
}

.navbar-menu::-webkit-scrollbar {
    display: none;
}

.nav-links {
    display: flex;
    gap: 6px;
    list-style: none;
    /* 允许换行：菜单项过多时自动换到第二行，保证所有菜单始终可见 */
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
}

.nav-links li {
    position: relative;
    flex-shrink: 0;
}

.nav-links a {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: var(--font-md);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
    font-weight: 500;
    border: 1px solid transparent;
}

.nav-links a:hover {
    background: var(--accent-muted);
    color: var(--accent);
    transform: none;
    border-color: var(--accent-border);
    box-shadow: none;
}

.nav-links a.active {
    background: var(--accent-muted);
    color: var(--accent);
    font-weight: 600;
    box-shadow: none;
    border-color: var(--accent-border);
}

.nav-links a i {
    font-size: 14px;
}

/* 「更多」下拉 */
.nav-more {
    position: relative;
}

.nav-more-toggle {
    color: var(--text-secondary);
    background: transparent;
    font-size: var(--font-md);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 500;
    font-family: inherit;
    white-space: nowrap;
}

.nav-more-toggle:hover,
.nav-more.open .nav-more-toggle,
.nav-more.has-active .nav-more-toggle {
    background: var(--accent-muted);
    color: var(--accent);
    border-color: var(--accent-border);
}

.nav-more-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 180px;
    margin: 0;
    padding: var(--space-2);
    list-style: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-overlay);
    z-index: 1100;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-more-menu[hidden] {
    display: none !important;
}

.nav-more-menu a {
    width: 100%;
    justify-content: flex-start;
}

/* 移动端汉堡菜单内：更多项平铺 */
@media (max-width: 1400px) {
    .navbar-row-bottom .nav-more-toggle {
        display: none;
    }
    .navbar-row-bottom .nav-more-menu {
        position: static;
        display: flex !important;
        box-shadow: none;
        border: none;
        padding: 0;
        min-width: 0;
        background: transparent;
    }
    .navbar-row-bottom .nav-more-menu[hidden] {
        display: flex !important;
    }
}

/* 禁用导航（脚本未加载完成时） */
.nav-links.disabled a {
    pointer-events: none;
    opacity: 0.6;
    filter: grayscale(30%);
}

/* 用户信息 */
.navbar-user {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-shrink: 0;
}

.user-name {
    font-size: var(--font-md);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    white-space: nowrap;
    transition: border-color 0.15s ease;
}

.user-name:hover {
    background: var(--surface-2);
    border-color: var(--border-strong);
}

.user-name i {
    font-size: var(--font-lg);
    color: var(--accent);
}

.btn-logout {
    background: transparent;
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-4);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-md);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
    text-decoration: none;
    font-weight: 500;
    white-space: nowrap;
    box-shadow: none;
}

.btn-logout:hover {
    background: rgba(232, 93, 93, 0.12);
    color: var(--danger);
    border-color: var(--danger);
    transform: none;
    box-shadow: none;
}

.btn-logout i {
    font-size: var(--font-md);
}

/* 顶栏次要链接（如「新版」） */
.btn-new-version {
    margin-left: var(--space-2);
    padding: var(--space-1) var(--space-3);
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: var(--font-xs);
    display: inline-flex;
    align-items: center;
    gap: var(--space-1);
}

.btn-new-version:hover {
    color: var(--accent);
}

/* ==================== 容器 ==================== */
.container {
    max-width: var(--container-max);
    margin: var(--navbar-offset) auto var(--space-5);
    padding: var(--space-5) var(--space-6);
}

/* ==================== 卡片通用样式 ==================== */
.card {
    background: var(--surface);
    padding: var(--space-5);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-5);
    box-shadow: none;
    backdrop-filter: none;
    border: 1px solid var(--border);
    transition: border-color 0.15s ease;
}

.card:hover {
    transform: none;
    box-shadow: none;
    border-color: var(--border-strong);
}

.card-title {
    font-size: var(--font-lg);
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    border-bottom: 1px solid var(--border);
    padding-bottom: var(--space-3);
}

.card-title i {
    color: var(--accent);
}

/* ==================== 表单控件 ==================== */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    color: #e0e0e0;
    margin-bottom: 6px;
    font-weight: 500;
    font-size: 13px;
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #e0e0e0;
    font-size: 14px;
    height: 40px;
    transition: all 0.3s;
    box-sizing: border-box;
}

.form-control:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--surface-2);
    box-shadow: 0 0 0 3px var(--accent-muted);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
    background: var(--surface-2);
    color: var(--text-primary);
    font-weight: 500;
    height: 40px;
    padding: 10px 14px;
}

/* 并发任务数下拉框特殊样式 - 确保文字显示完整 */
#train-concurrent {
    min-width: 280px;
    width: 100%;
}

/* 下拉菜单选项样式 */
select.form-control option {
    background: #0f0f1e;  /* 更深的背景 */
    color: var(--accent);
    padding: 10px;
    font-weight: 500;
}

select.form-control option:hover {
    background: #1a1a2e;
    color: #ffffff;
}

/* ==================== 按钮样式 ==================== */
.btn {
    padding: 10px 20px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: var(--font-md);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
    text-decoration: none;
    text-align: center;
    height: 40px;
    min-width: 90px;
    /* 无变体时的可读默认态（避免落到浏览器浅色按钮） */
    background: var(--surface-2);
    color: var(--text-primary);
}

.btn:hover {
    background: var(--border);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

.btn-primary {
    background: var(--accent);
    color: var(--text-on-accent);
    border-color: transparent;
}

.btn-primary:hover {
    background: #2ec4e8;
    color: var(--text-on-accent);
    border-color: transparent;
    filter: brightness(1.05);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-primary);
    border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
    background: var(--border);
    color: var(--text-primary);
    border-color: var(--text-muted);
}

.btn-success {
    background: var(--success);
    color: var(--text-on-accent);
    border-color: transparent;
}

.btn-success:hover {
    background: #36b87e;
    color: var(--text-on-accent);
    border-color: transparent;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: transparent;
}

.btn-danger:hover {
    background: #d44f4f;
    color: #fff;
    border-color: transparent;
}

.btn-warning {
    background: var(--warning);
    color: var(--text-on-accent);
    border-color: transparent;
}

.btn-warning:hover {
    filter: brightness(1.05);
    color: var(--text-on-accent);
}

.btn-info {
    background: var(--accent-muted);
    color: var(--accent);
    border: 1px solid var(--accent-border);
}

.btn-info:hover {
    background: rgba(61, 220, 255, 0.2);
    color: var(--accent);
    border-color: var(--accent);
}

.btn-sm {
    height: 32px;
    min-width: 64px;
    padding: 4px 12px;
    font-size: var(--font-sm);
}

/* 禁用：保持轮廓可读，不用大幅降透明度 */
.btn:disabled,
.btn[disabled],
.btn.is-disabled {
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border-color: var(--border);
    opacity: 1;
    cursor: not-allowed;
    filter: none;
}

.btn-primary:disabled,
.btn-success:disabled,
.btn-danger:disabled,
.btn-warning:disabled {
    background: var(--surface-2);
    color: var(--text-muted);
    border-color: var(--border);
}

.pagination-container .btn,
.pager-bar .btn {
    min-width: auto;
}

/* ==================== 表格样式 ==================== */
.table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.table thead {
    background: var(--surface-2);
}

.table th {
    padding: var(--space-3) var(--space-4);
    text-align: left;
    color: var(--text-secondary);
    font-weight: 600;
    border-bottom: 1px solid var(--border);
    font-size: var(--font-sm);
}

/* 表头居中 */
.table th[style*="text-align: center"] {
    text-align: center !important;
}

.table td {
    padding: 12px 15px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #e0e0e0;
    vertical-align: middle;
    white-space: nowrap;
}

.table tbody tr {
    transition: all 0.3s ease;
}

.table tbody tr:hover {
    background: rgba(61, 220, 255, 0.08);
    transform: translateX(2px);
    box-shadow: -2px 0 0 0 rgba(61, 220, 255, 0.5), 0 1px 4px rgba(61, 220, 255, 0.1);
}

/* ==================== 徽章样式 ==================== */
.badge {
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    display: inline-block;
}

.badge-success {
    background: #38ef7d;
    color: #000;
}

.badge-danger {
    background: #f44336;
    color: #fff;
}

.badge-warning {
    background: #ff9800;
    color: #000;
}

.badge-info {
    background: var(--accent);
    color: #000;
}

.badge-secondary {
    background: #6c757d;
    color: #fff;
}

.badge-offline {
    background: #fd7e14;
    color: #fff;
}

/* ==================== 进度条 ==================== */
.progress-bar {
    width: 100%;
    height: 25px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
    position: relative;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.progress-fill::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

/* ==================== 提示框 ==================== */
.alert {
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    margin-bottom: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-3);
    border: 1px solid var(--border);
}

.alert-info {
    background: var(--accent-muted);
    border-left: 3px solid var(--accent);
    color: var(--text-secondary);
}

.alert-success {
    background: rgba(62, 207, 142, 0.12);
    border-left: 3px solid var(--success);
    color: var(--success);
}

.alert-warning {
    background: rgba(232, 168, 56, 0.12);
    border-left: 3px solid var(--warning);
    color: var(--warning);
}

.alert-danger {
    background: rgba(232, 93, 93, 0.12);
    border-left: 3px solid var(--danger);
    color: var(--danger);
}

/* ==================== 通用面板工具类（替代高频内联 style） ==================== */
.panel {
    padding: var(--space-4);
    background: var(--surface-2);
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    margin-bottom: var(--space-4);
}

.panel-tint {
    background: var(--accent-muted);
    border-color: var(--accent-border);
}

.panel-title {
    color: var(--text-primary);
    margin-bottom: var(--space-3);
    font-size: var(--font-md);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.panel-title i {
    color: var(--accent);
}

.hint {
    color: var(--text-muted);
    font-size: var(--font-xs);
    font-weight: 400;
}

.hint-accent {
    color: var(--accent);
    font-size: var(--font-xs);
}

.mono-chip {
    background: var(--bg-base);
    padding: var(--space-1) var(--space-2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: var(--font-sm);
}

.text-ok { color: var(--success); }
.text-warn { color: var(--warning); }
.text-danger { color: var(--danger); }
.text-muted { color: var(--text-muted); }

.empty-cell {
    text-align: center;
    color: var(--text-muted);
    padding: var(--space-5);
}


/* ==================== 布局/间距工具类（内联 style 迁移） ==================== */
.mb-0 { margin-bottom: 0 !important; }
.mb-4 { margin-bottom: var(--space-4); }
.mb-5 { margin-bottom: var(--space-5); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.m-0 { margin: 0 !important; }
.mr-2 { margin-right: var(--space-2); }
.ml-2 { margin-left: var(--space-2); }
.mt-2 { margin-top: var(--space-2); }
.w-full { width: 100%; }
.text-center { text-align: center; }
.text-accent { color: var(--accent); }
.field-hint {
    color: var(--text-muted);
    font-size: var(--font-sm);
    margin-top: var(--space-1);
    display: block;
}
.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.row-gap {
    display: flex;
    gap: var(--space-2);
    align-items: center;
}
.row-gap-lg {
    display: flex;
    gap: var(--space-3);
    align-items: center;
    margin-bottom: var(--space-4);
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }
.grid-3-auto {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr auto;
    gap: var(--space-4);
    align-items: end;
}
.min-w-100 { min-width: 100px; }
.min-w-150 { min-width: 150px; }
.min-w-200 { min-width: 200px; }
.w-120 { width: 120px; }
.w-150 { width: 150px; }
.btn-compact { padding: 5px 12px; font-size: var(--font-xs); }
.pad-sm { padding: var(--space-2) var(--space-3); }
.label-sm { font-size: var(--font-sm); margin-bottom: var(--space-1); }
.table-fixed { table-layout: fixed; }
.col-w-8 { width: 8%; }
.col-w-10 { width: 10%; }
.col-w-11 { width: 11%; }
.col-w-12 { width: 12%; }
.col-w-15 { width: 15%; }
.col-w-18 { width: 18%; }
.col-w-20 { width: 20%; }
.col-w-25 { width: 25%; }
.col-w-30 { width: 30%; }
.col-w-35 { width: 35%; }
.col-nowrap { white-space: nowrap; }
.stat-tile {
    padding: var(--space-4);
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border);
    background: var(--surface-2);
}
.stat-tile-ok {
    background: rgba(62, 207, 142, 0.1);
    border-color: rgba(62, 207, 142, 0.35);
}
.stat-tile-info {
    background: var(--accent-muted);
    border-color: var(--accent-border);
}
.stat-tile-warn {
    background: rgba(232, 168, 56, 0.1);
    border-color: rgba(232, 168, 56, 0.35);
}
.stat-tile-danger {
    background: rgba(232, 93, 93, 0.1);
    border-color: rgba(232, 93, 93, 0.35);
}
.panel-soft {
    margin-top: var(--space-3);
    padding: var(--space-3);
    background: var(--accent-muted);
    border-radius: var(--radius-md);
    border: 1px solid var(--accent-border);
}
.section-accent {
    color: var(--accent);
    font-size: var(--font-md);
    margin-bottom: var(--space-3);
    font-weight: 600;
}
.nav-sep {
    padding: 0 var(--space-3);
    border-left: 2px solid var(--border);
}
.input-disabled-look {
    background: rgba(0,0,0,0.3);
    cursor: not-allowed;
    max-width: 250px;
}
.pager-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: var(--space-4);
    padding: 0 var(--space-2);
}

/* ==================== 加载动画 ==================== */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: var(--accent);
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ==================== Tab切换隐藏 ==================== */
.tab-pane {
    display: none;
    animation: fadeIn 0.5s;
}

.tab-pane.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== 响应式 ==================== */
@media (max-width: 1440px) {
    .navbar {
        padding: 18px 15px;
    }
    
    .navbar-menu {
        margin: 0 8px;
    }
    
    .nav-links {
        gap: 3px;
    }
    
    .nav-links a {
        padding: 10px 9px;
        font-size: 14px;
    }
    
    .navbar-user {
        min-width: 340px;
    }
}

@media (max-width: 1280px) {
    .navbar-brand .logo {
        font-size: 20px;
        min-width: 140px;
    }
    
    .navbar-menu {
        margin: 0 6px;
    }
    
    .nav-links {
        gap: 2px;
    }
    
    .nav-links a {
        font-size: 14px;
        padding: 9px 8px;
    }
    
    .navbar-user {
        min-width: 280px;
    }
    
    .container {
        padding: 20px 30px;
    }
}

/* 中间尺寸优化：隐藏搜索框、缩小用户区域 */
@media (max-width: 1400px) {
    /* 隐藏全局搜索框 */
    .global-search-wrapper {
        display: none !important;
    }
    
    .navbar-user {
        min-width: 200px;
        gap: 10px;
    }
    
    .user-name {
        padding: 6px 12px;
        font-size: 13px;
    }
}

@media (max-width: 1400px) {
    .container {
        padding: 15px 20px;
        margin-top: 90px;
    }
    
    .navbar {
        padding: 15px 12px;
        min-height: 65px;
    }
    
    .navbar-brand .logo {
        font-size: 18px;
        min-width: 120px;
    }
    
    .navbar-menu {
        margin: 0 5px;
    }
    
    .nav-links a {
        font-size: 13px;
        padding: 8px 7px;
    }
    
    .user-name {
        font-size: 13px;
        padding: 6px 10px;
    }
    
    .btn-logout {
        font-size: 13px;
        padding: 7px 14px;
    }
    
    .navbar-user {
        min-width: auto;
        margin-right: 0;
    }
    
    /* 表格响应式 */
    .table {
        font-size: 12px;
    }
    
    .table th,
    .table td {
        padding: 10px 8px;
    }
    
    /* 表单响应式 */
    .form-row,
    .form-row-training {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
    
    .form-group-btn {
        grid-column: 1 / -1;
    }
    
    /* 状态卡片 */
    .status-card {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .navbar {
        flex-wrap: wrap;
        padding: 12px 10px;
        min-height: auto;
    }
    
    .navbar-brand {
        order: 1;
        flex: 0 0 auto;
    }
    
    .navbar-brand .logo {
        font-size: 16px;
        min-width: 100px;
    }
    
    .navbar-user {
        order: 2;
        flex: 0 0 auto;
        min-width: auto;
        margin-right: 0;
        margin-left: auto;
    }
    
    .user-name {
        font-size: 12px;
        padding: 5px 8px;
    }
    
    .btn-logout {
        font-size: 12px;
        padding: 6px 12px;
    }
    
    .navbar-menu {
        order: 3;
        width: auto;
        margin: 0;
    }

    .nav-links {
        flex-wrap: nowrap;
        gap: 0;
        justify-content: flex-start;
    }
    
    .nav-links a {
        padding: 8px 10px;
        font-size: 13px;
    }
    
    .container {
        margin-top: 140px;
        padding: 15px;
    }
    
    .card {
        padding: 15px;
        margin-bottom: 15px;
    }
    
    .card-title {
        font-size: 18px;
    }
    
    /* 表单全部单列 */
    .form-row,
    .form-row-training {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    /* 状态卡片 */
    .status-card {
        grid-template-columns: repeat(2, 1fr);
        gap: 15px;
    }
    
    /* 表格滚动 */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table {
        min-width: unset;
    }
}

@media (max-width: 480px) {
    .navbar-brand .logo {
        font-size: 14px;
        min-width: 80px;
    }
    
    .nav-links a {
        font-size: 12px;
        padding: 7px 8px;
    }
    
    .user-name span {
        display: none;
    }
    
    .btn-logout {
        padding: 6px 10px;
    }
    
    .btn-logout i {
        margin-right: 0;
    }
    
    .btn-logout .fa-sign-out-alt + * {
        display: none;
    }
    
    .status-card {
        grid-template-columns: 1fr;
    }
    
    .card-title {
        font-size: 16px;
    }
    
    .btn {
        font-size: 13px;
        padding: 8px 16px;
    }
}

/* ==================== 轻量进度提示（非全屏） ==================== */
.progress-toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9000;
    max-width: min(360px, calc(100vw - 48px));
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(18, 20, 28, 0.95);
    border: 1px solid rgba(61, 220, 255, 0.25);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    line-height: 1.45;
    pointer-events: auto;
}

.progress-toast-spinner {
    color: var(--accent-cyan, #3ddcff);
    margin-top: 2px;
    flex-shrink: 0;
}

.progress-toast-text {
    flex: 1;
    min-width: 0;
}

/* ==================== 全局加载提示（右下角，非全屏） ==================== */
.global-loader {
    position: fixed;
    inset: auto 24px 24px auto;
    width: auto;
    max-width: min(380px, calc(100vw - 48px));
    background: rgba(18, 20, 28, 0.96);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    border: 1px solid rgba(61, 220, 255, 0.28);
    border-radius: 12px;
    box-shadow: 0 10px 36px rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 14px 16px;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    pointer-events: auto;
}

.global-loader.show {
    opacity: 1;
    visibility: visible;
}

.loader-content {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    gap: 12px;
    text-align: left;
}

.loader-spinner,
.loading-spinner {
    width: 22px;
    height: 22px;
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--accent-cyan, var(--accent));
    border-radius: 50%;
    animation: spin 1s linear infinite;
    flex-shrink: 0;
    margin-top: 2px;
}

.loader-text {
    color: rgba(255, 255, 255, 0.88);
    font-size: 13px;
    line-height: 1.45;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}
