/* ===== Nexa Social — design tokens ===== */
:root {
  --bg: #07060d;
  --bg-2: #0d0b18;
  --surface: rgba(255, 255, 255, 0.045);
  --surface-2: rgba(255, 255, 255, 0.075);
  --surface-solid: #12101f;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #f1effd;
  --muted: #9d99bb;
  --faint: #6c6889;

  --brand: #7c5cff;
  --brand-2: #4f7cff;
  --brand-3: #22d3ee;
  --pink: #ff5ca8;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #fb6f84;
  --grad: linear-gradient(135deg, #8b5cf6 0%, #6366f1 45%, #22d3ee 100%);
  --grad-soft: linear-gradient(135deg, rgba(139, 92, 246, 0.22), rgba(34, 211, 238, 0.14));

  --glow-color: 139, 92, 246;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.7), 0 2px 8px rgba(0, 0, 0, 0.3);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --font: 'Be Vietnam Pro', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

:root[data-theme='light'] {
  --bg: #f6f5fb;
  --bg-2: #eeecf7;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-2: rgba(255, 255, 255, 0.95);
  --surface-solid: #ffffff;
  --line: rgba(30, 20, 80, 0.09);
  --line-strong: rgba(30, 20, 80, 0.16);
  --text: #17142b;
  --muted: #5f5b7a;
  --faint: #918db0;
  --shadow: 0 20px 50px -24px rgba(40, 30, 110, 0.35), 0 2px 6px rgba(40, 30, 110, 0.08);
  color-scheme: light;
}

:root[data-accent='cyan'] { --brand: #06b6d4; --glow-color: 34, 211, 238; --grad: linear-gradient(135deg, #22d3ee, #3b82f6); }
:root[data-accent='pink'] { --brand: #ec4899; --glow-color: 236, 72, 153; --grad: linear-gradient(135deg, #f472b6, #8b5cf6); }
:root[data-accent='emerald'] { --brand: #10b981; --glow-color: 16, 185, 129; --grad: linear-gradient(135deg, #34d399, #06b6d4); }
:root[data-accent='amber'] { --brand: #f59e0b; --glow-color: 245, 158, 11; --grad: linear-gradient(135deg, #fbbf24, #f43f5e); }

*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, video { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: inherit; text-decoration: none; }
::selection { background: rgba(var(--glow-color), 0.4); }
:focus-visible { outline: 2px solid rgba(var(--glow-color), 0.9); outline-offset: 3px; border-radius: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Thanh cuộn mảnh */
* { scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 8px; }

/* ===== Vầng sáng theo chuột ===== */
.aura {
  position: fixed;
  left: 0; top: 0;
  width: 560px; height: 560px;
  margin: -280px 0 0 -280px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(circle, rgba(var(--glow-color), 0.16) 0%, rgba(var(--glow-color), 0.05) 35%, transparent 70%);
  opacity: 0;
  transition: opacity 0.6s var(--ease);
  will-change: transform;
}
.aura.on { opacity: 1; }
:root[data-theme='light'] .aura { background: radial-gradient(circle, rgba(var(--glow-color), 0.12) 0%, transparent 65%); }

/* ===== Spotlight: viền + nền phát sáng ngay dưới con trỏ ===== */
.glow { position: relative; isolation: isolate; }
.glow::before,
.glow::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s var(--ease);
}
.glow::before {
  z-index: -1;
  background: radial-gradient(420px circle at var(--mx, -999px) var(--my, -999px), rgba(var(--glow-color), 0.13), transparent 45%);
}
.glow::after {
  padding: 1px;
  background: radial-gradient(260px circle at var(--mx, -999px) var(--my, -999px), rgba(var(--glow-color), 0.95), rgba(34, 211, 238, 0.35) 35%, transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.glow:hover::before,
.glow:hover::after,
.glow-group:hover .glow::after { opacity: 1; }

/* ===== Nút ===== */
.btn {
  --h: 46px;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: var(--h);
  padding: 0 22px;
  border-radius: 999px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), background 0.3s, opacity 0.2s;
  user-select: none;
}
.btn-primary {
  color: #fff;
  background: var(--grad);
  background-size: 160% 160%;
  box-shadow: 0 10px 30px -10px rgba(var(--glow-color), 0.8), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-primary:hover { background-position: 100% 50%; box-shadow: 0 16px 40px -10px rgba(var(--glow-color), 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.3); }
.btn-ghost { background: var(--surface); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--surface-2); border-color: var(--line-strong); }
.btn-danger { color: #fff; background: linear-gradient(135deg, #f43f5e, #fb7185); }
.btn-sm { --h: 36px; padding: 0 14px; font-size: 13.5px; }
.btn:active { transform: scale(0.97); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn .spinner { display: none; }
.btn.loading .spinner { display: block; }
.btn.loading .label { opacity: 0.7; }
.ripple-ink {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: scale(0);
  animation: ripple 0.7s var(--ease) forwards;
  pointer-events: none;
}
@keyframes ripple { to { transform: scale(1); opacity: 0; } }

.spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Input ===== */
.field { position: relative; display: block; }
.field input,
.field textarea {
  width: 100%;
  height: 54px;
  padding: 22px 16px 8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  outline: none;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.field textarea { height: auto; min-height: 96px; resize: vertical; padding-top: 26px; }
.field label {
  position: absolute;
  left: 16px; top: 16px;
  color: var(--muted);
  pointer-events: none;
  transform-origin: left top;
  transition: transform 0.25s var(--ease), color 0.25s;
}
.field input:focus,
.field textarea:focus { border-color: rgba(var(--glow-color), 0.8); background: var(--surface-2); box-shadow: 0 0 0 4px rgba(var(--glow-color), 0.15); }
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field textarea:focus + label,
.field textarea:not(:placeholder-shown) + label { transform: translateY(-9px) scale(0.78); color: rgba(var(--glow-color), 1); }
.field .eye {
  position: absolute; right: 10px; top: 50%;
  transform: translateY(-50%);
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--muted);
}
.field .eye:hover { color: var(--text); background: var(--surface-2); }

/* ===== Logo ===== */
.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -0.02em; font-size: 19px; }
.logo-mark { width: 34px; height: 34px; flex: none; }

/* ===== Avatar ===== */
.avatar {
  --s: 42px;
  position: relative;
  width: var(--s); height: var(--s);
  flex: none;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 700;
  font-size: calc(var(--s) * 0.38);
  color: #fff;
  background: var(--av, var(--grad));
  user-select: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.avatar .dot {
  position: absolute; right: 0; bottom: 0;
  width: 28%; height: 28%;
  min-width: 10px; min-height: 10px;
  border-radius: 50%;
  background: var(--faint);
  border: 2px solid var(--surface-solid);
  transition: background 0.3s;
}
.avatar .dot.on { background: var(--ok); box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.6); animation: pulse 2.4s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px rgba(52, 211, 153, 0); } 100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); } }

/* ===== Toast ===== */
.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 10px; width: min(360px, calc(100vw - 32px)); }
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: var(--surface-solid);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
  animation: toast-in 0.5s var(--ease-spring);
}
.toast.out { animation: toast-out 0.35s var(--ease) forwards; }
.toast .ico { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--grad-soft); color: rgb(var(--glow-color)); flex: none; }
.toast.err .ico { background: rgba(251, 111, 132, 0.15); color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.95); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(30px); } }

