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

:root {
  --bg-1: #0b0d14;
  --bg-2: #141a2a;
  --card: #151c2e;
  --card-2: #111625;
  --line: rgba(255, 255, 255, 0.08);
  --text: #e8ebf2;
  --muted: #a7afc4;
  --accent: #4fd1c5;
  --accent-strong: #2dd4bf;
  --accent-2: #ffb86b;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Space Grotesk", "Segoe UI", Arial, sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: radial-gradient(1200px 700px at 10% -10%, #1f2a4a 0%, var(--bg-1) 50%),
              radial-gradient(1200px 700px at 110% 10%, #1b2c2d 0%, var(--bg-1) 55%);
}

button {
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: linear-gradient(180deg, var(--accent), var(--accent-strong));
  color: #0b0d14;
  font-weight: 700;
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

aside {
  padding: 24px 20px;
  background: linear-gradient(180deg, #0e1220, #0a0e19 60%);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
}

.aside-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

aside h1 {
  color: var(--accent);
  font-size: 20px;
  margin: 0;
}

aside a {
  display: block;
  padding: 10px 12px;
  color: var(--muted);
  text-decoration: none;
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid transparent;
}

aside a:hover,
aside a.active,
body[data-nav="home"] aside a[data-nav="home"],
body[data-nav="addons"] aside a[data-nav="addons"],
body[data-nav="imports"] aside a[data-nav="imports"],
body[data-nav="admin"] aside a[data-nav="admin"] {
  background: rgba(79, 209, 197, 0.12);
  color: var(--text);
  border-color: rgba(79, 209, 197, 0.25);
}

main { padding: 32px 34px 60px; }

.hero,
.stat,
.row,
.pack-summary,
.group-card,
.install-guide {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
}

.hero {
  padding: 28px;
  border-radius: 22px;
  margin-bottom: 28px;
}

.hero h2 { margin: 0 0 8px; }
.hero p { margin: 0; color: var(--muted); }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 18px;
  margin-bottom: 30px;
}

.stat {
  padding: 18px;
  border-radius: 18px;
  text-align: center;
}

.stat h3 { margin: 0; color: var(--accent); font-size: 26px; }
.stat p { margin: 6px 0 0; color: var(--muted); font-size: 13px; }

.pack-summary {
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 18px;
}

.pack-summary h3 { margin: 0 0 8px; }
.pack-summary p { margin: 0 0 12px; color: var(--muted); }

.summary-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.summary-badges span {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.featured h3 { margin: 0 0 14px; }

.list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.row {
  display: grid;
  grid-template-columns: 56px 1fr auto auto;
  gap: 16px;
  align-items: center;
  padding: 14px 18px;
  border-radius: 16px;
}

.row img {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  object-fit: cover;
}

.row h3 { margin: 0; }
.row p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.row small { color: var(--muted); font-size: 12px; text-align: right; }

.badge {
  margin-left: 8px;
  padding: 4px 10px;
  font-size: 11px;
  border-radius: 999px;
  background: var(--accent-2);
  color: #1a1208;
  font-weight: 700;
}

.group-card {
  border-radius: 18px;
  margin-bottom: 18px;
  overflow: hidden;
}

.group-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}

.group-card-header .arrow {
  background: rgba(79, 209, 197, 0.18);
  color: var(--accent);
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.group-card-body { padding: 14px; }
.group-card.collapsed .group-card-body { display: none; }
.group-card:not(.collapsed) .arrow { transform: rotate(90deg); }

.install-guide {
  border-radius: 16px;
  padding: 16px 18px;
  margin-bottom: 20px;
}

.install-guide h2 { margin: 0 0 10px; }
.guide-steps { margin: 0 0 10px 18px; color: var(--muted); }
.guide-note { margin: 0; font-size: 12px; color: var(--muted); }

.empty {
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

.aside-footer {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.donate-link {
  text-decoration: none;
  color: var(--text);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
}

.support-modal {
  position: fixed;
  inset: 0;
  display: none;
  z-index: 999;
}

.support-modal.show { display: block; }

.support-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.55);
}

.support-card {
  position: relative;
  max-width: 420px;
  margin: 10vh auto;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px;
}

.support-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.support-close {
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  padding: 4px 8px;
}

.support-text { color: var(--muted); margin: 8px 0 16px; }

.support-pix {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
}

.support-label {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--muted);
}

.support-pix code {
  font-family: "Space Grotesk", "Segoe UI", Arial, sans-serif;
  color: var(--text);
}

.mobile-menu-btn {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 30;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--card), var(--card-2));
  color: var(--text);
  display: none;
}

