/* ============================================================
   班级魔方 · 签到助手 — 主页面样式
   ============================================================ */

:root {
  --primary: #07c160;
  --primary-dark: #06ad56;
  --bg: #f0f2f5;
  --card: #ffffff;
  --text: #1a1a2e;
  --muted: #8e8e93;
  --danger: #ff3b30;
  --warning: #ff9500;
  --info: #007aff;
  --radius: 16px;
  --shadow: 0 2px 24px rgba(0,0,0,.06);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.10);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Header ─────────────────────────── */
.header {
  background: #fff;
  border-bottom: 1px solid rgba(0,0,0,.06);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-logo { display: none }
.header-title { font-size: 17px; font-weight: 700; color: var(--text) }

/* ── Layout ─────────────────────────── */
.container { max-width: 520px; margin: 0 auto; padding: 16px }

/* ── Card ───────────────────────────── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  transition: transform .15s, box-shadow .15s;
}
.card:active { transform: scale(.985); box-shadow: var(--shadow-lg) }

/* ── Buttons ────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border: none;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  letter-spacing: -0.2px;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.96) }
.btn-primary { background: var(--primary); color: #fff }
.btn-primary:hover { background: var(--primary-dark) }
.btn-blue { background: var(--info); color: #fff }
.btn-warning { background: var(--warning); color: #fff }
.btn-danger { background: var(--danger); color: #fff }
.btn-ghost { background: #f5f5f5; color: var(--text) }
.btn-outline { background: transparent; border: 1.5px solid rgba(255,255,255,.4); color: #fff }
.btn-block { display: flex; width: 100% }
.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 10px }
.btn-xs { padding: 5px 10px; font-size: 12px; border-radius: 8px }

/* ── Spacing ────────────────────────── */
.mt-4 { margin-top: 4px }
.mt-8 { margin-top: 8px }
.mt-12 { margin-top: 12px }
.mt-16 { margin-top: 16px }
.mt-24 { margin-top: 24px }
.mb-4 { margin-bottom: 4px }
.mb-8 { margin-bottom: 8px }
.mb-12 { margin-bottom: 12px }
.mb-16 { margin-bottom: 16px }

/* ── Text ───────────────────────────── */
.text-center { text-align: center }
.text-muted { color: var(--muted); font-size: 13px; line-height: 1.5 }
.text-error { color: var(--danger) }
.text-success { color: var(--primary) }
.text-bold { font-weight: 700 }

/* ── Flex helpers ───────────────────── */
.flex-between { display: flex; justify-content: space-between; align-items: center }
.flex-center { display: flex; align-items: center; gap: 8px }

/* ── Tag ────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.tag-pwd { background: #fff3e0; color: #e65100 }
.tag-gps { background: #e3f2fd; color: #1565c0 }
.tag-scan { background: #e8f5e9; color: #2e7d32 }

/* ── QR ─────────────────────────────── */
.qr-wrapper {
  background: #fff;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  text-align: center;
}
.qr-frame {
  display: inline-block;
  padding: 12px;
  border: 3px dashed #e0e0e0;
  border-radius: 12px;
  line-height: 0;
  transition: border-color .3s;
}
.qr-frame.loaded { border-color: var(--primary) }

/* ── Punch list ─────────────────────── */
.punch-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 0;
  border-bottom: 1px solid #f0f0f0;
}
.punch-item:last-child { border-bottom: none }

/* ── Modal ──────────────────────────── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  animation: fadeIn .2s;
}
.modal {
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 20px 60px rgba(0,0,0,.15);
  animation: slideUp .25s;
}

/* ── Toast ──────────────────────────── */
.toast {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  z-index: 300;
  font-size: 14px;
  font-weight: 500;
  max-width: 90%;
  box-shadow: 0 8px 30px rgba(0,0,0,.2);
  animation: slideDown .3s;
}
.toast.error { background: var(--danger) }

/* ── Spinner ────────────────────────── */
.spinner {
  display: inline-block;
  width: 22px;
  height: 22px;
  border: 2.5px solid #e0e0e0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

/* ── Input ──────────────────────────── */
.input {
  width: 100%;
  padding: 12px 16px;
  border: 2px solid #e8e8e8;
  border-radius: 12px;
  font-size: 14px;
  transition: border-color .2s;
  outline: none;
  font-family: inherit;
}
.input:focus { border-color: var(--primary) }

/* ── Course card ────────────────────── */
.course-card {
  position: relative;
  overflow: hidden;
  color: #fff;
  border-radius: var(--radius);
  padding: 22px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  transition: transform .2s, box-shadow .2s;
}
.course-card:active { transform: scale(.98) }
.course-card .course-bg {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: var(--radius);
}
.course-card .course-content { position: relative; z-index: 1 }

/* ── Empty state ────────────────────── */
.empty-state { padding: 60px 20px; text-align: center }
.empty-state .icon { font-size: 56px; margin-bottom: 16px }

/* ── Logo pulse ─────────────────────── */
.logo-pulse { animation: pulse 2s infinite }

/* ── Result badge ───────────────────── */
.result-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.result-ok { background: #e8f5e9; color: #2e7d32 }
.result-err { background: #fce4ec; color: #c62828 }

/* ── Hidden ─────────────────────────── */
.hidden { display: none !important }

/* ── Animations ─────────────────────── */
@keyframes spin { to { transform: rotate(360deg) } }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) } to { opacity: 1; transform: translateY(0) } }
@keyframes slideDown { from { opacity: 0; transform: translateX(-50%) translateY(-12px) } to { opacity: 1; transform: translateX(-50%) translateY(0) } }
@keyframes pulse { 0%,100% { transform: scale(1) } 50% { transform: scale(1.05) } }


/* ============================================================
   扫码页面样式 (暗色主题)
   ============================================================ */

body.scan-page {
  background: #000;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
}

body.scan-page .header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 20px;
  background: rgba(255,255,255,.05);
  backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 10;
}
body.scan-page .header img { width: 36px; height: 36px; border-radius: 8px }
body.scan-page .header span { font-size: 16px; font-weight: 700 }

body.scan-page .container {
  width: 100%;
  max-width: 420px;
  padding: 20px;
  flex: 1;
}

.scan-area {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  background: #111;
  box-shadow: 0 0 0 2px rgba(255,255,255,.1);
}
.scan-area video, .scan-area img { display: block; width: 100% }

.scan-hint {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: #999;
  animation: pulse-text 2s infinite;
}
@keyframes pulse-text { 0%,100% { opacity: 1 } 50% { opacity: .5 } }

.result-card {
  background: #1a1a1a;
  border-radius: 20px;
  padding: 30px 20px;
  text-align: center;
  margin-top: 20px;
}
.result-icon { font-size: 64px; margin-bottom: 12px }
.result-msg { font-size: 18px; font-weight: 700; margin-bottom: 20px }

body.scan-page .btn-ghost { background: rgba(255,255,255,.1); color: #fff; margin-top: 8px }

.mt-20 { margin-top: 20px }

body.scan-page .text-success { color: var(--primary) }
body.scan-page .text-error { color: #ff3b30 }
