/* ============ Githab search — современная тёмная тема ============ */
:root {
  --bg: #070b14;
  --bg-soft: #0b1220;
  --card: rgba(255, 255, 255, 0.035);
  --card-2: rgba(255, 255, 255, 0.055);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8edf6;
  --muted: #8b96a8;
  --accent: #58a6ff;
  --accent-2: #bc8cff;
  --green: #3fb950;
  --star: #e3b341;
  --grad: linear-gradient(135deg, #58a6ff 0%, #bc8cff 100%);
  --radius: 16px;
  --shadow-card: 0 10px 34px rgba(0, 0, 0, 0.45);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  overflow-x: hidden;
}

/* Фоновые свечения */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(110px);
  opacity: 0.16;
  pointer-events: none;
  z-index: 0;
}
.bg-glow-1 { width: 620px; height: 620px; background: #1f6feb; top: -220px; left: -160px; }
.bg-glow-2 { width: 560px; height: 560px; background: #8957e5; top: -140px; right: -180px; }
.bg-glow-3 { width: 640px; height: 640px; background: #116329; bottom: -320px; left: 30%; }

.container {
  width: min(1240px, 100% - 40px);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ============ Шапка ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: rgba(7, 11, 20, 0.72);
  border-bottom: 1px solid var(--border);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 0;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.logo-mark { width: 28px; height: 28px; color: var(--accent); }
.logo-text { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.logo-text em {
  font-style: normal;
  font-weight: 600;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.topbar-note { font-size: 13px; color: var(--muted); }

/* ============ Хиро ============ */
.hero { padding: 56px 0 8px; text-align: center; }
.hero h1 {
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 800;
  letter-spacing: -0.03em;
}
.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-sub {
  margin: 12px auto 28px;
  max-width: 640px;
  color: var(--muted);
  font-size: 15.5px;
}

.search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 760px;
  margin: 0 auto;
  background: rgba(13, 20, 35, 0.75);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 8px 8px 8px 16px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-wrap:focus-within {
  border-color: rgba(88, 166, 255, 0.65);
  box-shadow: 0 0 0 4px rgba(88, 166, 255, 0.13);
}
.search-icon { width: 18px; height: 18px; color: var(--muted); flex: none; }
.search-wrap input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 16px;
  font-family: inherit;
  padding: 10px 4px;
}
.search-wrap input::placeholder { color: #5c6678; }
.btn-clear {
  flex: none;
  width: 30px; height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.btn-clear:hover { background: rgba(255, 255, 255, 0.16); color: var(--text); }
.btn-search {
  flex: none;
  border: none;
  border-radius: 13px;
  padding: 11px 22px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--grad);
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.2s, filter 0.2s;
}
.btn-search:hover { transform: translateY(-1px); box-shadow: 0 8px 22px rgba(88, 166, 255, 0.35); filter: brightness(1.05); }
.btn-search:active { transform: translateY(0); }

.suggestions {
  margin-top: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}
.sug-label { font-size: 13px; color: var(--muted); }
.sug {
  border: 1px solid var(--border);
  background: var(--card);
  color: #b9c4d6;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.18s;
}
.sug:hover { border-color: rgba(88, 166, 255, 0.5); color: #fff; background: rgba(88, 166, 255, 0.1); }

/* ============ Фильтры ============ */
.filters {
  margin: 34px 0 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  backdrop-filter: blur(8px);
}
.filter-label {
  font-size: 12.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}
.period-pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pill {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  color: #aeb9cc;
  font-size: 14px;
  font-family: inherit;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.18s;
}
.pill:hover { color: #fff; border-color: var(--border-strong); }
.pill.active {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(140, 120, 255, 0.35);
}
.custom-range {
  margin-top: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 14px;
}
.range-sep { color: var(--muted); }
.custom-range input[type="date"] {
  background: rgba(13, 20, 35, 0.75);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 7px 10px;
  outline: none;
  color-scheme: dark;
}
.custom-range input[type="date"]:focus { border-color: rgba(88, 166, 255, 0.6); }

.filter-row {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}
.filter-select { display: flex; flex-direction: column; gap: 6px; }
.filter-select > span { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.filter-select select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(13, 20, 35, 0.75)
    url("data:image/svg+xml;charset=UTF-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='%238b96a8'%3E%3Cpath d='M4.427 7.427l3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z'/%3E%3C/svg%3E") no-repeat right 12px center;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 9px 36px 9px 13px;
  min-width: 150px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.18s;
  color-scheme: dark;
}
.filter-select select:hover, .filter-select select:focus { border-color: rgba(88, 166, 255, 0.55); }

/* ============ Статус / ошибки ============ */
.status-row { min-height: 34px; display: flex; align-items: center; }
.result-info { color: var(--muted); font-size: 14px; }
.error {
  margin: 10px 0 18px;
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.4);
  color: #ffb3ad;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 14.5px;
}

/* ============ Сетка карточек ============ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 18px;
  padding-bottom: 20px;
}
.card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: linear-gradient(180deg, var(--card-2), rgba(255, 255, 255, 0.02));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow-card);
  transition: transform 0.18s ease, border-color 0.18s, box-shadow 0.18s;
  animation: cardIn 0.35s ease both;
}
.card:hover {
  transform: translateY(-3px);
  border-color: rgba(88, 166, 255, 0.45);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(88, 166, 255, 0.12);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.card:nth-child(2) { animation-delay: 0.04s; }
.card:nth-child(3) { animation-delay: 0.08s; }
.card:nth-child(4) { animation-delay: 0.12s; }
.card:nth-child(5) { animation-delay: 0.16s; }
.card:nth-child(6) { animation-delay: 0.2s; }

.card-head { display: flex; align-items: flex-start; gap: 12px; }
.avatar {
  width: 42px; height: 42px;
  border-radius: 12px;
  border: 1px solid var(--border-strong);
  background: #10182a;
  flex: none;
}
.card-title { flex: 1; min-width: 0; }
.repo-name {
  display: block;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.repo-name .owner { color: var(--muted); font-weight: 500; }
.repo-name:hover { color: var(--accent); }
.repo-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.archived-badge {
  background: rgba(248, 81, 73, 0.15);
  color: #f8b0ab;
  border-radius: 6px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
}
.gh-link {
  flex: none;
  width: 34px; height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all 0.18s;
}
.gh-link:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); background: rgba(255, 255, 255, 0.06); }
.gh-link svg { width: 17px; height: 17px; }

.desc {
  color: #c3ccdb;
  font-size: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 20px;
}
.desc.none { color: #5c6678; font-style: italic; }

.topics { display: flex; gap: 6px; flex-wrap: wrap; }
.topic {
  font-size: 11.5px;
  color: #9cc8ff;
  background: rgba(88, 166, 255, 0.1);
  border: 1px solid rgba(88, 166, 255, 0.18);
  border-radius: 999px;
  padding: 2px 9px;
}

.stats { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: #aeb9cc; }
.stat { display: inline-flex; align-items: center; gap: 5px; }
.stat svg { width: 14px; height: 14px; }
.stat.stars { color: var(--star); }
.stat.dl { color: var(--green); }
.stat.issues { color: #8b96a8; }
.stat.forks { color: #a7a1ff; }

.card-foot {
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  font-size: 12.5px;
  color: var(--muted);
}
.card-foot .btn-open {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #dbe7ff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  border: 1px solid rgba(88, 166, 255, 0.35);
  background: rgba(88, 166, 255, 0.08);
  padding: 6px 13px;
  border-radius: 10px;
  transition: all 0.18s;
}
.card-foot .btn-open:hover {
  background: var(--grad);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 6px 18px rgba(88, 166, 255, 0.35);
}
.card-foot .btn-open svg { width: 12px; height: 12px; }

/* ============ Заглушки и пустой результат ============ */
.card.skeleton { gap: 14px; }
.sk { border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.11) 50%, rgba(255,255,255,0.05) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
.sk-line { height: 12px; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
}
.empty .big { font-size: 44px; margin-bottom: 12px; }
.empty h3 { color: var(--text); font-size: 19px; margin-bottom: 6px; }

/* ============ Пагинация ============ */
.pagination { display: flex; justify-content: center; gap: 6px; padding: 14px 0 40px; flex-wrap: wrap; }
.page-btn {
  min-width: 38px; height: 38px;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--card);
  color: #aeb9cc;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.16s;
}
.page-btn:hover:not(:disabled):not(.active) { border-color: rgba(88, 166, 255, 0.5); color: #fff; }
.page-btn.active { background: var(--grad); border-color: transparent; color: #fff; font-weight: 700; }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-dots { color: var(--muted); align-self: center; padding: 0 4px; }

/* ============ Подвал ============ */
.footer { border-top: 1px solid var(--border); padding: 22px 0; margin-top: 20px; }
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  color: #5f6a7d;
  font-size: 13px;
}

/* ============ Скроллбар ============ */
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #232c40; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #313d5a; }

/* ============ Адаптив ============ */
@media (max-width: 720px) {
  .container { width: min(1240px, 100% - 24px); }
  .hero { padding-top: 34px; }
  .hero-sub { font-size: 14px; }
  .search-wrap { padding-left: 12px; }
  .btn-search { padding: 10px 16px; }
  .filters { padding: 14px; }
  .grid { grid-template-columns: 1fr; gap: 14px; }
  .filter-select select { min-width: 0; flex: 1; }
  .filter-row { gap: 10px; }
  .filter-select { flex: 1 1 40%; }
  .topbar-note { display: none; }
}
