/* === Base Styles === */
body {
  margin: 0;
  background-color: #000;
  font-family: 'Helvetica Neue', sans-serif;
  color: white;
}

/* === Topbar === */
.topbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 1rem;
  padding-bottom: 1rem;
  height: 100px;
  background: url('../img/nav.png') center/cover no-repeat;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

.logo-image {
  height: 100%;
  width: auto;
  display: block;
  object-fit: contain;
  margin: 0;
  padding: 0;
}

/* === Menu === */
.menu {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: flex-end;
}

.menu a {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.6rem 1rem;
  text-shadow:
    -1px -1px 0 #ff2c2c,
     1px -1px 0 #ff2c2c,
    -1px  1px 0 #ff2c2c,
     1px  1px 0 #ff2c2c;
  transition: color 0.2s ease;
  position: relative;
}

.menu a:hover {
  color: #ff6464;
}

.menu a::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  height: 1.8px;
  width: 0%;
  background-color: #ff2c2c;
  transition: width 0.3s ease;
}

.menu a:hover::after {
  width: 100%;
}

/* === Menu Toggle (Mobile) === */
.menu-toggle {
  display: none;
}

.menu-icon {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  padding: 1rem;
}

.menu-icon span {
  width: 28px;
  height: 3px;
  background-color: #fff;
  display: block;
  border-radius: 2px;
}

/* === Search Section === */
.search-container {
  position: relative;
  display: flex;
  align-items: center;
}

/* Input nascosto di default */
.search-input {
  display: none;
  margin-right: 0.5rem;
  padding: 0.5rem 0.8rem;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid #ff2c2c;   /* colore coerente con i tuoi titoli */
  background: rgba(0,0,0,0.6); /* più carico, in linea col tema scuro */
  color: #fff;
  outline: none;
  transition: all 0.3s ease;
}

.search-input::placeholder {
  color: #fff;        /* 🔥 testo placeholder bianco */
  opacity: 0.8;       /* leggermente trasparente per differenziarlo dal testo normale */
}

.search-input.active {
  display: inline-block;
}

/* Pulsante lente minimal */
.search-btn {
  background: none;       /* 🔥 niente sfondo */
  border: none;
  cursor: pointer;
  font-size: 1.4rem;
  color: #ff2c2c;         /* stesso rosso dei tuoi titoli */
  transition: transform 0.2s ease;
}

.search-btn:hover .icon {
  transform: scale(1.2);
  text-shadow: 0 0 6px #ff2c2c;
}

.user-menu {
  position: relative;
  display: inline-block;
}

.user-button {
  font-size: 1.8rem;
  font-weight: 700;
  color: #fff;
  padding: 0.6rem 1rem;
  text-shadow:
    -1px -1px 0 #ff2c2c,
     1px -1px 0 #ff2c2c,
    -1px  1px 0 #ff2c2c,
     1px  1px 0 #ff2c2c;
  text-decoration: none;
  cursor: pointer;
}

.user-button:hover {
  color: #ff6464;
}

.user-dropdown {
  display: none;
  position: absolute;
  right: 0;
  background: rgba(0, 0, 0, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 0.5rem 0;
  z-index: 1000;
  min-width: 180px;
}

/* Riutilizza lo stile dei link del menu */
.user-dropdown a {
  display: block;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.6rem 1rem;
  text-shadow:
    -1px -1px 0 #ff2c2c,
     1px -1px 0 #ff2c2c,
    -1px  1px 0 #ff2c2c,
     1px  1px 0 #ff2c2c;
  transition: color 0.2s ease;
}

.user-dropdown a:hover {
  color: #ff6464;
  background: rgba(255, 255, 255, 0.05);
}

.mobile-only {
  display: none;
}

/* === Hero Section === */
.hero-wrapper {
  min-height: 100vh; /* copre sempre tutta la viewport */
  background-image: url('../img/pic.png');
  background-repeat: repeat;     /* 🔹 ripete in entrambe le direzioni */
  background-position: top left; /* 🔹 punto di partenza */
  background-size: auto;         /* 🔹 nessun ridimensionamento */
}

.hero {
  position: relative;
  min-height: 60vh;
  height: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
  margin-bottom: 2rem;
}

.hero-player-container {
  max-width: 1260px;
  margin: 0 auto;
  padding: 2rem 2rem;
  box-sizing: border-box;
}

.hero-content {
  margin-top: 100px;
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  color: white;
  z-index: 1;
}

.hero-content::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('../img/nav.png') center/cover no-repeat;
  opacity: 0.4; /* 🔥 regola qui la trasparenza */
  z-index: 0;
}

