/* ───────── หน้าสมัครทดลองใช้ฟรี (public landing) ─────────
   ใช้ design token ชุดเดียวกับ UI หลักของระบบ (style2.css: --ink/--surface/--line/
   --accent/--brand-gradient/--radius/--shadow) เพื่อให้หน้า public หน้าตาเป็นชุดเดียว
   กับหน้าที่ล็อกอินเข้าไปแล้ว — style2.css ต้องถูกโหลดก่อนไฟล์นี้เสมอ (ดู Index.cshtml)

   หมายเหตุ: หน้านี้ "ไม่" ครอบด้วย .s2 โดยตั้งใจ เพราะ .s2 .card-body บังคับ
   display:flex !important ซึ่งจะไปชนกับเลย์เอาต์ของฟอร์มนี้ — ยืมเฉพาะ token จาก :root
   ส่วนสีที่ระบบไม่มี token ให้ (สีบนพื้น gradient, สีแบรนด์ LINE) ประกาศเป็น --ts-* ด้านล่าง

   dark mode: token ของระบบสลับให้เองผ่าน [data-theme="dark"] ใน style2.css
   (LayoutFullScreen ยังไม่มีสวิตช์ธีม จึงเรนเดอร์เป็น light เสมอ แต่ถ้าเพิ่มทีหลังจะรองรับทันที) */

:root {
  /* hero อยู่บน brand gradient ซึ่งเข้มทั้งสองธีม จึงใช้ตัวอักษรสีขาวได้เลย ไม่ต้อง override ตอน dark */
  --ts-hero-fg: #ffffff;
  --ts-hero-fg-dim: rgba(255, 255, 255, 0.86);
  --ts-hero-fg-soft: rgba(255, 255, 255, 0.72);
  --ts-hero-chip-bg: rgba(255, 255, 255, 0.14);
  --ts-hero-chip-border: rgba(255, 255, 255, 0.34);
  --ts-hero-rule: rgba(255, 255, 255, 0.22);
  /* สีแบรนด์ LINE — ปุ่มแอด LINE ใช้สีนี้เพื่อให้ผู้ใช้จำช่องทางได้ทันที
       และแยกลำดับความสำคัญออกจากปุ่มหลักที่เป็นสีแบรนด์ OneSync */
  --ts-line-bg: #06c755;
  --ts-line-hover: #05a948;
}

/* หน้านี้ทาพื้นเอง ไม่ต้องพึ่ง body ของ Metronic
   ใช้ :has() แทนการเติม class ด้วย JS เพื่อไม่ให้พื้นหลังกะพริบตอนโหลด (FOUC) */
