/* ============================================================
   Salt — Design System
   Black + Gold palette | Auto dark/light via prefers-color-scheme
   ============================================================ */

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

:root {
  /* --- Colors --- */
  --color-bg:           #1a1a1a;
  --color-surface:      #242424;
  --color-surface-2:    #2e2e2e;
  --color-accent:       #C9A84C;
  --color-accent-dim:   rgba(201, 168, 76, 0.15);
  --color-text:         #ffffff;
  --color-text-muted:   rgba(255, 255, 255, 0.55);
  --color-border:       rgba(255, 255, 255, 0.08);
  --color-success:      #4caf82;
  --color-danger:       #e05c5c;
  --color-info:         #5c9be0;

  /* --- Typography --- */
  --font-sans:      -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, sans-serif;
  --font-size-xs:   12px;
  --font-size-sm:   14px;
  --font-size-base: 16px;
  --font-size-lg:   20px;
  --font-size-xl:   28px;
  --font-size-2xl:  40px;
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold:   700;
  --line-height-tight:  1.2;
  --line-height-base:   1.5;

  /* --- Spacing --- */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  40px;
  --space-2xl: 64px;

  /* --- Border Radius --- */
  --radius-sm:   8px;
  --radius-md:   16px;
  --radius-lg:   24px;
  --radius-pill: 9999px;

  /* --- Shadows --- */
  --shadow-sm:   0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
  --shadow-fab:  0 6px 20px rgba(201, 168, 76, 0.35);

  /* --- Transitions --- */
  --transition-fast: 150ms ease;
  --transition-std:  250ms ease;
  --transition-slow: 400ms ease;

  /* --- Touch targets --- */
  --touch-target: 48px;

  /* --- Z-index scale --- */
  --z-nav:     100;
  --z-fab:     110;
  --z-sheet:   200;
  --z-overlay: 190;
  --z-toast:   300;
}

@media (prefers-color-scheme: light) {
  :root {
    --color-bg:         #f2f2f7;
    --color-surface:    #ffffff;
    --color-surface-2:  #f8f8f8;
    --color-text:       #111111;
    --color-text-muted: rgba(0, 0, 0, 0.45);
    --color-border:     rgba(0, 0, 0, 0.08);
    --shadow-card:      0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-sm:        0 2px 8px rgba(0, 0, 0, 0.08);
  }
}

/* ============================================================
   Base / Reset
   ============================================================ */

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

body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video {
  max-width: 100%;
  display: block;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
}

p {
  margin: 0;
}

button {
  font-family: var(--font-sans);
  cursor: pointer;
  border: none;
  background: none;
}

input, select, textarea {
  font-family: var(--font-sans);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--space-sm) var(--space-md);
  width: 100%;
  outline: none;
  transition: border-color var(--transition-fast);
}

input:focus, select:focus, textarea:focus {
  border-color: var(--color-accent);
}

textarea {
  resize: vertical;
  min-height: 80px;
}

label {
  display: block;
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  margin-bottom: var(--space-xs);
}

* {
  -webkit-tap-highlight-color: transparent;
}

/* ============================================================
   Utility Classes
   ============================================================ */

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  padding: 12px var(--space-lg);
  border-radius: var(--radius-pill);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-bold);
  min-height: var(--touch-target);
  cursor: pointer;
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  white-space: nowrap;
  user-select: none;
  border: 2px solid transparent;
  text-decoration: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background-color: var(--color-accent);
  color: #1a1a1a;
  border-color: var(--color-accent);
}

.btn-primary:hover {
  opacity: 0.88;
  text-decoration: none;
}

.btn-ghost {
  background: transparent;
  color: var(--color-accent);
  border-color: var(--color-accent);
}

.btn-ghost:hover {
  background: var(--color-accent-dim);
  text-decoration: none;
}

.btn-danger {
  background: transparent;
  color: var(--color-danger);
  border-color: var(--color-danger);
}

.btn-sm {
  padding: 8px var(--space-md);
  font-size: var(--font-size-sm);
  min-height: 36px;
}

.btn-block {
  width: 100%;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-target);
  height: var(--touch-target);
  border-radius: 50%;
  background: transparent;
  color: var(--color-text);
  font-size: 20px;
  transition: background var(--transition-fast);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--color-accent-dim);
}

/* --- Cards --- */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-md);
  padding: var(--space-md);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--color-border);
}

.card-sm {
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-sm);
}

/* --- Badges --- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-pill);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-gold    { background: var(--color-accent-dim);    color: var(--color-accent); }
.badge-green   { background: rgba(76, 175, 130, 0.15);  color: var(--color-success); }
.badge-red     { background: rgba(224, 92, 92, 0.15);   color: var(--color-danger); }
.badge-blue    { background: rgba(92, 155, 224, 0.15);  color: var(--color-info); }
.badge-muted   { background: var(--color-border);        color: var(--color-text-muted); }

/* --- Avatar --- */
.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--color-accent-dim);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--font-weight-bold);
  font-size: var(--font-size-sm);
  flex-shrink: 0;
  overflow: hidden;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-lg {
  width: 64px;
  height: 64px;
  font-size: var(--font-size-lg);
}

/* --- Form Groups --- */
.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
  margin-bottom: var(--space-md);
}

.form-error {
  font-size: var(--font-size-sm);
  color: var(--color-danger);
}

/* --- Divider --- */
.divider {
  height: 1px;
  background: var(--color-border);
  margin: var(--space-md) 0;
}

/* --- Skeleton loaders --- */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-surface) 25%,
    var(--color-surface-2) 50%,
    var(--color-surface) 75%
  );
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeleton-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Text utilities --- */
.text-accent  { color: var(--color-accent); }
.text-muted   { color: var(--color-text-muted); }
.text-success { color: var(--color-success); }
.text-danger  { color: var(--color-danger); }
.text-sm      { font-size: var(--font-size-sm); }
.text-xs      { font-size: var(--font-size-xs); }
.text-lg      { font-size: var(--font-size-lg); }
.text-center  { text-align: center; }
.text-bold    { font-weight: var(--font-weight-bold); }
.text-medium  { font-weight: var(--font-weight-medium); }

/* --- Layout utilities --- */
.flex         { display: flex; }
.flex-col     { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-sm       { gap: var(--space-sm); }
.gap-md       { gap: var(--space-md); }
.w-full       { width: 100%; }
.h-full       { height: 100%; }

/* --- Accessibility --- */
.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;
}

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--color-surface-2);
  color: var(--color-text);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-pill);
  padding: var(--space-sm) var(--space-lg);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  z-index: var(--z-toast);
  opacity: 0;
  transition: opacity var(--transition-std), transform var(--transition-std);
  white-space: nowrap;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* --- Empty states --- */
.empty-state {
  text-align: center;
  padding: var(--space-2xl) var(--space-lg);
  color: var(--color-text-muted);
}

.empty-state i {
  font-size: 48px;
  color: var(--color-border);
  margin-bottom: var(--space-md);
}
