/* ═══════════════════════════════════════════════════════════════
   sambai.tech — dark modern AI app directory
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg: #08080d;
  --bg-2: #0b0b13;
  --panel: rgba(255, 255, 255, 0.028);
  --panel-hover: rgba(255, 255, 255, 0.05);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f2f2f7;
  --muted: rgba(233, 233, 245, 0.56);
  --faint: rgba(233, 233, 245, 0.34);
  --a1: #7c5cff;
  --a2: #22d3ee;
  --grad: linear-gradient(135deg, #7c5cff 0%, #22d3ee 100%);
  --green: #34d399;
  --indigo: #8d7bff;
  --amber: #f5b04c;
  --star: #fbbf24;
  --pink: #ff5c8a;
  --radius: 14px;
  --font-ui: "Inter", system-ui, -apple-system, sans-serif;
  --font-display: "Space Grotesk", var(--font-ui);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-ui);
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* faint engineering grid fading down from the top */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 55% at 50% -5%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 90% 55% at 50% -5%, #000 20%, transparent 75%);
  z-index: 0;
}

::selection { background: rgba(124, 92, 255, 0.4); }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, select { font: inherit; color: inherit; }

::-webkit-scrollbar { width: 10px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 99px; }
::-webkit-scrollbar-track { background: transparent; }

:focus-visible { outline: 2px solid var(--a2); outline-offset: 2px; border-radius: 4px; }

/* ═══════════════ BUTTONS ═══════════════ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.925rem;
  padding: 11px 20px;
  border: 1px solid transparent;
  transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
  white-space: nowrap;
}
.btn.primary {
  background: var(--grad);
  color: #0b0b13;
  box-shadow: 0 4px 24px rgba(124, 92, 255, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn.primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 34px rgba(124, 92, 255, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn.ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--text);
}
.btn.ghost:hover { background: var(--panel-hover); border-color: var(--border-strong); }
.btn.sm { padding: 8px 15px; font-size: 0.875rem; }
.btn.lg { padding: 13px 26px; font-size: 1rem; }

/* ═══════════════ NAV ═══════════════ */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(8, 8, 13, 0.72);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 1220px;
  margin: 0 auto;
  height: 58px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo { display: inline-flex; align-items: center; gap: 10px; }
.logo-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: var(--grad);
  color: #0b0b13;
  font-size: 15px;
  font-weight: 700;
  box-shadow: 0 2px 16px rgba(124, 92, 255, 0.45);
}
.logo-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}
.logo-word em { font-style: normal; color: var(--muted); font-weight: 500; }

.nav-links { display: flex; gap: 4px; margin-right: auto; }
.nav-links a {
  padding: 8px 13px;
  border-radius: 8px;
  font-size: 0.925rem;
  font-weight: 500;
  color: var(--muted);
  transition: color 0.15s ease, background 0.15s ease;
}
.nav-links a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.nav-links a.active { color: var(--text); }

.nav-actions { display: flex; align-items: center; gap: 10px; }

.nav-search {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px 8px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--faint);
  font-size: 0.875rem;
  transition: border-color 0.15s ease, color 0.15s ease;
}
.nav-search:hover { border-color: var(--border-strong); color: var(--muted); }
.nav-search kbd {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--faint);
}

/* ═══════════════ HERO ═══════════════ */

.hero { position: relative; z-index: 1; }
.hero::before {
  content: "";
  position: absolute;
  inset: -110px 0 auto 0;
  height: 400px;
  background:
    radial-gradient(42% 52% at 50% 8%, rgba(124, 92, 255, 0.22), transparent 70%),
    radial-gradient(30% 38% at 68% 30%, rgba(34, 211, 238, 0.12), transparent 70%);
  pointer-events: none;
}

.hero-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 42px 24px 34px;
  text-align: center;
  position: relative;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 3.6vw, 2.75rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.025em;
  margin: 0 0 16px;
  animation: fadeUp 0.6s 0.04s ease both;
}
.grad-text {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.searchbar {
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 8px 8px 18px;
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  background: rgba(13, 13, 21, 0.85);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(124, 92, 255, 0.07);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
  animation: fadeUp 0.6s 0.16s ease both;
}
.searchbar:focus-within {
  border-color: rgba(124, 92, 255, 0.65);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.5), 0 0 0 4px rgba(124, 92, 255, 0.16);
}
.search-ico { color: var(--faint); flex-shrink: 0; }
.searchbar input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none;
  outline: none;
  font-size: 1rem;
  color: var(--text);
}
.searchbar input::placeholder { color: var(--faint); }
.search-kbd {
  font-family: var(--font-ui);
  font-size: 0.74rem;
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--faint);
  flex-shrink: 0;
}