.hero-content > * {
  position: relative;
  z-index: 1; /* il testo resta sopra */
}


.player {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

.player-wrap {
  width: 100%;
  max-width: 960px;   /* stessa larghezza del player */
  margin: 0 auto;     /* centrato */
  display: flex;
  flex-direction: column;
  align-items: stretch;
}

.player video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.player-actions {
  display: flex;
  gap: 0.5rem;
}

.player-actions .emoji {
  font-size: inline-block;
  line-height: 1;
  display: inline-block;
}

.player-actions button:hover {
  transform: scale(1.3);
}

.player-actions .emoji.active {
  display: inline-block;
  font-size: inherit;
  border-radius: 50%;
  color: #ff6464;
  text-shadow:
    0 0 4px #ff6464,
    0 0 8px #ff6464,
    0 0 12px #ff6464,
    0 0 14px #ff6464;
}

.hero-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: 0;
}

.title {
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.6rem 1rem;
  text-shadow:
    -1px -1px 0 #ff2c2c,
     1px -1px 0 #ff2c2c,
    -1px  1px 0 #ff2c2c,
     1px  1px 0 #ff2c2c;
  transition: color 0.2s ease;
  position: relative;
}

.subtitle {
  font-size: 1.2rem;
  margin: 0.5rem 0;
}

.play-btn,
.info-btn {
  margin-right: 1rem;
  padding: 0.6rem 1.2rem;
  font-size: 1rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.play-btn {
  background-color: white;
  color: black;
}

.info-btn {
  background-color: rgba(109, 109, 110, 0.7);
  color: white;
}

.season-bar,
.episode-bar {
  width: 100%;
  box-sizing: border-box;
  margin: 0 auto;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding: 0.5rem;
  border-radius: 6px;

  /* Con venti episodi, dividere lo spazio in venti parti uguali dava
     pulsanti larghi pochi pixel: illeggibili sul telefono e difficili
     da centrare col dito. Ora la barra scorre di lato e ogni pulsante
     tiene una misura minima. Quando gli episodi sono pochi si allargano
     come prima, perche' possono crescere ma non rimpicciolire. */
  overflow-x: auto;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x proximity;
}

.season-bar {
  background: #0077cc; /* blu */
}

.episode-bar {
  background: #009966; /* verde */
}

.season-btn,
.episode-btn {
  flex: 1 0 auto;
  min-width: 3.4rem;
  scroll-snap-align: center;
  margin: 0;
  padding: 0.6rem 0.4rem;
  text-align: center;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  cursor: pointer;
  color: #fff;
  background: rgba(255,255,255,0.15);
  transition: background 0.2s ease;
}

.season-btn.active,
.episode-btn.active {
  background: rgba(255,255,255,0.5);
}

.carousel {
  position: relative;
  padding: 2rem;
  z-index: 1;
  margin-top: 1rem;
}

.carousel h2 {
  font-size: 1.5rem;       /* come .menu a */
  font-weight: 700;
  text-decoration: none;
  text-shadow:
    -1px -1px 0 #ff2c2c,
     1px -1px 0 #ff2c2c,
    -1px  1px 0 #ff2c2c,
     1px  1px 0 #ff2c2c;
  transition: color 0.2s ease;
  position: relative;
}

.carousel::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('../img/nav.png') center/cover no-repeat;
  opacity: 0.8; /* stessa trasparenza della hero */
  z-index: 0;
}

.carousel > * {
  position: relative;
  z-index: 1; /* contenuto sopra overlay */
}

.carousel .row {
  display: flex;
  flex-direction: row;
  gap: 12px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;

  /* Spazio dentro la riga perché il contorno della miniatura
     selezionata abbia dove stare. Un contorno si disegna fuori dal
     bordo, e qui la riga è alta quanto le miniature: senza questo
     margine interno veniva tagliato via dallo scorrimento, e da
     telecomando non si capiva più dove fosse il fuoco. */
  padding: 14px 18px;
  margin: -14px -18px;   /* il margine interno non sposta nulla a video */
}

