/* ==========================================================
   TECH ION SUPPORT - หน้าแจ้งปัญหา
   style.css : mobile first
   ธีมเดียวกับ docs-portal / เว็บบริษัท: ฟอนต์ Prompt · น้ำเงิน #155FD5 · ฟ้า #00C8F5 · กรมท่า #0A193A · พื้น #F7F9FC
   ฟอนต์อยู่ใน assets/fonts/ (SIL Open Font License) ไม่โหลดจาก CDN
========================================================== */

:root {
  --ink: #172033;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f7f9fc;
  --card: #ffffff;
  --brand: #155fd5;
  --brand-hover: #1677e8;
  --brand-soft: #e8f0fd;
  --accent: #00c8f5;
  --accent-ink: #00bfbf;
  --navy: #0a193a;
  --on-navy: #b8c5d9;
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --warn: #b45309;
  --warn-soft: #fef3c7;
  --ok: #065f46;
  --ok-soft: #d1fae5;
  --radius: 12px;
}

@font-face { font-family:"Prompt"; font-style:normal; font-weight:400; font-display:swap; src:url("assets/fonts/prompt-400-thai.woff2") format("woff2"); unicode-range:U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family:"Prompt"; font-style:normal; font-weight:400; font-display:swap; src:url("assets/fonts/prompt-400-latin.woff2") format("woff2"); unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family:"Prompt"; font-style:normal; font-weight:500; font-display:swap; src:url("assets/fonts/prompt-500-thai.woff2") format("woff2"); unicode-range:U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family:"Prompt"; font-style:normal; font-weight:500; font-display:swap; src:url("assets/fonts/prompt-500-latin.woff2") format("woff2"); unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family:"Prompt"; font-style:normal; font-weight:600; font-display:swap; src:url("assets/fonts/prompt-600-thai.woff2") format("woff2"); unicode-range:U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family:"Prompt"; font-style:normal; font-weight:600; font-display:swap; src:url("assets/fonts/prompt-600-latin.woff2") format("woff2"); unicode-range:U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

* { box-sizing: border-box; }

/* ให้ attribute hidden ชนะ display ของ class เสมอ (JS ใช้ hidden ซ่อน/โชว์ส่วนต่างๆ) */
[hidden] { display: none !important; }

html, body { margin: 0; padding: 0; }

/* ขนาดตัวอักษรทั้งหน้า: ลดลง 1 ระดับจากค่าเริ่มต้นของเบราว์เซอร์ (16px → 90% เท่ากับกดซูมออก 1 ครั้ง)
   ขนาดในไฟล์นี้และ assets/prefs.css เป็น rem จึงเล็กลงตามกันทั้งหน้า ยกเว้นช่องกรอกบนมือถือที่ต้องคง 16px (ดูหัวข้อช่องกรอก) */
html { font-size: 90%; }

body {
  font-family: "Prompt", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Thai", sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- แถบบน (เหมือน docs-portal) ---------- */
.topbar {
  background: var(--navy);
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: .55rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .6rem; color: #fff; line-height: 1.1; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; }
.brand b { font-weight: 600; font-size: 1.15rem; letter-spacing: -.01em; }
.brand b span { color: var(--accent-ink); }
.brand small { display: block; font-size: .6rem; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--on-navy); margin-top: .15rem; }
.phone { color: var(--on-navy); font-size: .85rem; white-space: nowrap; }
.phone:hover { color: #fff; text-decoration: none; }
.topbar-right { display: flex; align-items: center; gap: 10px; }

footer {
  text-align: center;
  color: var(--on-navy);
  background: var(--navy);
  font-size: .8rem;
  padding: 1.25rem 1rem;
  margin-top: auto;
}

/* ---------- โครงหน้า ---------- */
.page {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 1.25rem 1rem 2rem;
  flex: 1;
}
.card-stack { display: flex; flex-direction: column; gap: 14px; }

.title { font-size: 1.5rem; font-weight: 600; margin: .25rem 0 0; letter-spacing: -.01em; }
.subtitle { margin: 0 0 4px; color: var(--muted); font-size: .9rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: 0 1px 2px rgba(10,25,58,.04);
}
.card-title { font-size: 1.05rem; font-weight: 600; margin: 0 0 .6rem; }
.card-label { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }

/* ---------- ช่องกรอก ---------- */
.field { display: block; margin-bottom: .9rem; }
.field:last-child { margin-bottom: 0; }
.field-label { display: block; font-size: .95rem; margin-bottom: .25rem; font-weight: 600; }
.req { color: var(--danger); font-weight: 700; }

input[type="text"], input[type="tel"], input[type="email"], select, textarea {
  width: 100%;
  font: inherit;
  font-weight: normal;
  font-size: 16px; /* 16px ขึ้นไป iOS จะไม่ซูมเข้าเวลาแตะ */
  padding: .6rem .7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  color: var(--ink);
}
select { appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' fill='none' stroke='%2364748b' stroke-width='2'/></svg>");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--brand); outline-offset: 1px; border-color: var(--brand);
}
input.invalid, select.invalid, textarea.invalid { border-color: var(--danger); }
/* จอที่ใช้เมาส์ (คอมพิวเตอร์) ไม่มีปัญหาซูม ให้ช่องกรอกเล็กลงเท่าตัวหนังสืออื่นในหน้า */
@media (hover: hover) and (pointer: fine) {
  input[type="text"], input[type="tel"], input[type="email"], select, textarea { font-size: 1rem; }
}

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 380px) { .two-col { grid-template-columns: 1fr; } }

.hint { font-size: .8rem; color: var(--muted); margin-top: 6px; }

/* ---------- รายการค้นหาลูกค้า ---------- */
.search-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--card);
  margin: -6px 0 12px;
  overflow: hidden;
}
.search-list button {
  display: block; width: 100%; text-align: left;
  font: inherit; font-size: 16px;
  padding: .7rem .75rem; border: 0; background: none; color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.search-list button:last-child { border-bottom: 0; }
.search-list button:active { background: var(--brand-soft); }
.search-list .empty { padding: .7rem .75rem; color: var(--muted); font-size: .9rem; }

.chosen {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--brand-soft); border-radius: 8px;
  padding: .6rem .75rem; margin-bottom: .9rem; font-weight: 500;
}
.link-btn { font: inherit; font-size: .9rem; color: var(--brand); background: none; border: 0; padding: 0; text-decoration: underline; cursor: pointer; }

