/* ============================================================
   在线选课系统 · 共享设计系统（苹果风格）
   设计令牌、按钮、表单、卡片、表格、分页、标签、提示
   ============================================================ */
:root {
    --blue: #007aff;
    --blue-dark: #0062cc;
    --indigo: #5856d6;
    --green: #34c759;
    --red: #ff3b30;
    --orange: #ff9500;
    --gray: #8e8e93;
    --gray-2: #aeaeb2;
    --gray-3: #c7c7cc;
    --gray-4: #d1d1d6;
    --gray-5: #e5e5ea;
    --gray-6: #f2f2f7;
    --ink: #1c1c1e;
    --ink-2: #3a3a3c;
    --ink-3: #636366;
    --bg: #f5f5f7;
    --card: #ffffff;
    --border: rgba(60, 60, 67, 0.12);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.18);
    --radius: 12px;
    --radius-sm: 8px;
    --sidebar-w: 236px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC",
        "Helvetica Neue", "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 13px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration: none; }
a:hover { opacity: 0.82; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; }

.icon { vertical-align: -3px; flex: none; }

/* ---------------- 按钮 ---------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 16px;
    border: 1px solid transparent; border-radius: 9px;
    font-size: 13px; font-weight: 500; cursor: pointer;
    background: var(--gray-5); color: var(--ink);
    transition: transform .08s ease, opacity .15s ease, background .15s ease, box-shadow .15s ease;
    white-space: nowrap; line-height: 1;
}
.btn:hover { opacity: 0.9; }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); opacity: 1; }
.btn-success { background: var(--green); color: #fff; }
.btn-danger { background: var(--red); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--gray-4); color: var(--ink-2); }
.btn-ghost:hover { background: var(--gray-6); opacity: 1; }
.btn-link { background: transparent; color: var(--blue); padding: 0 6px; height: auto; }
.btn-link:hover { opacity: 0.75; }
.btn-link.danger { color: var(--red); }
.btn-link.is-disabled {
    color: var(--ink-3); cursor: not-allowed; opacity: .55;
    display: inline-flex; align-items: center; gap: 2px;
}
.btn-link.is-disabled:hover { opacity: .55; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; }

/* ---------------- 表单 ---------------- */
.field { margin-bottom: 16px; }
.field > label {
    display: block; margin-bottom: 6px;
    font-size: 12.5px; font-weight: 600; color: var(--ink-2);
}
.field .req { color: var(--red); margin-left: 2px; }
.hint { margin-top: 5px; font-size: 11.5px; color: var(--ink-3); }
.form-input, select.xiala, select.form-input {
    width: 100%; height: 36px; padding: 0 12px;
    border: 1px solid var(--gray-4); border-radius: 9px;
    background: #fff; color: var(--ink); font-size: 13px;
    outline: none; transition: border-color .15s ease, box-shadow .15s ease;
    font-family: inherit;
}
textarea.form-input { height: auto; min-height: 74px; padding: 9px 12px; resize: vertical; line-height: 1.5; }
.form-input:focus, select.xiala:focus, select.form-input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.16);
}
.form-input:read-only, .form-input[readonly] { background: var(--gray-6); color: var(--ink-3); }
.form-row { display: flex; gap: 14px; }
.form-row .field { flex: 1; }
.form-actions { display: flex; gap: 10px; margin-top: 22px; }
.form-narrow { max-width: 560px; }

/* 开关式下拉（用户偏好 xiala 风格：圆角胶囊） */
select.xiala {
    appearance: none; -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238e8e93' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 10px center;
    padding-right: 30px;
}

