/* HB Grid NextGen — Modern Streaming (Netflix-style) */
:root {
  --hb-bg: #020617;
  --hb-surface: #020617;
  --hb-surface-soft: #020617;
  --hb-card: #020617;
  --hb-card-elevated: #020617;
  --hb-accent: #e50914;
  --hb-accent-soft: rgba(229, 9, 20, 0.12);
  --hb-accent-alt: #e50914;
  --hb-text: #f9fafb;
  --hb-sub: #9ca3af;
  --hb-border-soft: #1f2933;
  --hb-chip-bg: #111827;
  --hb-chip-active-bg: #e50914;
  --hb-chip-active-text: #ffffff;
  --hb-radius-lg: 18px;
  --hb-radius-xl: 22px;
  --hb-radius-full: 999px;
  --hb-gap: 1rem;
  --hb-shadow-soft: 0 12px 30px rgba(0,0,0,.55);
  --hb-shadow-hover: 0 18px 45px rgba(0,0,0,.85);
}

/* ROOT WRAPPER */
.hb-tv-grid-wrap {
  margin: 0 auto 2.5rem auto;
  padding: 1.25rem 1rem 0.5rem;
  max-width: 1400px;
  background: radial-gradient(circle at top left, #111827 0, #020617 38%, #020617 100%);
  border-radius: 1.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.75);
  color: var(--hb-text);
  position: relative;
  overflow: hidden;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

/* TOP GRADIENT & DECOR */
.hb-tv-grid-wrap::before {
  content: "";
  position: absolute;
  inset: -40%;
  opacity: 0.45;
  background:
    radial-gradient(circle at top left, rgba(229,9,20,.28) 0, transparent 55%),
    radial-gradient(circle at top right, rgba(148,163,184,.24) 0, transparent 60%),
    radial-gradient(circle at bottom, rgba(15,23,42,.95) 0, rgba(15,23,42,1) 40%, #020617 100%);
  pointer-events: none;
}
.hb-tv-grid-wrap > * {
  position: relative;
  z-index: 1;
}

/* HEADER */
.hb-tv-grid-header {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  margin-bottom: 1.1rem;
}

.hb-title {
  margin: 0;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 800;
  color: #f9fafb;
}

.hb-title::after {
  content: "";
  display: block;
  width: 44px;
  height: 3px;
  margin-top: 0.4rem;
  border-radius: 999px;
  background: linear-gradient(90deg, #e50914, #f97316);
}

/* CONTROLS ROW */
.hb-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}

/* SEARCH BAR */
.hb-search {
  all: unset;
}

.hb-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 210px;
  max-width: 360px;
  padding: 0.55rem 0.9rem 0.55rem 2.25rem;
  border-radius: 999px;
  background: radial-gradient(circle at top left, rgba(15,23,42,.8) 0, rgba(15,23,42,.95) 50%);
  border: 1px solid rgba(148,163,184,.45);
  box-shadow: 0 8px 20px rgba(15,23,42,.75);
}

.hb-search-wrap:focus-within {
  border-color: rgba(248,250,252,.9);
  box-shadow: 0 0 0 1px rgba(248,250,252,.75), 0 18px 45px rgba(0,0,0,.9);
}

.hb-search-icon {
  position: absolute;
  left: 0.85rem;
  font-size: 0.9rem;
  opacity: 0.72;
}

.hb-search-input,
.hb-search {
  width: 100%;
  font-size: 0.92rem;
  color: var(--hb-text);
}

.hb-search-input::placeholder,
.hb-search::placeholder {
  color: rgba(148,163,184,.85);
}

/* CATEGORY CHIPS */
.hb-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding-bottom: 0.15rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,.5) transparent;
}
.hb-chips::-webkit-scrollbar {
  height: 4px;
}
.hb-chips::-webkit-scrollbar-track {
  background: transparent;
}
.hb-chips::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,.5);
  border-radius: 999px;
}

