/* ===== СТИЛИ ГЛАВНОЙ СТРАНИЦЫ — UNLOCK TOOLS
       Современный чистый стиль.
       Поиск в шапке — в правом нижнем углу.
       Сетка карточек — 3 колонки, картинки крупные (21:9). ===== */

/* ===== ШАПКА ===== */
.header {
  display: flex;
  justify-content: space-between;
  gap: 7px;
  margin-bottom: 8px;
  align-items: flex-start;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 4px 8px 46px; /* низ — место под поиск */
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
  position: relative;
  overflow: hidden;
}
.header::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-green), var(--accent), var(--accent-purple));
  z-index: 2;
}

.header-left {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  align-items: flex-start;
  margin-top: 0;
  padding-top: 4px;
}

.header-top-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 0;
  padding-top: 0;
  line-height: 1.2;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  line-height: 1.2;
}
.header-title h1 {
  margin: 0;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* ===== ОПИСАНИЕ САЙТА ===== */
.header-subtitle--hero {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  max-width: 640px;
  padding-left: 0;
  border-left: none;
  margin-top: 4px;
}

.descr-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-green);
  background: var(--accent-green-soft);
  border: 1px solid rgba(52, 199, 138, 0.25);
  border-radius: var(--radius-pill);
  padding: 3px 11px;
}
.descr-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(52, 199, 138, 0.6);
  animation: pulse 1.6s ease-in-out infinite;
}

.descr-title {
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
  letter-spacing: -0.01em;
}
.descr-title em {
  font-style: normal;
  color: var(--accent);
  background: linear-gradient(120deg, var(--accent), var(--accent-purple));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.descr-text {
  font-family: var(--font-ui);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-muted);
}
.descr-text strong {
  color: var(--accent-purple);
  font-weight: 600;
}

/* ================================================================ */

.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  justify-content: flex-start;
  gap: 4px;
  flex-shrink: 0;
  margin-top: 0;
  padding-top: 4px;
  padding-bottom: 0;
}

.header-hero {
  display: flex;
  justify-content: flex-start;
  margin-top: 0;
  transform: translateY(-2px);
}

/* ===== ПОИСК — В ПРАВОМ НИЖНЕМ УГЛУ ШАПКИ ===== */
.header-controls {
  position: absolute;
  right: 8px;
  bottom: 10px;
  left: auto;
  top: auto;
  width: auto;
  max-width: 60%;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  z-index: 5 !important;
}

.term-badge,
.lang-flag,
.term-logo,
.term-slogan {
  line-height: 1.2;
}
.term-slogan {
  margin-top: 0;
  padding-top: 0;
}

/* ===== ПОИСК ===== */
.search-input {
  position: relative;
  flex-basis: 280px;
  flex-grow: 0;
  flex-shrink: 1;
  min-width: 150px;
  max-width: 320px;
}
.search-input input {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
}
.search-input input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(90, 166, 255, 0.16);
}
.search-input input::placeholder {
  color: var(--text-dim);
  font-family: var(--font-ui);
}
.search-input svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 13px;
  height: 13px;
  opacity: 0.45;
  color: var(--text-muted);
}

/* ===== ЛЕЙАУТ ===== */
.layout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

/* ===== САЙДБАР ===== */
.side-filters {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 12px;
}

.side-filters-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.side-filters-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(90, 166, 255, 0.6);
}

.side-filters-hint {
  font-family: var(--font-ui);
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.side-filters-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 4px;
}

.side-filter-btn {
  width: 100%;
  text-align: left;
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-ui);
  font-size: 12.5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  transition: border-color var(--transition), background var(--transition), color var(--transition);
}
.side-filter-btn-main {
  display: flex;
  align-items: center;
  gap: 8px;
}
.side-filter-btn .dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--text-dim);
  transition: background var(--transition);
}
.side-filter-btn small {
  font-size: 11px;
  color: var(--text-dim);
  font-family: var(--font-ui);
}
.side-filter-btn:hover {
  border-color: var(--border);
  background: var(--bg-hover);
  color: var(--text);
}
.side-filter-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.side-filter-btn.active .dot {
  background: var(--accent-green);
  box-shadow: 0 0 8px rgba(52, 199, 138, 0.6);
}

/* ===== СЕТКА МОДЕЛЕЙ ===== */
.models-grid-wrapper {
  flex: 1;
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 14px 16px 18px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}

.models-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  gap: 10px;
  flex-wrap: wrap;
}

