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

:root {
  --bg: #0a0a0f;
  --bg2: #13131a;
  --bg3: #1c1c26;
  --border: rgba(255,255,255,0.08);
  --border-hover: rgba(255,255,255,0.18);
  --text: #f0f0f5;
  --text-muted: #888899;
  --text-dim: #555566;
  --accent: #7c6fff;
  --accent-glow: rgba(124,111,255,0.3);
  --accent2: #ff6b9d;
  --green: #00d68f;
  --amber: #ffb830;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
}

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Header ── */
.header {
  background: rgba(10,10,15,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
  padding: 1rem 1.5rem 0;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  max-width: 1400px;
  margin: 0 auto 1rem;
  flex-wrap: wrap;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  flex-shrink: 0;
}

.logo-mark {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.logo-text {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 400;
  color: var(--text);
  letter-spacing: -0.5px;
}
.logo-text strong { font-weight: 800; }

/* ── Search ── */
.search-wrap {
  flex: 1;
  display: flex;
  gap: 8px;
  min-width: 200px;
}

.search-wrap input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  font-size: 14px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  transition: border-color 0.2s;
  outline: none;
}

.search-wrap input:focus { border-color: var(--accent); }
.search-wrap input::placeholder { color: var(--text-dim); }

.search-wrap button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: opacity 0.15s;
  white-space: nowrap;
}
.search-wrap button:hover { opacity: 0.88; }

/* ── Submit button ── */
.submit-btn {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 9px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Syne', sans-serif;
  letter-spacing: 0.3px;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.submit-btn:hover { background: var(--accent); color: white; }

/* ── Category pills ── */
.cats-wrap {
  max-width: 1400px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 1rem;
}
.cats-wrap::-webkit-scrollbar { display: none; }

.cats {
  display: flex;
  gap: 8px;
  width: max-content;
}

.cat {
  padding: 5px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 13px;
  cursor: pointer;
  color: var(--text-muted);
  background: transparent;
  font-family: 'Inter', sans-serif;
  transition: all 0.15s;
  white-space: nowrap;
}
.cat:hover { border-color: var(--border-hover); color: var(--text); }
.cat.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ── Main ── */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.results-info {
  font-size: 13px;
  color: var(--text-muted);
}

.sort-select {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 13px;
  padding: 6px 10px;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  outline: none;
}

/* ── Grid ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

/* ── Cards ── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  position: relative;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

.card-logo {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: var(--bg3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
}

.card-name {
  font-family: 'Syne', sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 4px;
}

.card-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 12px;
  flex: 1;
}

/* Stars display */
.stars-display {
  color: var(--amber);
  font-size: 14px;
  letter-spacing: 1px;
}
.stars-count {
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 4px;
}
.rating-row {
  display: flex;
  align-items: center;
  margin-bottom: 8px;
}

/* Interactive star rating */
.rate-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-dim);
  margin-bottom: 5px;
}
.stars-input {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
}
.star-btn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: var(--bg3);
  transition: color 0.1s, transform 0.1s;
  padding: 0;
  line-height: 1;
}
.star-btn.lit { color: var(--amber); }
.star-btn:hover { transform: scale(1.2); color: var(--amber); }

/* Card footer */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.badge {
  font-size: 10px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.3px;
  font-family: 'Syne', sans-serif;
}
.badge-free { background: rgba(0,214,143,0.12); color: var(--green); }
.badge-paid { background: rgba(124,111,255,0.15); color: var(--accent); }
.badge-freemium { background: rgba(255,184,48,0.12); color: var(--amber); }

.card-cat { font-size: 11px; color: var(--text-dim); }

.visit-link {
  font-size: 11px;
  color: var(--text-dim);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 3px;
  transition: color 0.15s;
}
.visit-link:hover { color: var(--accent); }

/* New badge */
.badge-new {
  position: absolute;
  top: 10px;
  right: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.5px;
  font-family: 'Syne', sans-serif;
  text-transform: uppercase;
}

/* ── No results ── */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}
.no-results .icon { font-size: 48px; display: block; margin-bottom: 1rem; }
.no-results h3 { font-family: 'Syne', sans-serif; font-size: 18px; margin-bottom: 8px; }

/* ── Modal ── */
.modal-bg {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  backdrop-filter: blur(6px);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-bg.open { display: flex; }

.modal {
  background: var(--bg2);
  border: 1px solid var(--border-hover);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal h2 {
  font-family: 'Syne', sans-serif;
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 6px;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.field {
  margin-bottom: 1rem;
}
.field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  font-weight: 500;
}
.field input, .field select, .field textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 90px; }

.field-row { display: flex; gap: 12px; }
.field-row .field { flex: 1; }

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 1.5rem;
}

.btn-cancel {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 9px 18px;
  font-size: 13px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
}
.btn-submit {
  background: var(--accent);
  border: none;
  color: white;
  border-radius: var(--radius-sm);
  padding: 9px 22px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  font-family: 'Syne', sans-serif;
  letter-spacing: 0.3px;
  transition: opacity 0.15s;
}
.btn-submit:hover { opacity: 0.88; }

/* ── Toast ── */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent);
  color: white;
  padding: 10px 22px;
  border-radius: var(--radius-pill);
  font-size: 13px;
  font-weight: 500;
  font-family: 'Syne', sans-serif;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ── Responsive ── */
@media (max-width: 640px) {
  .header-inner { flex-wrap: wrap; }
  .search-wrap { order: 3; width: 100%; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
  .field-row { flex-direction: column; }
}
