/* ══════════════════════════════════════════════════════
   school-substitute 代课调课系统 - 样式表
   配色：教育蓝 + 温暖橙 + 清晰白
   ══════════════════════════════════════════════════════ */

:root {
  --blue:       #3B82F6;
  --blue-dark:  #1D4ED8;
  --blue-light: #EFF6FF;
  --orange:     #F59E0B;
  --orange-bg:  #FFFBEB;
  --green:      #10B981;
  --green-bg:   #ECFDF5;
  --red:        #EF4444;
  --red-bg:     #FEF2F2;
  --gray-50:    #F9FAFB;
  --gray-100:   #F3F4F6;
  --gray-200:   #E5E7EB;
  --gray-300:   #D1D5DB;
  --gray-500:   #6B7280;
  --gray-700:   #374151;
  --gray-900:   #111827;
  --shadow:     0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08);
  --shadow-md:  0 4px 6px rgba(0,0,0,.1), 0 2px 4px rgba(0,0,0,.06);
  --radius:     8px;
  --radius-lg:  12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: 'PingFang SC', 'Microsoft YaHei', -apple-system, sans-serif; font-size: 14px; color: var(--gray-700); background: var(--gray-100); }

/* ── 登录页 ───────────────────────────────────────── */
.login-bg {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 50%, #0EA5E9 100%);
  padding: 20px;
}
.login-card {
  background: #fff; border-radius: 16px; padding: 40px; width: 100%; max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  text-align: center;
}
.login-icon { font-size: 56px; margin-bottom: 8px; }
.login-card h1 { font-size: 22px; font-weight: 700; color: var(--gray-900); margin-bottom: 4px; }
.login-subtitle { color: var(--gray-500); font-size: 13px; margin-bottom: 24px; }
.login-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.tab-btn {
  flex: 1; padding: 8px 12px; border: 2px solid var(--gray-200); background: var(--gray-50);
  border-radius: var(--radius); cursor: pointer; font-size: 14px; font-weight: 500;
  color: var(--gray-500); transition: all .2s;
}
.tab-btn.active { border-color: var(--blue); background: var(--blue-light); color: var(--blue-dark); font-weight: 600; }
.login-hint { color: var(--gray-500); font-size: 13px; margin-bottom: 10px; text-align: left; }
.login-card .form-input, .login-card .form-select {
  width: 100%; padding: 10px 14px; border: 2px solid var(--gray-200); border-radius: var(--radius);
  font-size: 14px; margin-bottom: 12px; outline: none; transition: border-color .2s;
}
.login-card .form-input:focus, .login-card .form-select:focus { border-color: var(--blue); }

