/* =====================================================================
   app.css — Shared theme (Organic design system + Kanit override, per the
   "Open House Web App" / "Staff Console" Claude Design export)
   Kanit is self-hosted (assets/fonts/kanit) — no runtime CDN dependency.
   (เปลี่ยนจาก Mitr เป็น Kanit ทั้งระบบ — ไฟล์ฟอนต์เดิมที่ assets/fonts/mitr/
   ยังเก็บไว้บนดิสก์ได้ตามปกติ แค่ไม่มีการอ้างอิงถึงแล้ว)
   ===================================================================== */

@font-face {
  font-family: 'Kanit';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/kanit/kanit-thai-400-normal.woff2') format('woff2');
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Kanit';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/kanit/kanit-latin-400-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Kanit';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/kanit/kanit-thai-500-normal.woff2') format('woff2');
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Kanit';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('../fonts/kanit/kanit-latin-500-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Kanit';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/kanit/kanit-thai-600-normal.woff2') format('woff2');
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Kanit';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/kanit/kanit-latin-600-normal.woff2') format('woff2');
}
@font-face {
  font-family: 'Kanit';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/kanit/kanit-thai-700-normal.woff2') format('woff2');
  unicode-range: U+0E01-0E5B, U+200C-200D, U+25CC;
}
@font-face {
  font-family: 'Kanit';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/kanit/kanit-latin-700-normal.woff2') format('woff2');
}

:root {
  /* ---- ink / neutrals (Organic system) ---- */
  --oh-ink: #201e1d;
  --oh-cream: #f5ead8;
  --oh-page-bg: #f7fbff;
  --oh-surface: #fffdf8;
  --oh-border: rgba(32, 30, 29, .12);

  /* ---- vivid palette (Open House Web App override) ---- */
  --oh-pink: #ff4fa3;
  --oh-cyan: #2fd8e0;
  --oh-purple: #a05cff;
  --oh-lime: #b6e02f;
  --oh-yellow: #ffe14f;
  --oh-orange: #ffb03a;

  /* ---- semantic aliases (kept for existing markup/JS) ---- */
  --oh-primary: #a05cff;
  --oh-primary-dark: #7a3fd6;
  --oh-primary-light: #f3e8ff;
  --oh-accent: #ffb03a;
  --oh-success: #2f9e44;
  --oh-warning: #e07a1f;
  --oh-danger: #b3261e;
  --oh-text: var(--oh-ink);
  --oh-text-muted: rgba(32, 30, 29, .6);
  --oh-bg: var(--oh-page-bg);

  --oh-radius: 22px;
  --oh-radius-sm: 16px;
  --oh-radius-lg: 32px;
  --oh-radius-pill: 999px;
  --oh-shadow: 0 6px 20px rgba(32, 30, 29, .06);
  --oh-shadow-lg: 0 22px 50px rgba(160, 92, 255, .18);

  font-size: 18px;
}

* { box-sizing: border-box; }

@keyframes oh-shimmer { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
@keyframes oh-twinkle { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1.15); } }
@keyframes oh-popin { 0% { opacity: 0; transform: translateY(10px) scale(.97); } 100% { opacity: 1; transform: none; } }
@keyframes oh-holo {
  0% { transform: translate3d(-2%, -1%, 0) scale(1.05); }
  50% { transform: translate3d(2%, 2%, 0) scale(1.12); }
  100% { transform: translate3d(-2%, -1%, 0) scale(1.05); }
}
@keyframes oh-sheen { 0% { transform: translateX(-60%) rotate(8deg); } 100% { transform: translateX(160%) rotate(8deg); } }
@keyframes oh-spin { to { transform: rotate(360deg); } }

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100%;
  background: var(--oh-page-bg);
  color: var(--oh-text);
  font-family: 'Kanit', system-ui, sans-serif;
  line-height: 1.6;
}

