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

:root {
  --bg-from: #02010a;
  --bg-mid: #0c0a1e;
  --bg-to: #08021a;

  --glass-bg: rgba(255,255,255,0.04);
  --glass-border: rgba(255,255,255,0.10);
  --glass-shadow: 0 8px 32px rgba(0,0,0,0.45);

  --glow-purple: rgba(139,92,246,0.55);
  --glow-blue:   rgba(59,130,246,0.40);
  --glow-cyan:   rgba(34,211,238,0.35);

  --accent-1: #a78bfa;
  --accent-2: #60a5fa;
  --accent-3: #34d399;
}

html { scroll-behavior: smooth; }

body {
  background: radial-gradient(ellipse at 20% 30%, #130a2e 0%, var(--bg-mid) 40%, var(--bg-from) 100%);
  min-height: 100vh;
  font-family: 'Inter', sans-serif;
  color: #fff;
  -webkit-font-smoothing: antialiased;
}

/* ─────────────────────────────────────────────
   Text Gradient
───────────────────────────────────────────── */
.text-gradient {
  background: linear-gradient(135deg, #c4b5fd 0%, #818cf8 40%, #60a5fa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ─────────────────────────────────────────────
   Glassmorphism Base
───────────────────────────────────────────── */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--glass-border);
  box-shadow: var(--glass-shadow);
}

/* ─────────────────────────────────────────────
   Search Box Glow
───────────────────────────────────────────── */
.glass-glow {
  background: rgba(255,255,255,0.05);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(167,139,250,0.35);
  box-shadow:
    0 0 0 1px rgba(167,139,250,0.15),
    0 0 30px rgba(139,92,246,0.25),
    inset 0 1px 0 rgba(255,255,255,0.08);
  transition: box-shadow 0.3s ease, border-color 0.3s ease;
}

.glass-glow:focus-within {
  border-color: rgba(167,139,250,0.70);
  box-shadow:
    0 0 0 1px rgba(167,139,250,0.30),
    0 0 50px rgba(139,92,246,0.45),
    0 0 80px rgba(139,92,246,0.20),
    inset 0 1px 0 rgba(255,255,255,0.12);
}

/* ─────────────────────────────────────────────
   Nav Cards
───────────────────────────────────────────── */
.nav-card {
  position: relative;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 1.25rem;
  padding: 1.4rem 1.2rem 1.2rem;
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.35s ease,
    border-color 0.35s ease;
  animation: float var(--float-dur, 4s) ease-in-out infinite;
  animation-delay: var(--float-delay, 0s);
  box-shadow: 0 4px 24px rgba(0,0,0,0.35);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.nav-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.06) 0%, transparent 60%);
  border-radius: inherit;
  pointer-events: none;
}

.nav-card:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: rgba(167,139,250,0.40);
  box-shadow:
    0 12px 40px rgba(0,0,0,0.50),
    0 0 30px var(--card-glow, rgba(139,92,246,0.25));
}

.nav-card:hover .card-icon-wrap {
  transform: scale(1.15) rotate(-5deg);
}

/* ── Icon Wrapper ── */
.card-icon-wrap {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.10);
  flex-shrink: 0;
}

.card-name {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  color: rgba(255,255,255,0.92);
}

.card-desc {
  font-size: 0.72rem;
  color: rgba(255,255,255,0.42);
  line-height: 1.45;
}

.card-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6rem;
  padding: 0.15rem 0.5rem;
  border-radius: 99px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.35);
  margin-top: auto;
  width: fit-content;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─────────────────────────────────────────────
   Float Animation
───────────────────────────────────────────── */
@keyframes float {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%       { transform: translateY(-8px) rotate(0.5deg); }
  66%       { transform: translateY(-4px) rotate(-0.3deg); }
}

.gravity-active .nav-card {
  animation: none !important;
}

/* ─────────────────────────────────────────────
   Gravity Button
───────────────────────────────────────────── */
.gravity-btn {
  background: rgba(255,255,255,0.06);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.14);
  color: #fff;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4), 0 0 20px rgba(139,92,246,0.20);
  cursor: pointer;
  transition: all 0.3s ease;
}

.gravity-btn:hover {
  background: rgba(139,92,246,0.25);
  border-color: rgba(167,139,250,0.55);
  box-shadow: 0 4px 24px rgba(0,0,0,0.45), 0 0 30px rgba(139,92,246,0.40);
  transform: scale(1.05);
}

