/* ============================================================
   GameNef — Cyberpunk Purple Design System
   Visual Novel Platform
   ============================================================ */

/* ── Google Fonts ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800;900&family=Inter:wght@300;400;500;600;700&display=swap');

/* ── CSS Custom Properties ────────────────────────────────── */
:root {
  /* Backgrounds */
  --bg-darkest: #0a0a0f;
  --bg-dark: #0f0f1a;
  --bg-card: #12121e;
  --bg-card-hover: #1a1a2e;
  --purple-deep: #1a0a2e;

  /* Brand Colors */
  --purple-main: #7c3aed;
  --purple-light: #a855f7;
  --purple-glow: #c084fc;
  --pink-accent: #ec4899;
  --cyan-accent: #06b6d4;
  --gold-accent: #fbbf24;

  /* Text */
  --text-primary: #f5f3ff;
  --text-secondary: #c4b5fd;
  --text-muted: #6b7280;

  /* Borders & Glass */
  --border-glow: rgba(124, 58, 237, 0.4);
  --border-subtle: rgba(124, 58, 237, 0.2);
  --glass-bg: rgba(124, 58, 237, 0.08);
  --glass-bg-strong: rgba(124, 58, 237, 0.15);

  /* Shadows */
  --shadow-purple: 0 0 30px rgba(124, 58, 237, 0.25);
  --shadow-pink: 0 0 30px rgba(236, 72, 153, 0.2);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow-sm: 0 0 12px rgba(124, 58, 237, 0.5);

  /* Gradients */
  --gradient-brand: linear-gradient(135deg, #7c3aed 0%, #ec4899 100%);
  --gradient-brand-alt: linear-gradient(135deg, #a855f7 0%, #06b6d4 100%);
  --gradient-dark: linear-gradient(135deg, #0f0f1a 0%, #1a0a2e 100%);
  --gradient-card: linear-gradient(135deg, rgba(124,58,237,0.12) 0%, rgba(236,72,153,0.06) 100%);

  /* Typography */
  --font-heading: 'Outfit', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --radius-pill: 999px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-base: 0.25s ease;
  --transition-slow: 0.4s ease;

  /* Z-index layers */
  --z-base: 1;
  --z-card: 10;
  --z-nav: 100;
  --z-modal: 200;
  --z-toast: 300;
}

/* ── Reset & Base ─────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-darkest);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1.2;
  color: var(--text-primary);
}

a {
  color: var(--purple-light);
  text-decoration: none;
  transition: color var(--transition-fast);
}
a:hover { color: var(--purple-glow); }

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

ul, ol { list-style: none; }

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

input, select, textarea { font-family: inherit; }

/* ── Animated Star Background ─────────────────────────────── */
.stars-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

/* Star layers — each div is a layer with different speeds */
.stars-bg .stars-layer {
  position: absolute;
  inset: 0;
  background-repeat: repeat;
  animation: starsFloat linear infinite;
}

.stars-bg .stars-layer:nth-child(1) {
  background-image: radial-gradient(1px 1px at 10% 15%, rgba(168,85,247,0.8) 0%, transparent 100%),
                    radial-gradient(1px 1px at 30% 55%, rgba(196,180,253,0.6) 0%, transparent 100%),
                    radial-gradient(1px 1px at 55% 25%, rgba(168,85,247,0.7) 0%, transparent 100%),
                    radial-gradient(1px 1px at 75% 75%, rgba(255,255,255,0.5) 0%, transparent 100%),
                    radial-gradient(1px 1px at 90% 40%, rgba(196,180,253,0.6) 0%, transparent 100%),
                    radial-gradient(1.5px 1.5px at 20% 80%, rgba(236,72,153,0.5) 0%, transparent 100%),
                    radial-gradient(1px 1px at 45% 60%, rgba(255,255,255,0.4) 0%, transparent 100%),
                    radial-gradient(1px 1px at 65% 10%, rgba(168,85,247,0.6) 0%, transparent 100%),
                    radial-gradient(1px 1px at 85% 90%, rgba(196,180,253,0.5) 0%, transparent 100%),
                    radial-gradient(1px 1px at 5%  90%, rgba(255,255,255,0.3) 0%, transparent 100%);
  background-size: 400px 400px;
  animation-duration: 60s;
  opacity: 0.9;
}

.stars-bg .stars-layer:nth-child(2) {
  background-image: radial-gradient(1.5px 1.5px at 22% 33%, rgba(6,182,212,0.5) 0%, transparent 100%),
                    radial-gradient(1px 1px at 48% 72%, rgba(255,255,255,0.4) 0%, transparent 100%),
                    radial-gradient(2px 2px at 68% 18%, rgba(236,72,153,0.4) 0%, transparent 100%),
                    radial-gradient(1px 1px at 88% 55%, rgba(168,85,247,0.5) 0%, transparent 100%),
                    radial-gradient(1px 1px at 12% 47%, rgba(255,255,255,0.3) 0%, transparent 100%),
                    radial-gradient(1.5px 1.5px at 35% 85%, rgba(196,180,253,0.4) 0%, transparent 100%),
                    radial-gradient(1px 1px at 58% 40%, rgba(251,191,36,0.3) 0%, transparent 100%),
                    radial-gradient(1px 1px at 78% 95%, rgba(168,85,247,0.4) 0%, transparent 100%),
                    radial-gradient(1px 1px at 95% 20%, rgba(6,182,212,0.3) 0%, transparent 100%),
                    radial-gradient(1px 1px at 3%  60%, rgba(255,255,255,0.3) 0%, transparent 100%);
  background-size: 600px 600px;
  animation-duration: 90s;
  animation-direction: reverse;
  opacity: 0.7;
}

.stars-bg .stars-layer:nth-child(3) {
  background-image: radial-gradient(2px 2px at 15% 20%, rgba(255,255,255,0.6) 0%, transparent 100%),
                    radial-gradient(1px 1px at 40% 50%, rgba(196,180,253,0.5) 0%, transparent 100%),
                    radial-gradient(1.5px 1.5px at 70% 30%, rgba(168,85,247,0.5) 0%, transparent 100%),
                    radial-gradient(1px 1px at 85% 70%, rgba(236,72,153,0.4) 0%, transparent 100%),
                    radial-gradient(2px 2px at 25% 75%, rgba(255,255,255,0.4) 0%, transparent 100%),
                    radial-gradient(1px 1px at 55% 90%, rgba(6,182,212,0.3) 0%, transparent 100%),
                    radial-gradient(1px 1px at 95% 50%, rgba(251,191,36,0.3) 0%, transparent 100%);
  background-size: 800px 800px;
  animation-duration: 120s;
  opacity: 0.5;
}

@keyframes starsFloat {
  from { transform: translateY(0); }
  to   { transform: translateY(-400px); }
}

/* Nebula blobs */
.stars-bg::before,
.stars-bg::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}

.stars-bg::before {
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(124,58,237,0.18) 0%, transparent 70%);
  top: -200px;
  left: -200px;
  animation: nebulaFloat 20s ease-in-out infinite alternate;
}

.stars-bg::after {
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(236,72,153,0.12) 0%, transparent 70%);
  bottom: -150px;
  right: -150px;
  animation: nebulaFloat 25s ease-in-out infinite alternate-reverse;
}

