/* ============================================================
   教学秩序查课系统 - 自定义样式
   机构化精致风格 · petrol蓝 + 琥珀强调
   ============================================================ */

:root {
  --petrol-50: #f0f7f6;
  --petrol-200: #b3d9d6;
  --petrol-500: #0E5E5A;
  --amber-500: #D97706;
  --amber-400: #f59e0b;
  --ink: #1C2B2B;
  --cream: #F7F5F0;
}

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--cream);
  background-image:
    radial-gradient(circle at 12% 18%, rgba(14, 94, 90, 0.05) 0%, transparent 42%),
    radial-gradient(circle at 88% 82%, rgba(217, 119, 6, 0.05) 0%, transparent 42%);
  background-attachment: fixed;
}

/* ---- 字体微调 ---- */
.font-serif { letter-spacing: 0.01em; }
.tabular-nums { font-variant-numeric: tabular-nums; }

/* ============================================================
   呼吸光条 (当节卡片实时指示)
   ============================================================ */
.breathing {
  box-shadow: 0 0 12px rgba(217, 119, 6, 0.6);
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { opacity: 0.55; box-shadow: 0 0 8px rgba(217, 119, 6, 0.45); }
  50%      { opacity: 1;    box-shadow: 0 0 18px rgba(217, 119, 6, 0.85); }
}

/* ============================================================
   模态弹窗
   ============================================================ */
.modal-mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(8, 48, 46, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 5vh 1rem 2rem;
  overflow-y: auto;
  animation: maskIn 0.2s ease-out;
}
.modal-card {
  background: #fff; border-radius: 16px;
  box-shadow: 0 20px 60px -10px rgba(8, 48, 46, 0.4);
  width: 100%;
  animation: cardIn 0.26s cubic-bezier(0.16, 1, 0.3, 1);
  margin: auto;
}
@keyframes maskIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ============================================================
   表单公共
   ============================================================ */
