/* ============================================================
   JAIFUL Design System
   Colors: Deep Blue #2D5A7B | Gold #E8A838 | Green #4CAF7D | Warm White #F5F0EB
   Font: IBM Plex Sans Thai Looped
   ============================================================ */

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

/* ── CSS Variables ── */
:root {
  --blue:       #2D5A7B;
  --blue-dark:  #1e3f57;
  --blue-light: #3d7aa8;
  --gold:       #E8A838;
  --gold-dark:  #c98d20;
  --gold-light: #f5c96a;
  --green:      #4CAF7D;
  --green-dark: #3a9165;
  --warm-white: #F5F0EB;
  --warm-gray:  #e8e0d8;
  --text:       #2a2a2a;
  --text-muted: #777;
  --error:      #e05252;
  --error-bg:   #fdf0f0;
  --shadow-sm:  0 2px 8px rgba(45,90,123,0.08);
  --shadow-md:  0 4px 20px rgba(45,90,123,0.12);
  --shadow-lg:  0 8px 40px rgba(45,90,123,0.16);
  --radius-sm:  8px;
  --radius-md:  12px;
  --radius-lg:  20px;
  --radius-xl:  28px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'IBM Plex Sans Thai Looped', sans-serif;
  background: var(--warm-white);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Typography ── */
h1, h2, h3, h4 { line-height: 1.3; font-weight: 700; }
h1 { font-size: clamp(1.75rem, 5vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 4vw, 2rem); }
h3 { font-size: clamp(1.1rem, 3vw, 1.4rem); }
p { font-size: 1rem; }

/* ── Utility ── */
.text-center { text-align: center; }
.text-gold    { color: var(--gold); }
.text-blue    { color: var(--blue); }
.text-green   { color: var(--green); }
.text-muted   { color: var(--text-muted); }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* ── Container ── */
.container {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.container-wide {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 1.75rem;
  border-radius: var(--radius-md);
  font-family: 'IBM Plex Sans Thai Looped', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  white-space: nowrap;
  text-decoration: none;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: var(--gold);
  color: var(--blue-dark);
}
.btn-primary:hover { background: var(--gold-dark); text-decoration: none; }

.btn-secondary {
  background: transparent;
  color: var(--blue);
  border: 2px solid var(--blue);
}
.btn-secondary:hover { background: var(--blue); color: white; text-decoration: none; }

.btn-blue {
  background: var(--blue);
  color: white;
}
.btn-blue:hover { background: var(--blue-dark); text-decoration: none; }

.btn-green {
  background: var(--green);
  color: white;
}
.btn-green:hover { background: var(--green-dark); text-decoration: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: none;
  padding: 0.5rem 1rem;
}
.btn-ghost:hover { color: var(--blue); text-decoration: none; }

.btn-lg { padding: 1rem 2rem; font-size: 1.1rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 0.5rem 1rem; font-size: 0.875rem; border-radius: var(--radius-sm); }

.btn-full { width: 100%; }

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* ── Cards ── */
.card {
  background: white;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-sm);
}

.card-bordered {
  border: 1px solid var(--warm-gray);
}

/* ── Forms ── */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--blue-dark);
  margin-bottom: 0.4rem;
}

.form-label .required {
  color: var(--error);
  margin-left: 3px;
}

.form-label .hint {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-left: 6px;
}

.form-input {
  width: 100%;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--warm-gray);
  border-radius: var(--radius-md);
  font-family: 'IBM Plex Sans Thai Looped', sans-serif;
  font-size: 1rem;
  color: var(--text);
  background: white;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
}

.form-input:focus {
  outline: none;
  border-color: var(--blue-light);
  box-shadow: 0 0 0 3px rgba(45,90,123,0.1);
}

.form-input.error {
  border-color: var(--error);
  box-shadow: 0 0 0 3px rgba(224,82,82,0.1);
}

.form-input::placeholder { color: #bbb; }

textarea.form-input {
  resize: vertical;
  min-height: 100px;
}

select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%232D5A7B' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
}

.form-error {
  color: var(--error);
  font-size: 0.85rem;
  margin-top: 0.35rem;
  display: none;
}
.form-error.visible { display: block; }

/* ── Radio & Checkbox Choices ── */
.choice-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.choice-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  border: 1.5px solid var(--warm-gray);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  background: white;
}

.choice-item:hover {
  border-color: var(--blue-light);
  background: rgba(45,90,123,0.03);
}

.choice-item.selected {
  border-color: var(--blue);
  background: rgba(45,90,123,0.06);
}

.choice-item input[type="radio"],
.choice-item input[type="checkbox"] {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.choice-label { font-size: 0.95rem; line-height: 1.4; }

/* ── Scale input ── */
.scale-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scale-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--warm-gray);
  background: white;
  font-family: 'IBM Plex Sans Thai Looped', sans-serif;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.scale-btn:hover { border-color: var(--blue-light); }
.scale-btn.selected { background: var(--blue); color: white; border-color: var(--blue); }

.scale-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.4rem;
}

