/* 张老师数学 · 一对一/一对二排课系统 共享样式 */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif; background: #f2f6fb; color: #22344d; font-size: 14px; }

/* ---------- 通用按钮 ---------- */
.btn {
  display: inline-block; padding: 8px 18px; border: 1px solid #b9cde8; border-radius: 6px;
  background: #fff; color: #1a5fb4; font-size: 14px; cursor: pointer; transition: all .15s;
}
.btn:hover { border-color: #2f6fdb; background: #eaf3ff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: #2f6fdb; border-color: #2f6fdb; color: #fff; }
.btn-primary:hover { background: #1a5fb4; }
.btn.danger { color: #d95f5f; border-color: #e8b0b0; }
.btn.danger:hover { background: #fff0f0; border-color: #d95f5f; }
.btn-block { width: 100%; }
.btn-sm { padding: 4px 10px; font-size: 13px; }

a { color: #2f6fdb; cursor: pointer; text-decoration: none; margin-right: 12px; }
a:hover { text-decoration: underline; }
a.danger { color: #d95f5f; }

input, select, textarea {
  padding: 8px 12px; border: 1px solid #c7d7ea; border-radius: 6px; font-size: 14px;
  background: #fff; color: #22344d; outline: none; min-width: 180px;
}
input:focus, select:focus, textarea:focus { border-color: #2f6fdb; box-shadow: 0 0 0 3px rgba(47,111,219,.12); }

/* ---------- 登录页 ---------- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1a3a66 0%, #2f6fdb 100%); }
.login-card { width: 380px; background: #fff; border-radius: 14px; padding: 40px 36px; box-shadow: 0 20px 60px rgba(18,53,91,.35); }
.login-brand { font-size: 28px; font-weight: bold; color: #12355b; text-align: center; }
.login-sub { font-size: 15px; color: #7a8694; text-align: center; margin: 6px 0 26px; }
.login-form input { width: 100%; margin-bottom: 14px; }
.login-tip { text-align: center; color: #d95f5f; margin-top: 12px; min-height: 20px; font-size: 13px; }
.login-tip.err { color: #d95f5f; }
.login-hint { margin-top: 18px; font-size: 12px; color: #9aa7b5; text-align: center; }

/* ---------- 布局 ---------- */
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 210px; background: #12355b; color: #fff; flex-shrink: 0; display: flex; flex-direction: column; }
.side-brand { padding: 24px 20px 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-title { font-size: 20px; font-weight: bold; }
.side-sub { font-size: 12px; color: #a8c0dd; margin-top: 4px; }
.menu { flex: 1; padding: 12px 0; }
.menu a { display: block; padding: 11px 22px; color: #c8d9ee; font-size: 14px; border-left: 3px solid transparent; }
.menu a:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.menu a.active { background: rgba(47,111,219,.35); border-left-color: #5b9bff; color: #fff; font-weight: 600; }
.side-user { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.1); font-size: 13px; }
.side-user a { color: #ffc98a; display: block; margin-top: 6px; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { background: #fff; padding: 14px 24px; border-bottom: 1px solid #e4ecf6; display: flex; justify-content: space-between; align-items: center; }
.topbar-title { font-size: 17px; font-weight: 600; color: #12355b; }
.topbar-right a { font-size: 13px; }
.content { padding: 22px 24px; }

/* ---------- 面板/卡片 ---------- */
.panel { background: #fff; border: 1px solid #e4ecf6; border-radius: 10px; padding: 18px; margin-bottom: 16px; }
.panel-title { font-size: 15px; font-weight: 600; color: #12355b; margin-bottom: 12px; }
.panel.narrow { max-width: 480px; }
.bar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; flex-wrap: wrap; }
.row { display: flex; align-items: flex-start; margin-bottom: 12px; gap: 10px; }
.row label { width: 110px; color: #3d5a7c; flex-shrink: 0; line-height: 38px; }
.tip-text { color: #7a8694; font-size: 13px; margin-top: 10px; line-height: 1.7; }
.tip-text.err { color: #d95f5f; }
.search { min-width: 220px; }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #e4ecf6; border-radius: 10px; overflow: hidden; }
.tbl th { background: #eef4fc; color: #12355b; font-weight: 600; padding: 11px 14px; text-align: left; border-bottom: 1px solid #dbe7f5; white-space: nowrap; }
.tbl td { padding: 10px 14px; border-bottom: 1px solid #eff4fa; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #f8fbfe; }

/* ---------- 课表网格(每格可多条排课) ---------- */
.grid-wrap { overflow-x: auto; }
.grid { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid #dbe7f5; }
.grid th { background: #eef4fc; color: #12355b; font-weight: 600; padding: 8px 6px; border: 1px solid #dbe7f5; text-align: center; white-space: nowrap; }
.grid td { border: 1px solid #e7eef7; }
.grid-day { background: #f4f8fd; color: #12355b; font-weight: 600; text-align: center; padding: 8px 10px; white-space: nowrap; }
.grid-corner { background: #e4eefb !important; }
.grid-cell { min-width: 96px; height: 64px; text-align: center; vertical-align: middle; cursor: pointer; transition: background .12s; }
.grid-cell:hover { background: #f2f7ff; }
.grid-cell-big { min-width: 128px; height: auto; min-height: 84px; padding: 4px; }
.grid-cell.has { cursor: pointer; }
.cell-empty { color: #b9cde8; font-size: 20px; height: 100%; min-height: 74px; display: flex; align-items: center; justify-content: center; }
.cell-add { color: #4a8fe7; font-size: 13px; text-align: center; cursor: pointer; padding: 2px 0; border: 1px dashed #c9defb; border-radius: 6px; user-select: none; }
.cell-add:hover { background: #eaf3ff; border-color: #4a8fe7; }
.cell-list { display: flex; flex-direction: column; gap: 4px; }

.cell-entry {
  position: relative; text-align: left; background: #eaf3ff; border: 1px solid #c9defb;
  border-radius: 6px; padding: 4px 18px 4px 8px; cursor: pointer; transition: background .12s;
}
.cell-entry:hover { background: #dcebff; }
.cell-entry.filtered-out { opacity: .25; }
.entry-main { display: flex; align-items: center; gap: 6px; }
.entry-course { font-weight: 600; color: #1a5fb4; font-size: 13px; }
.entry-dur { font-size: 11px; color: #fff; background: #5b9bff; border-radius: 8px; padding: 0 6px; line-height: 16px; }
.entry-sub { color: #12355b; font-size: 12px; margin-top: 1px; }
.entry-teacher { color: #7a8694; font-size: 11px; margin-top: 1px; }
.entry-del { position: absolute; top: 1px; right: 4px; color: #d95f5f; font-size: 14px; cursor: pointer; opacity: 0; }
.cell-entry:hover .entry-del { opacity: 1; }

/* ---------- 学生选择 ---------- */
.stu-picker { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.stu-opt {
  display: inline-flex; align-items: center; gap: 5px; padding: 5px 12px;
  border: 1px solid #c7d7ea; border-radius: 16px; cursor: pointer; font-size: 13px;
}
.stu-opt.on { background: #eaf3ff; border-color: #2f6fdb; color: #1a5fb4; font-weight: 600; }
.stu-opt.off { opacity: .45; }
.stu-opt input { min-width: 0; margin: 0; }
.stu-count { width: 100%; color: #7a8694; font-size: 12px; }

/* ---------- 学生端课表列表 ---------- */
.schedule-list { max-width: 640px; }
.day-block { background: #fff; border: 1px solid #e4ecf6; border-radius: 10px; padding: 14px 18px; margin-bottom: 14px; }
.day-title { font-size: 15px; font-weight: 600; color: #12355b; margin-bottom: 10px; }
.lesson-item { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-bottom: 1px dashed #e7eef7; }
.lesson-item:last-child { border-bottom: none; }
.lesson-period { flex-shrink: 0; width: 64px; text-align: center; }
.lesson-period .p-num { font-size: 15px; font-weight: 700; color: #1a5fb4; }
.lesson-period .p-lbl { font-size: 11px; color: #9aa7b5; }
.lesson-main { flex: 1; }
.lesson-course { font-weight: 600; color: #22344d; font-size: 14px; }
.lesson-sub { color: #7a8694; font-size: 12px; margin-top: 2px; }
.lesson-dur { flex-shrink: 0; font-size: 12px; color: #1a5fb4; background: #eaf3ff; border-radius: 10px; padding: 2px 10px; }
.lesson-remark { flex-shrink: 0; font-size: 12px; color: #e08c2a; }
.empty-tip { text-align: center; color: #9aa7b5; padding: 40px 0; font-size: 14px; }

/* 我的课表统计条 */
.stat-line { color: #7a8694; font-size: 13px; margin-bottom: 12px; }

/* ---------- 弹窗 ---------- */
.mask { position: fixed; inset: 0; background: rgba(18,53,91,.45); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: #fff; border-radius: 12px; width: 520px; max-width: 92vw; max-height: 86vh; overflow: auto; }
.modal-title { padding: 16px 20px; font-size: 16px; font-weight: 600; color: #12355b; border-bottom: 1px solid #e4ecf6; display: flex; justify-content: space-between; }
.modal-close { color: #7a8694; font-size: 20px; margin: 0; }
.modal-body { padding: 18px 20px; }
.modal-body .row label { width: 110px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid #e4ecf6; display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- 打印(教务端) ---------- */
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .bar, .btn, .mask { display: none !important; }
  .content { padding: 0; }
  .grid td { border: 1px solid #999; }
}

/* ---------- 移动端适配(手机/平板)：官网式顶部导航 + 完整网格课表 ---------- */
.mobile-hide { }

@media (max-width: 768px) {
  /* 顶部官网式导航：白底蓝字横向条，可左右滑动 */
  .layout { flex-direction: column; }
  .sidebar {
    width: 100%; flex-direction: row; align-items: center;
    background: #ffffff; padding: 0 12px; position: sticky; top: 0; z-index: 50;
    box-shadow: 0 2px 10px rgba(31,60,100,.1);
  }
  .side-brand { padding: 10px 12px 10px 0; border-bottom: none; border-right: 1px solid #e5ebf3; flex-shrink: 0; }
  .side-title { font-size: 16px; color: #1f6feb; white-space: nowrap; }
  .side-sub { display: none; }
  .menu { flex: 1; display: flex; overflow-x: auto; padding: 0; gap: 2px; -webkit-overflow-scrolling: touch; }
  .menu a { padding: 13px 10px; border-left: none; border-bottom: 3px solid transparent; white-space: nowrap; font-size: 13px; color: #3a4a5c; }
  .menu a:hover { background: #f5f8fc; text-decoration: none; color: #1f6feb; }
  .menu a.active { border-left: none; border-bottom-color: #1f6feb; background: rgba(31,111,235,.07); color: #1f6feb; font-weight: 600; }
  .side-user { display: none; }

  .main { width: 100%; }
  .topbar { padding: 10px 14px; }
  .topbar-title { font-size: 15px; }
  .content { padding: 12px 12px 24px; }
  .mobile-hide { display: none !important; }

  /* 课表网格：完整 7天×7节 + 左右横滑 + 节次列固定不跟随 */
  .grid-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -6px 8px; }
  .grid { min-width: 704px; border-radius: 10px; }
  .grid-corner { position: sticky; left: 0; z-index: 3; }
  .grid th { padding: 7px 4px; font-size: 12px; }
  .grid-day { position: sticky; left: 0; z-index: 2; width: 52px; min-width: 52px; font-size: 11px; padding: 6px 2px; box-shadow: 1px 0 0 #dbe7f5; }
  .grid-cell-big { min-width: 92px; min-height: 76px; padding: 3px; }
  .cell-list { gap: 3px; }
  .cell-empty { min-height: 66px; font-size: 18px; }
  .cell-entry { padding: 3px 6px 3px 5px; border-radius: 5px; }
  .entry-main { gap: 3px; flex-wrap: wrap; }
  .entry-course { font-size: 12px; }
  .entry-dur { font-size: 9px; padding: 0 4px; line-height: 14px; }
  .entry-sub { font-size: 10px; }
  .entry-teacher { font-size: 10px; }
  .cell-add { font-size: 11px; padding: 1px 0; }
  /* 周六、周日列浅色底，一眼区分周末 */
  .grid thead tr th:nth-child(7),
  .grid thead tr th:nth-child(8),
  .grid tbody tr td:nth-child(7),
  .grid tbody tr td:nth-child(8) { background: #f6f9fd; }

  /* 表单 / 弹窗 / 管理表格 / 学生列表微调 */
  .bar { gap: 8px; }
  .bar select, .bar input, .bar .btn { min-width: 0; }
  .row { flex-wrap: wrap; gap: 6px; }
  .row label { width: 78px; font-size: 13px; line-height: 34px; }
  .row input, .row select, .row textarea { min-width: 0; flex: 1 1 120px; }
  .modal { width: 94vw; }
  .modal-body { padding: 14px; }
  .modal-body .row label { width: 78px; }
  .modal-foot { padding: 12px 14px; }
  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { min-width: 520px; }
  .schedule-list { max-width: 100%; }
  .day-block { padding: 12px; }
  .lesson-item { gap: 8px; padding: 10px 4px; }
  .lesson-period { width: 52px; }
  .lesson-dur { font-size: 11px; padding: 2px 8px; white-space: nowrap; }
  .entry-dur { white-space: nowrap; }
}