.carousel .row::-webkit-scrollbar {
  display: none;
}
.carousel .row {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

.thumb {
  position: relative;
  width: 160px;
  height: 90px;
  cursor: pointer;
  flex-shrink: 0;
}

.thumb:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 20px rgba(0,0,0,0.6);
}

.thumb:hover .thumb-img {
  opacity: 0.85; /* 🔹 leggero scurimento */
}

.thumb:hover .thumb-overlay {
  opacity: 1; /* 🔹 appare il titolo all’hover */
}

.thumb-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.thumb-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0,0,0,0.6);
  color: #fff;
  font-size: 12px;
  padding: 4px;
  display: flex;
  justify-content: space-between;
  border-radius: 0 0 6px 6px;
}

.thumb.genre-link {
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  background: rgba(0,0,0,0.6);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.3s ease;
}

.thumb.genre-link:hover {
  background: rgba(255,44,44,0.8); /* 🔹 highlight al passaggio */
}

.thumb-genre-label {
  color: #fff;
  font-size: 1rem;
  text-align: center;
  padding: 0.5rem;
  font-weight: bold;
  text-align: center;
}

.thumb-genre-subtext {
  font-size: 0.85em;
  color: #fff;
  margin-top: 4px;
  text-align: center;
  cursor: pointer;
  transition: color 0.2s ease;
}

.arrow {
  font-weight: bold;
  margin-left: 4px;
}

/* === Login Page === */

/* Contenitore principale */
.container-box {
  max-width: 400px;
  margin: 0 auto;
  padding: 20px;
  background: #111;
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(0,0,0,0.4);
  color: #fff;
}

.login-page {
  margin: 0;
  height: 100vh;
  background: url('../img/pic.png') center/cover no-repeat;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: 'Helvetica Neue', sans-serif;
  color: white;
}

.login-wrapper {
  text-align: center;
  max-width: 400px;
  width: 100%;
  padding: 2rem;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 12px;
  box-shadow: 0 0 20px rgba(255, 44, 44, 0.3);
}

.login-logo {
  width: 300px;
  margin-bottom: 1rem;
}

.login-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 1.5rem;
  text-shadow:
    -1px -1px 0 #ff2c2c,
     1px -1px 0 #ff2c2c,
    -1px  1px 0 #ff2c2c,
     1px  1px 0 #ff2c2c;
}

.form-control {
  width: 100%;
  padding: 0.8rem;
  font-size: 1rem;
  border: none;
  border-radius: 6px;
  margin-bottom: 1rem;
  background: #222;
  color: white;
  box-sizing: border-box;
}

.btn-red {
  background-color: #ff2c2c;
  color: white;
  border: none;
  font-weight: 700;
  font-size: 1.1rem;
  border-radius: 6px;
  cursor: pointer;
}

.btn-red:hover {
  background-color: #ff6464;
}

.extra-links a {
  color: #ff2c2c;
  text-decoration: underline;
}

/* === Responsive Styles === */
@media (max-width: 768px) {
  .topbar {
    position: sticky;
  }

  .desktop-only { display: none !important; }
  .mobile-only { display: block !important; }

  .user-dropdown {
    display: none !important; /* disattivo dropdown su mobile */
  }

  .logo-image {
    width: 160px;
  }

  .menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.95);
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    padding: 2rem 0;
    display: none;
    z-index: 99;
  }

  .menu-toggle:checked + .menu-icon + .menu {
    display: flex;
  }

  .menu-icon {
    display: flex;
  }

  .menu a {
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    padding: 0.6rem 1rem;
    text-shadow:
      -1px -1px 0 #ff2c2c,
       1px -1px 0 #ff2c2c,
      -1px  1px 0 #ff2c2c,
       1px  1px 0 #ff2c2c;
    transition: color 0.2s ease;
    position: relative;
  }

  .login-wrapper {
    max-width: 90%;
    padding: 1.5rem;
    border-radius: 8px;
  }

  .login-logo {
    width: 160px;
    max-width: 80%;
    margin-bottom: 2rem;
    filter: drop-shadow(0 0 8px #ff2c2c);
    transition: transform 0.3s ease;
  }

  .login-title {
    font-size: 1.6rem;
    margin-bottom: 1rem;
  }

  .form-control {
    font-size: 1rem;
    padding: 0.6rem;
  }

  .btn-red {
    font-size: 1rem;
    padding: 0.6rem 0;
  }

  .extra-links p {
    font-size: 0.9rem;
  }
}