@keyframes nebulaFloat {
  0%   { transform: translate(0, 0) scale(1); }
  50%  { transform: translate(60px, 40px) scale(1.1); }
  100% { transform: translate(-40px, 60px) scale(0.95); }
}

/* Extra floating orbs (optional, added via JS or extra divs) */
.nebula-orb {
  position: fixed;
  border-radius: 50%;
  pointer-events: none;
  z-index: 0;
  filter: blur(60px);
  animation: orbPulse 8s ease-in-out infinite alternate;
}

.nebula-orb-1 {
  width: 400px;
  height: 400px;
  background: radial-gradient(circle, rgba(124,58,237,0.15) 0%, transparent 70%);
  top: 10%;
  right: 5%;
  animation-duration: 12s;
}

.nebula-orb-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, rgba(6,182,212,0.10) 0%, transparent 70%);
  bottom: 20%;
  left: 8%;
  animation-duration: 9s;
  animation-delay: -4s;
}

@keyframes orbPulse {
  0%   { opacity: 0.5; transform: scale(1); }
  100% { opacity: 1;   transform: scale(1.2); }
}

/* ── Glassmorphism Card ───────────────────────────────────── */
.glass-card {
  background: var(--glass-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 2rem;
  position: relative;
  overflow: hidden;
  transition: border-color var(--transition-base),
              box-shadow var(--transition-base),
              transform var(--transition-base);
}

.glass-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-card);
  opacity: 0.5;
  pointer-events: none;
  border-radius: inherit;
}