.hb-chip {
  flex: 0 0 auto;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.4rem 0.9rem;
  border-radius: 999px;
  background: rgba(15,23,42,.95);
  border: 1px solid rgba(30,64,175,.5);
  color: rgba(209,213,219,.9);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition:
    background 160ms ease,
    color 160ms ease,
    border-color 160ms ease,
    transform 120ms ease,
    box-shadow 160ms ease;
}
.hb-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(248,250,252,.85);
  color: #f9fafb;
}
.hb-chip.is-active {
  background: linear-gradient(135deg,#e50914,#f97316);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 10px 25px rgba(0,0,0,.75);
}

/* GRID LAYOUT */
.hb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(165px, 1fr));
  gap: 1rem;
  margin: 0.35rem -0.1rem 0.75rem;
  padding: 0.1rem 0.1rem 0.9rem;
}

/* CARD BASE */
.hb-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  border-radius: 1.15rem;
  background: transparent;
  overflow: hidden;
  transform-origin: center bottom;
  transition:
    transform 160ms ease-out,
    box-shadow 180ms ease-out,
    filter 160ms ease-out;
}

.hb-card:hover {
  transform: translateY(-6px) scale(1.02);
  box-shadow: var(--hb-shadow-hover);
  z-index: 5;
}

/* ASPECT RATIOS */
.hb-ratio-16x9,
.hb-ratio-4x3,
.hb-ratio-1x1 {
  --hb-card-ratio-padding: 56.25%;
}
.hb-ratio-4x3 { --hb-card-ratio-padding: 75%; }
.hb-ratio-1x1 { --hb-card-ratio-padding: 100%; }

/* THUMBNAIL */
.hb-thumb {
  position: relative;
  display: block;
  width: 100%;
  padding-bottom: var(--hb-card-ratio-padding);
  border-radius: 1.15rem;
  overflow: hidden;
  background: #020617;
  box-shadow: 0 12px 32px rgba(0,0,0,.8);
}

.hb-thumb-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  transform: scale(1.02);
  transition:
    transform 260ms ease-out,
    filter 230ms ease-out,
    opacity 220ms ease-out;
}

.hb-card:hover .hb-thumb-bg {
  transform: scale(1.08);
  filter: saturate(1.2) contrast(1.08) brightness(1.08);
}

/* OVERLAY LAYER */
.hb-thumb-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    180deg,
    rgba(15,23,42,0) 18%,
    rgba(15,23,42,.65) 55%,
    rgba(15,23,42,.95) 100%
  );
  opacity: 0;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 0.6rem 0.7rem;
  transition: opacity 180ms ease-out;
}

.hb-card:hover .hb-thumb-overlay {
  opacity: 1;
}

/* PLAY ICON */
.hb-play-icon {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-right: 0.5rem;
  font-size: 0.9rem;
  background: rgba(15,23,42,.9);
  border: 1px solid rgba(248,250,252,.8);
  color: #f9fafb;
  box-shadow: 0 10px 25px rgba(0,0,0,.85);
}

.hb-thumb-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(249,250,251,.9);
}

/* LIVE DOT */
.hb-live-dot {
  position: absolute;
  top: 0.55rem;
  left: 0.7rem;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 0 5px rgba(239,68,68,.3);
}

/* CARD INFO */
.hb-info {
  padding: 0.25rem 0.15rem 0.2rem;
}

.hb-card-title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e5e7eb;
  line-height: 1.3;
}
.hb-card-title a {
  color: inherit;
  text-decoration: none;
}
.hb-card-title a:hover {
  text-decoration: underline;
}

/* BADGES UNDER TITLE */
.hb-badges {
  margin-top: 0.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.hb-badge {
  font-size: 0.7rem;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  background: rgba(15,23,42,.95);
  border: 1px solid rgba(148,163,184,.55);
  color: rgba(209,213,219,.92);
  text-decoration: none;
  line-height: 1.2;
}
.hb-badge:hover {
  border-color: rgba(248,250,252,.9);
}

/* META LINE */
.hb-meta {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: var(--hb-sub);
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.hb-sep {
  opacity: 0.65;
}

/* EMPTY STATE */
.hb-empty {
  padding: 0.9rem;
  font-size: 0.9rem;
  color: rgba(248,250,252,.86);
}

/* RESPONSIVE TWEAKS */
@media (max-width: 639px) {
  .hb-tv-grid-wrap {
    border-radius: 0;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-inline: 1rem;
  }
  .hb-title {
    font-size: 1.25rem;
  }
  .hb-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
  }
}

@media (min-width: 640px) and (max-width: 899px) {
  .hb-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (min-width: 900px) and (max-width: 1199px) {
  .hb-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 1200px) {
  .hb-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}