/* ==========================================================================
   app.css - สไตล์ชีตร่วมสำหรับระบบลงทะเบียน คัดกรอง และอนุมัติสมาชิก (nurse-path)
   อ้างอิงโทเคนและอัตลักษณ์จาก Theme ตัวอย่าง.html
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Anuphan:wght@400;500;600;700&family=IBM+Plex+Sans+Thai:wght@400;500;600;700&display=swap');

:root {
  /* ชุดสีหลัก (Color Tokens) */
  --ink: #23291f;
  --muted: #687064;
  --soft: #454b40;
  --paper: #fafbf6;
  --line: #23291f1f;
  --sun: #f9d84a;
  --sun-deep: #e7b90c;
  --cream: #f7f0e5;
  --mint: #e3efe0;
  --lilac: #ebe8fc;
  --sky: #e1eef5;
  --coral: #fbe8de;
  --orange: #b4532c;

  /* ฟอนต์ */
  --body: 'IBM Plex Sans Thai', 'Noto Sans Thai', sans-serif;
  --heading: 'Anuphan', 'Noto Sans Thai', sans-serif;

  /* มิติเงาและการเคลื่อนไหว */
  --lift-1: 0 1px 2px #23291f10, 0 6px 16px -10px #23291f40;
  --lift-2: 0 1px 2px #23291f0d, 0 18px 40px -24px #23291f66, 0 0 0 1px #23291f0f;
  --lift-3: 0 2px 6px #23291f0d, 0 40px 80px -40px #23291f80, 0 0 0 1px #23291f0f;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.7 var(--body);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea {
  font: inherit;
  font-family: var(--body);
  color: var(--ink);
}

button {
  cursor: pointer;
  border: 0;
  touch-action: manipulation;
}

h1, h2, h3, h4, h5 {
  font-family: var(--heading);
  margin: 0;
  color: var(--ink);
}

p {
  margin: 0;
}

.hidden {
  display: none !important;
}