.glass-card:hover {
  border-color: rgba(168, 85, 247, 0.6);
  box-shadow: var(--shadow-purple), var(--shadow-card);
  transform: translateY(-2px);
}

.glass-card--glow {
  box-shadow: var(--shadow-purple), var(--shadow-card);
}

.glass-card--no-hover:hover {
  transform: none;
  border-color: var(--border-glow);
  box-shadow: none;
}

/* Shimmer top border accent */
.glass-card--accent::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--gradient-brand);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-pill);
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
}

/* Ripple effect on buttons */
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255,255,255,0.25) 0%, transparent 70%);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::after  { opacity: 1; }
.btn:active        { transform: scale(0.97); }

/* Primary */
.btn-primary {
  background: var(--gradient-brand);
  color: #fff;
  border: none;
  box-shadow: 0 0 20px rgba(124, 58, 237, 0.4);
}
.btn-primary:hover {
  box-shadow: 0 0 35px rgba(124, 58, 237, 0.65), 0 0 15px rgba(236, 72, 153, 0.3);
  transform: translateY(-1px);
}

/* Secondary */
.btn-secondary {
  background: transparent;
  color: var(--purple-light);
  border: 1px solid var(--border-glow);
}
.btn-secondary:hover {
  background: var(--glass-bg-strong);
  border-color: var(--purple-light);
  box-shadow: var(--shadow-glow-sm);
  color: var(--purple-glow);
}

/* Danger */
.btn-danger {
  background: linear-gradient(135deg, #dc2626 0%, #991b1b 100%);
  color: #fff;
  border: none;
  box-shadow: 0 0 15px rgba(220, 38, 38, 0.3);
}
.btn-danger:hover {
  box-shadow: 0 0 30px rgba(220, 38, 38, 0.5);
  transform: translateY(-1px);
}

/* Ghost */
.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid transparent;
}
.btn-ghost:hover {
  background: var(--glass-bg);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

/* Sizes */
.btn-sm  { padding: 0.4rem 1rem; font-size: 0.8rem; }
.btn-lg  { padding: 0.85rem 2rem; font-size: 1rem; }
.btn-xl  { padding: 1rem 2.5rem; font-size: 1.1rem; }
.btn-block { width: 100%; }

/* Icon button */
.btn-icon {
  padding: 0.5rem;
  border-radius: var(--radius-md);
  width: 2.25rem;
  height: 2.25rem;
}

/* ── Forms ────────────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.25rem;
}

.form-label {
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.form-input,
.form-select,
.form-textarea {
  background: rgba(10, 10, 15, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.75rem 1rem;
  transition: border-color var(--transition-base),
              box-shadow var(--transition-base),
              background var(--transition-base);
  outline: none;
  width: 100%;
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--purple-main);
  background: rgba(10, 10, 15, 0.8);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2), var(--shadow-glow-sm);
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23a855f7' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  padding-right: 2.5rem;
  cursor: pointer;
}

.form-select option {
  background: var(--bg-card);
  color: var(--text-primary);
}

.form-textarea { resize: vertical; min-height: 100px; }

.form-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.form-error-msg {
  font-size: 0.82rem;
  color: #f87171;
  margin-top: 0.25rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

/* Input with icon */
.input-wrapper {
  position: relative;
}
.input-wrapper .input-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  transition: color var(--transition-fast);
}
.input-wrapper .form-input {
  padding-left: 2.75rem;
}
.input-wrapper:focus-within .input-icon {
  color: var(--purple-light);
}

/* ── Navigation Bar ───────────────────────────────────────── */
.navbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 2rem;
  height: 64px;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-glow);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-heading);
  font-size: 1.35rem;
  font-weight: 800;
  text-decoration: none;
  color: var(--text-primary);
}