.models-header-title {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.models-header-title .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px rgba(90, 166, 255, 0.6);
}

.models-header-meta {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.models-header-meta .divider {
  width: 1px;
  height: 14px;
  background: var(--border);
}

/* Сетка: 3 колонки */
.models-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

/* ===== КАРТОЧКА МОДЕЛИ ===== */
.model-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  background: var(--bg);
  border: 1px solid var(--border);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
  outline: none;
}

.model-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(90, 166, 255, 0.25);
}

.model-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--accent-green), var(--accent));
  opacity: 0;
  transition: opacity var(--transition);
  z-index: 2;
}
.model-card:hover::before {
  opacity: 1;
}

/* Картинка — крупный широкий формат 21:9,
   занимает всю ширину карточки, освободившееся от 3-колоночной
   сетки место (вместо 4 колонок) уходит на изображение. */
.model-image {
  position: relative;
  aspect-ratio: 21 / 9;
  width: 100%;
  overflow: hidden;
  background: var(--bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--border);
}
.model-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0.85;
  padding: 8px;
  transition: opacity var(--transition), transform var(--transition);
  z-index: 1;
}
.model-image .img-fallback {
  display: none;
  width: 40px;
  height: 40px;
  color: var(--text-dim);
  opacity: 0.5;
  position: absolute;
  z-index: 1;
}
.model-image .model-overlay-gradient {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(14,18,32,0.5), transparent 40%);
  z-index: 0;
}

.model-body {
  position: relative;
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 1;
}

.model-title {
  font-family: var(--font-ui);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  line-height: 1.3;
}
.model-title .badge {
  font-family: var(--font-ui);
  font-size: 9px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--bg-alt);
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.model-meta {
  font-family: var(--font-ui);
  font-size: 10.5px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.model-meta-os {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.model-meta-os .os-pill {
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: var(--bg-alt);
  font-size: 9.5px;
  color: var(--accent);
  letter-spacing: 0.02em;
}

.model-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px);
}
.model-card:hover img {
  opacity: 1;
  transform: scale(1.04);
}
.model-card:hover::before {
  opacity: 1;
}

/* ===== ПУСТОЕ СОСТОЯНИЕ ===== */
.empty-state {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 46px 20px;
  text-align: center;
  gap: 10px;
  color: var(--text-muted);
}
.empty-state svg {
  width: 40px;
  height: 40px;
  opacity: 0.3;
}
.empty-state h3 {
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}
.empty-state p {
  font-family: var(--font-ui);
  font-size: 12.5px;
  max-width: 320px;
  line-height: 1.5;
  color: var(--text-dim);
}

/* ===== КНОПКА "ПОКАЗАТИ ЩЕ" ===== */
.load-more-wrapper {
  display: flex;
  justify-content: center;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 14px;
}

.load-more-btn {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 8px 20px;
  cursor: pointer;
  font-weight: 600;
  transition: background var(--transition), box-shadow var(--transition), color var(--transition);
  white-space: nowrap;
}
.load-more-btn:hover {
  background: rgba(90, 166, 255, 0.2);
  box-shadow: 0 4px 14px rgba(90, 166, 255, 0.25);
  color: #8BC8FF;
}
.load-more-btn:focus-visible {
  box-shadow: 0 0 0 3px rgba(90, 166, 255, 0.25);
  outline: none;
}

/* ===== АДАПТИВ =====
   Базовая сетка — 3 колонки.
   3 колонки держим на широких и средних экранах,
   вниз переходим на 2 и 1 колонку. */
@media (max-width: 1180px) {
  .models-grid { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 860px) {
  body { padding: 10px; }
  .header {
    flex-direction: column;
    padding: 4px 8px 50px;
  }
  .header-right { align-items: flex-start; min-width: 0; width: 100%; text-align: left; padding-top: 2px; }
  .header-controls { left: 8px; right: 8px; max-width: none; width: auto; justify-content: stretch; }
  .search-input { flex: 1 1 100%; max-width: none; }
  .header-hero { align-self: flex-end; margin-top: 4px; transform: none; }
  .header-subtitle--hero { max-width: 100%; }
  .layout { flex-direction: column; }
  .side-filters { width: 100%; }
  .models-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}

@media (max-width: 480px) {
  .models-grid { grid-template-columns: 1fr; }
  .header-subtitle { font-size: 11px; }
  .descr-title { font-size: 14px; }
  .models-grid-wrapper { padding: 10px 10px 14px; }
  .load-more-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .header-hero { align-self: center; }
}