.form-group { display: flex; flex-direction: column; gap: 0.4rem; }
.form-label {
  font-size: 0.875rem; font-weight: 600; color: var(--ink);
  display: flex; align-items: center; gap: 0.25rem;
}
.form-input {
  width: 100%; padding: 0.55rem 0.75rem;
  border: 1px solid var(--petrol-200);
  border-radius: 0.5rem;
  background: #fff; color: var(--ink);
  font-size: 0.9rem; line-height: 1.4;
  outline: none; transition: border-color 0.15s, box-shadow 0.15s;
}
.form-input:focus {
  border-color: var(--amber-500);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15);
}
.form-input::placeholder { color: #9ca3af; }

/* ============================================================
   是/否 分段开关 (yn-field)
   ============================================================ */
.yn-field {
  border: 1px solid var(--petrol-200);
  border-radius: 0.5rem;
  padding: 0.5rem;
  background: #fff;
}
.yn-label {
  display: block; font-size: 0.75rem; color: #6b7280;
  margin-bottom: 0.35rem; font-weight: 500;
}
.yn-toggle {
  display: flex; background: var(--petrol-50);
  border-radius: 0.4rem; padding: 2px; position: relative;
}
.yn-toggle button {
  flex: 1; padding: 0.35rem 0.5rem; border: none; background: transparent;
  font-size: 0.8rem; font-weight: 600; color: #6b7280;
  border-radius: 0.3rem; cursor: pointer; transition: color 0.15s;
  position: relative; z-index: 1; min-height: 28px;
}
.yn-toggle button.active.yes { color: #fff; }
.yn-toggle button.active.no  { color: #fff; }
.yn-toggle .yn-slider {
  position: absolute; top: 2px; bottom: 2px; left: 2px;
  width: calc(50% - 2px); border-radius: 0.3rem;
  background: #d1d5db; transition: transform 0.18s cubic-bezier(0.16,1,0.3,1), background 0.18s;
}
.yn-toggle.is-yes .yn-slider { transform: translateX(100%); background: var(--amber-500); }
.yn-toggle.is-no  .yn-slider { background: var(--petrol-500); }

/* ============================================================
   数字字段
   ============================================================ */
.num-field { display: flex; flex-direction: column; gap: 0.3rem; }
.num-label { font-size: 0.75rem; color: #6b7280; font-weight: 500; }
.num-field .form-input { padding: 0.4rem 0.6rem; }

/* 隐藏 number 上下箭头但保留功能 */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none; margin: 0;
}
input[type=number] { -moz-appearance: textfield; }

/* ============================================================
   卡片 (当节课程项)
   ============================================================ */
.class-card {
  background: #fff; border: 1px solid var(--petrol-200);
  border-radius: 0.6rem; padding: 0.7rem 0.85rem;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  display: flex; flex-direction: column; gap: 0.3rem;
}
.class-card:hover {
  border-color: var(--amber-400);
  box-shadow: 0 4px 14px -4px rgba(217, 119, 6, 0.2);
  transform: translateY(-1px);
}
.class-card.is-self-study { background: #fafafa; border-style: dashed; }
.class-card.is-combined { border-color: var(--amber-400); background: linear-gradient(180deg, rgba(217, 119, 6, 0.04), #fff 40%); }
.class-card .cc-class { font-weight: 700; color: var(--petrol-500); font-size: 0.92rem; display: flex; align-items: center; gap: 0.35rem; flex-wrap: wrap; }
.class-card .cc-tag { font-size: 0.62rem; font-weight: 700; color: #fff; background: var(--amber-500); padding: 0.05rem 0.35rem; border-radius: 0.25rem; line-height: 1.4; }
.class-card .cc-row { display: flex; gap: 0.5rem; font-size: 0.78rem; color: #4b5563; }
.class-card .cc-row span:first-child { color: #9ca3af; min-width: 2.8em; }
.class-card .cc-course { font-size: 0.8rem; color: var(--ink); }
.class-card .cc-course b { color: var(--amber-600); }

/* 总览列 */
.overview-col {
  background: #fff; border: 1px solid var(--petrol-200);
  border-radius: 0.7rem; overflow: hidden;
}
.overview-col.is-current {
  border-color: var(--amber-500);
  box-shadow: 0 0 0 1px var(--amber-500), 0 8px 24px -8px rgba(217, 119, 6, 0.3);
}
.overview-col .oc-head {
  padding: 0.6rem 0.85rem; background: var(--petrol-50);
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--petrol-200);
}
.overview-col.is-current .oc-head { background: rgba(217, 119, 6, 0.1); }
.overview-col .oc-head .oc-sec { font-weight: 700; color: var(--petrol-500); }
.overview-col.is-current .oc-head .oc-sec { color: var(--amber-600); }
.overview-col .oc-time { font-size: 0.7rem; color: #9ca3af; font-family: 'JetBrains Mono', monospace; }
.overview-col .oc-body { padding: 0.4rem; max-height: 320px; overflow-y: auto; }
.overview-col .oc-item {
  font-size: 0.78rem; padding: 0.3rem 0.4rem; border-radius: 0.3rem;
  display: flex; justify-content: space-between; gap: 0.4rem;
  border-bottom: 1px dashed transparent;
}
.overview-col .oc-item:hover { background: var(--petrol-50); }
.overview-col .oc-item.is-clickable { cursor: pointer; transition: background .15s, transform .15s; }
.overview-col .oc-item.is-clickable:hover { background: var(--amber-50, rgba(217, 119, 6, 0.08)); transform: translateX(2px); }
.overview-col .oc-item.is-clickable:hover .oci-name { color: var(--amber-600); }
.overview-col .oc-item.is-clickable:active { transform: translateX(2px) scale(0.99); }
.overview-col .oc-item .oci-name { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 0.2rem; }
.overview-col .oc-item .oci-teacher { color: #6b7280; font-size: 0.72rem; flex-shrink: 0; }
.overview-col .oc-item.is-combined .oci-combined { font-size: 0.58rem; font-weight: 700; color: #fff; background: var(--amber-500); width: 1.1em; height: 1.1em; border-radius: 0.2rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.overview-col .oc-item.is-combined:hover .oci-name { color: var(--amber-600); }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  display: flex; align-items: flex-start; gap: 0.6rem;
  padding: 0.75rem 0.9rem; border-radius: 0.6rem;
  background: #fff; box-shadow: 0 8px 24px -6px rgba(8,48,46,0.25);
  border-left: 4px solid var(--petrol-500);
  animation: toastIn 0.3s cubic-bezier(0.16,1,0.3,1);
  font-size: 0.85rem; color: var(--ink);
}
.toast.success { border-left-color: #10b981; }
.toast.error   { border-left-color: #ef4444; }
.toast.warn    { border-left-color: var(--amber-500); }
.toast.info    { border-left-color: var(--petrol-500); }
.toast .toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast .toast-body { flex: 1; }
.toast .toast-title { font-weight: 700; margin-bottom: 1px; }
.toast .toast-msg { color: #6b7280; font-size: 0.78rem; }
.toast.leaving { animation: toastOut 0.25s ease-in forwards; }
@keyframes toastIn  { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes toastOut { to   { opacity: 0; transform: translateX(20px); } }

/* ============================================================
   滚动条
   ============================================================ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--petrol-200); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--petrol-400, #4f9d97); }

/* ============================================================
   记录表格
   ============================================================ */
#recordsBody tr { transition: background 0.12s; }
#recordsBody tr:hover { background: var(--petrol-50); }
#recordsBody td { padding: 0.6rem 0.75rem; vertical-align: middle; }
.rec-score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 2rem; padding: 0.15rem 0.5rem; border-radius: 0.4rem;
  font-family: 'JetBrains Mono', monospace; font-weight: 700; font-size: 0.85rem;
}
.rec-score.zero { background: #ecfdf5; color: #059669; }
.rec-score.low  { background: #fef3c7; color: #b45309; }
.rec-score.high { background: #fee2e2; color: #dc2626; }

/* ============================================================
   上传区 拖拽态
   ============================================================ */
#dropZone.dragover {
  border-color: var(--amber-500);
  background: rgba(217, 119, 6, 0.06);
  transform: scale(1.005);
}

/* ============================================================
   工具类
   ============================================================ */
.fade-in { animation: fadeIn 0.4s ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* 响应式：小屏表单弹窗贴底/全屏 */
@media (max-width: 640px) {
  .modal-mask { padding: 0; align-items: stretch; }
  .modal-card { border-radius: 0; min-height: 100vh; }
}