.navbar-brand .brand-emoji {
  font-size: 1.5rem;
  filter: drop-shadow(0 0 8px rgba(124, 58, 237, 0.7));
}

.navbar-brand .brand-text {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.navbar-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.navbar-nav a {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-pill);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-base);
}

.navbar-nav a:hover,
.navbar-nav a.active {
  background: var(--glass-bg);
  color: var(--purple-glow);
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.navbar-user {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.3rem 0.75rem 0.3rem 0.3rem;
  background: var(--glass-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ── Modals ───────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-xl);
  padding: 2rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow-purple), var(--shadow-card);
  transform: translateY(-20px) scale(0.97);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  font-weight: 700;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-close {
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius-md);
  background: var(--glass-bg);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.modal-close:hover {
  background: rgba(220, 38, 38, 0.15);
  border-color: rgba(220, 38, 38, 0.4);
  color: #f87171;
}

.modal-footer {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

/* ── Toast Notifications ──────────────────────────────────── */
.toast-container {
  position: fixed;
  top: 80px;
  right: 1.5rem;
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.9rem 1.25rem;
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-primary);
  pointer-events: all;
  min-width: 260px;
  max-width: 380px;
  animation: toastSlideIn 0.3s ease forwards;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.toast.removing {
  animation: toastSlideOut 0.25s ease forwards;
}

@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(120%); }
  to   { opacity: 1; transform: translateX(0); }
}

@keyframes toastSlideOut {
  from { opacity: 1; transform: translateX(0); }
  to   { opacity: 0; transform: translateX(120%); }
}

.toast-icon {
  font-size: 1.1rem;
  flex-shrink: 0;
}

.toast-success {
  border-color: rgba(34, 197, 94, 0.4);
  background: rgba(34, 197, 94, 0.08);
}
.toast-success .toast-icon { color: #4ade80; }

.toast-error {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}
.toast-error .toast-icon { color: #f87171; }

.toast-info {
  border-color: rgba(6, 182, 212, 0.4);
  background: rgba(6, 182, 212, 0.08);
}
.toast-info .toast-icon { color: #22d3ee; }

.toast-warning {
  border-color: rgba(251, 191, 36, 0.4);
  background: rgba(251, 191, 36, 0.08);
}
.toast-warning .toast-icon { color: #fbbf24; }

/* ── Avatar / User Badge ──────────────────────────────────── */
.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-family: var(--font-heading);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  flex-shrink: 0;
  position: relative;
}

.avatar-sm  { width: 2rem;    height: 2rem;    font-size: 0.75rem; }
.avatar-md  { width: 2.75rem; height: 2.75rem; font-size: 1rem; }
.avatar-lg  { width: 3.5rem;  height: 3.5rem;  font-size: 1.25rem; }
.avatar-xl  { width: 4.5rem;  height: 4.5rem;  font-size: 1.5rem; }

.avatar-purple {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  box-shadow: 0 0 14px rgba(124, 58, 237, 0.5);
}
.avatar-pink {
  background: linear-gradient(135deg, #db2777, #ec4899);
  color: #fff;
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.5);
}
.avatar-cyan {
  background: linear-gradient(135deg, #0891b2, #06b6d4);
  color: #fff;
  box-shadow: 0 0 14px rgba(6, 182, 212, 0.4);
}
.avatar-gold {
  background: linear-gradient(135deg, #d97706, #fbbf24);
  color: #1a1a1a;
  box-shadow: 0 0 14px rgba(251, 191, 36, 0.4);
}

/* Glow ring on avatar */
.avatar::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: var(--gradient-brand);
  z-index: -1;
  opacity: 0;
  transition: opacity var(--transition-base);
}
.avatar:hover::after { opacity: 1; }

/* Role Badge Pill */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.7rem;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-heading);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.role-badge-superadmin {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.4);
  color: #fbbf24;
}
.role-badge-admin {
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.4);
  color: var(--purple-glow);
}
.role-badge-artist {
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid rgba(236, 72, 153, 0.4);
  color: #f472b6;
}
.role-badge-writer {
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #22d3ee;
}

/* ── Asset Grid & Thumbnails ──────────────────────────────── */
.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.asset-thumb {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  aspect-ratio: 3/4;
}

.asset-thumb:hover {
  border-color: var(--purple-main);
  box-shadow: var(--shadow-glow-sm);
  transform: translateY(-3px) scale(1.02);
}

.asset-thumb img {
  width: 100%;
  height: 70%;
  object-fit: cover;
}

.asset-thumb-info {
  padding: 0.6rem 0.75rem;
}

.asset-thumb-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.asset-thumb-meta {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.asset-thumb-overlay {
  position: absolute;
  inset: 0;
  background: rgba(124, 58, 237, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-base);
  font-size: 1.5rem;
}

.asset-thumb:hover .asset-thumb-overlay { opacity: 1; }

/* Selected state */
.asset-thumb.selected {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 2px var(--purple-light), var(--shadow-glow-sm);
}
.asset-thumb.selected .asset-thumb-overlay {
  opacity: 0.4;
  background: rgba(168, 85, 247, 0.6);
}

/* ── AI Chat Widget ───────────────────────────────────────── */
.ai-chat-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

/* Floating toggle button */
.ai-chat-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  background: var(--gradient-brand);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-pill);
  color: white;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 14px;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.4);
  cursor: pointer;
  transition: all var(--transition-base);
}
.ai-chat-toggle:hover {
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 6px 24px rgba(124, 58, 237, 0.6), 0 0 15px rgba(236, 72, 153, 0.3);
}
.ai-toggle-emoji {
  font-size: 18px;
}
.ai-toggle-badge {
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.8);
}