/* ═══════════════ SECTIONS ═══════════════ */

.section {
  position: relative;
  z-index: 1;
  max-width: 1220px;
  margin: 0 auto;
  padding: 44px 24px 0;
}

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.section-head h2 {
  font-family: var(--font-display);
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.fire { margin-right: 4px; }
.see-all { font-size: 0.9rem; color: var(--muted); transition: color 0.15s ease; }
.see-all:hover { color: var(--a2); }
.results-count { font-size: 0.9rem; color: var(--faint); }

/* ═══════════════ TRENDING ═══════════════ */

.trend-strip {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
}
.trend-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
  cursor: pointer;
}
.trend-card:hover { border-color: rgba(124, 92, 255, 0.45); background: var(--panel-hover); transform: translateY(-2px); }
.trend-rank {
  font-family: var(--font-display);
  font-size: 1.9rem;
  font-weight: 700;
  color: transparent;
  -webkit-text-stroke: 1px rgba(255, 255, 255, 0.22);
  line-height: 1;
  flex-shrink: 0;
  width: 34px;
}
.trend-info { min-width: 0; }
.trend-name {
  font-weight: 600;
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.trend-growth { font-size: 0.78rem; color: var(--green); font-weight: 600; }

/* ═══════════════ TOOLBAR ═══════════════ */

.toolbar {
  position: sticky;
  top: 58px;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(9, 9, 15, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.pills {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.pills::-webkit-scrollbar { display: none; }
.pill {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: transparent;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--muted);
  transition: all 0.15s ease;
}
.pill:hover { color: var(--text); border-color: var(--border-strong); }
.pill.active {
  background: #eceaf9;
  border-color: #eceaf9;
  color: #0b0b13;
  font-weight: 600;
}
.pill .count {
  font-size: 0.72rem;
  padding: 1px 7px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--faint);
  font-weight: 600;
}
.pill.active .count { background: rgba(11, 11, 19, 0.12); color: rgba(11, 11, 19, 0.65); }

.controls { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-size: 0.875rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track {
  width: 36px;
  height: 21px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--border);
  position: relative;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: #c9c9d8;
  transition: transform 0.18s ease, background 0.18s ease;
}
.toggle input:checked + .toggle-track {
  background: rgba(52, 211, 153, 0.3);
  border-color: rgba(52, 211, 153, 0.5);
}
.toggle input:checked + .toggle-track .toggle-thumb {
  transform: translateX(15px);
  background: var(--green);
}

.select-wrap { position: relative; display: inline-flex; align-items: center; }
.select-wrap select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 8px 32px 8px 13px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}
.select-wrap select:hover { border-color: var(--border-strong); color: var(--text); }
.select-wrap select option { background: #12121c; color: var(--text); }
.select-wrap svg {
  position: absolute;
  right: 11px;
  pointer-events: none;
  color: var(--faint);
}

/* ═══════════════ APP GRID + CARDS ═══════════════ */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  animation: fadeUp 0.5s ease both;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(124, 92, 255, 0.5);
  background: var(--panel-hover);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(124, 92, 255, 0.18), 0 0 34px rgba(124, 92, 255, 0.12);
}

.card-top { display: flex; align-items: flex-start; gap: 13px; }

.app-icon {
  width: 46px;
  height: 46px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-size: 22px;
  background: linear-gradient(135deg, var(--g1), var(--g2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 4px 14px rgba(0, 0, 0, 0.35);
}

.app-head { flex: 1; min-width: 0; }
.app-name-row { display: flex; align-items: center; gap: 7px; }
.app-name {
  font-weight: 650;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.verified {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--a1);
  color: #fff;
}
.verified svg { width: 8.5px; height: 8.5px; }

.badge-new {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(34, 211, 238, 0.14);
  border: 1px solid rgba(34, 211, 238, 0.35);
  color: #67e8f9;
}

.app-users { font-size: 0.8rem; color: var(--faint); margin-top: 2px; display: block; }

.fav-btn {
  flex-shrink: 0;
  align-self: flex-start;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: var(--faint);
  transition: color 0.15s ease, background 0.15s ease, transform 0.1s ease;
}
.fav-btn:hover { color: var(--pink); background: rgba(255, 92, 138, 0.1); transform: scale(1.1); }
.fav-btn.active { color: var(--pink); }
.fav-btn svg { width: 16px; height: 16px; }
.fav-btn.active svg { fill: var(--pink); }

.app-desc {
  font-size: 0.89rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.7em;
}

.app-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--faint);
  padding: 3px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.rating { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; }
.rating .star { color: var(--star); font-size: 0.9rem; }
.rating .reviews { color: var(--faint); font-weight: 400; font-size: 0.8rem; }

.price-badge {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 7px;
}
.price-badge.free { color: var(--green); background: rgba(52, 211, 153, 0.1); border: 1px solid rgba(52, 211, 153, 0.3); }
.price-badge.freemium { color: var(--indigo); background: rgba(141, 123, 255, 0.12); border: 1px solid rgba(141, 123, 255, 0.32); }
.price-badge.paid { color: var(--amber); background: rgba(245, 176, 76, 0.1); border: 1px solid rgba(245, 176, 76, 0.3); }

.open-hint {
  position: absolute;
  right: 16px;
  bottom: 54px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--a2);
  opacity: 0;
  transform: translateX(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
.card:hover .open-hint { opacity: 1; transform: translateX(0); }

/* ── real, on-device apps ── */

.card.real {
  cursor: pointer;
  border-color: rgba(255, 255, 255, 0.14);
}

.card.real::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--c1, #7c5cff), var(--c2, #22d3ee));
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  mask-composite: exclude;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.card.real:hover::after { opacity: 1; }
.card.real:hover { transform: translateY(-3px); }

.real-chip { color: var(--green); font-weight: 600; }

.on-device-badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--green);
  background: rgba(52, 211, 153, 0.1);
  border: 1px solid rgba(52, 211, 153, 0.3);
  padding: 3px 10px;
  border-radius: 99px;
}

.card.real .open-hint { color: var(--text); }

/* ═══════════════ EMPTY STATE ═══════════════ */

.empty {
  text-align: center;
  padding: 70px 20px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  margin-top: 8px;
}
.empty-ico { font-size: 2.4rem; margin-bottom: 14px; }
.empty h3 { font-family: var(--font-display); font-size: 1.2rem; margin-bottom: 6px; }
.empty p { color: var(--muted); font-size: 0.92rem; margin-bottom: 20px; }

/* ═══════════════ CTA ═══════════════ */

.cta {
  position: relative;
  text-align: center;
  padding: 72px 28px;
  border-radius: 22px;
  border: 1px solid rgba(124, 92, 255, 0.3);
  background:
    linear-gradient(rgba(13, 13, 21, 0.6), rgba(13, 13, 21, 0.85)),
    linear-gradient(135deg, rgba(124, 92, 255, 0.35), rgba(34, 211, 238, 0.22));
  overflow: hidden;
}
.cta-glow {
  position: absolute;
  inset: auto 50% -140px 50%;
  transform: translateX(-50%);
  width: 480px;
  height: 240px;
  background: radial-gradient(closest-side, rgba(124, 92, 255, 0.4), transparent);
  pointer-events: none;
}
.cta h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  position: relative;
}
.cta p { color: var(--muted); margin: 12px auto 28px; max-width: 460px; position: relative; }
.cta-actions { display: flex; justify-content: center; gap: 12px; position: relative; }

