:root {
  --primary: #1e90ff;
  --primary-dark: #1565c0;
  --bg: #f5f7fa;
  --card: #ffffff;
  --text: #111;
  --radius: 14px;
}

/* ================= BASE ================= */
body {
  margin: 0;
  font-family: "Kanit", sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  /* ❗ สำคัญ */
}

/* ================= HEADER ================= */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 64px;
  background: #ffffff;
  border-bottom: 1px solid #e5e7eb;
  z-index: 1000;
}

.site-header .container {
  height: 100%;
}

.brand {
  font-family: "Kodchasan", sans-serif;
  font-size: 1.1rem;
  font-weight: 500;
  text-decoration: none;
  color: #000;
  letter-spacing: 1px;
  transform: skewX(-2deg);
}

/* ================= FOOTER ================= */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 48px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  z-index: 1000;
}

/* ================= CONTENT ================= */
#page-content {
  position: fixed;
  top: 64px;
  bottom: 48px;
  left: 0;
  right: 0;
  overflow-y: auto;
  padding: 16px;
}

/* ================= BUTTON ================= */
.btn-register {
  background: linear-gradient(135deg, #1e90ff, #4facfe);
  color: #ffffff;
  font-family: "Kodchasan", sans-serif;
  font-size: 1.15rem;
  font-weight: 500;
  border-radius: 999px;
  border: none;
  box-shadow: 0 6px 14px rgba(30, 144, 255, 0.35);
  transition: all 0.2s ease;
}

.btn-register:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(30, 144, 255, 0.45);
}

/* ================= STEP ================= */
.step {
  max-width: 720px;
  margin: 0 auto;
}

.d-none {
  display: none !important;
}

/* ================= ธงชาติ เปลี่ยนภาษา ================= */
.lang-switch .lang-btn {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
}

.lang-switch .lang-btn img {
  width: 32px;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.lang-switch .lang-btn:hover img {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

/* ธงที่เลือกอยู่ */
.lang-switch .lang-btn.active img {
  outline: 2px solid #1e90ff;
}

/* ❌ ข้อมูลไม่ครบ → แจ้งเตือน*/
.is-invalid {
  border-color: #dc3545;
}

/* หน้าสำหรับเลือก วัน / เดือน / ปี (ซ่อนก่อน)*/
/* Overlay */
.birth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 1999;
  opacity: 0;
  transition: opacity 0.25s ease;
}

/* Bottom Sheet */
.birth-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  z-index: 2000;
  border-radius: 20px 20px 0 0;
  padding: 12px 16px 20px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
}

/* Active state */
.birth-sheet.active {
  transform: translateY(0);
}

.birth-overlay.active {
  opacity: 1;
}

/* Grab handle */
.sheet-handle {
  width: 44px;
  height: 5px;
  background: #ccc;
  border-radius: 3px;
  margin: 6px auto 14px;
}

.birth-sheet {
  touch-action: none;
}

/* Overlay */
.birth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: 0.3s;
  z-index: 1999;
}

.birth-overlay.active {
  opacity: 1;
}

/* Bottom Sheet */
.birth-sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 48px;
  /* 👈 ดันขึ้นเหนือ footer */
  background: #fff;
  z-index: 3000;
  /* 👈 สูงกว่า footer แน่นอน */
  border-radius: 20px 20px 0 0;
  padding: 12px 16px 0;
  transform: translateY(120%);
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.15);
  max-height: calc(100vh - 112px);
  /* header + footer */
  display: flex;
  flex-direction: column;
}

.birth-sheet.active {
  transform: translateY(0);
}

/* Handle */
.sheet-handle {
  width: 44px;
  height: 5px;
  background: #ccc;
  border-radius: 3px;
  margin: 6px auto 12px;
}

/* Picker */
.picker-wheel {
  position: relative;
  display: flex;
  height: 180px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}

.picker-wheel select {
  flex: 1 1 0;
  min-width: 0;
  /* 🔴 ตัวนี้จำเป็นมาก */
  border: none;
  background: transparent;
  font-size: 16px;
  /* ลดลงเล็กน้อย */
  text-align: center;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
}

.picker-wheel option {
  height: 36px;
  line-height: 36px;
  white-space: nowrap;
}

.picker-wheel select::-webkit-scrollbar {
  display: none;
}

/* เส้นกลาง iOS */
.picker-highlight {
  position: absolute;
  top: 72px;
  left: 0;
  right: 0;
  height: 36px;
  border-top: 1px solid #ddd;
  border-bottom: 1px solid #ddd;
  pointer-events: none;
}

/* ================= Sticky Confirm Button ================= */
.sheet-footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 12px 0 4px;
  border-top: 1px solid #e5e7eb;
}

/* ปรับ padding ของ sheet */
.birth-sheet {
  padding-bottom: 8px;
  /* ลดจากเดิม */
}

/* ================= Sheet Body ================= */
.sheet-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 12px;
}

/* ================= Sheet Footer (ปุ่ม) ================= */
.sheet-footer {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 10px 0 6px;
  border-top: 1px solid #e5e7eb;
}

