/* ═══════════════════════════════════════════════════════════════
   Leaf's Central — features.css
   Card overlay · Fav button · NEW badge · Sort dropdown
   Settings drawer · Cloak bar · Mobile nav · PWA banner
═══════════════════════════════════════════════════════════════ */

/* Fixed navbar — push body content down so it isn't hidden behind the bar */
body { padding-top: 61px; }

/* Position context so overlays/buttons stay inside the card */
.card-inner { position: relative; }

/* ── Back to top button ─────────────────────────────────────── */
#backToTop {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 48;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(17, 24, 39, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.13);
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  color: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 0.22s ease, transform 0.22s ease, background 0.15s;
  padding: 0;
  font-size: 0; /* hide any text fallback */
}
#backToTop.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
#backToTop:hover {
  background: rgba(30, 40, 60, 0.95);
  border-color: rgba(255, 255, 255, 0.22);
}
#backToTop svg { display: block; }
@media (max-width: 768px) {
  #backToTop { bottom: 72px; right: 14px; } /* clear mobile nav */
}



/* ── Favourite button ───────────────────────────────────────── */
.fav-btn {
  position: absolute;
  top: 5px;
  right: 5px;
  z-index: 6;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(0,0,0,.55);
  border: 1px solid rgba(255,255,255,.18);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity .15s;
  cursor: pointer;
  padding: 0;
  color: #9ca3af;
  flex-shrink: 0;
}
.fav-btn svg { width: 10px; height: 10px; pointer-events: none; }
.game-card:hover .fav-btn,
.app-card:hover  .fav-btn { opacity: 1; }
.fav-btn.favorited { opacity: 1 !important; color: #f87171; }
.fav-btn.favorited svg { fill: #f87171; stroke: #f87171; }
.no-animations .fav-btn { transition: none !important; }

/* ── NEW badge ──────────────────────────────────────────────── */
.new-badge {
  position: absolute;
  bottom: 5px;
  left: 5px;
  z-index: 3;
  font-size: 8px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 99px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  color: #fff;
  letter-spacing: .04em;
  pointer-events: none;
}

/* ── Favourites section ─────────────────────────────────────── */
#favSection { width: 100%; margin-bottom: 16px; }
#favRow {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(8, 1fr);
}
@media (min-width: 1280px) { #favRow { grid-template-columns: repeat(10, 1fr); } }
@media (max-width: 1024px) { #favRow { grid-template-columns: repeat(6, 1fr); } }
@media (max-width: 640px)  { #favRow { grid-template-columns: repeat(3, 1fr); } }

/* ── Sort dropdown ──────────────────────────────────────────── */
.sf-sort-wrap { position: relative; flex-shrink: 0; }
.sf-sort-btn {
  height: 36px;
  padding: 0 13px;
  border-radius: 99px;
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.1);
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .15s, color .15s;
}
.sf-sort-btn:hover { background: rgba(255,255,255,.13); color: #e2e8f0; }
.sf-sort-btn svg { pointer-events: none; }
.sf-sort-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #1e2433;
  border: 1px solid #2d3748;
  border-radius: 12px;
  overflow: hidden;
  min-width: 145px;
  box-shadow: 0 8px 32px rgba(0,0,0,.55);
  display: none;
  z-index: 30;
}
.sf-sort-dropdown.open { display: block; }
.sf-sort-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 500;
  color: #94a3b8;
  cursor: pointer;
  transition: background .1s;
  font-family: inherit;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.sf-sort-opt:hover { background: rgba(255,255,255,.05); color: #e2e8f0; }
.sf-sort-opt.active { color: #a5b4fc; background: rgba(99,102,241,.1); }

/* ── Grid density variants ──────────────────────────────────── */
[data-density="dense"] { gap: 4px !important; }
[data-density="comfy"] { gap: 14px !important; }

[data-density="dense"] .card-body { padding: 3px 5px 4px; }
[data-density="comfy"] .card-body { padding: 8px 10px 10px; }
[data-density="comfy"] .card-title { font-size: 13px !important; font-weight: 700; }
/* Dense: hide tag pills to keep cards from growing too tall */
[data-density="dense"] .card-tags { display: none; }

/* ── No-animations mode ─────────────────────────────────────── */
.no-animations .card-inner { transition: none !important; }

/* ═══════════════════════════════════════════════════════════════
   Navbar icon buttons (settings gear + panic shield)
═══════════════════════════════════════════════════════════════ */
.sf-icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: #9ca3af;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, color .2s;
  flex-shrink: 0;
}
.sf-icon-btn:hover { background: rgba(255,255,255,.13); color: #e2e8f0; }

.sf-panic-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(239,68,68,.1);
  border: 1px solid rgba(239,68,68,.22);
  color: #f87171;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .2s, border-color .2s, color .2s;
  flex-shrink: 0;
}
.sf-panic-btn:hover { background: rgba(239,68,68,.2); border-color: rgba(239,68,68,.45); }
.sf-panic-btn.active { background: rgba(239,68,68,.28); border-color: rgba(239,68,68,.6); }
.sf-panic-btn svg { pointer-events: none; }

/* ═══════════════════════════════════════════════════════════════
   Cloak Bar  —  fixed, slides DOWN to appear, slides UP to hide
═══════════════════════════════════════════════════════════════ */
.sf-cloak-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  transform: translateY(-110%);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1);
  padding: 7px 20px;
  background: rgba(17, 10, 10, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(239,68,68,.25);
  font-size: 11px;
  color: #f87171;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
  pointer-events: none;
}
.sf-cloak-bar.visible {
  transform: translateY(0);
  pointer-events: auto;
}
.sf-cloak-bar svg { flex-shrink: 0; }
.sf-kbd {
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 10px;
  font-family: inherit;
}

/* ═══════════════════════════════════════════════════════════════
   Settings Drawer
═══════════════════════════════════════════════════════════════ */
.sf-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.sf-overlay.open { opacity: 1; pointer-events: all; }

.sf-drawer {
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: min(320px, 90vw);
  background: #0f1116;
  border-left: 1px solid #1f2937;
  transform: translateX(100%);
  transition: transform .3s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(0,0,0,.4);
}
.sf-overlay.open .sf-drawer { transform: translateX(0); }

.sf-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #1a1d28;
}
.sf-drawer-title { font-size: 15px; font-weight: 700; color: #fff; }
.sf-drawer-close {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  border: none;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, color .15s;
}
.sf-drawer-close:hover { background: rgba(255,255,255,.13); color: #fff; }

.sf-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.sf-section-title {
  font-size: 10px;
  font-weight: 600;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 10px;
}
.sf-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  margin-bottom: 6px;
  gap: 10px;
}
.sf-option-label { font-size: 13px; font-weight: 500; color: #e2e8f0; }
.sf-option-sub { font-size: 11px; color: #475569; margin-top: 1px; }

.sf-toggle {
  width: 36px; height: 20px;
  border-radius: 99px;
  background: #374151;
  position: relative;
  cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
  border: none;
  padding: 0;
}
.sf-toggle.on { background: #3b82f6; }
.sf-toggle::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform .2s;
}
.sf-toggle.on::after { transform: translateX(16px); }

.sf-density-pills { display: flex; gap: 4px; }
.sf-density-pill {
  padding: 4px 11px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: #6b7280;
  cursor: pointer;
  transition: all .15s;
  font-family: inherit;
}
.sf-density-pill.active {
  background: rgba(99,102,241,.18);
  border-color: rgba(99,102,241,.4);
  color: #a5b4fc;
}

.sf-cloak-presets { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.sf-cloak-preset {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.sf-cloak-preset:hover { border-color: rgba(99,102,241,.3); background: rgba(99,102,241,.05); }
.sf-cloak-preset.selected { border-color: rgba(99,102,241,.4); background: rgba(99,102,241,.1); }
.sf-cloak-icon {
  width: 30px; height: 30px;
  border-radius: 6px;
  background: rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.sf-cloak-info { flex: 1; min-width: 0; }
.sf-cloak-name { font-size: 12px; font-weight: 600; color: #e2e8f0; }
.sf-cloak-domain { font-size: 10px; color: #475569; }
.sf-cloak-check {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid #374151;
  flex-shrink: 0;
  transition: all .2s;
}
.sf-cloak-preset.selected .sf-cloak-check { background: #3b82f6; border-color: #3b82f6; }

/* ═══════════════════════════════════════════════════════════════
   Mobile Bottom Navigation
═══════════════════════════════════════════════════════════════ */
.sf-mobile-nav {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 50;
  background: rgba(9,11,17,.97);
  border-top: 1px solid #1f2937;
  backdrop-filter: blur(12px);
  padding: 8px 0 max(10px, env(safe-area-inset-bottom));
  justify-content: space-around;
  align-items: center;
}
@media (max-width: 767px) {
  .sf-mobile-nav { display: flex; }
  body { padding-bottom: 64px; }
}
.sf-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  color: #4b5563;
  text-decoration: none;
  cursor: pointer;
  padding: 2px 10px;
  transition: color .15s;
}
.sf-nav-item:hover,
.sf-nav-item.active { color: #818cf8; }
.sf-nav-item svg { display: block; }
.sf-nav-item span { font-size: 9px; font-weight: 600; letter-spacing: .02em; }

/* ═══════════════════════════════════════════════════════════════
   PWA Install Banner
═══════════════════════════════════════════════════════════════ */
.sf-pwa-banner {
  display: none;
  position: fixed;
  bottom: 72px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 49;
  width: calc(100% - 32px);
  max-width: 520px;
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(17,24,39,.96);
  border: 1px solid rgba(99,102,241,.22);
  backdrop-filter: blur(8px);
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  font-family: "Space Grotesk", "Inter", system-ui, sans-serif;
}
@media (min-width: 768px) { .sf-pwa-banner { bottom: 24px; } }
.sf-pwa-text { font-size: 12px; color: #64748b; }
.sf-pwa-install {
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 700;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border: none;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}
.sf-pwa-install:hover { opacity: .88; }
.sf-pwa-dismiss {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-family: inherit;
  flex-shrink: 0;
}
