/* ============================================================
   base.css — Reset & Utilities
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Kanit:wght@400;500;600;700&family=Sarabun:wght@400;500;600;700&display=swap');

*, *::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: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background: var(--color-bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img, svg { display: block; max-width: 100%; }
button { font-family: var(--font-body); cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: var(--font-body); }

/* Layout */
.container { max-width: var(--max-w); margin: 0 auto; padding: 0 var(--sp-5); }
.page-body { padding-top: calc(var(--header-h) + var(--sp-6)); padding-bottom: var(--sp-12); }

/* Flex & Grid helpers */
.flex        { display: flex; }
.flex-col    { display: flex; flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }

/* Text utilities */
.text-sm  { font-size: var(--text-sm); }
.text-xs  { font-size: var(--text-xs); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold { font-weight: 700; }
.text-center { text-align: center; }
.text-muted  { color: var(--color-text-3); }
.text-primary { color: var(--color-primary); }

/* Card */
.card {
  background: var(--color-surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
}

/* Badge */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 10px; border-radius: var(--r-full);
  font-size: var(--text-xs); font-weight: 600;
}
.badge-green  { background: var(--color-primary-light); color: var(--color-primary-dark); }
.badge-gold   { background: #fef3cd; color: #856404; }
.badge-red    { background: #fde8ea; color: #842029; }
.badge-gray   { background: #f0f4f2; color: var(--color-text-3); }

/* Button */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 10px 22px; border-radius: var(--r-md);
  font-size: var(--text-base); font-weight: 600;
  transition: all .18s ease; cursor: pointer; border: none;
  white-space: nowrap;
}
.btn-primary {
  background: var(--color-primary); color: var(--color-text-inv);
  box-shadow: 0 2px 8px rgba(26,122,74,.30);
}
.btn-primary:hover { background: var(--color-primary-dark); box-shadow: var(--shadow-lg); transform: translateY(-1px); }
.btn-outline {
  background: transparent; color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
}
.btn-outline:hover { background: var(--color-primary-faint); }
.btn-sm { padding: 6px 14px; font-size: var(--text-sm); border-radius: var(--r-sm); }
.btn-danger { background: var(--color-danger); color: #fff; }
.btn-danger:hover { background: #b02a37; }

/* Form */
.form-group { display: flex; flex-direction: column; gap: var(--sp-2); }
.form-label { font-size: var(--text-sm); font-weight: 600; color: var(--color-text-2); }
.form-control {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--r-md);
  font-size: var(--text-base);
  font-family: var(--font-body);
  color: var(--color-text);
  background: var(--color-surface);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.form-control:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(26,122,74,.12);
}
.form-control::placeholder { color: var(--color-text-3); }
.form-control.is-invalid { border-color: var(--color-danger); }

/* Alert */
.alert {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  display: flex; align-items: center; gap: var(--sp-2);
}
.alert-danger  { background: #fde8ea; color: #842029; border: 1px solid #f5c2c7; }
.alert-success { background: #d1e7dd; color: #0a3622; border: 1px solid #a3cfbb; }

/* Divider */
.divider {
  display: flex; align-items: center; gap: var(--sp-3);
  color: var(--color-text-3); font-size: var(--text-sm);
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--color-border);
}

/* sr-only */
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }
