/* ============================================================
   Premium SWB Store — Design System v2
   New direction: vibrant purple→blue gradient, fully rounded
   pill UI, soft elevated cards, light-first premium app-store look
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700;800&family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #F4F5FB;
  --surface: #FFFFFF;
  --surface-2: #F0F1FA;
  --border: rgba(30,20,70,0.08);
  --text: #171425;
  --text-muted: #6E6B85;

  --accent: #7C5CFC;       /* violet */
  --accent-2: #3AB0FF;     /* sky blue */
  --accent-rgb: 124,92,252;
  --gradient: linear-gradient(135deg, #7C5CFC 0%, #3AB0FF 100%);
  --gradient-soft: linear-gradient(135deg, rgba(124,92,252,0.14) 0%, rgba(58,176,255,0.14) 100%);

  --danger: #FF5C7A;
  --success: #2FD98A;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 10px 34px rgba(80,60,180,0.10);
  --shadow-lg: 0 20px 50px rgba(80,60,180,0.16);

  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --nav-h: 76px;
}

[data-theme="dark"] {
  --bg: #0F0D1B;
  --surface: #17142A;
  --surface-2: #1E1A35;
  --border: rgba(255,255,255,0.08);
  --text: #F2F1FA;
  --text-muted: #9C97B8;
  --shadow: 0 10px 34px rgba(0,0,0,0.35);
  --shadow-lg: 0 20px 50px rgba(0,0,0,0.45);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  transition: background .25s ease, color .25s ease;
}
h1,h2,h3,h4,h5 { font-family: var(--font-display); margin: 0 0 .5em; letter-spacing: -0.01em; font-weight: 700; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
.container { max-width: 1240px; margin: 0 auto; padding: 0 24px; }
.muted { color: var(--text-muted); }
.mono { font-family: var(--font-mono); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* Gradient text utility — used for hero headline / brand emphasis */
.gradient-text {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ---------- Glass ---------- */
.glass {
  background: color-mix(in srgb, var(--surface) 75%, transparent);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  border-bottom: 1px solid var(--border);
}
.glass-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Navbar ---------- */
.navbar { position: sticky; top: 0; z-index: 100; height: var(--nav-h); }
.navbar__inner { height: 100%; display: flex; align-items: center; gap: 24px; }
.navbar__brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; flex-shrink: 0; }
.navbar__logo {
  background: var(--gradient); color: #fff; padding: 6px 10px; border-radius: 12px;
  font-family: var(--font-mono); font-size: .8rem; box-shadow: 0 6px 16px rgba(var(--accent-rgb),0.35);
}
.navbar__brand-text em { color: var(--accent); font-style: normal; }
.navbar__search { flex: 1; max-width: 480px; position: relative; }
.navbar__search input {
  width: 100%; padding: 12px 18px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-size: .9rem;
}
.navbar__search input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb),0.12); }
.search-suggest {
  position: absolute; top: calc(100% + 10px); left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 360px; overflow-y: auto; display: none; z-index: 50;
}
.search-suggest.active { display: block; }
.search-suggest__item { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.search-suggest__item:hover { background: var(--surface-2); }
.search-suggest__item img { width: 36px; height: 36px; border-radius: 10px; object-fit: cover; }
.navbar__links { display: flex; gap: 22px; font-weight: 600; font-size: .92rem; }
.navbar__links a:hover { color: var(--accent); }
.navbar__actions { display: flex; align-items: center; gap: 10px; }
.navbar__burger { display: none; }
.icon-btn {
  background: var(--surface-2); border: 1px solid var(--border); width: 40px; height: 40px;
  border-radius: 50%; color: var(--text); font-size: 1rem;
}
.icon-btn:hover { background: var(--gradient-soft); border-color: transparent; }

.user-menu { position: relative; }
.user-menu__btn { background: none; border: none; padding: 0; }
.avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid transparent; background: var(--gradient); padding: 2px; }
.avatar--sm { width: 34px; height: 34px; }
.user-menu__dropdown {
  position: absolute; right: 0; top: calc(100% + 12px); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  min-width: 190px; display: none; flex-direction: column; overflow: hidden; z-index: 60;
}
.user-menu__dropdown--open { display: flex; }
.user-menu__dropdown a, .user-menu__dropdown button {
  padding: 13px 18px; background: none; border: none; text-align: left; color: var(--text); font-size: .9rem; font-weight: 500;
}
.user-menu__dropdown a:hover, .user-menu__dropdown button:hover { background: var(--gradient-soft); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 26px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: .92rem; transition: transform .15s ease, box-shadow .2s ease, opacity .2s ease;
}
.btn:active { transform: scale(0.96); }
.btn--primary { background: var(--gradient); color: #fff; box-shadow: 0 10px 24px rgba(var(--accent-rgb),0.32); }
.btn--primary:hover { box-shadow: 0 14px 30px rgba(var(--accent-rgb),0.42); transform: translateY(-1px); }
.btn--ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--gradient-soft); border-color: transparent; }
.btn--danger { background: var(--danger); color: #fff; }
.btn--block { width: 100%; }
.btn--sm { padding: 9px 18px; font-size: .82rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
label { display: block; font-size: .85rem; font-weight: 700; margin-bottom: 7px; }
input, textarea, select {
  width: 100%; padding: 13px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); font-family: inherit; font-size: .92rem;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(var(--accent-rgb),0.12); background: var(--surface); }
.field-error { color: var(--danger); font-size: .8rem; margin-top: 4px; display: none; }
.field-error.active { display: block; }
.auth-card { max-width: 440px; margin: 60px auto; padding: 40px; }
.auth-card h1 { font-size: 1.7rem; }

/* ---------- Cards ---------- */
.grid { display: grid; gap: 22px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: transform .25s cubic-bezier(.2,.8,.2,1), box-shadow .25s ease;
  display: flex; flex-direction: column; position: relative; box-shadow: var(--shadow);
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.card__thumb { width: 100%; aspect-ratio: 16/10; object-fit: cover; background: var(--surface-2); }
.card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 7px; flex: 1; }
.card__title { font-size: 1rem; font-weight: 700; }
.card__meta { display: flex; align-items: center; gap: 8px; font-size: .78rem; color: var(--text-muted); }
.file-badge {
  font-family: var(--font-mono); font-size: .72rem; background: var(--gradient-soft);
  border: 1px solid transparent; padding: 4px 10px; border-radius: 8px; color: var(--accent);
}
.card__footer { display: flex; justify-content: space-between; align-items: center; margin-top: auto; padding-top: 10px; font-size: .78rem; color: var(--text-muted); font-weight: 600; }
.card::after { content: none; } /* remove old bottom-line accent from v1 */

/* ---------- Skeleton ---------- */
.skel { background: linear-gradient(90deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 10px; }
.skel--thumb { aspect-ratio: 16/10; width: 100%; border-radius: var(--radius) var(--radius) 0 0; }
.skel--line { height: 12px; margin: 10px 18px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- Toasts ---------- */
.toast-host { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 1000; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 14px 20px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  transform: translateX(120%); opacity: 0; transition: all .3s ease; font-size: .88rem; max-width: 320px; font-weight: 500;
}
.toast--show { transform: translateX(0); opacity: 1; }
.toast__icon { font-weight: 800; }
.toast--success .toast__icon { color: var(--success); }
.toast--error .toast__icon { color: var(--danger); }
.toast--info .toast__icon { color: var(--accent-2); }
.toast--warning .toast__icon { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 80px; padding: 56px 0 0; }
.site-footer__grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 32px; }
.site-footer h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.site-footer a { display: block; padding: 7px 0; font-size: .9rem; color: var(--text); font-weight: 500; }
.site-footer a:hover { color: var(--accent); }
.site-footer__bottom { margin-top: 30px; padding: 22px 0; border-top: 1px solid var(--border); font-size: .8rem; color: var(--text-muted); }

/* ---------- Hero ---------- */
.hero { padding: 100px 0 70px; position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; top: -220px; right: -180px; width: 560px; height: 560px;
  background: var(--gradient); opacity: .18; filter: blur(60px); border-radius: 50%; pointer-events: none;
}
.hero::after {
  content: ""; position: absolute; bottom: -200px; left: -160px; width: 420px; height: 420px;
  background: var(--accent-2); opacity: .14; filter: blur(70px); border-radius: 50%; pointer-events: none;
}
.hero h1 { font-size: clamp(2.3rem, 5vw, 3.6rem); max-width: 720px; }
.hero p.lead { font-size: 1.12rem; color: var(--text-muted); max-width: 560px; margin-bottom: 30px; }
.hero__actions { display: flex; gap: 14px; }
.hero__stats { display: flex; gap: 44px; margin-top: 54px; }
.hero__stat b { font-family: var(--font-display); font-size: 1.8rem; display: block; }
.hero__stat b { background: var(--gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }

section { padding: 54px 0; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 26px; }
.section-head a { color: var(--accent); font-size: .88rem; font-weight: 700; }

/* ---------- Badges / chips ---------- */
.chip {
  display: inline-flex; align-items: center; padding: 8px 16px; border-radius: 999px;
  border: 1px solid var(--border); font-size: .84rem; font-weight: 600; background: var(--surface); transition: all .2s ease;
}
.chip:hover, .chip--active { border-color: transparent; background: var(--gradient); color: #fff; }

/* Category tiles get a gradient icon badge for that "app store" feel */
#category-grid .card, #cat-header ~ .grid .card { text-align: center; }
.grid .card > div:first-child[style*="font-size:2"] {
  background: var(--gradient-soft); border-radius: 50%; width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
}

/* ---------- Utility ---------- */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.text-center { text-align: center; }
.mt-0{margin-top:0} .mb-0{margin-bottom:0}
.empty-state { text-align: center; padding: 90px 20px; color: var(--text-muted); }
.empty-state .icon { font-size: 3.2rem; margin-bottom: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .navbar__search { display: none; }
  .site-footer__grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 720px) {
  .navbar__burger { display: block; }
  .navbar__links {
    position: fixed; top: var(--nav-h); left: 0; right: 0; background: var(--surface);
    flex-direction: column; padding: 18px 24px; display: none; border-bottom: 1px solid var(--border);
  }
  .navbar__links--open { display: flex; }
  .hero__stats { flex-wrap: wrap; gap: 26px; }
  .site-footer__grid { grid-template-columns: 1fr; }
  .auth-card { margin: 30px 16px; padding: 28px; }
}