/* ── Progress Steps ── */
.progress-wrap {
  padding: 1.25rem 0;
}

.progress-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 0.75rem;
}

.step-dot {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--warm-gray);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.step-dot.active {
  background: var(--blue);
  color: white;
  box-shadow: 0 0 0 4px rgba(45,90,123,0.15);
}

.step-dot.done {
  background: var(--green);
  color: white;
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--warm-gray);
  max-width: 60px;
  transition: background 0.3s;
}

.step-line.done { background: var(--green); }

.progress-label {
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.progress-label strong { color: var(--blue); }

/* ── Alert / Notice ── */
.alert {
  padding: 1rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.alert-info { background: rgba(45,90,123,0.08); color: var(--blue-dark); }
.alert-success { background: rgba(76,175,125,0.1); color: var(--green-dark); }
.alert-warning { background: rgba(232,168,56,0.12); color: #8a5e10; }
.alert-error { background: var(--error-bg); color: var(--error); }

.alert-icon { font-size: 1.2rem; flex-shrink: 0; margin-top: 1px; }

/* ── Loading spinner ── */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

.spinner-blue {
  border: 2px solid rgba(45,90,123,0.15);
  border-top-color: var(--blue);
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast notification ── */
#toast-container {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
  width: calc(100% - 3rem);
  max-width: 400px;
}

.toast {
  background: var(--blue-dark);
  color: white;
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  box-shadow: var(--shadow-md);
  animation: toast-in 0.3s ease;
  pointer-events: auto;
}

.toast.success { background: var(--green-dark); }
.toast.error   { background: var(--error); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Badge display ── */
.badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.badge-blue   { background: rgba(45,90,123,0.12); color: var(--blue); }
.badge-gold   { background: rgba(232,168,56,0.15); color: #8a5e10; }
.badge-green  { background: rgba(76,175,125,0.12); color: var(--green-dark); }
.badge-gray   { background: var(--warm-gray); color: var(--text-muted); }

/* ── Status chips ── */
.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-chip::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.7;
}

.status-interested { background: rgba(232,168,56,0.12); color: #8a5e10; }
.status-registered  { background: rgba(45,90,123,0.1); color: var(--blue); }
.status-confirmed   { background: rgba(76,175,125,0.12); color: var(--green-dark); }
.status-attended    { background: rgba(76,175,125,0.2); color: var(--green-dark); }
.status-cancelled   { background: rgba(224,82,82,0.1); color: var(--error); }
.status-paid        { background: rgba(76,175,125,0.15); color: var(--green-dark); }
.status-pending     { background: rgba(232,168,56,0.1); color: #8a5e10; }
.status-uploaded    { background: rgba(45,90,123,0.1); color: var(--blue); }

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--warm-gray);
  margin: 1.5rem 0;
}

/* ── Avatar / Icon ── */
.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--blue);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── File upload ── */
.file-upload-zone {
  border: 2px dashed var(--warm-gray);
  border-radius: var(--radius-md);
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.file-upload-zone:hover,
.file-upload-zone.drag-over {
  border-color: var(--blue-light);
  background: rgba(45,90,123,0.03);
}

.file-upload-zone .upload-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.file-upload-zone p { color: var(--text-muted); font-size: 0.9rem; }
.file-upload-zone strong { color: var(--blue); }

.file-preview {
  margin-top: 1rem;
  padding: 0.75rem 1rem;
  background: rgba(45,90,123,0.05);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.file-preview-icon { font-size: 1.5rem; }
.file-preview-name { font-size: 0.9rem; font-weight: 500; flex: 1; }
.file-preview-remove { cursor: pointer; color: var(--error); padding: 0.25rem; }

/* ── Payment info box ── */
.payment-box {
  background: linear-gradient(135deg, #1e3f57, #2D5A7B);
  color: white;
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.payment-box .bank-name {
  font-size: 0.85rem;
  opacity: 0.7;
  margin-bottom: 0.25rem;
}

.payment-box .account-number {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold);
}

.payment-box .account-holder {
  font-size: 0.9rem;
  opacity: 0.85;
  margin-top: 0.2rem;
}

.payment-box .price-tag {
  background: var(--gold);
  color: var(--blue-dark);
  font-weight: 800;
  font-size: 1.25rem;
  padding: 0.5rem 1.25rem;
  border-radius: var(--radius-md);
  display: inline-block;
  margin-top: 1rem;
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 1000;
  animation: fade-in 0.2s ease;
  padding: 0;
}

@media (min-width: 600px) {
  .modal-overlay { align-items: center; padding: 1rem; }
}

.modal {
  background: white;
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem 1.5rem 2.5rem;
  animation: slide-up 0.3s ease;
}

@media (min-width: 600px) {
  .modal { border-radius: var(--radius-xl); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.modal-close {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--warm-gray);
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(20px); } to { transform: translateY(0); } }

/* ── Responsive ── */
@media (max-width: 480px) {
  .card { padding: 1.25rem; border-radius: var(--radius-md); }
  .btn-lg { padding: 0.875rem 1.5rem; font-size: 1rem; }
}