/* === Overlay Feedback === */
.overlay-feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  font-size: 2rem;
  font-weight: 600;
  color: white;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.5em 1em;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 999;
}

#overlay-feedback {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.95);
  font-size: 2rem;
  font-weight: 600;
  color: white;
  background: rgba(0, 0, 0, 0.6);
  padding: 0.5em 1em;
  border-radius: 12px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 2147483647;
}

#overlay-feedback.show {
  opacity: 1 !important;
  transform: translate(-50%, -50%) scale(1.05) !important;
  visibility: visible !important;
}

/* === Player Header === */
.player-filename {
  color: #fff;
  font-size: 1.8rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.6rem 1rem;
  text-shadow:
    -1px -1px 0 #ff2c2c,
     1px -1px 0 #ff2c2c,
    -1px  1px 0 #ff2c2c,
     1px  1px 0 #ff2c2c;
  transition: color 0.2s ease;
  position: relative;
}

.player-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  padding: 0 0.5rem;
}

.player-title {
  font-size: 1rem;
  font-weight: 500;
  color: #eee;
}

.player-actions button {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: #eee;
  cursor: pointer;
  margin-left: 0.5rem;
  transition: color 0.2s ease;
}

.player-actions button:hover {
  color: #ff4d4d;
}

.player-actions button.active {
  box-shadow: 0 0 12px 4px rgba(255, 0, 0, 0.6);
  border-radius: 50%;
  transition: box-shadow 0.3s ease;
}

/* === Episode Navigation === */
.plyr-episode-nav {
  display: flex;
  gap: 0.5rem;
}

.plyr-episode-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  color: #eee;
  cursor: pointer;
  transition: color 0.2s ease;
}

.plyr-episode-btn:hover {
  background: #00aaff;
  border-radius: 6px;
}

/* Tablet */
@media (max-width: 1024px) {
  .topbar {
    padding: 0 1rem;
    height: 80px;
  }
  .menu a {
    font-size: 1.2rem;
  }
  .hero {
    height: 50vh;
  }
  .player-actions {
    gap: 0.5rem;
  }
  .player-actions button {
    font-size: 1rem;
    padding: 0.4rem 0.6rem;
  }
}

/* Mobile */
@media (max-width: 768px) {
  /* Topbar */
  .topbar {
    flex-direction: row;
    height: 60px;
  }
  .logo-image {
    width: 120px;
  }
  .menu {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0;
  }
  .menu a {
    font-size: 1rem;
  }

  /* Player */
  .player-wrap {
    width: 100%;
    aspect-ratio: 16/9;
  }
  .player-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }
  .player-filename {
    font-size: 1.2rem;
  }

  /* Overlay */
  #overlay-feedback {
    font-size: 1.4rem;
    padding: 0.4em 0.8em;
  }

  /* Barre stagioni/episodi */
  .season-bar,
  .episode-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    justify-content: flex-start;
    padding: 0.5rem;
  }
  .season-btn,
  .episode-btn {
    /* Crescono se c'e' posto, non si stringono mai sotto la misura di
       un dito: con cinque stagioni riempiono la riga, con venti episodi
       la riga scorre. */
    flex: 1 0 auto;
    min-width: 60px;
    font-size: 0.9rem;
  }

  /* Login */
  .login-wrapper {
    max-width: 90%;
    padding: 1rem;
  }
  .login-title {
    font-size: 1.4rem;
  }

  .player-actions {
    width: 100%;
    display: flex;
    justify-content: space-around; /* pulsanti ben distanziati */
    margin-top: 0.5rem;
  }
  .player-actions button {
    flex: 1;              /* occupano spazio proporzionale */
    max-width: 80px;      /* non diventano troppo larghi */
    font-size: 0.9rem;
    padding: 0.4rem;
  }
  .player-actions .emoji {
    font-size: 1.2rem;    /* emoji leggibili anche su schermi piccoli */
  }
}

