/* ==========================================================================
   MEGAFILMES 4K — design system
   Ported from the original AzulPlay /base (Tailwind v4 + oklch).
   Dark theme with blue accent.
   ========================================================================== */

:root {
  --background: oklch(0.14 0.02 260);
  --foreground: oklch(0.98 0.005 250);
  --card: oklch(0.19 0.025 260);
  --card-foreground: oklch(0.98 0.005 250);
  --primary: oklch(0.62 0.19 254);
  --primary-foreground: oklch(0.99 0.005 250);
  --primary-glow: oklch(0.72 0.17 250);
  --secondary: oklch(0.24 0.03 260);
  --secondary-foreground: oklch(0.98 0.005 250);
  --muted: oklch(0.24 0.03 260);
  --muted-foreground: oklch(0.72 0.02 260);
  --accent: oklch(0.55 0.2 258);
  --accent-foreground: oklch(0.99 0.005 250);
  --destructive: oklch(0.6 0.22 27);
  --destructive-foreground: oklch(0.99 0.005 250);
  --border: oklch(0.28 0.03 260);
  --input: oklch(0.24 0.03 260);
  --ring: oklch(0.62 0.19 254);

  --gradient-primary: linear-gradient(135deg, var(--primary), var(--primary-glow));
  --gradient-hero: linear-gradient(
    180deg,
    transparent 0%,
    oklch(0.14 0.02 260 / 0.4) 50%,
    oklch(0.14 0.02 260) 100%
  );
  --shadow-glow: 0 10px 40px -10px oklch(0.62 0.19 254 / 0.5);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  background-color: var(--background);
  color: var(--foreground);
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input,
select {
  font-family: inherit;
  color: var(--foreground);
}

::selection {
  background: var(--primary);
  color: var(--primary-foreground);
}

/* ---------- Layout helpers ---------- */
.container {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding-inline: 1rem;
}

@media (min-width: 768px) {
  .container {
    padding-inline: 2rem;
  }
}

/* ---------- Navbar ---------- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: oklch(0.14 0.02 260 / 0.7);
  border-bottom: 1px solid var(--border);
}

.navbar-inner {
  height: 3.5rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.brand {
  font-size: 1.25rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand-grad {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-sol {
  color: var(--foreground);
}

.brand-badge {
  font-size: 0.6rem;
  font-weight: 800;
  vertical-align: super;
  margin-left: 2px;
  color: var(--primary);
}

.nav-links {
  display: none;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
}

@media (min-width: 768px) {
  .nav-links {
    display: flex;
    gap: 0.5rem;
  }
}

.nav-link {
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  color: var(--muted-foreground);
  transition: color 0.15s;
}

.nav-link:hover {
  color: var(--foreground);
}

.nav-link.active {
  color: var(--foreground);
  background: var(--secondary);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: 0.375rem;
  font-weight: 600;
  font-size: 0.9375rem;
  transition: transform 0.15s, background 0.15s, color 0.15s;
}

.btn-primary {
  background: var(--gradient-primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-glow);
}

.btn-primary:hover {
  transform: scale(1.05);
}

.btn-ghost {
  background: oklch(0.24 0.03 260 / 0.8);
  color: var(--foreground);
}

.btn-ghost:hover {
  background: var(--secondary);
}

.btn-sm {
  padding: 0.375rem 1.25rem;
  font-size: 0.875rem;
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  width: 100%;
  height: 70vh;
  overflow: hidden;
  background: var(--background);
}

@media (min-width: 768px) {
  .hero {
    height: 85vh;
  }
}

.hero-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: var(--gradient-hero);
}

.hero-left {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to right, var(--background), oklch(0.14 0.02 260 / 0.6), transparent);
}

.hero-content {
  position: relative;
  z-index: 10;
  height: 100%;
  max-width: 80rem;
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 5rem 1rem 0;
}

@media (min-width: 768px) {
  .hero-content {
    padding: 8rem 2rem 0;
  }
}

.hero-box {
  max-width: 42rem;
}

.hero-kicker {
  color: var(--primary);
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.hero-title {
  font-size: 1.875rem;
  font-weight: 900;
  margin-bottom: 1rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

@media (min-width: 768px) {
  .hero-title {
    font-size: 3.75rem;
  }
}

.hero-desc {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.85);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 36rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
  .hero-desc {
    font-size: 1rem;
  }
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.hero-loading {
  height: 70vh;
  background: var(--secondary);
  animation: pulse 1.6s ease-in-out infinite;
}

@media (min-width: 768px) {
  .hero-loading {
    height: 85vh;
  }
}

@keyframes hero-fade-out {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.hero-fade-out {
  animation-name: hero-fade-out;
  animation-timing-function: ease-in-out;
  animation-fill-mode: forwards;
}

/* ---------- Rows ---------- */
.row {
  margin-top: 2rem;
}

@media (min-width: 768px) {
  .row {
    margin-top: 2.5rem;
  }
}

.row-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.row-title {
  font-size: 1.125rem;
  font-weight: 600;
}

@media (min-width: 768px) {
  .row-title {
    font-size: 1.25rem;
  }
}

.row-seeall {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--primary);
  flex-shrink: 0;
}