/* Chat panel container */
.ai-chat-panel {
  position: absolute;
  bottom: 64px;
  right: 0;
  width: 360px;
  height: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-glow);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-purple), var(--shadow-card);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.95);
  transition: all var(--transition-base);
  z-index: 1001;
}
.ai-chat-panel.open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0) scale(1);
}

/* Header */
.ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--glass-bg-strong);
  border-bottom: 1px solid rgba(124, 58, 237, 0.2);
}
.ai-header-info {
  display: flex;
  align-items: center;
  gap: 10px;
}
.ai-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.4);
}
.ai-name {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}
.ai-status {
  display: flex;
  align-items: center;
  gap: 6px;
}
.ai-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.8);
  animation: aiPulse 2s infinite;
}
@keyframes aiPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}
.ai-status-text {
  font-size: 11px;
  color: var(--text-muted);
}
.ai-chat-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: all var(--transition-fast);
}
.ai-chat-close:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Messages area */
.ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(10, 10, 15, 0.3);
}
.ai-bubble {
  display: flex;
  gap: 8px;
  max-width: 85%;
  animation: bubbleIn 0.25s cubic-bezier(0.1, 1, 0.1, 1) forwards;
}
.ai-bubble-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--glass-bg-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.ai-bubble-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ai-bubble-text {
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.5;
  border-radius: var(--radius-md);
  word-break: break-word;
}
.ai-bubble-time {
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
}
.ai-bubble-ai {
  align-self: flex-start;
}
.ai-bubble-ai .ai-bubble-text {
  background: var(--glass-bg-strong);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-top-left-radius: 2px;
}
.ai-bubble-user {
  align-self: flex-end;
  justify-content: flex-end;
}
.ai-bubble-user .ai-bubble-text {
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.25) 0%, rgba(236, 72, 153, 0.15) 100%);
  border: 1px solid rgba(168, 85, 247, 0.25);
  color: var(--text-primary);
  border-top-right-radius: 2px;
}
.ai-bubble-user .ai-bubble-time {
  align-self: flex-end;
}

/* Typing / Thinking Indicator */
.ai-thinking {
  align-self: flex-start;
}
.ai-typing-indicator {
  display: flex;
  gap: 4px;
  padding: 10px 14px;
  background: var(--glass-bg-strong);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  border-top-left-radius: 2px;
  align-items: center;
  justify-content: center;
  width: 50px;
}
.ai-typing-indicator span {
  width: 6px;
  height: 6px;
  background: var(--purple-glow);
  border-radius: 50%;
  animation: aiBounce 1.4s infinite both;
}
.ai-typing-indicator span:nth-child(2) { animation-delay: .2s; }
.ai-typing-indicator span:nth-child(3) { animation-delay: .4s; }
@keyframes aiBounce {
  0%, 80%, 100% { transform: scale(0); }
  40% { transform: scale(1); }
}