/* Mobile piccolo */
@media (max-width: 480px) {
  .menu a {
    font-size: 0.9rem;
  }
  .player-filename {
    font-size: 1rem;
  }
  .season-btn,
  .episode-btn {
    flex: 1 0 auto;
    min-width: 50px;
    font-size: 0.8rem;
    padding: 0.4rem;
  }
  #overlay-feedback {
    font-size: 1.2rem;
  }
  .player-actions button {
    max-width: 60px;
    font-size: 0.8rem;
    padding: 0.3rem;
  }
  .player-actions .emoji {
    font-size: 1rem;
  }
}


/* CATALOGO */
.catalogo-wrapper {
  padding: 2rem;
  background: url('../img/pic.png') repeat;
  min-height: 100vh;
  position: relative;
}

.catalogo-wrapper h1 {
  display: inline-block;
  position: relative;
  color: #fff;
  font-size: 3rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.6rem 1rem;
  text-shadow:
    -1px -1px 0 #ff2c2c,
     1px -1px 0 #ff2c2c,
    -1px  1px 0 #ff2c2c,
     1px  1px 0 #ff2c2c;
  transition: color 0.2s ease;
  z-index: 1;
}

.catalogo-wrapper h1::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: url('../img/nav.png') center/cover no-repeat;
  opacity: 0.8;
  border-radius: 8px;
  z-index: -1;
}


.catalogo-wrapper span {
  font-size: 1rem;
  font-weight: 700;
  text-shadow:
    -1px -1px 0 #ff2c2c,
     1px -1px 0 #ff2c2c,
    -1px  1px 0 #ff2c2c,
     1px  1px 0 #ff2c2c;
  transition: color 0.2s ease;
  position: relative;
}

.catalogo-search-wrapper {
  position: relative;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-radius: 8px;
  overflow: hidden;
  z-index: 1;
}

.catalogo-search-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('../img/nav.png') center/cover no-repeat;
  opacity: 0.6;
  border-radius: 8px;
  z-index: -1;
}


.catalogo-search-wrapper h3 {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.6rem 1rem;
  text-shadow:
    -1px -1px 0 #ff2c2c,
     1px -1px 0 #ff2c2c,
    -1px  1px 0 #ff2c2c,
     1px  1px 0 #ff2c2c;
  transition: color 0.2s ease;
  position: relative;
}

.catalogo-search-wrapper span {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.6rem 1rem;
  text-shadow:
    -1px -1px 0 #ff2c2c,
     1px -1px 0 #ff2c2c,
    -1px  1px 0 #ff2c2c,
     1px  1px 0 #ff2c2c;
  transition: color 0.2s ease;
  position: relative;
}




.catalogo-search {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 1rem 1.5rem;
  align-items: end;
}

.catalogo-search label,
.catalogo-search button {
  width: 100%;
}


.catalogo-search label {
  display: flex;
  flex-direction: column;
  font-size: 0.9rem;
  color: #fff;
}

.catalogo-search input,
.catalogo-search select {
  margin-top: 0.3rem;
  padding: 0.5rem;
  border-radius: 4px;
  border: 1px solid #444;
  background: #111;
  color: #fff;
  width: 100%;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  line-height: 1.2;
}

.btn-search {
  padding: 0.6rem 1.2rem;
  border: none;
  border-radius: 4px;
  background: #e50914;
  color: #fff;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.3s ease;
  width: 100%;
}

.btn-search:hover {
  background: #f6121d;
}

/* Layout mobile/tablet */
@media (max-width: 800px) {
  .catalogo-search {
    grid-template-columns: 1fr;
  }

  .catalogo-search label,
  .catalogo-search button {
    width: 100%;
  }
}

.catalogo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
}

.catalogo-grid {
  position: relative;
  padding: 1.5rem;
  margin-bottom: 2rem;
  border-radius: 8px;
  overflow: hidden;
  z-index: 1;
}

.catalogo-grid a {
  color: #fff;
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  padding: 0.6rem 1rem;
  text-shadow:
    -1px -1px 0 #ff2c2c,
     1px -1px 0 #ff2c2c,
    -1px  1px 0 #ff2c2c,
     1px  1px 0 #ff2c2c;
  transition: color 0.2s ease;
  position: relative;
}