body:has(.ts-card) {
  background: var(--bg-tint, #fbfcfd);
}

/* กว้างขึ้นเพื่อรองรับเลย์เอาต์ 2 คอลัมน์บนจอใหญ่ */
body:has(.ts-card) .content .container {
  max-width: 1000px;
  padding-left: 12px;
  padding-right: 12px;
}

body:has(.ts-card) main {
  padding-bottom: 0 !important;
}

/* footer เดิมของ LayoutFullScreen เป็นแถบเทาทึบ — ปรับเฉพาะหน้านี้ให้เข้าชุดกับ token
   (จำกัดขอบเขตด้วย :has() เพื่อไม่ให้กระทบ Home/Privacy/Terms/NoMembership ที่ใช้ layout เดียวกัน) */
body:has(.ts-card) footer.footer {
  background-color: var(--surface, #ffffff) !important;
  color: var(--ink-3, #6b7280) !important;
  border-top: 1px solid var(--line, #eceef1) !important;
  font-size: 0.9rem;
}

.ts-card {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  background: var(--surface, #ffffff);
  border: 1px solid var(--line, #eceef1);
  border-radius: var(--radius-lg, 14px);
  overflow: hidden;
  box-shadow: var(
    --shadow-lg,
    0 4px 12px rgba(15, 23, 42, 0.05),
    0 16px 40px rgba(15, 23, 42, 0.08)
  );
  margin: 22px 0 30px;
  font-family:
    "Inter",
    "Sarabun",
    -apple-system,
    "Segoe UI",
    sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}

/* thank-you เป็นคอลัมน์เดียวเสมอ ไม่ต้องแบ่งซ้าย-ขวา */
.ts-card.is-single {
  grid-template-columns: 1fr;
}

/* ── hero (คอลัมน์ซ้ายบนจอใหญ่) ── */
.ts-hero {
  background: var(
    --brand-gradient,
    linear-gradient(
      135deg,
      oklch(68.014% 0.12438 228.937),
      oklch(57.81% 0.13865 246.211)
    )
  );
  color: var(--ts-hero-fg, #ffffff);
  padding: 38px 34px;
  display: flex;
  flex-direction: column;
}

.ts-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* โลโก้เป็นภาพสีขาวโปร่ง — บนพื้น gradient ต้องมีเงาช่วยดันขอบ ไม่งั้นรายละเอียดจม */
.ts-brand img {
  width: 55px;
  height: 55px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.28));
}

/* auto ทั้งบน-ล่าง = จัดกึ่งกลางในพื้นที่ที่เหลือระหว่างโลโก้กับบรรทัดแบรนด์ */
.ts-hero-body {
  margin: auto 0;
  padding: 28px 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: flex-start;
}

.ts-brand-name {
  font-size: 1.6rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.ts-hero-eyebrow {
  align-self: flex-start;
  border: 1px solid var(--ts-hero-chip-border, rgba(255, 255, 255, 0.34));
  background: var(--ts-hero-chip-bg, rgba(255, 255, 255, 0.14));
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.ts-hero-title {
  font-size: 1.85rem;
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: -0.01em;
  margin: 0;
}

.ts-hero-sub {
  font-size: 1.2rem;
  line-height: 1.65;
  margin: 0;
  color: var(--ts-hero-fg-dim, rgba(255, 255, 255, 0.86));
}

.ts-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.ts-chip {
  border: 1px solid var(--ts-hero-chip-border, rgba(255, 255, 255, 0.34));
  background: var(--ts-hero-chip-bg, rgba(255, 255, 255, 0.14));
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 1rem;
  font-weight: 600;
  white-space: nowrap;
}

/* บรรทัดแบรนด์ติดล่างสุดของคอลัมน์บนจอใหญ่ (ts-hero-body กินที่ว่างที่เหลือไปหมดแล้ว) */
.ts-hero-foot {
  padding-top: 22px;
  border-top: 1px solid var(--ts-hero-rule, rgba(255, 255, 255, 0.22));
  font-size: 0.88rem;
  line-height: 1.6;
  color: var(--ts-hero-fg-soft, rgba(255, 255, 255, 0.72));
}

/* ── ฟอร์ม (คอลัมน์ขวาบนจอใหญ่) ── */
.ts-form {
  padding: 34px 34px 32px;
}

.ts-field {
  margin-bottom: 16px;
}

.ts-label {
  display: block;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--label, #344054);
  margin-bottom: 6px;
}

.ts-label .ts-optional {
  font-weight: 400;
  color: var(--ink-4, #9aa3b2);
}

/* ให้ตรงกับ .s2 .fld-input ของ UI หลัก (เส้นขอบ / โฟกัสริง / รัศมี)
   แต่สูงกว่าเล็กน้อยเพราะเป็นหน้า public ที่กรอกบนมือถือเป็นหลัก */
.ts-input {
  width: 100%;
  height: 40px;
  border-radius: var(--radius, 10px);
  border: 1px solid var(--line-strong, #d5d9de);
  background: var(--surface, #ffffff);
  color: var(--ink, #1d2939);
  padding: 0 12px;
  /* ต้อง >= 16px กัน iOS Safari zoom ตอน focus */
  font-size: 16px;
  font-family: inherit;
  transition:
    border-color 120ms,
    box-shadow 120ms;
  -webkit-appearance: none;
  appearance: none;
}

.ts-input::placeholder {
  color: var(--ink-4, #9aa3b2);
}

.ts-input:hover {
  border-color: oklch(78% 0.012 240);
}

.ts-input:focus {
  outline: none;
  border-color: var(--accent, #3a9bc1);
  box-shadow: 0 0 0 3px
    color-mix(in oklch, var(--accent, #3a9bc1) 18%, transparent);
}

.ts-input.is-invalid {
  border-color: var(--danger, #dc3545);
  box-shadow: 0 0 0 3px
    color-mix(in oklch, var(--danger, #dc3545) 15%, transparent);
}

.ts-hint {
  font-size: 1rem;
  color: var(--ink-4, #9aa3b2);
  margin-top: 6px;
}

.ts-error {
  font-size: 0.85rem;
  color: var(--danger, #dc3545);
  margin-top: 5px;
}

/* honeypot — ต้องซ่อนจากคนแต่ยังอยู่ใน DOM ให้ bot เห็น
   ห้ามใช้ Bootstrap d-none (มี !important) เพราะ field นี้ไม่ต้อง toggle แต่กันสับสนไว้ก่อน */
.ts-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

/* ── ปุ่ม ── */
/* ทรงเดียวกับ .s2-btn-primary ของ UI หลัก (pill + สี accent) */
.ts-btn {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 32px;
  min-height: 52px;
  font-family: inherit;
  font-size: 1.02rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color 120ms,
    border-color 120ms;
}

/* ใช้ brand-gradient ตัวเดียวกับ hero (และกับ .co-page-icon ของ UI หลัก)
   แทนสี --accent แบนๆ เพื่อให้ปุ่มหลักกับ hero เป็นสีชุดเดียวกัน */
.ts-btn-primary {
  background: var(
    --brand-gradient,
    linear-gradient(
      135deg,
      oklch(68.014% 0.12438 228.937),
      oklch(57.81% 0.13865 246.211)
    )
  );
  font-size: 1.2rem;
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 4px 14px
    color-mix(in oklch, var(--accent, #3a9bc1) 34%, transparent);
  transition:
    filter 120ms,
    box-shadow 120ms;
}

.ts-btn-primary:hover,
.ts-btn-primary:focus {
  filter: brightness(0.94);
  color: #ffffff;
  text-decoration: none;
}

.ts-btn-line {
  background: var(--ts-line-bg, #06c755);
  border-color: var(--ts-line-bg, #06c755);
  color: #ffffff;
  font-size: 1.2rem;
}

.ts-btn-line:hover,
.ts-btn-line:focus {
  background: var(--ts-line-hover, #05a948);
  border-color: var(--ts-line-hover, #05a948);
  color: #ffffff;
  text-decoration: none;
}

.ts-btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.ts-safe {
  text-align: center;
  font-size: 1rem;
  color: var(--ink-4, #9aa3b2);
  margin: 12px 0 0;
}

.ts-or {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--ink-4, #9aa3b2);
  font-size: 0.88rem;
}

.ts-or::before,
.ts-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line, #eceef1);
}

.ts-terms {
  text-align: center;
  font-size: 1rem;
  color: var(--ink-4, #9aa3b2);
  margin: 16px 0 0;
}

/* ── thank-you ── */
.ts-thanks {
  padding: 52px 34px 48px;
  text-align: center;
  max-width: 520px;
  margin: 0 auto;
}

.ts-thanks-icon {
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(
    --brand-gradient,
    linear-gradient(
      135deg,
      oklch(68.014% 0.12438 228.937),
      oklch(57.81% 0.13865 246.211)
    )
  );
  box-shadow: var(
    --shadow,
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 4px 14px rgba(15, 23, 42, 0.04)
  );
}

.ts-thanks-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink, #1d2939);
  margin-bottom: 10px;
}

.ts-thanks-text {
  font-size: 1rem;
  line-height: 1.7;
  color: var(--ink-3, #6b7280);
  margin-bottom: 24px;
}

/* ── responsive ── */
@media (max-width: 860px) {
  .ts-card {
    grid-template-columns: 1fr;
  }

  .ts-hero {
    padding: 30px 26px 26px;
  }

  /* บนมือถือไม่มีที่ว่างให้จัดกึ่งกลาง — บีบระยะห่างลงให้ถึงฟอร์มเร็วขึ้น */
  .ts-hero-body {
    padding: 16px 0 0;
    gap: 12px;
  }

  /* hero อยู่บนสุด ไม่ใช่คอลัมน์ข้าง — ตัดบรรทัดแบรนด์ออกเพื่อไม่ให้ดันฟอร์มลงไปอีก */
  .ts-hero-foot {
    display: none;
    font-size: 1.2rem;
  }

  .ts-hero-title {
    font-size: 1.55rem;
  }

  .ts-form {
    padding: 26px 26px 28px;
  }
}

@media (max-width: 480px) {
  .ts-card {
    margin: 12px 0 22px;
  }

  .ts-hero {
    padding: 16px 20px 20px;
  }

  .ts-hero-title {
    font-size: 1.42rem;
  }

  .ts-form {
    padding: 22px 20px 26px;
  }

  /* ไอคอน/หัวข้อ/ปุ่มถูกขยายขึ้นสำหรับจอใหญ่ (ดู .ts-thanks-icon/.ts-thanks-title/
     .ts-btn-line ด้านบน) แต่ไม่เคยลดขนาดกลับตอนจอมือถือแคบ ทำให้สถานะ thank-you
     ดูอัดแน่น/ล้นจอเมื่อเทียบกับพื้นที่ที่มี */
  .ts-thanks {
    padding: 36px 20px 32px;
  }

  .ts-thanks-icon {
    width: 56px;
    height: 56px;
  }

  .ts-thanks-title {
    font-size: 1.2rem;
  }

  .ts-thanks .ts-btn-line {
    font-size: 1rem;
  }
}