/* ── 按钮 ─────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px;
  border: none; border-radius: var(--radius); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .2s; line-height: 1.4;
}
.btn-primary  { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-dark); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-300); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger   { background: var(--red); color: #fff; }
.btn-danger:hover  { background: #DC2626; }
.btn-success  { background: var(--green); color: #fff; }
.btn-success:hover { background: #059669; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; margin-top: 4px; }

/* ── 应用外壳 ─────────────────────────────────────── */
.app-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── 顶栏 ─────────────────────────────────────────── */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 52px; padding: 0 20px; background: linear-gradient(135deg, #1E3A5F, #1D4ED8);
  color: #fff; flex-shrink: 0; box-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.topbar-left { display: flex; align-items: center; gap: 10px; }
.topbar-icon { font-size: 22px; }
.topbar-title { font-size: 16px; font-weight: 700; color: #fff; }
.topbar-sub  { font-size: 13px; color: rgba(255,255,255,.75); }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.role-badge { padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.role-badge.admin { background: rgba(239,68,68,.2); color: #FCA5A5; }
.role-badge.teacher { background: rgba(255,255,255,.15); color: rgba(255,255,255,.9); }
.admin-hint { font-size: 12px; color: rgba(255,255,255,.6); }
.topbar .btn { background: rgba(255,255,255,.15); color: #fff; border: 1px solid rgba(255,255,255,.3); font-size: 12px; }
.topbar .btn:hover { background: rgba(255,255,255,.25); }

/* ── 主区域 ───────────────────────────────────────── */
.app-body { display: flex; flex: 1; overflow: hidden; }

/* ── 侧边栏 ───────────────────────────────────────── */
.sidebar { width: 180px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--gray-200); overflow-y: auto; padding: 12px 0; }
.sidebar-section { padding: 0 12px; }
.sidebar-section-title { font-size: 11px; font-weight: 600; color: var(--gray-400); text-transform: uppercase; letter-spacing: .05em; padding: 8px 8px 4px; }
.nav-btn {
  display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px;
  border: none; background: none; border-radius: var(--radius); cursor: pointer;
  font-size: 14px; color: var(--gray-600); text-align: left; transition: all .15s; margin-bottom: 2px;
}
.nav-btn:hover { background: var(--blue-light); color: var(--blue-dark); }
.nav-btn.active { background: var(--blue-light); color: var(--blue-dark); font-weight: 600; }
.nav-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 5px;
  background: var(--red); color: #fff; border-radius: 9px;
  font-size: 11px; font-weight: 700; margin-left: auto;
}
.pending-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; background: var(--red-bg); color: var(--red);
  border-radius: var(--radius); font-size: 13px; font-weight: 600;
}
.preview-card { border: 2px solid var(--orange); background: var(--orange-bg); }
.preview-hint { font-size: 12px; color: var(--orange); margin-left: auto; }
.preview-table tbody tr { background: #fff; }
.preview-table tbody tr:hover { background: var(--orange-bg); }
.preview-table .sub-select { padding: 4px 8px; font-size: 13px; min-width: 100px; }
.preview-table .conflict { background: var(--red-bg) !important; }
.preview-table .conflict td { color: var(--red); }

/* ── 内容区 ───────────────────────────────────────── */
.content { flex: 1; overflow-y: auto; padding: 24px; background: var(--gray-50); }

/* ── 页面容器 ─────────────────────────────────────── */
.page { max-width: 1200px; margin: 0 auto; }
.page-title { font-size: 20px; font-weight: 700; color: var(--gray-900); margin-bottom: 20px; }

/* ── 统计卡片 ─────────────────────────────────────── */
.stats-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 20px; }
.stat-card {
  flex: 1; min-width: 100px; background: #fff; border-radius: var(--radius-lg); padding: 16px;
  text-align: center; box-shadow: var(--shadow); border: 1px solid var(--gray-100);
  transition: transform .2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-icon { font-size: 24px; margin-bottom: 4px; }
.stat-num { font-size: 28px; font-weight: 800; color: var(--blue-dark); line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--gray-500); margin-top: 2px; }
.stat-alert .stat-num { color: var(--orange); }

.stat-mini { display: flex; flex-direction: column; align-items: center; background: var(--blue-light); border-radius: var(--radius); padding: 8px 16px; }
.stat-mini .sn { font-size: 20px; font-weight: 700; color: var(--blue-dark); }
.stat-mini .sl { font-size: 11px; color: var(--blue); }

/* ── 卡片 ─────────────────────────────────────────── */
.card { background: #fff; border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--gray-100); margin-bottom: 16px; }
.card h3 { font-size: 15px; font-weight: 600; color: var(--gray-800); margin-bottom: 14px; display: flex; align-items: center; gap: 6px; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-header h3 { margin-bottom: 0; }

/* ── 表单 ─────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; color: var(--gray-600); margin-bottom: 4px; }
.form-input, .form-select, .form-textarea {
  width: 100%; padding: 9px 12px; border: 1.5px solid var(--gray-200); border-radius: var(--radius);
  font-size: 14px; color: var(--gray-800); outline: none; transition: border-color .2s; background: #fff;
}
.form-input:focus, .form-select:focus, .form-textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(59,130,246,.1); }
.form-input[readonly] { background: var(--gray-50); color: var(--gray-500); }
.form-textarea { resize: vertical; min-height: 120px; font-family: monospace; font-size: 12px; }
.form-file { width: 100%; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.form-row label { font-size: 14px; font-weight: 500; color: var(--gray-600); white-space: nowrap; }

/* ── 数据表 ───────────────────────────────────────── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table thead th {
  background: var(--gray-100); padding: 10px 12px; text-align: left;
  font-weight: 600; color: var(--gray-700); border-bottom: 2px solid var(--gray-200);
  white-space: nowrap;
}
.data-table tbody td { padding: 9px 12px; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
.data-table tbody tr:hover { background: var(--blue-light); }
.data-table tbody tr:last-child td { border-bottom: none; }
.row-approved td { opacity: .6; }

/* 课表专用表格 */
.tt-table .time-cell { font-size: 11px; color: var(--gray-400); white-space: nowrap; }
.tt-table .has-class { background: var(--blue-light) !important; }
.tt-table .empty-cell { background: var(--gray-50); color: var(--gray-300); }
.tt-table .subj { font-weight: 600; color: var(--blue-dark); font-size: 13px; }
.tt-table .tea  { font-size: 12px; color: var(--gray-500); }

/* 课后服务行 */
.afterschool-row td { background: #FFF7ED !important; }
.afterschool-row td.period-cell .period-time { display: block; font-size: 10px; color: #9A3412; margin-top: 2px; white-space: nowrap; }
.afterschool-cell.has-class { background: #FFEDD5 !important; }
.afterschool-cell.empty-cell { background: #FFF7ED !important; }
.afterschool-cell .subj { color: #C2410C; font-size: 12px; }
.week-tag {
  display: inline-block; padding: 1px 5px; border-radius: 4px;
  font-size: 10px; font-weight: 600; margin-left: 3px; background: #93C5FD; color: #1E40AF;
}
.week-tag.week-double { background: #FCA5A5; color: #991B1B; }

/* 星期五特色社团活动单元格 */
.afterschool-cell.special-club {
  background: #F3E8FF !important;
  text-align: center;
  color: #6B21A8;
  font-weight: 600;
}

/* 表格内的时间单元格 */
.tt-table .time-cell {
  font-size: 11px;
  color: #6B7280;
  margin-bottom: 4px;
  padding-bottom: 4px;
  border-bottom: 1px dashed #E5E7EB;
}

/* ── 徽章 ─────────────────────────────────────────── */
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.badge-green  { background: var(--green-bg); color: var(--green); }
.badge-yellow { background: var(--orange-bg); color: var(--orange); }
.badge-red    { background: var(--red-bg); color: var(--red); }
.badge-blue   { background: var(--blue-bg, #DBEAFE); color: var(--blue, #2563EB); }

/* ── 空状态 ───────────────────────────────────────── */
.empty-state { text-align: center; padding: 60px 20px; color: var(--gray-400); }
.empty-icon { font-size: 64px; margin-bottom: 12px; }
.empty-state h3 { font-size: 18px; font-weight: 600; color: var(--gray-500); margin-bottom: 8px; }
.empty-state p { font-size: 14px; }

/* ── 操作栏 ───────────────────────────────────────── */
.action-bar { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.view-toggle { display: flex; gap: 8px; margin-bottom: 16px; }
.filter-row { display: flex; gap: 8px; align-items: center; }

/* ── 快速操作卡片 ─────────────────────────────────── */
.quick-actions { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.action-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 12px; background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow); border: 1px solid var(--gray-100); cursor: pointer;
  transition: all .2s; text-decoration: none;
}
.action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--blue); }
.action-icon { font-size: 32px; }
.action-label { font-size: 14px; font-weight: 600; color: var(--gray-700); }

/* ── 提醒卡片 ─────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.alert-warn { background: var(--orange-bg); color: #92400E; border: 1px solid #FCD34D; }
.alert-success { background: var(--green-bg); color: #065F46; border: 1px solid #6EE7B7; }

/* ── 状态 ─────────────────────────────────────────── */
.status-ok   { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--green-bg); color: #065F46; border-radius: 20px; font-size: 13px; font-weight: 600; }
.status-warn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; background: var(--orange-bg); color: #92400E; border-radius: 20px; font-size: 13px; font-weight: 600; }

/* ── 辅助 ─────────────────────────────────────────── */
.text-muted { color: var(--gray-400); font-size: 13px; }
.link { color: var(--blue); cursor: pointer; text-decoration: underline; }
.link:hover { color: var(--blue-dark); }
.section { background: #fff; border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px; }
.section h3 { font-size: 15px; font-weight: 600; color: var(--gray-800); margin-bottom: 14px; }

/* 代课教师高亮 */
.sub-tea { font-weight: 600; color: var(--green); }

/* ── 响应式 ───────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { width: 140px; }
  .form-grid { grid-template-columns: 1fr; }
  .stats-row { gap: 8px; }
  .stat-card { min-width: 80px; padding: 12px; }
  .stat-num { font-size: 22px; }
}
/* ── 手机端顶部导航栏 ─────────────────────────────── */
.mobile-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 1px solid var(--gray-200);
  position: sticky;
  top: 0;
  z-index: 100;
}
.mobile-back-btn {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.mobile-back-btn:hover { color: var(--blue-dark); }
.mobile-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-900);
  flex: 1;
  text-align: center;
}
.mobile-spacer { width: 60px; }

@media (max-width: 600px) {
  .sidebar { display: none; }
  .content { padding: 12px; }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
  .mobile-header { display: flex; }
  .topbar { display: none; } /* 手机端隐藏桌面顶栏 */
}

/* ── 滚动条美化 ───────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ��ʦƴ�������� */
.teacher-search-box { position: relative; width: 100%; }
#teacher-search-input { width: 100%; padding: 12px 16px; font-size: 15px; border: 2px solid var(--gray-200); border-radius: var(--radius); transition: border-color .2s; }
#teacher-search-input:focus { outline: none; border-color: var(--blue); }
.search-dropdown { position: absolute; top: 100%; left: 0; right: 0; margin-top: 4px; background: #fff; border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-md); max-height: 280px; overflow-y: auto; z-index: 100; }
.search-item { display: flex; justify-content: space-between; align-items: center; padding: 10px 16px; cursor: pointer; border-bottom: 1px solid var(--gray-100); transition: background .15s; }
.search-item:hover, .search-item.active { background: var(--blue-light); }
.search-item:last-child { border-bottom: none; }
.search-name { font-size: 15px; font-weight: 500; color: var(--gray-700); }
.search-pinyin { font-size: 12px; color: var(--gray-500); background: var(--gray-100); padding: 2px 8px; border-radius: 4px; }
.search-no-result { padding: 16px; text-align: center; color: var(--gray-500); font-size: 14px; }

/* ── 社团活动按钮 + 弹窗 ─────────────────────────── */
.btn-club-table { background: #8B5CF6; color: #fff; padding: 6px 14px; border: none; border-radius: 6px; font-size: 13px; font-weight: 500; cursor: pointer; transition: background .15s; }
.btn-club-table:hover { background: #7C3AED; }
#club-table-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000; display: none; align-items: center; justify-content: center; padding: 24px; }
#club-table-modal.open { display: flex; }
#club-table-modal .modal-content { background: #fff; border-radius: 12px; max-width: 960px; width: 100%; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.25); }
#club-table-modal .modal-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--gray-100); flex: 0 0 auto; }
#club-table-modal .modal-header h3 { margin: 0; font-size: 16px; font-weight: 600; color: var(--gray-700); }
#club-table-modal .modal-close { background: none; border: none; font-size: 24px; line-height: 1; color: var(--gray-500); cursor: pointer; padding: 0 4px; }
#club-table-modal .modal-close:hover { color: var(--red); }
#club-table-modal .modal-body { padding: 16px 20px; overflow-y: auto; flex: 1 1 auto; }

/* 手机端：社团活动弹窗改为全屏展示（仅 modal-content 设全屏，header/body 正常参与布局） */
@media (max-width: 768px) {
  #club-table-modal { padding: 0; align-items: stretch; }
  #club-table-modal .modal-content {
    max-width: 100%;
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
  }
  #club-table-modal .modal-header { padding: 12px 16px; }
  #club-table-modal .modal-header h3 { font-size: 17px; }
  #club-table-modal .modal-close { font-size: 28px; padding: 4px 10px; }
  #club-table-modal .modal-body { padding: 10px 12px; }
  #club-table-modal .data-table { font-size: 13px; min-width: 520px; }
  #club-table-modal .data-table tbody td { padding: 8px 10px; }
}