.catalogo-grid::before {
  content: "";
  position: absolute;
  inset: 0;
  background: url('../img/nav.png') center/cover no-repeat;
  opacity: 0.6;
  border-radius: 8px;
  z-index: -1;
}

.card {
  background: #111;
  border-radius: 8px;
  overflow: hidden;
  transition: transform 0.2s ease;
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

.card:hover {
  transform: scale(1.05);
}

.card-image img {
  width: 150px;   /* larghezza fissa */
  height: 200px;  /* altezza fissa */
  object-fit: cover; /* ritaglia l’immagine mantenendo proporzioni */
  display: block;
  margin: 0 auto; /* centra l’immagine */
}


.card-footer {
  padding: 0.5rem;
  color: #ddd;
  background: #1a1a1a;
}

.card-footer h4 {
  margin: 0;
  font-size: 1rem;
  color: #fff;
}

.card-footer p {
  margin: 0.2rem 0;
  font-size: 0.8rem;
  color: #aaa;
}

.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden { display: none; }

.modal-content {
  background: #1a1a1a;
  color: #fff;
  padding: 1rem;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 0.5rem; right: 0.8rem;
  font-size: 1.5rem;
  cursor: pointer;
}

/* Stile base del modale */
#modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#modal.hidden {
  display: none;
}

#modal .modal-content {
  background: #111;
  color: #fff;
  border-radius: 8px;
  max-width: 800px;
  width: 90%;
  max-height: 90%;
  overflow-y: auto;
  padding: 20px;
  box-sizing: border-box;
}

/* Immagini dentro il modale */
#modal img {
  width: 350px;   /* larghezza fissa */
  height: 500px;  /* altezza fissa */
  object-fit: cover; /* ritaglia l’immagine mantenendo proporzioni */
  display: block;
  margin: 0 auto; /* centra l’immagine */
  border-radius: 6px;
  margin-top: 10px;
}

/* Pulsante chiusura */
#modal .close {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  color: #fff;
  cursor: pointer;
}

/* Base primary red button (like the "Cerca" style) */
.btn-primary-watch {
  display: inline-block;
  width: 100%;
  max-width: 280px;
  padding: 12px 18px;
  border: none;
  border-radius: 6px;
  background: #e50914; /* Netflix-style red */
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  text-align: center;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(229, 9, 20, 0.35);
  transition: transform 120ms ease, box-shadow 120ms ease, filter 120ms ease;
}

/* Hover: slightly brighter and lift */
.btn-primary-watch:hover {
  filter: brightness(1.06);
  box-shadow: 0 8px 18px rgba(229, 9, 20, 0.45);
  transform: translateY(-1px);
}

/* Active: press down */
.btn-primary-watch:active {
  transform: translateY(0);
  box-shadow: 0 4px 10px rgba(229, 9, 20, 0.3);
}

/* Focus: visible ring for accessibility */
.btn-primary-watch:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

/* Make it breathe nicely in the modal */
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 16px;

}

@media (max-width: 600px) {
  .btn-primary-watch {
    width: 100%;
    max-width: none;
    padding: 14px 20px;
    font-size: 1.05rem;
    border-radius: 8px;
  }

  .modal-actions {
    flex-direction: column;
    gap: 10px;
  }
}

/* --- Responsive --- */
@media (max-width: 600px) {
  #modal .modal-content {
    width: 95%;
    height: auto;
    max-height: 80%;
    padding: 15px;
    font-size: 0.9rem;
  }

  #modal h2 {
    font-size: 1.2rem;
  }

  #modal p {
    font-size: 0.85rem;
    line-height: 1.3;
  }

  /* La locandina aveva misure fisse — 350x500 — scritte con un selettore
     che comincia per id, quindi vinceva su ogni regola adattiva scritta
     dopo. Su un telefono da 360 px il contenitore ne offre 290: la
     locandina sbordava, e con lei tutta la finestra.

     Qui la si lascia scalare, tenendo la forma da locandina. La regola
     larga resta intatta: sul computer la finestra e' quella di sempre. */
  #modal img {
    width: 100%;
    max-width: 220px;
    height: auto;
    aspect-ratio: 7 / 10;
    object-fit: cover;
    margin-left: auto;
    margin-right: auto;
  }

  #modal .modal-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  #modal .modal-actions button {
    width: 100%;
    padding: 10px;
    font-size: 1rem;
  }
}