/* Input Area */
.ai-chat-input-area {
  padding: 10px 12px;
  background: var(--bg-dark);
  border-top: 1px solid rgba(124, 58, 237, 0.2);
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.ai-input {
  flex: 1;
  background: rgba(10, 10, 15, 0.6);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 13px;
  padding: 8px 12px;
  outline: none;
  resize: none;
  max-height: 120px;
  line-height: 1.4;
  transition: all var(--transition-base);
}
.ai-input::placeholder {
  color: var(--text-muted);
}
.ai-input:focus {
  border-color: var(--purple-main);
  box-shadow: 0 0 10px rgba(124, 58, 237, 0.3);
  background: rgba(10, 10, 15, 0.8);
}
.ai-send-btn {
  background: var(--gradient-brand);
  border: none;
  color: white;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-base);
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
  flex-shrink: 0;
  margin-bottom: 1px;
}
.ai-send-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.5);
}
.ai-send-btn svg {
  width: 16px;
  height: 16px;
  transform: rotate(45deg);
}

.ai-disclaimer {
  font-size: 9px;
  color: var(--text-muted);
  text-align: center;
  padding: 4px 0 8px;
  background: var(--bg-dark);
}

/* ── Sidebar ──────────────────────────────────────────────── */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: rgba(10, 10, 15, 0.6);
  border-right: 1px solid var(--border-subtle);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow-y: auto;
  padding: 1.25rem 0;
}

.sidebar-section-title {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  padding: 0.75rem 1.25rem 0.4rem;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  cursor: pointer;
  border-left: 2px solid transparent;
}

.sidebar-item:hover {
  background: var(--glass-bg);
  color: var(--text-primary);
}

.sidebar-item.active {
  background: rgba(124, 58, 237, 0.12);
  color: var(--purple-glow);
  border-left-color: var(--purple-main);
}

.sidebar-item .sidebar-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.75rem 1.25rem;
}

/* ── Loading / Spinner ────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid rgba(124, 58, 237, 0.3);
  border-top-color: var(--purple-light);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.spinner-sm  { width: 1rem;   height: 1rem; }
.spinner-lg  { width: 2.5rem; height: 2.5rem; border-width: 3px; }
.spinner-xl  { width: 3.5rem; height: 3.5rem; border-width: 4px; }

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Full-page loading overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: var(--bg-darkest);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.loading-overlay .loading-text {
  font-family: var(--font-heading);
  font-size: 0.9rem;
  color: var(--text-muted);
  animation: loadingPulse 1.5s ease infinite;
}

@keyframes loadingPulse {
  0%, 100% { opacity: 0.5; }
  50%       { opacity: 1; }
}

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar               { width: 6px; height: 6px; }
::-webkit-scrollbar-track         { background: var(--bg-darkest); }
::-webkit-scrollbar-thumb         { background: rgba(124, 58, 237, 0.5); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover   { background: var(--purple-main); }
::-webkit-scrollbar-corner        { background: var(--bg-darkest); }

/* ── Page Layout Helpers ──────────────────────────────────── */
.page-wrapper {
  position: relative;
  z-index: var(--z-base);
  min-height: 100vh;
}

.content-area {
  padding: 2rem;
  flex: 1;
  overflow-y: auto;
}

.section-title {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.section-title .title-accent {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Stat Cards ───────────────────────────────────────────── */
.stat-card {
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-lg);
  background: var(--glass-bg);
  border: 1px solid var(--border-subtle);
  transition: all var(--transition-base);
}

.stat-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-purple);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 800;
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.stat-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.3rem;
}

/* ── User Card (Admin panel) ──────────────────────────────── */
.user-card {
  background: var(--glass-bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.user-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--gradient-brand);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.user-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-purple);
  transform: translateY(-2px);
}

.user-card:hover::before { opacity: 1; }

.user-card-header {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.user-card-info {
  flex: 1;
  min-width: 0;
}

.user-card-name {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.user-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* ── Grid Layouts ─────────────────────────────────────────── */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.25rem;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }

/* ── Divider ──────────────────────────────────────────────── */
.divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--border-glow), transparent);
  margin: 1.5rem 0;
}

