/* ==========================================================================
   CyoriaSMP — Design Tokens & Core System
   ใช้ร่วมกันทุกหน้า (public + admin + dashboard)
   ========================================================================== */

/* ─── Fonts ──────────────────────────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ─── Tokens ─────────────────────────────────────────────────────────────── */

:root {
  /* Backgrounds */
  --bg: #050506;
  --bg-surface: color-mix(in srgb, var(--fg) 6%, transparent);
  --bg-elevated: color-mix(in srgb, var(--fg) 9%, transparent);
  --bg-card: color-mix(in srgb, var(--fg) 5%, transparent);

  /* Foregrounds */
  --fg: #ffffff;
  --muted: #8a8f98;
  --subtle: color-mix(in srgb, var(--fg) 40%, transparent);

  /* Borders */
  --border: color-mix(in srgb, var(--fg) 15%, transparent);
  --border-hover: color-mix(in srgb, var(--fg) 30%, transparent);

  /* Accent */
  --accent: #5e6ad2;
  --accent-hover: #7b85e0;
  --accent-muted: color-mix(in srgb, var(--accent) 15%, transparent);
  --accent-border: color-mix(in srgb, var(--accent) 35%, transparent);

  /* Status */
  --success: #22c55e;
  --warning: #eab308;
  --danger: #ef4444;
  --info: #3b82f6;

  /* Typography */
  --font-display: Inter, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-body: Inter, system-ui, -apple-system, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  /* Spacing (8px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;

  /* Radii */
  --radius: 8px;
  --radius-sm: 6px;

  /* Shadows */
  --shadow: 0 20px 60px color-mix(in srgb, var(--bg) 75%, transparent);
  --shadow-sm: 0 4px 12px color-mix(in srgb, var(--bg) 80%, transparent);

  /* Layout */
  --shell-width: 1180px;
  --header-height: 72px;
}

/* ─── prefers-reduced-motion ────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ─── Reset ───────────────────────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--fg);
  background: var(--bg);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  color: inherit;
  font: inherit;
  cursor: pointer;
}

input,
textarea,
select {
  font: inherit;
  color: var(--fg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  outline: none;
  transition: border-color 0.2s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-border);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

::placeholder {
  color: var(--muted);
}

/* ─── Utilities ───────────────────────────────────────────────────────────── */

.shell {
  width: min(var(--shell-width), calc(100% - 40px));
  margin: 0 auto;
}

.shell-sm {
  width: min(900px, calc(100% - 40px));
  margin: 0 auto;
}

.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;
}

/* ─── Typography ──────────────────────────────────────────────────────────── */

h1, h2, h3, h4, h5, h6, p {
  margin-top: 0;
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(44px, 8vw, 86px);
  line-height: 1.03;
  letter-spacing: -0.04em;
  font-weight: 600;
  margin-bottom: 26px;
}

h2 {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 600;
}

h3 {
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: -0.01em;
  font-weight: 600;
}

.eyebrow {
  margin: 0 0 18px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.text-mono {
  font-family: var(--font-mono);
}

.text-muted {
  color: var(--muted);
}

.text-sm {
  font-size: 13px;
}

/* ─── Buttons ─────────────────────────────────────────────────────────────── */

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  white-space: nowrap;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  background: var(--accent);
  color: var(--fg);
  border: 1px solid var(--accent);
}

.button-primary:hover {
  background: var(--accent-hover);
  box-shadow: 0 8px 24px color-mix(in srgb, var(--accent) 25%, transparent);
}

.button-secondary {
  background: transparent;
  color: var(--fg);
  border: 1px solid var(--border);
}

.button-secondary:hover {
  border-color: var(--accent-border);
  background: var(--accent-muted);
}

/* ─── Status Dot ──────────────────────────────────────────────────────────── */

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  display: inline-block;
  flex-shrink: 0;
}

.status-dot.status-online {
  background: var(--success);
  box-shadow: 0 0 8px color-mix(in srgb, var(--success) 50%, transparent);
}

.status-dot.status-offline {
  background: var(--danger);
}
