/* ============================================================
   OuderPad V3 — main.css
   Speels, gradients, soft shadows, glassmorphism
   Design tokens & global resets
   ============================================================ */

:root {
  /* Backgrounds */
  --bg: #FBFAFE;
  --bg-soft: #F4F0FE;
  --bg-warm: #FFF6F0;

  /* Ink */
  --ink: #15131A;
  --ink-soft: #3D3845;
  --ink-mute: #6F6878;
  --ink-faint: #A39CAF;
  --line: #ECE7F3;
  --line-soft: #F4F0FA;

  /* Accent palette */
  --pink: #FF7BAC;
  --pink-light: #FFE0EC;
  --pink-deep: #D63C7A;
  --purple: #7C5CFF;
  --purple-light: #E8E0FF;
  --purple-deep: #4926E0;
  --teal: #00D4B7;
  --teal-light: #C5FAF1;
  --teal-deep: #009482;
  --apricot: #FFB37D;
  --apricot-light: #FFE4D1;
  --sun: #FFD93D;
  --sun-light: #FFF4B8;

  /* Semantic */
  --success: #00D4B7;
  --success-light: #C5FAF1;
  --warning: #FFB37D;
  --warning-light: #FFE4D1;
  --danger: #FF7BAC;
  --danger-light: #FFE0EC;

  /* Legacy compat (some old code refers to these) */
  --bg-card: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --text-0: #15131A;
  --text-1: #3D3845;
  --text-2: #6F6878;
  --text-3: #A39CAF;
  --text-bright: #15131A;
  --sage: #00D4B7;
  --sage-deep: #009482;
  --sage-soft: #C5FAF1;
  --sage-glow: rgba(0, 212, 183, 0.3);
  --terra: #FF7BAC;
  --terra-soft: #FFE0EC;
  --gold: #7C5CFF;
  --gold-soft: #E8E0FF;
  --gold-glow: rgba(124, 92, 255, 0.3);
  --rose: #FF7BAC;
  --rose-soft: #FFE0EC;
  --good: #00D4B7;
  --warn: #FFB37D;
  --bad: #FF7BAC;

  /* Typography */
  --display: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  --hand: 'Caveat', cursive;
  --serif: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  --sans: 'Geist', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(124, 92, 255, 0.06), 0 1px 2px rgba(124, 92, 255, 0.04);
  --shadow-md: 0 4px 16px rgba(124, 92, 255, 0.06), 0 1px 3px rgba(124, 92, 255, 0.04);
  --shadow-lg: 0 12px 32px rgba(124, 92, 255, 0.10), 0 4px 12px rgba(124, 92, 255, 0.06);
  --shadow-xl: 0 24px 60px rgba(124, 92, 255, 0.12), 0 4px 16px rgba(124, 92, 255, 0.06);
  --shadow-glow: 0 0 60px rgba(124, 92, 255, 0.15);

  /* Radii */
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-full: 100px;

  /* Easing */
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease-smooth: cubic-bezier(.16, 1, .3, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
*:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--display);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "ss02";
  overflow-x: hidden;
}

/* Background blobs — global atmosphere */
body::before, body::after {
  content: '';
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
}
body::before {
  top: -200px; left: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--pink-light), transparent 70%);
}
body::after {
  bottom: -200px; right: -200px;
  width: 600px; height: 600px;
  background: radial-gradient(circle, var(--purple-light), transparent 70%);
}

a { color: inherit; text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--purple); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  font-size: inherit;
}

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

input, select, textarea {
  font-family: inherit;
  font-size: 15px;
  background: white;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: var(--r-md);
  padding: 11px 14px;
  transition: all 0.2s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 4px var(--purple-light);
}
input::placeholder, textarea::placeholder { color: var(--ink-faint); }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--purple); }

::selection { background: var(--purple); color: white; }