/* ── Gradient Text Utility ────────────────────────────────── */
.text-gradient {
  background: var(--gradient-brand);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-alt {
  background: var(--gradient-brand-alt);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Utility Classes ──────────────────────────────────────── */
.flex         { display: flex; }
.flex-col     { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.items-start  { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center  { justify-content: center; }
.justify-end     { justify-content: flex-end; }
.gap-1  { gap: 0.25rem; }
.gap-2  { gap: 0.5rem; }
.gap-3  { gap: 0.75rem; }
.gap-4  { gap: 1rem; }
.gap-6  { gap: 1.5rem; }
.gap-8  { gap: 2rem; }
.flex-1 { flex: 1; }
.w-full { width: 100%; }
.h-full { height: 100%; }
.relative { position: relative; }
.overflow-hidden { overflow: hidden; }
.text-center { text-align: center; }
.text-right  { text-align: right; }
.text-sm   { font-size: 0.875rem; }
.text-xs   { font-size: 0.75rem; }
.text-lg   { font-size: 1.125rem; }
.text-xl   { font-size: 1.25rem; }
.text-2xl  { font-size: 1.5rem; }
.text-3xl  { font-size: 1.875rem; }
.font-bold  { font-weight: 700; }
.font-medium { font-weight: 500; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.mt-1  { margin-top: 0.25rem; }
.mt-2  { margin-top: 0.5rem; }
.mt-4  { margin-top: 1rem; }
.mt-6  { margin-top: 1.5rem; }
.mb-2  { margin-bottom: 0.5rem; }
.mb-4  { margin-bottom: 1rem; }
.mb-6  { margin-bottom: 1.5rem; }
.p-4   { padding: 1rem; }
.px-4  { padding-left: 1rem; padding-right: 1rem; }
.py-2  { padding-top: 0.5rem; padding-bottom: 0.5rem; }
.hidden { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border-width: 0;
}

/* Glow pulse animation */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 15px rgba(124, 58, 237, 0.4); }
  50%       { box-shadow: 0 0 40px rgba(124, 58, 237, 0.7), 0 0 20px rgba(236, 72, 153, 0.3); }
}

.glow-pulse { animation: glowPulse 3s ease-in-out infinite; }

/* Card border animation */
@keyframes borderGlow {
  0%, 100% { border-color: rgba(124, 58, 237, 0.4); }
  50%       { border-color: rgba(168, 85, 247, 0.7); }
}

.border-animate { animation: borderGlow 3s ease-in-out infinite; }

/* Fade In */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.fade-in { animation: fadeIn 0.4s ease forwards; }

/* Staggered children animation */
.stagger-children > * {
  opacity: 0;
  animation: fadeIn 0.4s ease forwards;
}
.stagger-children > *:nth-child(1)  { animation-delay: 0.05s; }
.stagger-children > *:nth-child(2)  { animation-delay: 0.1s; }
.stagger-children > *:nth-child(3)  { animation-delay: 0.15s; }
.stagger-children > *:nth-child(4)  { animation-delay: 0.2s; }
.stagger-children > *:nth-child(5)  { animation-delay: 0.25s; }
.stagger-children > *:nth-child(6)  { animation-delay: 0.3s; }
.stagger-children > *:nth-child(7)  { animation-delay: 0.35s; }
.stagger-children > *:nth-child(8)  { animation-delay: 0.4s; }
.stagger-children > *:nth-child(9)  { animation-delay: 0.45s; }
.stagger-children > *:nth-child(10) { animation-delay: 0.5s; }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 3rem 1rem;
  color: var(--text-muted);
  text-align: center;
}

.empty-state-icon {
  font-size: 3rem;
  filter: grayscale(0.3);
}

.empty-state-title {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .navbar-nav { display: none; }
  .content-area { padding: 1.25rem; }
  .users-grid { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .asset-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .modal { margin: 0 0.5rem; max-width: 100%; }
}

@media (max-width: 480px) {
  .glass-card { padding: 1.25rem; }
  .btn-xl { padding: 0.85rem 1.75rem; font-size: 1rem; }
  .stat-value { font-size: 1.5rem; }
  .grid-4 { grid-template-columns: 1fr; }
}
