/* RESET */
* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: #111;
  color: #fff;
  font-family: Arial, sans-serif;
}

/* ================= NAVBAR ================= */

.navbar {
  background: #000;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;          /* MOBILE FIRST */
  align-items: stretch;
  gap: 10px;
}

/* TOP ROW (TITLE + BUTTON) */
.nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar h1 {
  font-size: 18px;
  margin: 0;
  white-space: nowrap;
}

/* SEARCH */
.navbar input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 4px;
  border: none;
  outline: none;
}

/* GENERATOR BUTTON */
.generator-link {
  padding: 6px 10px;
  background: #e50914;
  color: #fff;
  text-decoration: none;
  border-radius: 6px;
  font-size: 16px;
  white-space: nowrap;
}

.generator-link:hover {
  background: #f6121d;
}

/* ================= CATEGORY ================= */

.category {
  margin: 16px;
}

.category h2 {
  font-size: 18px;
  margin-bottom: 10px;
}

/* ================= ROW ================= */

.row {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

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

/* ================= TILE ================= */

.tile {
  width: 170px;
  flex-shrink: 0;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  background: #000;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.tile:hover {
  transform: scale(1.08);
  box-shadow: 0 10px 30px rgba(0,0,0,0.6);
  z-index: 5;
}

/* POSTER IMAGE */
.tile img {
  width: 100%;
  height: 250px;
  object-fit: cover;
  display: block;
}

/* DARK GRADIENT */
.tile::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0,0,0,0) 55%,
    rgba(0,0,0,0.95) 100%
  );
  z-index: 1;
}

/* TEXT OVERLAY */
.tile-info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 10px;
  z-index: 2;
}

.tile-title {
  font-size: 14px;
  font-weight: bold;
  line-height: 1.2;
}

.tile-meta {
  font-size: 12px;
  opacity: 0.85;
  margin-top: 4px;
}

/* ================= PLAYER MODAL ================= */

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 1000;
}

.modal iframe {
  width: 100%;
  height: 100%;
}

/* ✅ LARGE THUMB-FRIENDLY CLOSE BUTTON */
.close {
  position: absolute;
  bottom: 80px;
  right: 16px;

  width: 44px;
  height: 44px;

  display: flex;
  align-items: center;
  justify-content: center;

  font-size: 26px;
  font-weight: bold;

  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;

  cursor: pointer;
  z-index: 1100;

  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.close:active {
  background: rgba(255,255,255,0.2);
  transform: scale(0.95);
}

/* ================= SERIES PANEL ================= */

.series-panel {
  display: none;
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 1100;
  overflow-y: auto;
}

.series-content {
  padding: 16px;
  max-width: 900px;
  margin: auto;
}

.series-content h2 {
  font-size: 22px;
}

/* ================= EPISODES ================= */

.episode-list {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.episode {
  padding: 14px;
  background: #222;
  border-radius: 8px;
  font-size: 16px;
}

.episode:active {
  background: #333;
}

/* ================= DESKTOP ENHANCEMENTS ================= */

@media (min-width: 768px) {
  .navbar {
    flex-direction: row;
    align-items: center;
  }

  .nav-top {
    gap: 12px;
  }

  .navbar input {
    max-width: 300px;
    margin-left: 12px;
  }

  .tile {
    width: 200px;
  }

  .tile img {
    height: 300px;
  }

  .navbar h1 {
    font-size: 22px;
  }

  .category h2 {
    font-size: 20px;
  }

  /* Smaller close button on desktop */
  .close {
    top: 12px;
    right: 18px;
    bottom: auto;

    width: 36px;
    height: 36px;
    font-size: 22px;
  }

  .close:hover {
    background: rgba(255,255,255,0.25);
  }
}

.category-title {
  cursor: pointer;
}

.category-title:hover {
  text-decoration: underline;
  color: #e50914;
}

/* CATEGORY GRID VIEW */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
}

/* Slightly larger tiles in grid */
.grid .tile {
  width: 100%;
}

/* Desktop grid */
@media (min-width: 768px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  }
}