/* ═══════════════ FOOTER ═══════════════ */

.footer {
  position: relative;
  z-index: 1;
  margin-top: 90px;
  border-top: 1px solid var(--border);
  background: rgba(11, 11, 18, 0.6);
}
.footer-inner {
  max-width: 1220px;
  margin: 0 auto;
  padding: 52px 24px 40px;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 40px;
}
.footer-brand p { color: var(--faint); font-size: 0.9rem; margin-top: 16px; max-width: 300px; }
.footer-col h4 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 16px;
}
.footer-col a {
  display: block;
  font-size: 0.92rem;
  color: var(--muted);
  padding: 5px 0;
  transition: color 0.14s ease;
}
.footer-col a:hover { color: var(--text); }
.footer-base {
  max-width: 1220px;
  margin: 0 auto;
  padding: 20px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  color: var(--faint);
}
.footer-base a { color: var(--muted); }
.footer-base a:hover { color: var(--text); }

/* ═══════════════ ANIMATIONS ═══════════════ */

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

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

/* ═══════════════ RESPONSIVE ═══════════════ */

@media (max-width: 1080px) {
  .trend-strip { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
  .nav-links { display: none; }
  .footer-inner { grid-template-columns: 1fr 1fr; }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 680px) {
  .nav-search { display: none; }
  .hero-inner { padding-top: 36px; padding-bottom: 26px; }
  .searchbar .btn { display: none; }
  .trend-strip { grid-template-columns: repeat(2, 1fr); }
  .toolbar { flex-direction: column; align-items: stretch; }
  .controls { justify-content: space-between; }
  .footer-base { flex-direction: column; text-align: center; }
}

@media (max-width: 460px) {
  .grid { grid-template-columns: 1fr; }
  .trend-strip { grid-template-columns: 1fr; }
}