/* ===== Reveal ===== */
[data-reveal] {
  --d: 0ms;
  opacity: 0;
  transition: opacity 0.9s var(--ease) var(--d), transform 1.1s var(--ease) var(--d), filter 0.9s var(--ease) var(--d);
  will-change: transform, opacity;
}
[data-reveal='up'] { transform: translateY(60px); }
[data-reveal='down'] { transform: translateY(-50px); }
[data-reveal='left'] { transform: translateX(-90px) rotate(-3deg); }
[data-reveal='right'] { transform: translateX(90px) rotate(3deg); }
[data-reveal='zoom'] { transform: scale(0.85); filter: blur(10px); }
[data-reveal='flip'] { transform: perspective(900px) rotateX(-55deg) translateY(60px); transform-origin: 50% 100%; }
[data-reveal='fly'] { transform: perspective(1100px) translate3d(0, 120px, -260px) rotateX(28deg) rotateZ(var(--fz, -6deg)); filter: blur(6px); }
[data-reveal].in { opacity: 1; transform: none; filter: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
  [data-reveal] { opacity: 1; transform: none; filter: none; }
}
:root[data-motion='reduced'] *, :root[data-motion='reduced'] *::before, :root[data-motion='reduced'] *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
:root[data-motion='reduced'] [data-reveal] { opacity: 1; transform: none; filter: none; }