/* ---------------- 卡片/面板 ---------------- */
.card {
    background: var(--card); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); border: 1px solid rgba(0, 0, 0, 0.03);
}
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 18px; border-bottom: 1px solid var(--border);
}
.card-head h3 { font-size: 14.5px; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.page-head { margin: 4px 0 16px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head h2 { font-size: 20px; letter-spacing: -0.2px; }
.page-head .sub { color: var(--ink-3); font-size: 12.5px; margin-top: 3px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------- 表格（统一行高，宽松易读、对齐不错位） ---------------- */
.table-wrap { width: 100%; overflow-x: auto; }
table.data {
    width: 100%; border-collapse: collapse;
    font-size: 12.5px;
}
table.data th {
    height: 38px; padding: 0 12px;
    background: var(--gray-6); color: var(--ink-2);
    font-weight: 600; text-align: left; white-space: nowrap;
    border-bottom: 1px solid var(--border);
}
table.data td {
    height: 40px; padding: 0 12px;
    border-bottom: 1px solid var(--gray-6);
    color: var(--ink-2); white-space: nowrap;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: #f8faff; }
table.data .c, table.data td.c, table.data th.c { text-align: center; }
table.data th.idx, table.data td.idx { width: 54px; min-width: 54px; color: var(--ink-3); }
table.data .num { font-variant-numeric: tabular-nums; }
table.data .main { color: var(--ink); font-weight: 500; }
table.data .muted { color: var(--ink-3); }
.two-line { max-width: 260px; white-space: normal; line-height: 1.35; padding-top: 5px; padding-bottom: 5px; }

/* ---------------- 标签/徽章/状态 ---------------- */
.tag {
    display: inline-flex; align-items: center; gap: 4px;
    height: 21px; padding: 0 9px; border-radius: 11px;
    font-size: 11px; font-weight: 600;
    background: var(--gray-5); color: var(--ink-3);
}
.tag.blue { background: rgba(0, 122, 255, 0.12); color: var(--blue); }
.tag.green { background: rgba(52, 199, 89, 0.14); color: #1d9a42; }
.tag.red { background: rgba(255, 59, 48, 0.12); color: var(--red); }
.tag.orange { background: rgba(255, 149, 0, 0.15); color: #c96f00; }
.tag.gray { background: var(--gray-5); color: var(--ink-3); }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot.green { background: var(--green); }
.dot.red { background: var(--red); }

/* ---------------- 时段切换标签 ---------------- */
.switch-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.switch-tabs a {
    display: inline-flex; align-items: center; gap: 6px;
    height: 30px; padding: 0 14px; border-radius: 15px;
    background: #fff; border: 1px solid var(--border);
    color: var(--ink-2); font-size: 12.5px; font-weight: 500;
    box-shadow: var(--shadow-sm);
}
.switch-tabs a.active { background: var(--blue); border-color: var(--blue); color: #fff; }

/* ---------------- 筛选条 ---------------- */
.filter-bar {
    display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap;
    margin-bottom: 16px;
}
.filter-bar .f-item label { display:block; font-size:11.5px; color: var(--ink-3); margin-bottom: 4px; font-weight: 600; }
.filter-bar select, .filter-bar input { min-width: 150px; }
.filter-bar .field.inline { display: flex; align-items: center; gap: 8px; margin-bottom: 0; }
.filter-bar .field.inline label { font-size:12.5px; color: var(--ink-2); font-weight: 600; margin-bottom: 0; }
.filter-bar .field.inline.grow { flex: 1; }
.filter-bar .field.inline.grow input { flex: 1; min-width: 160px; }
td.nowraps { white-space: nowrap; }
.list-foot { padding: 12px 16px; font-size: 12.5px; color: var(--ink-3); border-top: 1px solid var(--border); }

/* ---------------- 闪存提示 ---------------- */
.alert {
    display: flex; align-items: center; gap: 9px;
    padding: 11px 15px; border-radius: var(--radius-sm);
    margin-bottom: 14px; font-size: 13px;
    border: 1px solid transparent;
}
.alert.success { background: rgba(52, 199, 89, 0.12); color: #1d7a38; border-color: rgba(52,199,89,.25); }
.alert.error { background: rgba(255, 59, 48, 0.1); color: #c42d24; border-color: rgba(255,59,48,.22); }
.alert.info { background: rgba(0, 122, 255, 0.09); color: #0a5ec4; border-color: rgba(0,122,255,.2); }
.alert .icon { flex: none; }

/* ---------------- 空状态 ---------------- */
.empty {
    padding: 54px 20px; text-align: center; color: var(--ink-3);
}
.empty .icon { opacity: .35; margin-bottom: 10px; }
.empty p { margin: 4px 0; font-size: 13px; }

/* ---------------- 分页 ---------------- */
.pager { display: flex; align-items: center; gap: 5px; padding: 14px 16px; flex-wrap: wrap; }
.page-btn {
    min-width: 30px; height: 30px; padding: 0 8px;
    display: inline-flex; align-items: center; justify-content: center;
    border-radius: 8px; border: 1px solid var(--border);
    background: #fff; color: var(--ink-2); font-size: 12.5px;
}
.page-btn:hover { background: var(--gray-6); opacity: 1; }
.page-btn.active { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-btn.disabled { opacity: .4; pointer-events: none; }
.page-info { margin-left: auto; color: var(--ink-3); font-size: 12px; }
.pager-single { color: var(--ink-3); font-size: 12px; }

/* ---------------- 统计卡片 ---------------- */
.stat-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px; margin-bottom: 18px;
}
.stat-card {
    background: #fff; border-radius: var(--radius); padding: 16px 18px;
    box-shadow: var(--shadow-sm); border: 1px solid rgba(0,0,0,.03);
    display: flex; align-items: center; gap: 14px;
}
.stat-icon {
    width: 42px; height: 42px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center; color: #fff; flex: none;
}
.stat-icon.blue { background: linear-gradient(135deg, #2a93ff, #0a6cff); }
.stat-icon.indigo { background: linear-gradient(135deg, #6a73ff, #4b47c2); }
.stat-icon.green { background: linear-gradient(135deg, #3dd670, #28b451); }
.stat-icon.orange { background: linear-gradient(135deg, #ffb340, #ff8800); }
.stat-num { font-size: 22px; font-weight: 700; letter-spacing: -0.5px; line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--ink-3); }

/* ---------------- 描述列表（学生详情等） ---------------- */
dl.info-grid { display: grid; grid-template-columns: 130px 1fr; gap: 0; margin: 0; }
dl.info-grid dt {
    background: var(--gray-6); padding: 11px 16px; font-weight: 600;
    color: var(--ink-2); border-bottom: 1px solid #fff; font-size: 12.5px;
}
dl.info-grid dd { margin: 0; padding: 11px 16px; border-bottom: 1px solid var(--gray-6); }

/* 工具 */
.flex { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.mt8 { margin-top: 8px; } .mt16 { margin-top: 16px; } .mb16 { margin-bottom: 16px; }
.muted-text { color: var(--ink-3); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------------- 弹窗（苹果风模态框） ---------------- */
.modal-mask {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0, 0, 0, 0.32);
    -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
    display: none; align-items: center; justify-content: center;
    padding: 28px 16px;
}
.modal-mask.show { display: flex; animation: modalMaskIn .16s ease; }
.modal {
    background: #fff; border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 560px; max-width: 100%;
    max-height: 88vh; display: flex; flex-direction: column;
    overflow: hidden;
    animation: modalPopIn .2s cubic-bezier(.2, .8, .3, 1);
}
.modal.wide { width: 640px; }
.modal-head {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 20px 14px;
}
.modal-head h3 { font-size: 16px; letter-spacing: -0.2px; }
.modal-head .sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.modal-close {
    width: 30px; height: 30px; flex: none;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; border-radius: 50%; background: var(--gray-6);
    color: var(--ink-3); cursor: pointer; transition: background .15s ease;
}
.modal-close:hover { background: var(--gray-5); color: var(--ink); }
.modal-body {
    padding: 4px 20px 18px;
    overflow-y: auto; -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.modal-body > form { margin: 0; }
.modal-body .field:last-child { margin-bottom: 0; }
.modal-foot {
    display: flex; justify-content: flex-end; gap: 10px;
    padding: 13px 20px; border-top: 1px solid var(--border);
    background: #fbfbfd;
}
.modal-body .alert { margin-top: 2px; margin-bottom: 14px; }
.modal-readonly {
    min-height: 36px; display: flex; align-items: center;
    padding: 0 12px; border-radius: 9px;
    background: var(--gray-6); color: var(--ink-3);
    font-size: 13px; font-variant-numeric: tabular-nums;
}
@keyframes modalMaskIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalPopIn {
    from { opacity: 0; transform: translateY(14px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 600px) {
    .modal-mask { padding: 0; align-items: flex-end; }
    .modal { width: 100%; max-height: 94vh; border-radius: 16px 16px 0 0; }
}
