/* assets/css/student.css */
:root {
  --bg:      #0f1117;
  --bg2:     #161b27;
  --bg3:     #1e2536;
  --border:  #2a3347;
  --text:    #e2e8f0;
  --text2:   #94a3b8;
  --text3:   #64748b;
  --primary: #3b82f6;
  --green:   #22c55e;
  --red:     #ef4444;
  --yellow:  #f59e0b;
  --radius:  12px;
  --font:    'IBM Plex Sans Thai', system-ui, sans-serif;
  --mono:    'JetBrains Mono', monospace;
}

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

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* ─── Header ─────────────────────────────────────────────── */
.student-header {
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.s-header-inner {
  display: flex; justify-content: space-between; align-items: center;
  padding: .9rem 1.25rem; max-width: 560px; margin: 0 auto;
}
.s-brand { font-size: 1rem; font-weight: 800; }
.btn-logout-s {
  font-size: .8rem; color: var(--text3);
  border: 1px solid var(--border); border-radius: 7px;
  padding: .3rem .7rem; text-decoration: none;
  transition: all .15s;
}
.btn-logout-s:hover { border-color: var(--red); color: var(--red); }

/* ─── Main ───────────────────────────────────────────────── */
.student-main {
  max-width: 560px; margin: 0 auto;
  padding: 1.25rem 1.25rem 4rem;
  display: flex; flex-direction: column; gap: 1.25rem;
}

/* ─── Profile Card ───────────────────────────────────────── */
.profile-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
}

.profile-avatar {
  width: 52px; height: 52px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; font-weight: 800; color: #fff;
}

.profile-info { flex: 1; min-width: 0; }
.profile-name    { font-size: 1rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.profile-code    { font-family: var(--mono); font-size: .85rem; color: var(--primary); }
.profile-faculty { font-size: .8rem; color: var(--text2); }

/* Progress ring */
.profile-progress { display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.pct-ring {
  position: relative; width: 58px; height: 58px;
}
.pct-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg   { fill: none; stroke: var(--bg3); stroke-width: 5; }
.ring-fill {
  fill: none; stroke: var(--green); stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 0 163.36;
  transition: stroke-dasharray .6s ease;
}
.pct-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: .75rem; font-weight: 700; font-family: var(--mono);
}
.pct-label { font-size: .72rem; color: var(--text2); }

/* ─── QR Section ─────────────────────────────────────────── */
.qr-section {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
}

.btn-gen-qr {
  width: 100%; padding: 1rem;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff; border: none; border-radius: 10px;
  font-family: var(--font); font-size: 1.05rem; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; justify-content: center; gap: .5rem;
  transition: opacity .15s, transform .1s;
}
.btn-gen-qr:hover  { opacity: .9; }
.btn-gen-qr:active { transform: scale(.98); }
.gen-icon { font-size: 1.2rem; }

.qr-card {
  margin-top: 1.25rem;
  display: flex; flex-direction: column; align-items: center; gap: .75rem;
}

#qr-canvas-wrap {
  background: #fff;
  padding: 12px;
  border-radius: 12px;
  display: inline-block;
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}
#qr-canvas-wrap canvas { display: block; }

.qr-expire {
  font-size: .8rem; color: var(--yellow);
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: 6px; padding: .3rem .75rem;
}

.qr-hint { font-size: .85rem; color: var(--text2); }

/* ─── Checkpoint List ────────────────────────────────────── */
.cp-list { display: flex; flex-direction: column; gap: 0; }
.cp-list-title {
  font-size: .9rem; font-weight: 700; color: var(--text2);
  margin-bottom: .75rem; text-transform: uppercase; letter-spacing: .06em;
}

.cp-item {
  display: flex; align-items: center; gap: .75rem;
  padding: 1rem;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px; margin-bottom: .5rem;
  transition: border-color .15s;
}
.cp-item.passed { border-color: rgba(34,197,94,.3); background: rgba(34,197,94,.04); }

.cp-check  { font-size: 1.3rem; flex-shrink: 0; }
.cp-info   { flex: 1; min-width: 0; }
.cp-item-name { font-size: .95rem; font-weight: 600; }
.cp-item-loc  { font-size: .78rem; color: var(--text3); margin-top: .15rem; }
.cp-item-time {
  font-size: .75rem; color: var(--green); margin-top: .15rem;
}

.badge-done {
  font-size: .72rem; font-weight: 700;
  background: rgba(34,197,94,.15); color: var(--green);
  border-radius: 5px; padding: .15rem .5rem; white-space: nowrap;
}
.badge-todo {
  font-size: .72rem; font-weight: 700;
  background: var(--bg3); color: var(--text3);
  border-radius: 5px; padding: .15rem .5rem; white-space: nowrap;
}

/* ─── Login (student) ────────────────────────────────────── */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 1.25rem;
  background: var(--bg);
  background-image: radial-gradient(ellipse at 30% 60%, rgba(59,130,246,.07) 0%, transparent 55%);
}
.s-login-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 16px; padding: 2rem 1.75rem;
  width: 100%; max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
.s-login-logo { text-align: center; margin-bottom: 2rem; }
.s-login-icon { font-size: 3rem; }
.s-login-logo h1 { font-size: 1.2rem; font-weight: 800; margin-top: .5rem; }
.s-login-logo p  { color: var(--text2); font-size: .85rem; }

.s-login-form .form-group { margin-top: .75rem; }

.btn-login-s {
  width: 100%; margin-top: 1.25rem; padding: .85rem;
  background: linear-gradient(135deg, var(--primary), #6366f1);
  color: #fff; border: none; border-radius: 10px;
  font-family: var(--font); font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: opacity .15s;
}
.btn-login-s:hover { opacity: .9; }

/* Shared form elements (reuse from admin) */
.form-group { display: flex; flex-direction: column; gap: .35rem; }
.form-label { font-size: .82rem; font-weight: 600; color: var(--text2); }
.form-input {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--text); border-radius: 8px;
  padding: .65rem .9rem; font-family: var(--font); font-size: .95rem;
  outline: none; width: 100%; transition: border-color .15s;
}
.form-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(59,130,246,.15); }

.alert {
  padding: .75rem 1rem; border-radius: 8px; font-size: .85rem;
  margin-bottom: .75rem;
}
.alert-error { background: rgba(239,68,68,.12); color: var(--red); border: 1px solid rgba(239,68,68,.3); }

.login-footer { text-align: center; margin-top: 1.5rem; }
.login-footer a { color: var(--text3); font-size: .82rem; text-decoration: none; }
.login-footer a:hover { color: var(--primary); }

/* Utilities */
.btn {
  display: inline-flex; align-items: center; gap: .4rem;
  padding: .45rem .9rem; border-radius: 8px;
  font-family: var(--font); font-size: .85rem; font-weight: 500;
  cursor: pointer; border: 1px solid transparent;
  transition: all .15s; text-decoration: none;
}
.btn-sm     { padding: .3rem .65rem; font-size: .8rem; }
.btn-outline { background: transparent; border-color: var(--border); color: var(--text2); }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.mt-2 { margin-top: .5rem; }

@media (max-width: 380px) {
  .profile-card { flex-wrap: wrap; }
  .profile-progress { width: 100%; flex-direction: row; align-items: center; }
}