.menu-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 18, 0.55);
  opacity: 0;
  pointer-events: none;
  z-index: 15;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.theme-toggle {
  padding: 0;
  border: 0;
  background: transparent;
}

.toggle-track {
  position: relative;
  width: 70px;
  height: 34px;
  border-radius: 999px;
  background: #1b2236;
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
}

.toggle-icon { font-size: 14px; opacity: 0.8; }
.toggle-icon.sun { color: #fbbf24; }
.toggle-icon.moon { color: #cbd5f5; }

.toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: radial-gradient(circle at 35% 35%, #fff6cc, #f59e0b 70%);
}

:root[data-theme="light"] {
  --bg-1: #ebe7e1;
  --bg-2: #e4dfd8;
  --card: #f6f2ee;
  --card-2: #eee9e3;
  --line: rgba(15, 23, 42, 0.14);
  --text: #202430;
  --muted: #5f6b7a;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
}

:root[data-theme="light"] .toggle-thumb {
  transform: translateX(36px);
  background: radial-gradient(circle at 30% 30%, #ffffff, #cbd5f5 65%);
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }

  aside {
    position: fixed;
    top: 0;
    left: 0;
    width: 260px;
    max-width: 85vw;
    transform: translateX(-105%);
    z-index: 20;
  }

  body.menu-open aside { transform: translateX(0); }
  .mobile-menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  body.menu-open .menu-backdrop { opacity: 1; pointer-events: auto; }
  main { padding: 22px 18px 40px; }
}

@media (max-width: 720px) {
  .row {
    grid-template-columns: 48px 1fr;
  }

  .row button,
  .row small {
    grid-column: 1 / -1;
    text-align: left;
  }
}

.editor-list {
  display: grid;
  gap: 14px;
}

.editor-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
}

.admin-field {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
}

.admin-field span {
  font-size: 12px;
  color: var(--muted);
}

.admin-field input,
.admin-field textarea,
.admin-field select,
.admin-actions select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  color: var(--text);
  padding: 8px 10px;
  font-family: "Space Grotesk", "Segoe UI", Arial, sans-serif;
}

.admin-field select,
.admin-actions select {
  color-scheme: dark;
}

.admin-field select option,
.admin-actions select option {
  background: #ffffff;
  color: #111111;
}

.admin-field textarea {
  min-height: 72px;
  resize: vertical;
}

.admin-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.admin-textarea {
  width: 100%;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  font-family: Consolas, "Courier New", monospace;
}

.admin-master-detail {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 12px;
}

.admin-item-list {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 520px;
  overflow: auto;
}

.admin-item-btn {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  color: var(--text);
  padding: 8px 10px;
  box-shadow: none;
}

.admin-item-btn.active {
  background: rgba(79, 209, 197, 0.16);
  border-color: rgba(79, 209, 197, 0.35);
}

.admin-item-group-title {
  margin: 10px 2px 4px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-item-list .admin-item-group-title:first-child {
  margin-top: 0;
}

.admin-item-detail {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  padding: 12px;
}

.inline-login {
  margin-top: 14px;
  max-width: 420px;
}

.inline-login .admin-actions {
  margin-bottom: 8px;
}

@media (max-width: 980px) {
  .admin-master-detail {
    grid-template-columns: 1fr;
  }
}