a { color: #c67139; text-decoration: none; }
a:hover { color: #8c491a; text-decoration: underline; }

.oh-bg-veil {
  position: fixed;
  inset: -10%;
  z-index: -1;
  pointer-events: none;
  opacity: .5;
  filter: blur(60px);
  animation: oh-holo 26s ease-in-out infinite;
  background: conic-gradient(from 200deg at 50% 50%,
    rgba(255, 79, 163, .35), rgba(255, 225, 79, .28), rgba(182, 224, 47, .28),
    rgba(47, 216, 224, .32), rgba(160, 92, 255, .32), rgba(255, 79, 163, .35));
}

.oh-page {
  position: relative;
  min-height: 100vh;
  isolation: isolate;
  background:
    radial-gradient(900px 520px at 6% -6%, rgba(255, 79, 163, .18), transparent 62%),
    radial-gradient(820px 480px at 98% 2%, rgba(47, 216, 224, .20), transparent 64%),
    radial-gradient(760px 520px at 18% 62%, rgba(160, 92, 255, .14), transparent 64%),
    radial-gradient(700px 480px at 88% 84%, rgba(182, 224, 47, .14), transparent 62%),
    linear-gradient(180deg, #fbfdff, #f4f8ff 45%, #fdf6fb);
}

.oh-rainbow-bar {
  height: 6px;
  background: linear-gradient(90deg, #ff4fa3, #ffb03a, #b6e02f, #2fd8e0, #a05cff, #ff4fa3);
  background-size: 200% 100%;
  animation: oh-shimmer 6s linear infinite;
}

/* ---- top nav ---- */
.oh-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
  background: rgba(255, 255, 255, .68);
  border-bottom: 1px solid rgba(255, 255, 255, .7);
  box-shadow: 0 6px 24px rgba(32, 30, 29, .06);
}
.oh-nav__inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.oh-nav__brand { display: flex; align-items: center; gap: 10px; margin-right: auto; }
.oh-nav__brand img { width: 40px; height: 40px; object-fit: contain; }
.oh-nav__brand-name { font-weight: 600; font-size: 21px; line-height: 1; }
.oh-nav__brand-sub { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: rgba(32, 30, 29, .55); }
.oh-nav__links { display: flex; gap: 6px; flex-wrap: wrap; }
.oh-nav__links a,
.oh-nav__links button {
  font-family: 'Kanit', sans-serif;
  font-weight: 600;
  font-size: 15px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--oh-border);
  background: #fff;
  color: var(--oh-ink);
  cursor: pointer;
}
.oh-nav__links a.is-active,
.oh-nav__links button.is-active {
  border-color: var(--oh-purple);
  background: var(--oh-purple);
  color: #fff;
  box-shadow: 0 6px 16px rgba(160, 92, 255, .4);
}

/* ---- layout shells ---- */
.oh-container { max-width: 720px; margin: 0 auto; padding: 24px 16px 64px; position: relative; z-index: 1; }
.oh-container--wide { max-width: 1180px; margin: 0 auto; padding: 24px 16px 64px; position: relative; z-index: 1; }
.oh-container--frame { max-width: 980px; margin: 0 auto; padding: 26px 22px 60px; position: relative; z-index: 1; }

.oh-hero-banner { display: block; width: 100%; height: auto; }

.oh-eyebrow { font-family: 'Kanit'; font-size: 17px; color: var(--oh-purple); margin-top: 12px; font-weight: 500; }
.oh-h1 { font-family: 'Kanit'; font-size: 42px; line-height: 1.05; margin: 4px 0 6px; max-width: 22ch; font-weight: 700; }
.oh-lede { font-size: 18px; color: rgba(32, 30, 29, .75); font-family: 'Kanit'; }

@media (max-width: 640px) {
  .oh-h1 { font-size: 32px; }
}

/* legacy plain header (login/search fallback contexts) */
.oh-header {
  background: linear-gradient(135deg, var(--oh-purple) 0%, var(--oh-pink) 100%);
  color: #fff;
  padding: 28px 16px;
  text-align: center;
  box-shadow: var(--oh-shadow);
}
.oh-header__eyebrow { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; margin: 0 0 4px; }
.oh-header h1 { margin: 0; font-size: 1.5rem; font-weight: 600; }
.oh-header p { margin: 6px 0 0; opacity: .9; font-size: .95rem; }

/* ---- notes / info cards ---- */
.oh-notes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 16px; }
.oh-note-card {
  display: flex; gap: 11px; align-items: flex-start;
  background: var(--oh-surface); border: 1px solid var(--oh-border);
  border-radius: 22px; padding: 14px 16px; box-shadow: 0 4px 14px rgba(32, 30, 29, .05);
}
.oh-note-card .dot { width: 8px; height: 8px; flex: none; margin-top: 6px; border-radius: 999px; }
.oh-note-card .text { font-size: 20px; line-height: 1.55; color: rgba(32, 30, 29, .72); font-family: 'Kanit'; }

/* note card แบบเน้นเด่น — ใช้กับข้อความที่อยากให้สะดุดตาที่สุด (เช่น จุดขายหลัก)
   พื้นหลัง/ตัวหนังสือยังคงเป็นสีขาวแบบปกติ แต่มีกรอบไล่สีวิ่งรอบการ์ดให้สะดุดตา */
.oh-note-card--highlight {
  position: relative;
  z-index: 0;
  border-color: transparent;
  animation: oh-note-pop .45s cubic-bezier(.34, 1.56, .64, 1);
}
.oh-note-card--highlight::before {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 22px;
  z-index: -1;
  background: linear-gradient(90deg, #ff4fa3, #a05cff, #2fd8e0, #ffb03a, #ff4fa3);
  background-size: 300% 100%;
  opacity: .5;
  animation: oh-note-border-run 3s linear infinite;
}
.oh-note-card--highlight .text b,
.oh-note-card--highlight .text strong { color: var(--oh-ink); text-decoration: underline; text-underline-offset: 3px; }
@keyframes oh-note-pop {
  0%   { transform: scale(.96); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
@keyframes oh-note-border-run {
  0%   { background-position: 0% 50%; }
  100% { background-position: 300% 50%; }
}

/* ---- venue / map card ---- */
.oh-venue-card {
  margin-top: 14px; border-radius: 26px; overflow: hidden;
  border: 1px solid var(--oh-border); background: var(--oh-surface);
  box-shadow: 0 6px 20px rgba(32, 30, 29, .06);
}
.oh-venue-card__head { padding: 14px 18px 12px; display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.oh-venue-card__kicker { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: #c2185b; }
.oh-venue-card__name { font-family: 'Kanit'; font-weight: 600; font-size: 18px; margin-top: 3px; }
.oh-venue-card__line { font-size: 16px; color: rgba(32, 30, 29, .6); font-family: 'Kanit'; }
.oh-venue-card__link {
  margin-left: auto; text-decoration: none; font-family: 'Kanit'; font-weight: 600; font-size: 14px;
  padding: 9px 15px; border-radius: 999px; background: var(--oh-ink); color: #fff;
}
.oh-venue-card__link:hover { text-decoration: none; opacity: .9; }
.oh-venue-card iframe { display: block; width: 100%; height: 260px; border: 0; }

/* ---- generic cards ---- */
.oh-card {
  background: var(--oh-surface);
  border-radius: var(--oh-radius-lg);
  box-shadow: var(--oh-shadow);
  padding: 24px;
  position: relative;
  z-index: 1;
}
@media (min-width: 640px) { .oh-card { padding: 32px; } }
.oh-card--elev { box-shadow: 0 10px 30px rgba(32, 30, 29, .08); }

.oh-form-card { background: var(--oh-surface); border-radius: var(--oh-radius-lg); padding: 22px; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 10px 30px rgba(32, 30, 29, .08); }

.oh-section-title { font-size: 1.05rem; font-weight: 600; margin: 28px 0 12px; color: var(--oh-purple); }
.oh-section-title:first-child { margin-top: 0; }

/* ---- fields ---- */
.oh-field { margin-bottom: 18px; }
.oh-field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 6px; color: var(--oh-text); }
.oh-field .oh-hint { font-size: .78rem; color: var(--oh-text-muted); margin-top: 5px; }
.oh-field .oh-error { font-size: .78rem; font-weight: 500; color: var(--oh-danger); margin-top: 5px; display: none; }
.oh-field.has-error .oh-error { display: block; }
.oh-field.has-error input,
.oh-field.has-error select,
.oh-field.has-error textarea { border-color: var(--oh-danger) !important; }

.oh-field.oh-row-2 { display: grid; grid-template-columns: 3fr 1fr; gap: 14px; align-items: start; }
@media (max-width: 480px) {
  .oh-field.oh-row-2 { grid-template-columns: 1fr; }
}

input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="search"], select, textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1.5px solid var(--oh-border);
  border-radius: var(--oh-radius-pill);
  font-size: .95rem;
  font-family: inherit;
  color: var(--oh-text);
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
select { border-radius: var(--oh-radius-sm); }
textarea { border-radius: var(--oh-radius-sm); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--oh-purple);
  box-shadow: 0 0 0 3px var(--oh-primary-light);
}

/* pill-style choice groups (dates / grade / etc.) — reuses existing markup pattern */
.oh-checkbox-group, .oh-radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.oh-checkbox-group label, .oh-radio-group label {
  display: flex; align-items: center; gap: 8px;
  font-weight: 500; font-family: 'Kanit'; font-size: 13px;
  border: 1.5px solid var(--oh-border); border-radius: 999px;
  padding: 9px 16px; cursor: pointer; flex: 0 0 auto;
  transition: border-color .15s, background .15s, color .15s;
  background: #fff; color: var(--oh-ink);
}
.oh-checkbox-group label > input, .oh-radio-group label > input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.oh-checkbox-group label:has(input:checked),
.oh-radio-group label:has(input:checked) {
  border-color: var(--oh-pink);
  background: var(--oh-pink);
  color: #fff;
  box-shadow: 0 6px 16px rgba(255, 79, 163, .4);
}

.oh-consent {
  border-radius: 22px; padding: 15px 17px;
  background: #f7f2ff; border: 1px solid rgba(160, 92, 255, .35);
}
.oh-consent__title { font-weight: 700; font-size: 15px; margin-bottom: 6px; }
.oh-consent__title .req { color: #c2185b; }
.oh-consent__body { font-size: 14px; color: rgba(32, 30, 29, .7); }
.oh-consent__body + .oh-consent__body { margin-top: 8px; }
.oh-consent__toggle {
  cursor: pointer; margin-top: 11px; display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; padding: 0; font: inherit; text-align: left; width: 100%;
}
.oh-consent__box {
  width: 22px; height: 22px; flex: none; border-radius: 7px; display: grid; place-items: center;
  font-size: 16px; color: #fff; border: 1.5px solid rgba(32, 30, 29, .3); background: #fff;
}
.oh-consent__toggle.is-checked .oh-consent__box { border-color: var(--oh-purple); background: var(--oh-purple); }
.oh-consent__label { font-size: 15px; font-weight: 600; }
.oh-consent .oh-error { font-size: .78rem; font-weight: 500; color: var(--oh-danger); margin-top: 8px; display: none; }
.oh-consent.has-error { border-color: var(--oh-danger); }
.oh-consent.has-error .oh-error { display: block; }
.oh-consent.has-error .oh-consent__label { color: var(--oh-danger); }
.oh-consent.has-error .oh-consent__box { border-color: var(--oh-danger); }

/* ---- searchable faculty combobox ---- */
.oh-combo { position: relative; }
.oh-combo__panel {
  position: absolute; z-index: 9; left: 0; right: 0; top: calc(100% + 6px);
  max-height: 250px; overflow: auto; background: #fff;
  border: 1px solid var(--oh-border); border-radius: 20px;
  box-shadow: 0 14px 34px rgba(32, 30, 29, .16); padding: 6px;
}
.oh-combo__option {
  cursor: pointer; width: 100%; text-align: left; border: 0; background: transparent;
  border-radius: 14px; padding: 10px 13px; display: flex; align-items: center; gap: 9px;
  font-size: 15px; font-weight: 500; font-family: 'Kanit'; color: var(--oh-ink);
}
.oh-combo__option:hover, .oh-combo__option.is-active { background: rgba(32, 30, 29, .06); }
.oh-combo__option .dot { width: 9px; height: 9px; flex: none; border-radius: 999px; }
.oh-combo__empty { padding: 12px 14px; font-size: 15px; color: rgba(32, 30, 29, .5); }
.oh-combo__selected {
  margin-top: 7px; display: inline-flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 999px; font-size: 14px; font-weight: 600; color: var(--oh-ink);
}
.oh-combo__selected .dot { width: 9px; height: 9px; border-radius: 999px; }

/* ---- buttons ---- */
.oh-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--oh-radius-pill);
  padding: 14px 22px; font-size: .98rem; font-weight: 600;
  font-family: 'Kanit', sans-serif; cursor: pointer;
  transition: transform .1s, box-shadow .15s, opacity .15s;
  width: 100%;
}
.oh-btn:active { transform: scale(0.98); }
.oh-btn:disabled { opacity: .6; cursor: not-allowed; }

.oh-btn--gradient {
  color: #fff;
  background: linear-gradient(95deg, #ff4fa3, #a05cff 55%, #2fd8e0);
  box-shadow: 0 8px 22px rgba(160, 92, 255, .38);
}
.oh-btn--gradient-lime { color: var(--oh-ink); background: linear-gradient(95deg, #b6e02f, #ffe14f); }
.oh-btn--gradient-cyan { color: #fff; background: linear-gradient(95deg, #2fd8e0, #a05cff); box-shadow: 0 8px 20px rgba(47, 216, 224, .4); }
.oh-btn--gradient-pink { color: #fff; background: linear-gradient(95deg, #ff4fa3, #a05cff); box-shadow: 0 8px 20px rgba(160, 92, 255, .35); }
.oh-btn--primary { background: var(--oh-purple); color: #fff; }
.oh-btn--primary:hover { background: var(--oh-primary-dark); }
.oh-btn--secondary { background: #fff; color: var(--oh-ink); border: 1.5px solid var(--oh-border); }
.oh-btn--ghost { background: transparent; color: var(--oh-text-muted); border: 1px solid var(--oh-border); }
.oh-btn--danger { background: var(--oh-danger); color: #fff; }
.oh-btn--sm { padding: 9px 16px; font-size: .85rem; width: auto; }
.oh-btn--dark { background: var(--oh-ink); color: #fff; }

/* ---- perks card ---- */
.oh-perks-card { border-radius: 30px; background: var(--oh-ink); color: #fff; padding: 22px; margin: 20px 0 0; }
.oh-perks-card__title { letter-spacing: .18em; text-transform: uppercase; color: rgba(255,255,255,.55); font-weight: 500; font-size: 14px; }
.oh-perks-list { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.oh-perk { display: flex; gap: 12px; align-items: flex-start; }
.oh-perk__n { width: 26px; height: 26px; flex: none; border-radius: 999px; display: grid; place-items: center; font-family: 'Kanit'; font-weight: 600; font-size: 14px; color: var(--oh-ink); }
.oh-perk__title { font-family: 'Kanit'; font-size: 17px; font-weight: 600; }

/* ---- alerts / spinner ---- */
.oh-alert { border-radius: var(--oh-radius-sm); padding: 14px 16px; font-size: .9rem; margin-bottom: 18px; display: flex; gap: 10px; align-items: flex-start; }
.oh-alert--error { background: #ffe9e6; color: #8c1d18; border: 1px solid #f3b6b0; }
.oh-alert--success { background: #e9fbe8; color: #1e6b2c; border: 1px solid #bde8bb; }
.oh-alert--warning { background: #fff1e0; color: #8c491a; border: 1px solid #f3cf9e; }
.oh-alert--info { background: #eafcff; color: #0f7f8c; border: 1px solid #b9eef4; }

.oh-spinner { width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.4); border-top-color: #fff; border-radius: 50%; animation: oh-spin .7s linear infinite; display: inline-block; }

.oh-footer { text-align: center; color: var(--oh-text-muted); font-size: .8rem; margin-top: 32px; }
.oh-link-row { text-align: center; margin-top: 18px; font-size: .9rem; }

/* ---- toast ---- */
.oh-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 40;
  animation: oh-popin .25s ease both; padding: 12px 20px; border-radius: 999px;
  background: var(--oh-ink); color: #fff; font-size: 15px; font-weight: 600;
  box-shadow: 0 12px 30px rgba(32, 30, 29, .35);
}

/* ---- gate card (staff login) ---- */
.oh-gate-wrap { min-height: 86vh; display: grid; place-items: center; padding: 40px 20px; }
.oh-gate-card { width: 100%; max-width: 420px; display: flex; flex-direction: column; gap: 13px; background: var(--oh-surface); border-radius: var(--oh-radius-lg); box-shadow: 0 10px 30px rgba(32,30,29,.08); padding: 28px; }
.oh-gate-brand { display: flex; align-items: center; gap: 11px; }
.oh-gate-brand img { width: 44px; height: 44px; object-fit: contain; }
.oh-gate-brand__title { font-weight: 600; font-size: 19px; line-height: 1.1; }
.oh-gate-brand__sub { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: rgba(32,30,29,.55); }
.oh-gate-title { font-weight: 600; font-size: 22px; margin-top: 4px; }
.oh-gate-body { font-size: 15px; color: rgba(32,30,29,.65); }

[hidden] { display: none !important; }