/* ---------- การ์ดอุปกรณ์ (โหมด QR) ---------- */
.device-card { border-left: 4px solid var(--accent); }
.device-main { font-size: 1.15rem; font-weight: 600; margin-top: 4px; }
.device-sub { color: var(--muted); font-size: .9rem; margin-top: 2px; }
.device-warn { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: .5rem .7rem; font-size: .85rem; margin-top: 10px; }
.tcr-fields { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line, rgba(127,127,127,.25)); }
.staff-card { border-left: 4px solid var(--warn); }
.staff-card .check-row { margin-top: 6px; }

/* ---------- รูปถ่าย ---------- */
.photo-row { display: flex; flex-wrap: wrap; gap: 10px; }
.photo-add {
  width: 96px; height: 96px; border: 2px dashed var(--line); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  color: var(--brand); font-weight: 500; font-size: .85rem; cursor: pointer; text-align: center; padding: 4px;
}
.photo-thumb { position: relative; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; background: var(--line); }
.photo-thumb img, .photo-thumb video { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-thumb .remove {
  position: absolute; top: 4px; right: 4px; width: 26px; height: 26px; border-radius: 50%;
  border: 0; background: rgba(10,25,58,.7); color: #fff; font-size: 16px; line-height: 26px; padding: 0; cursor: pointer;
}
.photo-thumb .busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--card) 70%, transparent); font-size: .75rem; color: var(--muted); }
.photo-thumb .fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: .8rem; color: var(--muted); }

/* ---------- ช่อง S/N + ปุ่มสแกน ---------- */
.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row input { flex: 1; min-width: 0; }
.btn-icon {
  display: inline-flex; align-items: center; gap: 6px;
  font: inherit; font-size: .95rem; font-weight: 500; white-space: nowrap;
  background: var(--card); color: var(--brand); border: 1px solid var(--brand); border-radius: 8px;
  padding: 0 .8rem; cursor: pointer;
}
.btn-icon:hover { background: var(--brand-soft); }

/* ---------- แถบความคืบหน้าตอนอัปโหลด ---------- */
.progress { display: flex; flex-direction: column; gap: 6px; }
.progress-track { height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress-bar { height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--accent)); transition: width .2s ease; }
.progress-text { font-size: .85rem; color: var(--muted); text-align: center; }

