/* MixTrip Design Tokens — from design-system/mixtrip/MASTER.md */
@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;500;600;700&family=Nunito:wght@300;400;500;600;700&display=swap');

:root {
  /* color */
  --color-primary: #7C3AED;
  --color-on-primary: #FFFFFF;
  --color-secondary: #A78BFA;
  --color-accent: #16A34A;
  --color-background: #FAF5FF;
  --color-foreground: #4C1D95;
  --color-muted: #ECEEF9;
  --color-border: #DDD6FE;
  --color-destructive: #DC2626;
  --color-ring: #7C3AED;
  --color-surface: #FFFFFF;

  /* spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  --space-2xl: 48px;
  --space-3xl: 64px;

  /* shadows */
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.1);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
  --shadow-xl: 0 20px 25px rgba(0,0,0,0.15);

  /* type */
  --font-heading: 'Fredoka', 'Mali', sans-serif;
  --font-body: 'Nunito', 'Sarabun', sans-serif;

  /* touch */
  --touch: 44px;
  --radius: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

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

body {
  font-family: var(--font-body);
  background: var(--color-background);
  color: var(--color-foreground);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  padding-bottom: calc(var(--touch) + var(--space-lg)); /* FAB space */
}

h1, h2, h3, h4 { font-family: var(--font-heading); font-weight: 600; }

a { color: var(--color-primary); }

button, .clickable { cursor: pointer; }

button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- components ---------- */
.btn {
  min-height: var(--touch);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: var(--font-body);
  font-size: 1rem;
  border: none;
  transition: all 200ms ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
}
.btn-primary { background: var(--color-accent); color: #fff; }
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.btn-secondary { background: transparent; color: var(--color-primary); border: 2px solid var(--color-primary); }
.btn-secondary:hover { background: rgba(124, 58, 237, 0.06); }
.btn-danger { background: transparent; color: var(--color-destructive); border: 2px solid var(--color-destructive); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.card {
  background: var(--color-surface);
  border-radius: var(--radius);
  padding: var(--space-lg);
  box-shadow: var(--shadow-md);
  transition: box-shadow 200ms ease, transform 200ms ease;
}
.card:hover { box-shadow: var(--shadow-lg); }

.input {
  width: 100%;
  min-height: var(--touch);
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: var(--font-body);
  background: var(--color-surface);
  transition: border-color 200ms ease;
}
.input:focus { border-color: var(--color-primary); outline: none; box-shadow: 0 0 0 3px rgba(124,58,237,0.13); }

.field { display: flex; flex-direction: column; gap: var(--space-xs); margin-bottom: var(--space-md); }
.field label { font-weight: 600; font-size: 0.9rem; }

/* contextual FAB — auto-hide, appears only when relevant */
.fab {
  position: fixed;
  right: var(--space-lg);
  bottom: var(--space-lg);
  min-height: var(--touch);
  padding: 0 var(--space-lg);
  border-radius: 999px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-family: var(--font-heading);
  font-size: 1rem;
  box-shadow: var(--shadow-lg);
  border: none;
  display: none; /* shown contextually via [data-show] */
  align-items: center;
  gap: var(--space-sm);
  z-index: 50;
  transition: transform 200ms ease, opacity 200ms ease;
}
.fab[data-show="1"] { display: inline-flex; }
.fab:hover { transform: translateY(-2px); }
.fab svg { width: 20px; height: 20px; }

/* header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-sm) var(--space-lg);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 40;
}
.topbar .brand { font-family: var(--font-heading); font-weight: 700; font-size: 1.25rem; color: var(--color-primary); }

/* layout */
.container { max-width: 720px; margin: 0 auto; padding: var(--space-lg) var(--space-md); }

.tabs {
  display: flex;
  gap: var(--space-xs);
  background: var(--color-muted);
  border-radius: var(--radius-sm);
  padding: var(--space-xs);
  margin-bottom: var(--space-lg);
  overflow-x: auto;
}
.tab {
  flex: 1;
  min-height: var(--touch);
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-weight: 600;
  color: var(--color-foreground);
  white-space: nowrap;
  padding: 0 var(--space-md);
  transition: all 200ms ease;
}
.tab[aria-selected="true"] { background: var(--color-surface); box-shadow: var(--shadow-sm); color: var(--color-primary); }

/* status pill */
.pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--color-muted);
  color: var(--color-foreground);
}

.empty {
  text-align: center;
  color: var(--color-secondary);
  padding: var(--space-2xl) var(--space-lg);
}

.error-banner {
  background: #FEF2F2;
  color: var(--color-destructive);
  border: 1px solid #FECACA;
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  margin-bottom: var(--space-md);
}

.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  margin-bottom: var(--space-sm);
  transition: box-shadow 200ms ease;
}
.list-item:hover { box-shadow: var(--shadow-md); }

.icon { width: 20px; height: 20px; flex-shrink: 0; }
.icon-lg { width: 28px; height: 28px; }

.muted { color: var(--color-secondary); }
.small { font-size: 0.85rem; }
