/* /v2/assets/css/global.css */
@import url('/assets/fonts/fonts.css');

:root {
  --bg:         #0a0a0f;
  --surface:    #111118;
  --surface2:   #1a1a26;
  --border:     rgba(255,255,255,0.08);
  --border2:    rgba(255,255,255,0.14);
  --text:       #e8e8f0;
  --text-muted: #7878a0;
  --accent:     #0d6efd;
  --accent2:    #3d8bfd;
  --accent-glow:rgba(13,110,253,0.35);
  --red:        #ef4444;
  --green:      #22c55e;
  --gold:       #f59e0b;

  --radius-sm:  8px;
  --radius-md:  14px;
  --radius-lg:  20px;
  --radius-xl:  28px;
  --radius-pill:9999px;

  --font-display: 'Cinzel', serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'Space Mono', monospace;

  --shadow-sm:  0 2px 8px rgba(0,0,0,.4);
  --shadow-md:  0 4px 24px rgba(0,0,0,.5);
  --shadow-lg:  0 8px 48px rgba(0,0,0,.6);
  --shadow-glow:0 0 32px var(--accent-glow);

  --transition: 200ms cubic-bezier(.4,0,.2,1);
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ── Scrollbar ── */
::-webkit-scrollbar        { width: 6px; height: 6px; }
::-webkit-scrollbar-track  { background: var(--surface); }
::-webkit-scrollbar-thumb  { background: var(--surface2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Typography ── */
h1,h2,h3,h4,h5,h6 { font-family: var(--font-display); font-weight: 700; line-height: 1.2; }
a { color: var(--accent2); text-decoration: none; transition: color var(--transition); }
a:hover { color: #60a5fa; }
p { color: var(--text-muted); line-height: 1.7; }

/* ── Inputs ── */
.input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 14px;
  padding: 12px 16px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.input::placeholder { color: var(--text-muted); }
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}
.input-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.input-group { margin-bottom: 20px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 24px;
  border-radius: var(--radius-pill);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 28px var(--accent-glow);
  filter: brightness(1.1);
}
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--surface2); color: var(--text); border-color: var(--border2); }
.btn-danger {
  background: rgba(239,68,68,.15);
  color: var(--red);
  border: 1px solid rgba(239,68,68,.3);
}
.btn-danger:hover { background: rgba(239,68,68,.25); }
.btn-sm { padding: 7px 16px; font-size: 13px; }
.btn-lg { padding: 15px 36px; font-size: 16px; }
.btn-full { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ── Cards ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
}
.card-sm { padding: 18px 22px; }

/* ── Alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}
.alert-error   { background: rgba(239,68,68,.12); color: #fca5a5; border: 1px solid rgba(239,68,68,.25); }
.alert-success { background: rgba(34,197,94,.12);  color: #86efac;  border: 1px solid rgba(34,197,94,.25); }
.alert-info    { background: rgba(13,110,253,.12); color: #93c5fd; border: 1px solid rgba(13,110,253,.25); }

/* ── Navbar ── */
.navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: 60px;
  background: rgba(10,10,15,.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 16px;
}
.navbar-logo {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 20px;
  color: #fff;
  letter-spacing: 2px;
  text-decoration: none;
}
.navbar-logo span { color: var(--accent2); }
.navbar-spacer { flex: 1; }
.navbar-links { display: flex; align-items: center; gap: 8px; }
.navbar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}
.navbar-toggle:hover { background: var(--surface2); border-color: var(--border2); }

@media (max-width: 760px) {
  .navbar { padding: 0 16px; gap: 10px; }
  .navbar-logo { font-size: 17px; }
  .navbar-toggle { display: inline-flex; }
  .navbar-links {
    position: fixed;
    top: 60px; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    background: rgba(10,10,15,.97);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom));
    gap: 8px;
    max-height: calc(100vh - 60px);
    overflow-y: auto;
    transform: translateY(-8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition), visibility var(--transition);
  }
  .navbar-links.open {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
  }
  .navbar-links .btn { width: 100%; justify-content: flex-start; }
}

