/* ============================================================
   BASE.CSS — Variables, Fonts, Reset, Utilities
   ວຽງຈັນທະເລສົດ POS v2.0
   ============================================================ */

/* ----- Google Fonts ----- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Noto+Sans+Lao:wght@400;500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

/* ----- Design Tokens ----- */
:root {
  /* Brand */
  --primary:      #0f6648;
  --primary-dark: #0d5a3e;
  --primary-light:#e8f5ef;
  --accent:       #f0a500;
  --accent-light: #fff8e6;

  /* Semantic */
  --danger:       #c0392b;
  --danger-light: #fdf0ef;
  --warn:         #d97706;
  --warn-light:   #fef3c7;
  --info:         #2563eb;
  --info-light:   #eff6ff;
  --success:      #0f6648;
  --success-light:#e8f5ef;

  /* Neutral */
  --text-primary:  #111827;
  --text-secondary:#4b5563;
  --text-muted:    #9ca3af;
  --border:        #e5e7eb;
  --border-strong: #d1d5db;
  --bg:            #f9fafb;
  --bg-hover:      #f3f4f6;
  --card:          #ffffff;

  /* Typography */
  --font-lao:  'Noto Sans Lao', sans-serif;
  --font-num:  'Inter', 'Plus Jakarta Sans', sans-serif;
  --font-ui:   'Inter', 'Noto Sans Lao', sans-serif;

  /* Spacing */
  --radius-sm: 6px;
  --radius:    8px;
  --radius-lg: 12px;
  --radius-xl: 16px;

  /* Shadow */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.05);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.08);
  --shadow:    0 2px 8px rgba(0,0,0,.10);
  --shadow-md: 0 4px 16px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);

  /* Transitions */
  --transition: all 0.15s ease;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font-lao);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* Numbers use Inter */
.num, [data-num], td.num, .price, .qty, .amount,
.stat-value, .change-display {
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

button  { cursor: pointer; border: none; font-family: var(--font-lao); font-size: 14px; }
input, select, textarea { font-family: var(--font-lao); font-size: 14px; }
a { color: var(--primary); text-decoration: none; }
img { max-width: 100%; display: block; }

/* ----- Hidden ----- */
.hidden { display: none !important; }

/* ----- Flex utilities ----- */
.flex            { display: flex; }
.flex-col        { display: flex; flex-direction: column; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.items-end       { align-items: flex-end; }
.justify-center  { justify-content: center; }
.justify-between { justify-content: space-between; }
.justify-end     { justify-content: flex-end; }
.flex-1          { flex: 1; }
.flex-wrap       { flex-wrap: wrap; }
.shrink-0        { flex-shrink: 0; }
.gap-1  { gap: 4px; }
.gap-2  { gap: 8px; }
.gap-3  { gap: 12px; }
.gap-4  { gap: 16px; }

/* ----- Grid ----- */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.auto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }

/* ----- Width ----- */
.w-full  { width: 100%; }
.w-auto  { width: auto; }

/* ----- Text ----- */
.text-xs      { font-size: 11px; }
.text-sm      { font-size: 12px; }
.text-base    { font-size: 14px; }
.text-md      { font-size: 15px; }
.text-lg      { font-size: 16px; }
.text-xl      { font-size: 18px; }
.text-2xl     { font-size: 22px; }
.text-3xl     { font-size: 28px; }
.font-normal  { font-weight: 400; }
.font-medium  { font-weight: 500; }
.font-semibold{ font-weight: 600; }
.font-bold    { font-weight: 700; }
.text-left    { text-align: left; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.uppercase    { text-transform: uppercase; }
.tracking-wide{ letter-spacing: .6px; }
.truncate     { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whitespace-nowrap { white-space: nowrap; }
.leading-tight { line-height: 1.3; }

/* ----- Colors ----- */
.text-primary  { color: var(--primary); }
.text-danger   { color: var(--danger); }
.text-warn     { color: var(--warn); }
.text-info     { color: var(--info); }
.text-muted    { color: var(--text-muted); }
.text-secondary{ color: var(--text-secondary); }

/* ----- Spacing ----- */
.p-2 { padding: 8px; }
.p-3 { padding: 12px; }
.p-4 { padding: 16px; }
.p-5 { padding: 20px; }
.px-2 { padding-left:8px; padding-right:8px; }
.px-3 { padding-left:12px; padding-right:12px; }
.px-4 { padding-left:16px; padding-right:16px; }
.py-2 { padding-top:8px; padding-bottom:8px; }
.py-3 { padding-top:12px; padding-bottom:12px; }
.mb-1 { margin-bottom: 4px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.mb-5 { margin-bottom: 20px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.ml-auto { margin-left: auto; }
.ml-1    { margin-left: 4px; }
.mr-auto { margin-right: auto; }

/* ----- Stock status ----- */
.stock-ok  { color: var(--primary);  font-weight: 600; font-family: var(--font-num); }
.stock-low { color: var(--warn);     font-weight: 600; font-family: var(--font-num); }
.stock-out { color: var(--danger);   font-weight: 600; font-family: var(--font-num); }

/* ----- Alert box ----- */
.alert {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 1.5;
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.alert-warn    { background: var(--warn-light);    border: 1px solid #fcd34d; color: #92400e; }
.alert-info    { background: var(--info-light);    border: 1px solid #bfdbfe; color: #1e40af; }
.alert-danger  { background: var(--danger-light);  border: 1px solid #fca5a5; color: #991b1b; }
.alert-success { background: var(--success-light); border: 1px solid #6ee7b7; color: #065f46; }

/* ----- Divider ----- */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}
.divider-dashed {
  border-top-style: dashed;
}