/* ============ BRAND ============ */
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 12px;
  background: conic-gradient(from 45deg, var(--pink), var(--purple), var(--teal), var(--pink));
  position: relative;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(124, 92, 255, 0.3);
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 4px;
  background: var(--bg);
  border-radius: 8px;
}
.brand-mark.small { width: 28px; height: 28px; border-radius: 9px; }
.brand-mark.small::after { inset: 3px; border-radius: 6px; }

/* ============ FLASH TOASTS ============ */
.flash-toast {
  position: fixed; bottom: 24px; right: 24px; padding: 14px 22px;
  border-radius: var(--r-md); font-size: 14px; font-weight: 500; z-index: 9999;
  box-shadow: var(--shadow-lg);
  animation: toastSlide 0.4s var(--ease-spring);
  backdrop-filter: blur(12px);
}
@keyframes toastSlide {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.flash-error { background: var(--danger-light); color: var(--pink-deep); border: 1px solid var(--pink); }
.flash-success { background: var(--success-light); color: var(--teal-deep); border: 1px solid var(--teal); }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: var(--r-full);
  font-size: 14px; font-weight: 600;
  background: white; color: var(--ink);
  border: 1px solid var(--line);
  cursor: pointer; transition: all 0.25s var(--ease-spring);
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}
.btn:hover { border-color: var(--purple); color: var(--purple); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn.primary {
  background: var(--ink); color: white; border-color: transparent;
  box-shadow: 0 4px 16px rgba(21, 19, 26, 0.2);
}
.btn.primary:hover { background: var(--purple-deep); color: white; transform: translateY(-2px); box-shadow: 0 12px 28px rgba(124, 92, 255, 0.3); }
.btn.outlined { background: transparent; border-color: var(--purple); color: var(--purple); box-shadow: none; }
.btn.outlined:hover { background: var(--purple-light); }
.btn.danger { background: var(--danger-light); color: var(--pink-deep); border-color: var(--pink); }
.btn.gradient {
  background: linear-gradient(135deg, var(--pink), var(--purple));
  color: white; border-color: transparent;
  box-shadow: 0 4px 16px rgba(124, 92, 255, 0.25);
}
.btn.gradient:hover { background: linear-gradient(135deg, var(--pink-deep), var(--purple-deep)); transform: translateY(-2px); box-shadow: 0 12px 28px rgba(124, 92, 255, 0.35); color: white; }
.btn.small { padding: 7px 14px; font-size: 12px; }
.btn.icon { padding: 9px; width: 36px; height: 36px; justify-content: center; }

/* ============ COMMON ============ */
.mono-num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-mute); }
.bold { font-weight: 600; color: var(--ink); }
.center { text-align: center; }
.divider { height: 1px; background: var(--line); margin: 24px 0; border: none; }

/* Tables base */
table { width: 100%; border-collapse: collapse; }
table th, table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--line-soft); }
table th { color: var(--ink-mute); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; background: var(--bg-soft); }
table td { color: var(--ink); font-size: 14.5px; }

/* Forms base */
form label { display: block; font-size: 13px; color: var(--ink-mute); margin-bottom: 7px; font-weight: 500; }
form .field { margin-bottom: 18px; }

/* Pills (tags) */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--bg-soft); color: var(--ink-mute);
  border: 1px solid var(--line);
}
.pill.success { background: var(--success-light); color: var(--teal-deep); border-color: var(--teal); }
.pill.warning { background: var(--warning-light); color: #B7741F; border-color: var(--apricot); }
.pill.danger { background: var(--danger-light); color: var(--pink-deep); border-color: var(--pink); }
.pill.info { background: var(--purple-light); color: var(--purple-deep); border-color: var(--purple); }

/* Cards */
.card {
  background: white;
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-md);
}
.card.glow { box-shadow: var(--shadow-xl); }
.card.gradient-border { background: linear-gradient(white, white) padding-box, linear-gradient(135deg, var(--pink), var(--purple)) border-box; border: 2px solid transparent; }

/* Glassmorphism utility */
.glass {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 24px rgba(124, 92, 255, 0.08);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01s !important;
  }
}