/* ── Badge rarity colors ── */
.rarity-common    { color: #9ca3af; }
.rarity-uncommon  { color: #4ade80; }
.rarity-rare      { color: #60a5fa; }
.rarity-epic      { color: #3d8bfd; }
.rarity-legendary { color: #f59e0b; text-shadow: 0 0 12px rgba(245,158,11,.5); }

/* ── Loading spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--border2);
  border-top-color: var(--accent2);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Grain texture overlay ── */
.grain::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9998;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.4;
}

/* ── Page transitions ── */
.page-enter {
  animation: pageIn .4s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes pageIn {
  from { opacity:0; transform: translateY(10px); }
  to   { opacity:1; transform: translateY(0); }
}

/* ── Toast notifications ── */
#toast-container {
  position: fixed;
  top: 24px; left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}
.toast {
  background: rgba(20,20,28,.95);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  box-shadow: 0 12px 30px rgba(0,0,0,.4);
  animation: toastIn .25s ease forwards;
  pointer-events: auto;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.toast.success span:first-child { color: var(--green); }
.toast.error   span:first-child { color: var(--red); }
.toast.info    span:first-child { color: var(--accent2); }
@keyframes toastIn  { from { opacity:0; transform:translateY(-16px); } to { opacity:1; transform:none; } }
@keyframes toastOut { from { opacity:1; } to { opacity:0; transform:translateY(-16px); } }

/* ── Range slider ── */
input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: var(--surface2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: var(--accent2);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent-glow);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
.modal {
  background: var(--surface);
  border: 1px solid var(--border2);
  border-radius: var(--radius-xl);
  padding: 36px;
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
}
.modal-title { font-size: 22px; margin-bottom: 8px; }
.modal-body  { margin-top: 20px; }
.modal-footer { margin-top: 28px; display: flex; gap: 12px; justify-content: flex-end; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

/* ── Utilities ── */
.flex        { display: flex; }
.flex-col    { flex-direction: column; }
.items-center{ align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2       { gap: 8px; }
.gap-3       { gap: 12px; }
.gap-4       { gap: 16px; }
.mt-1        { margin-top: 4px; }
.mt-2        { margin-top: 8px; }
.mt-4        { margin-top: 16px; }
.mt-6        { margin-top: 24px; }
.text-sm     { font-size: 13px; }
.text-xs     { font-size: 12px; }
.text-muted  { color: var(--text-muted); }
.text-center { text-align: center; }
.font-bold   { font-weight: 700; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hidden      { display: none !important; }
.w-full      { width: 100%; }
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 24px 0;
}

/* ── Site-wide tooltip (same style the profile's social icons use) ── */
[data-tooltip] { position: relative; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute; bottom: calc(100% + 6px);
  left: 50%; transform: translateX(-50%);
  background: rgba(0,0,0,.85); color: #fff;
  font-size: 10px; font-weight: 600;
  padding: 3px 8px; border-radius: 6px;
  white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s;
  z-index: 9999;
}
[data-tooltip]:hover::after { opacity: 1; }

/* ── iOS-style toggle switch ──────────────────────────────────────────────── */
.toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}
.toggle-wrap input[type=checkbox] { display: none; }
.toggle-track {
  width: 42px; height: 24px;
  background: rgba(255,255,255,.12);
  border-radius: 12px;
  position: relative;
  transition: background .22s;
  flex-shrink: 0;
  border: 1px solid rgba(255,255,255,.1);
}
.toggle-wrap input:checked ~ .toggle-track,
.toggle-wrap input:checked + .toggle-track {
  background: var(--accent);
  border-color: var(--accent);
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 18px; height: 18px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  transition: transform .22s cubic-bezier(.4,0,.2,1);
}
.toggle-wrap input:checked ~ .toggle-track::after,
.toggle-wrap input:checked + .toggle-track::after {
  transform: translateX(18px);
}
.toggle-label {
  font-size: 13px;
  color: var(--text);
  font-family: var(--font-body);
}
