/* ============================================================
   SALESUPPORT — Base Reset & Global Styles
   ============================================================
   ไฟล์นี้คือ "การตั้งค่าเริ่มต้น" ของทุกหน้า
   ไม่ต้องแก้ไขมาก — ใช้ tokens จาก tokens.css ทั้งหมด
   ============================================================ */

/* 1. Reset พื้นฐาน — ลบ margin/padding เริ่มต้นของ browser */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 2. ตั้งค่า body หลัก */
html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--color-text);
  background-color: var(--color-bg);
  line-height: 1.5;
  min-height: 100vh;
}

/* 3. หัวข้อ (Heading) */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  color: var(--color-heading);
  font-weight: var(--font-semibold);
  line-height: 1.3;
}

h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }

/* 4. ลิงก์ */
a {
  color: var(--color-emerald-600);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--color-emerald-700); }

/* 5. รูปภาพ */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 6. ตาราง — ตั้งค่าพื้นฐาน (จะ override ใน components.css) */
table {
  width: 100%;
  border-collapse: collapse;
}

/* 7. ฟอร์ม — ตั้งค่าพื้นฐาน */
input, textarea, select, button {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

/* 8. Scrollbar — สีเขียว subtle */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: var(--color-bg);
}
::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: var(--radius-full);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--color-muted);
}

/* 9. Utility class ที่ใช้บ่อย */
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-left   { text-align: left; }

.text-muted     { color: var(--color-muted); }
.text-secondary { color: var(--color-secondary); }
.text-success   { color: var(--color-success); }
.text-warning   { color: var(--color-warning); }
.text-error     { color: var(--color-error); }
.text-info      { color: var(--color-info); }

.font-mono   { font-family: var(--font-mono); }
.font-bold   { font-weight: var(--font-bold); }
.font-semibold { font-weight: var(--font-semibold); }
.font-medium { font-weight: var(--font-medium); }

.text-xs { font-size: var(--text-xs); }
.text-sm { font-size: var(--text-sm); }
.text-lg { font-size: var(--text-lg); }
.text-xl { font-size: var(--text-xl); }
.text-2xl { font-size: var(--text-2xl); }
.text-3xl { font-size: var(--text-3xl); }

/* 10. Display utilities */
.flex          { display: flex; }
.inline-flex   { display: inline-flex; }
.items-center  { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-6 { gap: var(--space-6); }

/* 11. Margin/Padding แบบใช้บ่อย */
.m-0  { margin: 0; }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.p-4  { padding: var(--space-4); }
.p-6  { padding: var(--space-6); }
