/* ============================================================
   K - search.css  (search page + top searches)
   ============================================================ */

.search-page {
  padding: calc(var(--nav-h-lg) + 5vh) 16px 8vh;
}

.search-input-wrap {
  position: relative;
  max-width: 600px;
  margin-bottom: 4vh;
}

.search-page-input {
  width: 100%;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  color: var(--text);
  font-size: clamp(16px, 1.6vw, 24px);
  font-weight: 600;
  padding: 14px 44px 14px 16px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-page-input::placeholder {
  color: var(--text-mid);
  font-weight: 400;
}

.search-page-input:focus {
  border-color: rgba(220, 38, 38, 0.4);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.search-page-clear {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-mid);
  padding: 6px;
}

.search-section-title {
  font-family: var(--font-display);
  font-size: clamp(16px, 1.3vw, 20px);
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-section-title::before {
  content: "";
  width: 3px;
  height: 18px;
  background: var(--primary);
  border-radius: 2px;
}

/* Top Searches */
.top-searches {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top-search-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.top-search-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.top-search-row:focus-visible {
  background: rgba(255, 255, 255, 0.06);
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.top-search-rank {
  font-size: clamp(16px, 1.6vw, 24px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-mid);
  width: 36px;
  text-align: center;
  flex-shrink: 0;
}

.top-search-thumb {
  position: relative;
  flex: 0 0 120px;
  aspect-ratio: 16 / 9;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-2);
}

.top-search-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.top-search-thumb .ts-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  color: var(--text);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.top-search-row:hover .ts-play {
  opacity: 1;
}

.top-search-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

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

.result-card {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-1);
  border: 1px solid var(--border-subtle);
  aspect-ratio: 16 / 9;
  transition: border-color 0.25s ease;
}

.result-card:hover {
  border-color: rgba(220, 38, 38, 0.25);
}

.result-card:focus-visible {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary);
}

.result-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.35s ease;
}

.result-card:hover img {
  transform: scale(1.05);
}

.result-card .rc-body {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 20px 12px 10px;
  background: linear-gradient(180deg, transparent 0%, rgba(5, 7, 10, 0.85) 60%);
}

.result-card .rc-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.result-card .rc-type {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(11, 15, 20, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-mid);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.result-card .rc-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  background: rgba(0, 0, 0, 0.35);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.result-card:hover .rc-play {
  opacity: 1;
}

.search-none {
  color: var(--text-mid);
  font-size: 15px;
  padding: 3vh 0;
  line-height: 1.6;
}

mark.hl {
  background: rgba(220, 38, 38, 0.35);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

@media (max-width: 480px) {
  .search-results {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}
