/* ============================================
   Search Overlay (V03) — bar расширяется вправо
   из своей позиции в шапке (левый край фиксирован),
   панель опускается ниже с тем же левым краем.
   Порт из `Бэкдор сайт/shared/search-overlay.css`.
   CSS-переменные адаптированы под нашу base.css.
   ============================================ */

/* Backdrop */
.bd-search-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 12, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease-out;
}
body.bd-search-open .bd-search-backdrop {
  opacity: 1;
  pointer-events: auto;
}

/* Hide original header search when overlay is open */
body.bd-search-open .site-header .h-search {
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s;
}

/* Morphing search bar */
.bd-search-bar {
  position: fixed;
  top: var(--bd-bar-top, 16px);
  left: var(--bd-bar-left, 145px);
  width: var(--bd-bar-width, 260px);
  height: var(--bd-bar-height, 40px);
  z-index: 102;
  display: flex; align-items: center;
  gap: 12px;
  padding: 0 14px;
  background: rgba(255,255,255,0.025);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
  border-top-color: rgba(255,255,255,0.12);
  border-radius: 11px;
  font-size: 14px;
  color: var(--text-muted);
  pointer-events: none;
  opacity: 0;
  transition:
    opacity .12s,
    width .35s cubic-bezier(0.22, 1, 0.36, 1),
    background .25s,
    border-color .25s;
}
body.bd-search-open .bd-search-bar {
  opacity: 1;
  pointer-events: auto;
  width: var(--bd-overlay-width, 1200px);
  background: rgba(74, 124, 255, 0.08);
  border-color: rgba(74, 124, 255, 0.3);
  border-top-color: rgba(74, 124, 255, 0.5);
}
.bd-search-bar svg.ic {
  width: 18px; height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
  stroke: currentColor; fill: none; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round;
}
.bd-search-bar input {
  flex: 1;
  min-width: 0;
  background: none;
  border: none; outline: none;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 0;
}
.bd-search-bar input::placeholder { color: var(--text-muted); }

/* Clear × */
.bd-search-bar .bd-clear {
  width: 28px; height: 28px;
  flex-shrink: 0;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  color: var(--text-muted);
  display: none;
  align-items: center; justify-content: center;
  cursor: pointer;
  transition: color .15s, background .15s;
  padding: 0;
}
.bd-search-bar.has-text .bd-clear { display: flex; }
.bd-search-bar .bd-clear:hover { color: var(--text); background: rgba(255,255,255,0.12); }
.bd-search-bar .bd-clear svg { width: 12px; height: 12px; }

/* Panel */
.bd-search-panel {
  position: fixed;
  top: calc(var(--bd-bar-top, 16px) + var(--bd-bar-height, 40px) + 12px);
  left: var(--bd-bar-left, 145px);
  width: var(--bd-overlay-width, 1200px);
  max-height: 70vh;
  z-index: 101;
  background: #1a2238;
  border: 1px solid rgba(255,255,255,0.08);
  border-top-color: rgba(255,255,255,0.18);
  border-radius: 18px;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
  display: flex; flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  clip-path: inset(0 0 100% 0);
  transform: translateY(-12px);
  transition:
    opacity .25s ease-out .25s,
    clip-path .35s cubic-bezier(0.22, 1, 0.36, 1) .25s,
    transform .35s cubic-bezier(0.22, 1, 0.36, 1) .25s;
}
body.bd-search-open .bd-search-panel {
  opacity: 1;
  pointer-events: auto;
  clip-path: inset(0 0 0 0);
  transform: translateY(0);
}

.bd-search-body {
  padding: 8px 18px 22px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.15) transparent;
}
.bd-search-body::-webkit-scrollbar { width: 8px; }
.bd-search-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 4px; }
.bd-search-body::-webkit-scrollbar-track { background: transparent; }