/* ===== Toast slide-in ===== */
.toast-slide {
  position: fixed;
  left: 50%;
  bottom: -100px;
  transform: translateX(-50%);
  background: rgba(46, 46, 46, 0.85);
  /* background: rgba(0, 0, 0, 0.85);*/
  color: #fff;
  padding: 14px 20px;
  border-radius: 24px;
  font-size: 15px;

  /* min-width: 260px;*/
  /* ← เพิ่มตรงนี้ */
  /* max-width: 90vw;*/
  /* ← ไม่ล้นจอ */
  width: calc(100% - 32px);
  /* ← เต็มจอเว้นขอบ */
  max-width: 420px;
  text-align: center;

  z-index: 4000;
  opacity: 0;
  transition: all 0.35s ease;
  pointer-events: none;
}

#address-picker {
  width: 100vw;
  max-width: 100vw;
  overflow-x: hidden;
}

.toast-slide.show {
  bottom: 55px;
  opacity: 1;
}

/* ================= PAYMENT ================= */
#step-payment .card {
  border-radius: 14px;
}

#step-payment .btn-primary {
  background: linear-gradient(135deg, #1e90ff, #4facfe);
  border: none;
  border-radius: 12px;
  font-size: 16px;
}

#step-payment .alert {
  border-radius: 12px;
}

/* ================= STEP PROGRESS ================= */
.step-progress {
  width: 100%;
}

/* เส้นพื้นหลัง */
.progress-bar-line {
  position: relative;
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

/* เส้นสีฟ้า */
.progress-active {
  height: 100%;
  background: linear-gradient(135deg, #1e90ff, #4facfe);
  border-radius: 999px;
  transition: width 0.3s ease;
}

/* สถานะ */
.progress-active.step-1 {
  width: 33.33%;
}

.progress-active.step-2 {
  width: 66.66%;
}

.progress-active.step-3 {
  width: 100%;
}

/* ================= STEP TRANSFER ================= */
#step-transfer {
  padding-bottom: 120px;
  font-size: 14px;
}

/* กล่องขั้นตอน */
.transfer-box {
  background: #ffffff;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.transfer-title {
  font-weight: 600;
  margin-bottom: 8px;
}

.transfer-box ol {
  padding-left: 18px;
  margin: 0;
  line-height: 1.6;
}

/* ข้อควรระวัง */
.transfer-warning {
  background: #fff;
  border-left: 4px solid #ff5a5a;
  padding: 12px 14px;
  border-radius: 8px;
}

.transfer-warning ul {
  padding-left: 18px;
  margin: 6px 0 0;
}

/* กล่องข้อมูลธนาคาร */
.transfer-bank {
  background: #fff;
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.transfer-bank .row-item {
  display: flex;
  flex-direction: column;
  margin-bottom: 12px;
}

.transfer-bank .row-item span {
  color: #777;
  font-size: 12px;
}

.copy-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.copy-btn {
  border: none;
  background: #f1f5f9;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
}

/* ปุ่มล่างแบบ Mobile App */
.transfer-submit {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 64px;
  height: 52px;

  background: #4da3ff;
  color: #fff;
  border: none;
  border-radius: 14px;
  font-size: 16px;
  font-weight: 500;

  box-shadow: 0 6px 16px rgba(77, 163, 255, 0.4);
  z-index: 3000;
}

/* ===== STEP 5 TRANSFER SHEET ===== */

.transfer-sheet {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: #fff;
  z-index: 4000;
  display: none;
  flex-direction: column;
}

.transfer-sheet.active {
  display: flex;
}

.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    display: none;
    z-index: 1000;
}

.sheet-overlay.active {
    display: block;
}

/* Header */
.sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
}

.sheet-header h6 {
  margin: 0;
  font-weight: 600;
}

.close-sheet {
  background: #e6f0ff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
}

/* Content */
.sheet-content {
  padding: 16px;
  overflow-y: auto;
}

/* Warning */
.sheet-warning {
  border-left: 4px solid #ff6b6b;
  padding: 12px 14px;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 16px;
}

.sheet-warning ul {
  padding-left: 18px;
  margin: 6px 0 0;
  font-size: 13px;
}

/* Label */
.sheet-label {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
  display: block;
}

/* Slip Upload */
.slip-upload {
    position: relative;
    width: 100%;
    height: 320px; /* สูงพอสำหรับแนวตั้ง */
    border: 2px dashed #ccc;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
}

.slip-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: none;
  background: #f1f5f9;
  font-size: 20px;
}

/* Input */
.sheet-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #d1d5db;
  margin-bottom: 16px;
}

/* Amount row */
.amount-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.amount-row span {
  color: #666;
  font-size: 13px;
}

/* Actions */
.sheet-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.btn-submit {
  flex: 1;
  background: #22c55e;
  color: #fff;
  border: none;
  padding: 12px;
  border-radius: 12px;
  font-weight: 500;
}

.btn-cancel {
  flex: 1;
  background: #e5e7eb;
  border: none;
  padding: 12px;
  border-radius: 12px;
}

/* Footer */
.sheet-note {
  font-size: 12px;
  color: #666;
  text-align: center;
  margin-top: 16px;
}

.transfer-sheet {
  display: none;
}

.transfer-sheet.active {
  display: flex;
}

#btn-next:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* รูปถ่ายสลิปโอนเงิน */
.slip-upload {
  position: relative;
  width: 100%;
  height: 350px;
  border: 2px dashed #ccc;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fafafa;
  overflow: hidden;
}

.slip-btn {
  background: none;
  border: none;
  font-size: 32px;
  cursor: pointer;
  z-index: 2;
}

.slip-upload img {
    width: 100%;
    height: 100%;
    object-fit: contain; /* สำคัญที่สุด */
    background: #fff;
}

.slip-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  z-index: 3;
}