/* ---------- กล่องสแกนบาร์โค้ด (เต็มจอ) ---------- */
.no-scroll { overflow: hidden; }
.scanner {
  position: fixed; inset: 0; z-index: 1000; background: rgba(10,25,58,.92);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.scanner-box { width: 100%; max-width: 480px; background: var(--card); border-radius: 12px; padding: 16px; text-align: center; }
.scanner-box h2 { margin: 0 0 10px; font-size: 1.1rem; color: var(--ink); }
.scanner-view { position: relative; width: 100%; aspect-ratio: 4 / 3; background: #000; border-radius: 8px; overflow: hidden; }
#scannerVideo { width: 100%; height: 100%; object-fit: cover; display: block; }
.scanner-frame {
  position: absolute; left: 12%; right: 12%; top: 30%; bottom: 30%;
  border: 2px solid var(--accent); border-radius: 8px; pointer-events: none;
}
.scanner-line { position: absolute; left: 0; right: 0; height: 2px; background: var(--accent); animation: scanLine 2s linear infinite; }
@keyframes scanLine { 0% { top: 0; } 50% { top: calc(100% - 2px); } 100% { top: 0; } }
.scanner-status { font-size: .9rem; color: var(--muted); margin: 10px 0 0; }
.scanner-buttons .btn-secondary { margin-top: 10px; }

/* ---------- ส่ง ---------- */
.submit-area { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.turnstile { min-height: 65px; display: flex; justify-content: center; }
.btn-primary {
  font: inherit; font-size: 1.05rem; font-weight: 600;
  background: var(--brand); color: #fff; border: 1px solid var(--brand); border-radius: 8px;
  padding: .85rem 1rem; width: 100%; cursor: pointer;
}
.btn-primary:hover:not(:disabled) { background: var(--brand-hover); border-color: var(--brand-hover); }
.btn-primary:disabled { opacity: .6; cursor: wait; }
.btn-secondary {
  font: inherit; font-size: 1rem; font-weight: 500;
  background: var(--card); color: var(--brand); border: 1px solid var(--brand); border-radius: 8px;
  padding: .7rem 1rem; width: 100%; margin-top: 12px; cursor: pointer;
}
.btn-secondary:hover { background: var(--brand-soft); }
.fineprint { font-size: .85rem; color: var(--muted); text-align: center; margin: 0; }

/* ---------- ข้อความแจ้ง ---------- */
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 6px; padding: .6rem .8rem; font-size: .9rem; }
.form-error { background: var(--danger-soft); color: var(--danger); border-radius: 6px; padding: .6rem .8rem; font-size: .9rem; }
.photo-error { margin: .5rem 0; }

/* ---------- หน้าสำเร็จ ---------- */
.success-card { text-align: center; padding: 1.75rem 1rem; }
.success-icon {
  width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 8px;
  background: var(--ok-soft); color: var(--ok); font-size: 34px; line-height: 64px; font-weight: 700;
}
.success-ticket { font-size: 1.25rem; margin: 6px 0; }

/* ==========================================================
   ธีมมืด (เลือกจากเมนูฟันเฟือง หรือ "ตามระบบ") ดู assets/prefs.js
   เปลี่ยนเฉพาะ token สีทั้งหน้า ค่าที่กรอกและข้อมูลที่ส่งเข้า GLPI ไม่เกี่ยว
========================================================== */
:root[data-theme="dark"] {
  --ink: #e6ebf5;
  --muted: #9aa8c0;
  --line: #2a3650;
  --bg: #0b1220;
  --card: #141d31;
  --brand: #4d8cf5;
  --brand-hover: #6aa0ff;
  --brand-soft: #1b2a4a;
  --accent: #00c8f5;
  --accent-ink: #34d8f0;
  --navy: #070d1a;
  --on-navy: #9aa8c0;
  --danger: #ff8a8a;
  --danger-soft: #3a1c1c;
  --warn: #f5c26b;
  --warn-soft: #3a2f14;
  --ok: #6ee7b7;
  --ok-soft: #123326;
}
:root[data-theme="dark"] select {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' fill='none' stroke='%239aa8c0' stroke-width='2'/></svg>");
}
:root[data-theme="dark"] .card { box-shadow: none; }
:root[data-theme="dark"] .btn-primary { color: #fff; }

/* ===== โหมดธนาคาร: FAQ + ช่องติ๊กยืนยัน ===== */
.faq-intro { font-size: .9rem; color: var(--muted); margin: 0 0 .6rem; }
.faq-list { list-style: none; margin: 0 0 .75rem; padding: 0; display: grid; gap: 6px; counter-reset: faq; }
.faq-list > li > a {
  display: flex; align-items: center; gap: 10px;
  padding: .6rem .75rem; border: 1px solid var(--line); border-radius: 8px;
  color: var(--ink); text-decoration: none; background: var(--card);
}
.faq-list > li > a:hover { border-color: var(--brand); background: var(--brand-soft); }
.faq-icon { font-size: 1.1rem; line-height: 1; flex: none; }
.faq-text { flex: 1; font-size: .95rem; }
.faq-play { flex: none; color: #fff; background: #e62117; border-radius: 6px; font-size: .7rem; padding: 3px 7px; }
.faq-offline { padding: .6rem .75rem; border: 1px dashed var(--line); border-radius: 8px; }
.faq-offline-head { display: flex; align-items: center; gap: 10px; font-size: .95rem; }
.faq-offline ol { margin: .4rem 0 0 1.9rem; padding: 0; font-size: .9rem; color: var(--muted); }
.check-row { display: flex; align-items: flex-start; gap: 10px; padding: .6rem .75rem; border-radius: 8px; background: var(--brand-soft); cursor: pointer; font-size: .95rem; font-weight: 500; }
.check-row input { width: 20px; height: 20px; margin: 1px 0 0; flex: none; accent-color: var(--brand); }
.check-row:has(input.invalid) { outline: 2px solid var(--danger); }