.row-seeall:hover {
  text-decoration: underline;
}

@media (min-width: 768px) {
  .row-seeall {
    font-size: 0.875rem;
  }
}

.row-body {
  position: relative;
  display: block;
}

.row-track {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.row-track::-webkit-scrollbar {
  display: none;
}

@media (min-width: 768px) {
  .row-track {
    gap: 1rem;
  }
}

.row-arrow {
  position: absolute;
  top: 0;
  bottom: 2rem;
  z-index: 10;
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  color: var(--foreground);
  opacity: 0;
  transition: opacity 0.2s;
}

.row:hover .row-arrow {
  opacity: 1;
}

@media (min-width: 768px) {
  .row-arrow {
    display: flex;
  }
}

.row-arrow.bg-left {
  left: 0;
  background: linear-gradient(to right, var(--background), transparent);
}

.row-arrow.bg-right {
  right: 0;
  background: linear-gradient(to left, var(--background), transparent);
}

/* ---------- Poster card ---------- */
.card {
  display: block;
  width: 180px;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .card {
    width: calc((100% - 4rem) / 5);
  }
}

.card-thumb {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 0.375rem;
  overflow: hidden;
  background: var(--secondary);
  box-shadow: inset 0 0 0 1px var(--border);
  transition: transform 0.3s, box-shadow 0.3s;
}

.group:hover .card-thumb {
  box-shadow: inset 0 0 0 1px var(--primary), var(--shadow-glow);
  transform: scale(1.04);
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted-foreground);
  padding: 0.5rem;
}

.card-rating {
  position: absolute;
  top: 0.375rem;
  right: 0.375rem;
  font-size: 0.625rem;
  font-weight: 700;
  padding: 0.125rem 0.375rem;
  border-radius: 0.25rem;
  background: oklch(0.14 0.02 260 / 0.8);
  backdrop-filter: blur(4px);
  color: var(--primary);
}

.card-meta {
  margin-top: 0.5rem;
  padding-inline: 0.125rem;
}