/* แถบแจ้งเตือนด้านบนสุด (In-App Browser Alert) */
.inapp-banner {
  background: var(--cream);
  color: #736025;
  border-bottom: 1px solid #e7b90c40;
  padding: 12px 20px;
  font-size: 14px;
  line-height: 1.6;
  text-align: center;
  position: relative;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.inapp-banner strong {
  color: #5c4a16;
}

/* แถบบน (Header) */
.top {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 max(20px, calc((100vw - 1120px) / 2));
  background: #fafbf6ed;
  backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid #23291f0f;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.logo {
  width: 39px;
  height: 39px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 23px;
  background: var(--sun);
  box-shadow: inset 0 -3px var(--sun-deep), 0 8px 18px -12px #c99a00;
  flex: none;
}

.brand strong {
  font: 700 24px/1.1 var(--heading);
  display: block;
}

.eyebrow {
  white-space: nowrap;
  font-size: 9px;
  letter-spacing: 1.8px;
  color: var(--muted);
}

.pill {
  font-size: 12px;
  font-weight: 500;
  background: #f1f0e6;
  color: var(--soft);
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.pill.warn {
  background: #fff4cc;
  color: #736025;
}

.pill.success {
  background: var(--mint);
  color: #27602f;
}

.pill.danger {
  background: var(--coral);
  color: #8f3d1c;
}

/* พื้นหลังส่วนหัว */
main {
  position: relative;
  isolation: isolate;
}

main:before {
  content: '';
  position: absolute;
  z-index: -2;
  pointer-events: none;
  inset: 0 0 auto;
  height: 820px;
  background: radial-gradient(42% 58% at 76% 46%, #fff4cc 0%, transparent 74%),
              radial-gradient(34% 40% at 8% 10%, #e3efe0 0%, transparent 70%),
              var(--paper);
}

main:after {
  content: '';
  position: absolute;
  z-index: -1;
  pointer-events: none;
  inset: 0 0 auto;
  height: 820px;
  background-image: radial-gradient(#23291f14 1.2px, transparent 1.3px);
  background-size: 26px 26px;
  opacity: .5;
  -webkit-mask-image: linear-gradient(#000, transparent 75%);
  mask-image: linear-gradient(#000, transparent 75%);
}

.content {
  max-width: 1120px;
  margin: auto;
  padding: 28px 20px 60px;
}

/* ส่วนนำ Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: clamp(24px, 4vw, 56px);
  align-items: center;
  padding: 26px 0 48px;
}

.tag {
  font-size: 13px;
  color: var(--muted);
  display: block;
  margin-bottom: 14px;
}

.hero h1 {
  font: 600 clamp(32px, 4.2vw, 54px)/1.22 var(--heading);
  letter-spacing: -1px;
  margin-bottom: 20px;
  text-wrap: balance;
}

.hero h1 em {
  font-style: normal;
  display: inline-block;
  background: var(--sun);
  padding: .02em .3em .08em;
  border-radius: .22em;
  transform: rotate(-1.6deg);
  box-shadow: inset 0 -.07em 0 var(--sun-deep), 0 .2em .45em -.28em #b88a0099;
}

.hero p.lead {
  font-size: 17px;
  line-height: 1.85;
  color: var(--soft);
  margin-bottom: 24px;
  max-width: 540px;
}

/* ปุ่มทั่วไป */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: 999px;
  background: var(--sun);
  color: var(--ink);
  font-size: 16px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: inset 0 -4px var(--sun-deep), 0 14px 28px -16px #c99a00;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}

.btn:hover:not([disabled]) {
  transform: translateY(-2px);
  box-shadow: inset 0 -3px var(--sun-deep), 0 20px 34px -16px #c99a00;
}

.btn:active:not([disabled]) {
  transform: translateY(1px);
  box-shadow: inset 0 -2px var(--sun-deep);
}

.btn[disabled] {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.light {
  background: #fff;
  border: 1px solid #23291f30;
  box-shadow: none;
}

.btn.light:hover:not([disabled]) {
  background: #f1f0e6;
  box-shadow: none;
}

.btn.danger {
  background: var(--coral);
  color: var(--orange);
  box-shadow: inset 0 -3px #e2a58a, 0 10px 20px -10px #e2a58a;
}

.btn.danger:hover:not([disabled]) {
  background: #fbd6c5;
}

.btn.line {
  background: #06c755;
  color: #fff;
  box-shadow: inset 0 -4px #049a42, 0 14px 28px -16px #049a42;
}

.btn.line:hover:not([disabled]) {
  box-shadow: inset 0 -3px #049a42, 0 20px 34px -16px #049a42;
}

button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

/* ตั๋วเส้นทาง 5 ขั้น */
.ticket {
  background: var(--ink);
  color: #fff;
  border-radius: 34px;
  padding: 24px 26px 26px;
  transform: rotate(2deg);
  box-shadow: inset 0 -6px #000, var(--lift-3);
  max-width: 400px;
  width: 100%;
  justify-self: center;
}

.ticket-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font: 600 15px/1.3 var(--heading);
}

.ticket-tag {
  background: var(--sun);
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 11px;
  font: 600 11px/1.1 var(--heading);
  white-space: nowrap;
}

.ticket h2 {
  font: 600 20px/1.4 var(--heading);
  color: #fff;
  margin: 14px 0 4px;
}

.ticket-divider {
  border-top: 2px dashed #ffffff2b;
  margin: 16px -26px;
  position: relative;
}

.ticket-divider:before, .ticket-divider:after {
  content: '';
  position: absolute;
  top: -12px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fafbf6;
}

.ticket-divider:before { left: -11px; }
.ticket-divider:after { right: -11px; }

.ticket ol {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
}

.ticket li {
  display: flex;
  gap: 12px;
  align-items: center;
  font-size: 14px;
  line-height: 1.5;
}

.ticket li b {
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #ffffff14;
  color: var(--sun);
  font: 600 13px var(--heading);
}

.ticket small {
  display: block;
  color: #ffffffb8;
  font-size: 12px;
}

/* แผงฟอร์ม / การ์ด */
.panel {
  background: #fff;
  border-radius: 26px;
  box-shadow: var(--lift-2);
  padding: 28px;
  margin-bottom: 24px;
  position: relative;
}

.panelhead {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 22px;
}

.num {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #fff4cc;
  font: 600 19px var(--heading);
  color: #8a6a00;
}

.panelhead h2 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -.3px;
  line-height: 1.4;
}

.sub {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.fields {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 18px 16px;
}

.f {
  grid-column: span 3;
  min-width: 0;
}

.f.s1 { grid-column: span 1; }
.f.s2 { grid-column: span 2; }
.f.s4 { grid-column: span 4; }
.f.s6 { grid-column: span 6; }

label, .lbl {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 7px;
}

.req { color: var(--orange); }
.opt { color: var(--muted); font-weight: 400; font-size: 12px; }

.field {
  width: 100%;
  min-height: 48px;
  border: 1px solid #23291f26;
  border-radius: 14px;
  background: var(--paper);
  padding: 11px 14px;
  font-size: 16px;
  transition: border-color .15s, background .15s;
}

.field:focus {
  outline: 2px solid var(--sun-deep);
  outline-offset: 2px;
  background: #fff;
}

textarea.field {
  resize: vertical;
  min-height: 90px;
  line-height: 1.8;
}

.hint {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}

.err {
  font-size: 12px;
  color: var(--orange);
  margin-top: 5px;
  display: none;
}

.invalid .field, .invalid .chips {
  outline: 2px solid #e2a58a;
  outline-offset: 2px;
  border-radius: 14px;
}

.invalid .err {
  display: block;
}

/* Radio Chips สวยงาม 7 สี */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  position: relative;
  margin: 0;
}

.chip input {
  position: absolute;
  opacity: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}

.chip span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 8px 15px;
  border-radius: 999px;
  border: 1px solid #23291f26;
  background: #fff;
  font-size: 14px;
  font-weight: 500;
  color: var(--soft);
  transition: background .15s, box-shadow .15s, border-color .15s;
}

.chip span:before {
  content: '';
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dot, #c9ccbf);
  flex: none;
}

.chip input:hover + span {
  background: #f1f0e6;
}

.chip input:focus-visible + span {
  outline: 3px solid var(--ink);
  outline-offset: 3px;
}

.chip input:checked + span {
  background: var(--bg, #f1f0e6);
  border-color: var(--bd, #23291f40);
  color: var(--fg, var(--ink));
  font-weight: 600;
  box-shadow: inset 0 -3px var(--bd, #23291f26);
}

.chip.c0 { --dot: #b9bdb1; --bg: #f1f0e6; --bd: #c9ccbf; }
.chip.c1 { --dot: #6aa6c6; --bg: var(--sky); --bd: #9cc3d8; --fg: #245a7a; }
.chip.c2 { --dot: var(--sun-deep); --bg: #fff4cc; --bd: var(--sun-deep); --fg: #6b5200; }
.chip.c3 { --dot: #d9744c; --bg: var(--coral); --bd: #e2a58a; --fg: #8f3d1c; }
.chip.c4 { --dot: #8f7fd6; --bg: var(--lilac); --bd: #b9aeea; --fg: #4d3f8a; }
.chip.c5 { --dot: #5fa56b; --bg: var(--mint); --bd: #9cc7a4; --fg: #27602f; }
.chip.c6 { --dot: var(--sun); --bg: var(--ink); --bd: #000; --fg: #fff; }

/* แถวแบบสำรวจ 5 ขั้นตอน */
.step {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 6px 14px;
  padding: 22px 0;
  border-top: 1px solid #23291f14;
}

.step:first-of-type {
  border-top: 0;
  padding-top: 4px;
}

.stepnum {
  font: 600 30px/1.2 var(--heading);
  color: #8b9189;
}

.step h3 {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 12px;
}

.stepbody {
  min-width: 0;
}

.problem {
  margin-top: 14px;
  background: var(--coral);
  border-radius: 18px;
  padding: 16px;
}

.problem .field {
  background: #fff;
}

.progressline {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #f1f0e6;
  border-radius: 18px;
  padding: 14px 18px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--soft);
}

.bar {
  flex: 1;
  height: 8px;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--sun-deep);
  border-radius: 8px;
  transition: width .3s var(--ease);
}

/* ข้อความแจ้งเตือน / คำชี้แจงสำคัญ */
.notice {
  background: #fff4cc;
  color: #736025;
  border: 1px solid #e7b90c30;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.8;
  padding: 14px 18px;
  margin-bottom: 22px;
}

.notice.danger {
  background: var(--coral);
  color: #8f3d1c;
  border-color: #e2a58a60;
}

.notice.success {
  background: var(--mint);
  color: #27602f;
  border-color: #9cc7a460;
}

.submitrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.formerror {
  background: var(--coral);
  color: #8f3d1c;
  border-radius: 16px;
  padding: 13px 16px;
  font-size: 14px;
  margin-bottom: 18px;
}

/* การเลือกแพ็กเกจ */
.packages-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.pkg-card {
  border: 2px solid #23291f1a;
  border-radius: 20px;
  padding: 22px;
  background: var(--paper);
  cursor: pointer;
  transition: all .2s var(--ease);
  position: relative;
  display: flex;
  flex-direction: column;
}

.pkg-card:hover {
  border-color: var(--sun-deep);
  background: #fff;
}

.pkg-card.selected {
  border-color: var(--sun-deep);
  background: #fffdf5;
  box-shadow: 0 0 0 2px var(--sun-deep), var(--lift-1);
}

.pkg-card h3 {
  font-size: 18px;
  margin-bottom: 8px;
}

.pkg-price {
  font: 700 28px/1.1 var(--heading);
  color: var(--ink);
  margin-bottom: 8px;
}

.pkg-days {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 12px;
}

.pkg-desc {
  font-size: 14px;
  color: var(--soft);
  line-height: 1.6;
  margin-top: auto;
}

/* ส่วนแสดงสถานะผู้เรียน (Status Views) */
.status-card {
  border-radius: 26px;
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--lift-2);
}

.status-card.pending {
  background: var(--cream);
  border: 1px solid #e7b90c30;
}

.status-card.active {
  background: var(--mint);
  border: 1px solid #9cc7a460;
}

.status-card.rejected {
  background: var(--coral);
  border: 1px solid #e2a58a60;
}

.status-card.expired {
  background: #f7f3e6;
  border: 1px solid #c9ccbf;
}

.status-card.banned {
  background: #23291f;
  color: #fff;
}

.status-card.banned h2, .status-card.banned p {
  color: #fff;
}

.badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.badge-tag {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px #23291f15;
}

/* การเชื่อมต่อ LINE */
.line-connect-box {
  background: #eef7ee;
  border-radius: 20px;
  padding: 22px;
  margin-top: 20px;
  border: 1px solid #9cc7a460;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* โมดัล (Modal) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: #23291f80;
  backdrop-filter: blur(4px);
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-card {
  background: #fff;
  border-radius: 26px;
  padding: 32px;
  max-width: 580px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--lift-3);
  position: relative;
}

.modal-card h2 {
  font-size: 22px;
  margin-bottom: 12px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 24px;
}

/* ตารางแอดมิน (Admin Table) */
.admin-table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 18px;
  box-shadow: var(--lift-1);
  background: #fff;
  margin-top: 18px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  text-align: left;
}

.admin-table th {
  background: #f1f0e6;
  color: var(--ink);
  font-weight: 600;
  padding: 14px 16px;
  white-space: nowrap;
  border-bottom: 1px solid #23291f14;
}

.admin-table td {
  padding: 14px 16px;
  border-bottom: 1px solid #23291f0d;
  color: var(--soft);
}

.admin-table tr:hover td {
  background: #fafbf6;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  border-bottom: 1px solid #23291f14;
  margin-bottom: 20px;
}

.admin-tab {
  background: transparent;
  border: 0;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  transition: all .15s;
  white-space: nowrap;
}

.admin-tab.active {
  background: var(--sun);
  color: var(--ink);
  box-shadow: inset 0 -2px var(--sun-deep);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.kpi-card {
  background: #fff;
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--lift-1);
}

.kpi-card .val {
  font: 700 32px/1.1 var(--heading);
  margin-top: 6px;
}

/* หน้าจอ Responsive */
@media(max-width: 900px) {
  .hero {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px 0 36px;
  }
  .ticket {
    transform: rotate(1deg);
  }
}

@media(max-width: 640px) {
  .top {
    height: 66px;
  }
  .brand strong {
    font-size: 21px;
  }
  .pill {
    font-size: 11px;
    padding: 5px 10px;
  }
  .content {
    padding: 18px 14px 40px;
  }
  .hero p.lead {
    font-size: 15px;
  }
  .hero .btn {
    width: 100%;
  }
  .panel {
    padding: 20px;
    border-radius: 24px;
  }
  .fields {
    gap: 16px 12px;
  }
  .f, .f.s1, .f.s2, .f.s4 {
    grid-column: span 6;
  }
  .step {
    grid-template-columns: minmax(0, 1fr);
  }
  .stepnum {
    font-size: 22px;
  }
  .chip span {
    font-size: 13px;
    padding: 8px 12px;
  }
  .submitrow .btn {
    width: 100%;
  }
  .ticket {
    border-radius: 28px;
    transform: none;
  }
  .line-connect-box {
    flex-direction: column;
    align-items: stretch;
  }
  .line-connect-box .btn {
    width: 100%;
  }
}

@media(prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