.bd-h {
  display: flex; align-items: center; gap: 10px;
  font-size: 18px; font-weight: 700;
  color: var(--text);
  margin: 18px 0 12px;
  letter-spacing: -0.01em;
}
.bd-h:first-child { margin-top: 10px; }
.bd-h-ct {
  font-size: 12px; font-weight: 700;
  color: #6b94ff;
  background: rgba(74,124,255,0.14);
  border-radius: 6px;
  padding: 3px 9px;
}
.bd-count {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.bd-count b { color: var(--text); font-weight: 700; }

/* Recent rows */
.bd-rec { display: flex; flex-direction: column; }
.bd-rec-row {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 15px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: background .12s;
}
.bd-rec-row:hover { background: rgba(74,124,255,0.10); }
.bd-rec-row .ic {
  width: 18px; height: 18px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.bd-rec-row .ic svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bd-rec-row .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bd-rec-row .arr {
  color: var(--text-muted);
  flex-shrink: 0;
}
.bd-rec-row .arr svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* Trending grid */
.bd-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
.bd-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: transform .15s;
  position: relative;
}
.bd-card:hover { transform: translateY(-2px); }
.bd-card .cv {
  position: relative;
  aspect-ratio: 4/5;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background-size: cover; background-position: center;
  margin-bottom: 8px;
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.bd-card:hover .cv { border-color: rgba(212,175,106,0.6); box-shadow: 0 8px 20px rgba(212,175,106,0.18); }
.bd-card-type {
  position: absolute;
  top: 8px; left: 8px;
  padding: 3px 7px;
  border-radius: 5px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
  backdrop-filter: blur(6px);
  z-index: 2;
  line-height: 1;
}
.bd-card-type.addon { background: rgba(122,93,255,0.85); }
.bd-card-type.sub   { background: rgba(245,197,24,0.85); color: #1a1408; }
.bd-card-type.card  { background: rgba(94,212,163,0.85); color: #08130d; }

/* ===== Subscription cover (зеркалит cart.css/.search.css .sc-* стили) ===== */
.bd-sub-cover {
  position: absolute; inset: 0;
  border-radius: 10px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
  container-type: inline-size;
}
.bd-sub-cover::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
}
.bd-sub-num {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; line-height: 0.78;
  user-select: none; pointer-events: none; z-index: 1;
  font-size: clamp(72px, 90cqw, 200px);
  letter-spacing: -0.08em;
  color: transparent;
  -webkit-text-fill-color: transparent;
  -webkit-background-clip: text;
  background-clip: text;
}
.bd-sub-num.single { font-size: clamp(96px, 120cqw, 240px); letter-spacing: -0.03em; }
.bd-sub-cnt {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.bd-sub-pslogo { height: clamp(14px, 14cqw, 32px); max-width: 80%; object-fit: contain; display: block; }
.bd-sub-ealogo { width: clamp(28px, 24cqw, 56px); height: auto; display: block; }
.bd-sub-tier {
  font-size: clamp(11px, 12cqw, 22px); font-weight: 900; line-height: 1;
  letter-spacing: 0.03em; text-transform: uppercase;
}
.bd-sub-ealabel {
  font-family: 'Geist', sans-serif;
  font-weight: 900; font-size: clamp(14px, 16cqw, 26px);
  letter-spacing: -0.02em; line-height: 1; color: #fff;
}

/* Essential — серый */
.bd-sub-cover.sc-essential { background: #c0c0c6; }
.bd-sub-cover.sc-essential::before {
  background:
    radial-gradient(ellipse 70% 80% at 30% 20%, rgba(255,255,255,0.35) 0%, transparent 60%),
    radial-gradient(ellipse 60% 70% at 75% 80%, rgba(160,160,175,0.5) 0%, transparent 55%),
    radial-gradient(ellipse 90% 60% at 50% 50%, rgba(220,220,228,0.3) 0%, transparent 70%),
    linear-gradient(155deg, #d6d6dc 0%, #b5b5be 40%, #a0a0ac 70%, #c0c0c8 100%);
}
.bd-sub-cover.sc-essential .bd-sub-num {
  background: linear-gradient(180deg, #ebebf0 0%, #6d6d78 100%);
  -webkit-background-clip: text; background-clip: text;
}
.bd-sub-cover.sc-essential .bd-sub-tier { color: #1a1a20; }

/* Extra — золотой */
.bd-sub-cover.sc-extra { background: #c9a035; }
.bd-sub-cover.sc-extra::before {
  background:
    radial-gradient(ellipse 65% 75% at 25% 25%, rgba(255,230,140,0.45) 0%, transparent 55%),
    radial-gradient(ellipse 55% 65% at 80% 75%, rgba(160,120,20,0.4) 0%, transparent 50%),
    radial-gradient(ellipse 80% 50% at 50% 50%, rgba(230,195,80,0.25) 0%, transparent 65%),
    linear-gradient(155deg, #e2c560 0%, #caa530 35%, #a88520 65%, #dbb845 100%);
}
.bd-sub-cover.sc-extra .bd-sub-num {
  background: linear-gradient(180deg, #f4da80 0%, #5c4510 100%);
  -webkit-background-clip: text; background-clip: text;
}
.bd-sub-cover.sc-extra .bd-sub-tier { color: #000; }

/* Deluxe — чёрный с золотом */
.bd-sub-cover.sc-deluxe { background: #000; --accent: #f5c518; }
.bd-sub-cover.sc-deluxe::before {
  background:
    radial-gradient(ellipse 60% 65% at 35% 30%, rgba(200,170,100,0.18) 0%, transparent 55%),
    radial-gradient(ellipse 50% 55% at 70% 70%, rgba(255,255,255,0.06) 0%, transparent 50%),
    radial-gradient(ellipse 80% 50% at 50% 50%, rgba(200,170,100,0.05) 0%, transparent 65%),
    linear-gradient(155deg, #0e0e0e 0%, #050505 40%, #000 70%, #0a0a0a 100%);
}
.bd-sub-cover.sc-deluxe .bd-sub-num {
  background: linear-gradient(180deg, #d6b85a 0%, #000 100%);
  -webkit-background-clip: text; background-clip: text;
}
.bd-sub-cover.sc-deluxe .bd-sub-tier { color: var(--accent); }
.bd-sub-cover.sc-deluxe .bd-sub-pswrap {
  position: relative; display: inline-block;
  height: clamp(14px, 14cqw, 32px); line-height: 0;
}
.bd-sub-cover.sc-deluxe .bd-sub-tinted {
  height: 100%; width: auto; display: block;
  clip-path: inset(0 0 0 25.5%);
  filter: brightness(0) saturate(100%) invert(78%) sepia(68%) saturate(2000%) hue-rotate(358deg) brightness(105%) contrast(101%);
}
.bd-sub-cover.sc-deluxe .bd-sub-crest {
  position: absolute; left: 0; top: 0; height: 100%; width: auto; display: block;
}

/* EA Play — тёмно-синий с красным */
.bd-sub-cover.sc-ea_play { background: #1a1a3e; --accent: #ff4654; }
.bd-sub-cover.sc-ea_play::before {
  background:
    radial-gradient(ellipse 55% 65% at 80% 15%, rgba(220,50,80,0.3) 0%, transparent 55%),
    radial-gradient(ellipse 45% 50% at 90% 40%, rgba(180,40,100,0.2) 0%, transparent 50%),
    radial-gradient(ellipse 50% 60% at 15% 85%, rgba(40,40,120,0.35) 0%, transparent 55%),
    linear-gradient(155deg, #22224a 0%, #1a1a40 30%, #14142e 60%, #1e1e48 100%);
}
.bd-sub-cover.sc-ea_play .bd-sub-num {
  background: linear-gradient(180deg, #4c4c8c 0%, #0d0d24 100%);
  -webkit-background-clip: text; background-clip: text;
}
.bd-card .pr-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.bd-card .pr {
  font-size: 14px; font-weight: 800;
  font-feature-settings: "tnum";
}
.bd-card .disc {
  padding: 2px 6px;
  background: #4a7cff;
  color: #fff;
  border-radius: 4px;
  font-size: 10px; font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1;
}
.bd-card .nm {
  font-size: 13px; font-weight: 600;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.bd-card .nm mark {
  background: rgba(232,196,126,0.22);
  color: #e8c47e;
  padding: 0 2px;
  border-radius: 3px;
}
.bd-card .ed {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Loading skeleton */
.bd-loading {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}
.bd-loading .sk {
  aspect-ratio: 4/5;
  border-radius: 10px;
  background: linear-gradient(110deg, rgba(255,255,255,0.04) 30%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 70%);
  background-size: 200% 100%;
  animation: bdShimmer 1.4s linear infinite;
}
@keyframes bdShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* Empty state */
.bd-empty {
  text-align: center;
  padding: 56px 16px;
}
.bd-empty-ic {
  width: 72px; height: 72px;
  border-radius: 18px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.bd-empty-ic svg { width: 32px; height: 32px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.bd-empty-ttl {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.bd-empty-sub {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 380px;
  margin: 0 auto;
  line-height: 1.5;
}

/* Responsive */
@media (max-width: 1280px) { .bd-grid, .bd-loading { grid-template-columns: repeat(5, 1fr); } }
@media (max-width: 1024px) { .bd-grid, .bd-loading { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 760px) {
  body.bd-search-open .bd-search-bar { width: calc(100vw - var(--bd-bar-left, 16px) - 16px); }
  .bd-search-panel { width: calc(100vw - var(--bd-bar-left, 16px) - 16px); }
  .bd-grid, .bd-loading { grid-template-columns: repeat(3, 1fr); gap: 10px; }
  .bd-h { font-size: 16px; }
}