.card-title {
  font-size: 0.875rem;
  color: rgba(255, 255, 255, 0.9);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

.card-year {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}

/* Channel card inside rows/grids */
.ch-card {
  display: block;
  width: 200px;
  flex-shrink: 0;
}

@media (min-width: 768px) {
  .ch-card {
    width: calc((100% - 4rem) / 5);
  }
}

.ch-frame {
  aspect-ratio: 16/9;
  border-radius: 0.375rem;
  background: var(--card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.group:hover .ch-frame {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.ch-logo {
  max-width: 80%;
  max-height: 80%;
  object-fit: contain;
}

.ch-name {
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- Skeleton ---------- */
.skeleton {
  width: 180px;
  flex-shrink: 0;
  aspect-ratio: 2 / 3;
  border-radius: 0.375rem;
  background: var(--secondary);
  animation: pulse 1.6s ease-in-out infinite;
}

@media (min-width: 768px) {
  .skeleton {
    width: 240px;
  }
}

.skeleton-video {
  width: 200px;
  aspect-ratio: 16/9;
}

@media (min-width: 768px) {
  .skeleton-video {
    width: 260px;
  }
}

.skeleton-grid {
  aspect-ratio: 2 / 3;
  border-radius: 0.375rem;
  background: var(--secondary);
  animation: pulse 1.6s ease-in-out infinite;
  width: 100%;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ---------- Grid pages (filmes / series) ---------- */
.page-head {
  padding-top: 2rem;
}

.page-title {
  font-size: 1.875rem;
  font-weight: 900;
}

@media (min-width: 768px) {
  .page-title {
    font-size: 2.25rem;
  }
}

.page-sub {
  color: var(--muted-foreground);
  font-size: 0.875rem;
  margin-top: 0.25rem;
}

.page-ctrl {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.select,
.search {
  background: var(--secondary);
  border: 1px solid var(--border);
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  outline: none;
}

.select {
  max-width: 100%;
}

.search {
  width: 12rem;
}

.select:focus-visible,
.search:focus-visible {
  box-shadow: 0 0 0 2px var(--ring);
}

.grid {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.grid-2 {
  grid-template-columns: repeat(2, 1fr);
}

@media (min-width: 640px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

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

@media (min-width: 1024px) {
  .grid-6 {
    grid-template-columns: repeat(6, 1fr);
  }
}

.grid .card {
  width: 100%;
}

.empty {
  grid-column: 1 / -1;
  color: var(--muted-foreground);
  font-size: 0.875rem;
}

/* ---------- TV page ---------- */
.cats {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.cats::-webkit-scrollbar {
  display: none;
}

.cat-pill {
  flex-shrink: 0;
  padding: 0.375rem 0.75rem;
  border-radius: 999px;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  color: var(--muted-foreground);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.cat-pill:hover {
  color: var(--foreground);
}

.cat-pill.on {
  border-color: var(--primary);
  color: var(--primary-foreground);
  background: var(--gradient-primary);
}

.tv-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, 1fr);
  margin-top: 1.5rem;
}

@media (min-width: 640px) {
  .tv-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 768px) {
  .tv-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 1024px) {
  .tv-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}

.tv-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.tv-tile:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-glow);
}

.tv-frame {
  width: 100%;
  aspect-ratio: 16/9;
  border-radius: 0.25rem;
  background: var(--background);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.tv-frame img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.tv-tile-name {
  font-size: 0.75rem;
  text-align: center;
  color: rgba(255, 255, 255, 0.9);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.375rem;
  flex-wrap: wrap;
  margin-top: 2rem;
  margin-bottom: 1rem;
}

.page-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  border: 1px solid var(--border);
  background: oklch(0.24 0.03 260 / 0.6);
  color: var(--foreground);
  min-width: 2.25rem;
  justify-content: center;
}

.page-btn:hover {
  background: var(--secondary);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-btn.current {
  border-color: var(--primary);
  color: var(--primary-foreground);
  background: var(--gradient-primary);
}

.page-gap {
  color: var(--muted-foreground);
  padding-inline: 0.25rem;
}

/* ---------- Detail / player ---------- */
.detail-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image: var(--bg-bd);
  background-size: cover;
  background-position: center;
  filter: blur(16px);
  transform: scale(1.08);
}
.detail-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(0,0,0,.55), rgba(0,0,0,.55)),
    linear-gradient(to bottom, transparent 55%, var(--background) 100%);
}
@media (max-width: 767px) {
  .detail-bg {
    background-image: var(--bg-poster, var(--bg-bd));
  }
}
.detail-backdrop {
  position: relative;
}
.detail-inner {
  position: relative;
  padding-top: 8rem;
  padding-bottom: 2rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 1.5rem;
  transition: color 0.15s;
}

.back-link:hover {
  color: var(--foreground);
}

.detail-title {
  font-size: 1.875rem;
  font-weight: 900;
  margin-bottom: 0.75rem;
}

@media (min-width: 768px) {
  .detail-title {
    font-size: 3rem;
  }
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin-bottom: 1rem;
}

.detail-meta .star {
  color: var(--primary);
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.detail-meta .sp {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
}

.detail-overview {
  color: rgba(255, 255, 255, 0.85);
  max-width: 48rem;
  line-height: 1.6;
}

/* player */
.player-wrap {
  width: 100%;
  max-width: 1440px;
  margin-inline: auto;
  padding: 0 1rem 4rem;
}

@media (min-width: 768px) {
  .player-wrap {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

.player-head {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.player-frame {
  aspect-ratio: 16 / 9;
  min-height: 280px;
  width: 100%;
  max-width: 80rem;
  margin-inline: auto;
  background: #000;
}

@media (min-width: 768px) {
  .player-frame {
    min-height: 640px;
  }
}

.ip {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #000;
}

.player-poster-btn {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.player-poster-btn img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.7), rgba(0, 0, 0, 0.2) 50%, rgba(0, 0, 0, 0.4));
}

.play-badge {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.play-badge span {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  border-radius: 999px;
  background: oklch(0.62 0.19 254 / 0.9);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-glow);
}

.play-badge .icon {
  width: 2rem;
  height: 2rem;
  margin-left: 0.25rem;
}

.episodes-grid {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

@media (min-width: 768px) {
  .episodes-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.ep-btn {
  display: flex;
  gap: 0.75rem;
  padding: 0.5rem;
  border-radius: 0.375rem;
  text-align: left;
  background: var(--background);
  box-shadow: inset 0 0 0 1px var(--border);
  transition: background 0.15s, box-shadow 0.15s;
}

.ep-btn:hover {
  background: var(--secondary);
}

.ep-btn.on {
  box-shadow: inset 0 0 0 1px var(--primary);
  background: var(--secondary);
}

.ep-thumb {
  width: 6rem;
  flex-shrink: 0;
  aspect-ratio: 16/9;
  border-radius: 0.25rem;
  overflow: hidden;
  background: var(--background);
}

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

.ep-title {
  font-size: 0.875rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ep-ov {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.125rem;
}

.player-empty {
  padding: 2rem 1rem;
  color: var(--muted-foreground);
}

/* ---------- Suggestion modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: oklch(0.14 0.02 260 / 0.8);
  backdrop-filter: blur(4px);
  animation: fadeIn 0.3s;
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 42rem;
  overflow: hidden;
  border-radius: 0.75rem;
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  animation: zoomIn 0.4s;
}

.modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 10;
  padding: 0.5rem;
  border-radius: 999px;
  background: oklch(0.14 0.02 260 / 0.6);
  color: var(--foreground);
  transition: background 0.15s;
}

.modal-close:hover {
  background: oklch(0.14 0.02 260 / 0.9);
}

.modal-media {
  position: relative;
  aspect-ratio: 16/9;
  width: 100%;
}

.modal-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.modal-media .shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--card), var(--card) 30%, transparent);
}

.modal-body {
  padding: 1.5rem;
  margin-top: -4rem;
  position: relative;
}

.modal-kicker {
  color: var(--primary);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.modal-title {
  font-size: 1.5rem;
  font-weight: 900;
  margin-bottom: 0.75rem;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

@media (min-width: 768px) {
  .modal-title {
    font-size: 1.875rem;
  }
}

.modal-overview {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 1.25rem;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes zoomIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(0.25rem);
  }
  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 4rem;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-align: center;
}

/* ---------- Utility ---------- */
.mb-06 {
  margin-bottom: 1.5rem;
}

.pb-16 {
  padding-bottom: 4rem;
}

.mt-2 {
  margin-top: 0.5rem;
}

.loading-msg {
  padding: 2rem 1rem;
  color: var(--muted-foreground);
}

/* ---------- Navbar right-side (search icon + hamburger) ---------- */
.nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.nav-search-btn,
.nav-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.375rem;
  color: var(--muted-foreground);
  transition: color 0.15s, background 0.15s;
}

.nav-search-btn:hover,
.nav-toggle:hover {
  color: var(--foreground);
  background: var(--secondary);
}

@media (min-width: 768px) {
  .nav-toggle {
    display: none;
  }
}

/* ---------- Off-canvas drawer (mobile) ---------- */
.drawer-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: oklch(0.14 0.02 260 / 0.6);
  backdrop-filter: blur(2px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 91;
  width: min(300px, 80vw);
  height: 100%;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.4);
  transform: translateX(100%);
  transition: transform 0.3s ease;
  display: flex;
  flex-direction: column;
  padding: 1.5rem;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}

.drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.375rem;
  color: var(--muted-foreground);
  transition: color 0.15s, background 0.15s;
}

.drawer-close:hover {
  color: var(--foreground);
  background: var(--secondary);
}

.drawer-links {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.drawer-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--muted-foreground);
  transition: color 0.15s, background 0.15s;
}

.drawer-link:hover {
  color: var(--foreground);
  background: var(--secondary);
}

.drawer-link.active {
  color: var(--foreground);
  background: var(--secondary);
}

.drawer-link svg {
  color: var(--primary);
}

/* ---------- Home search button ---------- */
.home-search {
  display: flex;
  justify-content: center;
}

.home-search-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 0.875rem 2rem;
  border-radius: 0.5rem;
  font-size: 1rem;
  font-weight: 600;
  background: var(--gradient-primary);
  color: var(--primary-foreground);
  box-shadow: var(--shadow-glow);
  transition: transform 0.15s, box-shadow 0.15s;
  width: 100%;
  max-width: 480px;
}

.home-search-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 0 24px var(--primary);
}

@media (min-width: 768px) {
  .home-search-btn {
    font-size: 1.125rem;
    padding: 1rem 2.5rem;
  }
}

/* ---------- Search modal ---------- */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 4rem 1rem 1rem;
  background: oklch(0.14 0.02 260 / 0.85);
  backdrop-filter: blur(6px);
  animation: fadeIn 0.2s;
  overflow-y: auto;
}

.search-modal {
  width: 100%;
  max-width: 800px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: zoomIn 0.25s;
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1rem 0;
}

.search-modal-input {
  flex: 1;
  padding: 0.625rem 0.75rem;
  border-radius: 0.375rem;
  border: 1px solid var(--border);
  background: var(--background);
  color: var(--foreground);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}

.search-modal-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px oklch(from var(--primary) l c h / 0.2);
}

.search-modal-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.375rem;
  color: var(--muted-foreground);
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.search-modal-close:hover {
  color: var(--foreground);
  background: var(--secondary);
}

.type-chips {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1rem 0;
  flex-wrap: wrap;
}

.type-chip {
  padding: 0.375rem 1rem;
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 600;
  background: var(--secondary);
  color: var(--muted-foreground);
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.type-chip:hover {
  color: var(--foreground);
}

.type-chip.on {
  background: oklch(from var(--primary) l c h / 0.15);
  color: var(--primary);
  border-color: var(--primary);
}

.search-body {
  padding: 1rem;
  min-height: 120px;
}

.search-spinner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  color: var(--muted-foreground);
  font-size: 0.9375rem;
}

.search-spinner::before {
  content: "";
  width: 1.5rem;
  height: 1.5rem;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.search-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--muted-foreground);
  font-size: 0.9375rem;
}

.search-group-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin: 1rem 0 0.5rem;
  padding-left: 0.125rem;
}

.search-results .card {
  width: 100%;
}

.search-results .tv-tile {
  width: 100%;
}