.gravity-btn.active {
  background: rgba(139,92,246,0.35);
  border-color: rgba(167,139,250,0.70);
  box-shadow: 0 4px 30px rgba(139,92,246,0.50), 0 0 60px rgba(139,92,246,0.30);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 4px 30px rgba(139,92,246,0.50), 0 0 60px rgba(139,92,246,0.30); }
  50%       { box-shadow: 0 4px 40px rgba(139,92,246,0.70), 0 0 80px rgba(139,92,246,0.50); }
}

/* ─────────────────────────────────────────────
   Reset Button
───────────────────────────────────────────── */
.reset-btn {
  background: rgba(52,211,153,0.12);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(52,211,153,0.28);
  color: #6ee7b7;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
  cursor: pointer;
  transition: all 0.3s ease;
}

.reset-btn:hover {
  background: rgba(52,211,153,0.22);
  border-color: rgba(52,211,153,0.55);
  transform: scale(1.05);
}

/* ─────────────────────────────────────────────
   Physics DOM Cards
───────────────────────────────────────────── */
.physics-card {
  position: fixed;
  will-change: transform;
  pointer-events: auto;
  user-select: none;
  z-index: 40;
  transition: none;
  animation: none !important;
  cursor: grab;
}

.physics-card:active {
  cursor: grabbing;
}

/* Smooth return animation */
.physics-card.returning {
  transition:
    left 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    top  0.7s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.7s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.5s ease;
  pointer-events: none;
}

/* ─────────────────────────────────────────────
   Category Filter Bar
───────────────────────────────────────────── */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

.cat-bar {
  position: relative;
}

/* Each tab pill */
.cat-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 1rem;
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.04);
  color: rgba(255,255,255,0.50);
  transition:
    color        0.25s ease,
    background   0.25s ease,
    border-color 0.25s ease,
    transform    0.2s  cubic-bezier(0.34,1.56,0.64,1);
  user-select: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  flex-shrink: 0;
}

.cat-tab:hover {
  color: rgba(255,255,255,0.80);
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.15);
}

.cat-tab.active {
  color: #fff;
  background: rgba(139,92,246,0.30);
  border-color: rgba(167,139,250,0.55);
  box-shadow:
    0 0 18px rgba(139,92,246,0.35),
    inset 0 1px 0 rgba(255,255,255,0.12);
}

.cat-tab.active .cat-tab-icon {
  color: #c4b5fd;
}

/* Icon inside tab */
.cat-tab-icon {
  font-size: 0.7rem;
  opacity: 0.8;
  transition: color 0.25s ease;
}

/* Count badge */
.cat-badge {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.05rem 0.38rem;
  border-radius: 99px;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.50);
  transition: background 0.25s ease, color 0.25s ease;
  min-width: 1.25rem;
  text-align: center;
}

.cat-tab.active .cat-badge {
  background: rgba(167,139,250,0.35);
  color: #e9d5ff;
}

/* Indicator stripe (thin line under bar) */
.cat-indicator {
  display: none; /* JS controls via inline; kept as positioning fallback */
}

/* ─────────────────────────────────────────────
   Cards Empty State
───────────────────────────────────────────── */
.cards-empty {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  padding: 3.5rem 0;
  color: rgba(255,255,255,0.25);
  font-size: 0.875rem;
}
.cards-empty i { font-size: 2rem; opacity: 0.3; }

/* ─────────────────────────────────────────────
   Card entry animation
───────────────────────────────────────────── */
@keyframes card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    }
}

.nav-card {
  animation-name: card-in, float;
  animation-duration: 0.35s, var(--float-dur, 4s);
  animation-timing-function: cubic-bezier(0.22,1,0.36,1), ease-in-out;
  animation-fill-mode: both, none;
  animation-iteration-count: 1, infinite;
  animation-delay: var(--card-in-delay, 0s), var(--float-delay, 0s);
}

/* Override for gravity-active (no float animation) */
.gravity-active .nav-card {
  animation: none !important;
}

/* ─────────────────────────────────────────────
   Scrollbar
───────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(139,92,246,0.35); border-radius: 99px; }

/* ─────────────────────────────────────────────
   Hidden utility
───────────────────────────────────────────── */
.hidden { display: none !important; }

/* ─────────────────────────────────────────────
   Mobile Responsive Adjustments
───────────────────────────────────────────── */
@media (max-width: 640px) {
  .nav-card { padding: 1.1rem 1rem 1rem; }
  .card-icon-wrap { width: 2.25rem; height: 2.25rem; font-size: 1.1rem; }
  .card-name { font-size: 0.9rem; }
  .gravity-btn { 
    bottom: 1.25rem; left: 1.25rem; 
    padding: 0.6rem 1rem; font-size: 0.8rem;
  }
  .reset-btn { 
    bottom: 1.25rem; left: 8rem; 
    padding: 0.6rem 1rem; font-size: 0.8rem; 
  }
}

