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

body {
  background: #141414;
  color: #fff;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.6;
  font-size: 20px;
}
body.tv {
  zoom: 80%;
}
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.9) 0%,
    rgba(0, 0, 0, 0.7) 70%,
    transparent 100%
  );
  backdrop-filter: blur(10px);
  padding: 1rem 4%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  transition: background 0.3s ease;
}

header.scrolled {
  background: rgba(0, 0, 0, 0.95);
}

.logo {
  font-size: 2rem;
  font-weight: bold;
  color: #2a09e5;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
}

.header-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
  justify-content: flex-end;
}

.search-container {
  position: relative;
  flex: 0 1 350px;
}

#search {
  padding: 12px 20px;
  font-size: 1rem;
  width: 100%;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 25px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  transition: all 0.3s ease;
  outline: none;
}

#search:focus {
  border-color: #2a09e5;
  box-shadow: 0 0 20px rgba(229, 9, 20, 0.3);
  transform: scale(1.02);
}

#search::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

/* CORS Selector Dropdown */
.cors-selector {
  position: relative;
}

.cors-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
  display: block;
}

#cors-select {
  padding: 10px 35px 10px 15px;
  font-size: 0.95rem;
  min-width: 180px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  cursor: pointer;
  transition: all 0.3s ease;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23fff' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

#cors-select:hover {
  border-color: #2a09e5;
  background-color: rgba(0, 0, 0, 0.85);
}

#cors-select:focus {
  border-color: #2a09e5;
  box-shadow: 0 0 15px rgba(229, 9, 20, 0.3);
}

#cors-select option {
  background: #1a1a1a;
  color: #fff;
  padding: 10px;
}

main {
  margin-top: 80px;
}

.hero {
  height: 70vh;
  background: linear-gradient(45deg, #2a09e5, #2f07b2);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-bottom: 3rem;
  background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><defs><pattern id="grain" width="100" height="100" patternUnits="userSpaceOnUse"><circle cx="25" cy="25" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="75" cy="75" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="50" cy="10" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="10" cy="60" r="1" fill="rgba(255,255,255,0.1)"/><circle cx="90" cy="40" r="1" fill="rgba(255,255,255,0.1)"/></pattern></defs><rect width="100" height="100" fill="url(%23grain)"/></svg>');
}

.hero-content h1 {
  font-size: 4rem;
  margin-bottom: 1rem;
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
}

.hero-content p {
  font-size: 1.5rem;
  opacity: 0.9;
  max-width: 600px;
  margin: 0 auto;
}

section {
  margin: 3rem 0;
}

section h2 {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  padding-left: 4%;
  color: #fff;
  position: relative;
}

section h2::before {
  content: "";
  position: absolute;
  left: 4%;
  bottom: -5px;
  width: 60px;
  height: 3px;
  background: #2a09e5;
}

.carousel-container {
  width: 80% !important; /* Forza il container ad essere più stretto */
  max-width: 80% !important;
  margin: 0 auto !important;
  overflow: hidden !important;
  position: relative !important;
}

/* Carosello stesso - DEVE essere più largo del container */
.carousel {
  display: flex !important;
  width: max-content !important; /* IMPORTANTE: lascia che si espanda */
  min-width: max-content !important;
  gap: 20px !important;
  padding: 10px 0 !important;
  transition: transform 0.3s ease !important;
}

.carousel {
  display: flex;
  overflow-x: auto;
  gap: 1rem;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
  padding: 0 50px;
}

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

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  z-index: 10;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(5px);
}

.carousel-btn:hover {
  background: rgba(35, 9, 229, 0.9);
  transform: translateY(-50%) scale(1.1);
  box-shadow: 0 4px 15px rgba(46, 9, 229, 0.49);
}

.carousel-btn.prev {
  left: 5px;
}

.carousel-btn.next {
  right: 5px;
}

.carousel-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.carousel-btn:disabled:hover {
  background: rgba(0, 0, 0, 0.8);
  transform: translateY(-50%) scale(1);
  box-shadow: none;
}

.card {
    width: 100%;
  min-width: auto;
  margin-bottom: 10px;
  min-width: 200px;
  cursor: pointer;
  transition: all 0.3s ease;
  scroll-snap-align: start;
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.card:hover {
  transform: scale(1.08) translateY(-10px);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
  z-index: 10;
}

.card.clicked {
  animation: cardClick 0.6s ease-out;
}

@keyframes cardClick {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.95);
  }
  100% {
    transform: scale(1);
  }
}

.card img {
  width: 100%;
  height: 300px;
  object-fit: cover;
  display: block;
  border-radius: 12px;
}

.card-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.95));
  padding: 2rem 1rem 1rem;
  font-weight: 600;
  text-align: center;
}

#home {
  display: block;
}

#results {
  display: none;
  padding: 2rem 0;
}

#player {
  display: none;
  padding: 2rem 4%;
}

.player-header {
  margin-bottom: 2rem;
}

.back-btn {
  position: absolute;
  top: 80px;
  left: 20px;
  z-index: 1000;
  background: rgba(229, 9, 20, 0.9);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
}

.back-btn:hover {
  background: #2a09e5;
  transform: translateX(-5px);
  box-shadow: 0 4px 15px rgba(229, 9, 20, 0.4);
}

.player-info {
  margin-bottom: 2rem;
}

.player-info h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: #fff;
}

.meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  font-size: 0.95rem;
  opacity: 0.8;
}

.overview {
  line-height: 1.8;
  opacity: 0.9;
  max-width: 900px;
}

.player-content {
  display: grid;
  grid-template-columns: 1fr 350px;
  gap: 2rem;
  align-items: start;
}

.video-container {
  position: relative;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

/* Episode Selection Warning */
.select-episode-warning {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    135deg,
    rgba(20, 20, 20, 0.95),
    rgba(10, 10, 10, 0.95)
  );
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 15;
  border-radius: 12px;
  padding: 2rem;
  text-align: center;
}

.select-episode-warning .icon {
  font-size: 5rem;
  margin-bottom: 1.5rem;
  color: #2a09e5;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.7;
    transform: scale(1.1);
  }
}

.select-episode-warning h3 {
  font-size: 1.8rem;
  margin-bottom: 0.5rem;
  color: #fff;
}

.select-episode-warning p {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.7);
}

.video-js {
  width: 100%;
  height: auto;
  aspect-ratio: 16/9;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.vjs-theme-cinesearch {
  --vjs-theme-cinesearch--primary: #2a09e5;
  --vjs-theme-cinesearch--secondary: #0715b2;
}

.video-js .vjs-big-play-button {
  background-color: rgba(9, 35, 229, 0.9);
  border: 3px solid #fff;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  line-height: 74px;
  font-size: 3em;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  transition: all 0.3s ease;
}

.video-js .vjs-big-play-button:hover {
  background-color: #2a09e5;
  transform: translate(-50%, -50%) scale(1.1);
  box-shadow: 0 0 30px rgba(9, 35, 229, 0.9);
}

.video-js .vjs-control-bar {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
  backdrop-filter: blur(10px);
  height: 4em;
  padding: 0 1em;
}

.video-js .vjs-progress-control .vjs-progress-holder {
  height: 0.5em;
  margin: 0;
}

.video-js .vjs-play-progress {
  background-color: #2a09e5;
}

.video-js .vjs-play-progress:before {
  color: #2a09e5;
  font-size: 1.2em;
  top: -0.4em;
}

.video-js .vjs-load-progress {
  background: rgba(255, 255, 255, 0.3);
}

.video-js .vjs-slider {
  background-color: rgba(255, 255, 255, 0.2);
}

.video-js .vjs-volume-level {
  background-color: #2a09e5;
}

.video-js:hover .vjs-control-bar {
  opacity: 1;
}

.video-js .vjs-button > .vjs-icon-placeholder:before {
  line-height: 2.2;
}

.video-js .vjs-menu-button .vjs-menu .vjs-menu-content {
  background-color: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.video-js .vjs-menu li.vjs-menu-item {
  padding: 0.8em 1em;
  font-size: 1em;
  transition: all 0.2s ease;
}

.video-js .vjs-menu li.vjs-menu-item:hover,
.video-js .vjs-menu li.vjs-menu-item:focus {
  background-color: rgba(229, 9, 20, 0.3);
}

.video-js .vjs-menu li.vjs-selected,
.video-js .vjs-menu li.vjs-selected:hover,
.video-js .vjs-menu li.vjs-selected:focus {
  background-color: rgba(229, 9, 20, 0.5);
  color: #fff;
}

.vjs-quality-selector .vjs-menu-button {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-weight: 600;
}

.episode-selector {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 1.5rem;
  backdrop-filter: blur(10px);
  height: fit-content;
}

.episode-selector h3 {
  margin-bottom: 1rem;
  color: #2a09e5;
}

.season-selector {
  margin-bottom: 4rem;
}

.season-selector label {
  display: block;
  margin-bottom: 2rem;
  font-weight: 600;
}

.season-selector select {
  width: 100%;
  padding: 10px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  outline: none;
  transition: border-color 0.3s ease;
}

.season-selector select:focus {
  border-color: #2a09e5;
}

.episodes-list {
  max-height: 400px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #2a09e5 transparent;
}

.episode-item {
  padding: 12px;
  margin-bottom: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
}

.episode-item:hover {
  background: rgba(229, 9, 20, 0.2);
  border-color: #2a09e5;
}

.episode-item.active {
  background: rgba(229, 9, 20, 0.3);
  border-color: #2a09e5;
}

.episode-number {
  font-weight: bold;
  color: #2a09e5;
  margin-bottom: 4px;
}

.episode-title {
  font-size: 0.9rem;
  opacity: 0.9;
}

.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 25;
  border-radius: 12px;
}

.loading {
  display: inline-block;
  width: 50px;
  height: 50px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #2a09e5;
  animation: spin 1s ease-in-out infinite;
  margin-bottom: 1rem;
}

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

.loading-text {
  color: #fff;
  font-size: 1rem;
  opacity: 0.9;
}

.error-message {
  background: rgba(229, 9, 20, 0.2);
  border: 2px solid #2a09e5;
  color: #fff;
  padding: 1.5rem;
  border-radius: 8px;
  margin: 1rem;
  text-align: center;
}

.error-message h3 {
  margin-bottom: 0.5rem;
}

@media (max-width: 768px) {
  .player-content {
    grid-template-columns: 1fr;
  }

  .hero-content h1 {
    font-size: 2.5rem;
  }

  .header-controls {
    flex-wrap: wrap;
  }

  .search-container {
    flex: 1 1 200px;
  }

  .cors-selector {
    flex: 0 1 auto;
  }

  #cors-select {
    min-width: 150px;
  }

  .card {
    min-width: 150px;
  }
}

.episodes-list::-webkit-scrollbar {
  width: 8px;
}

.episodes-list::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.episodes-list::-webkit-scrollbar-thumb {
  background: #2a09e5;
  border-radius: 4px;
}

.episodes-list::-webkit-scrollbar-thumb:hover {
  background: #0715b2;
}

.resume-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(229, 9, 20, 0.9);
  color: white;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: bold;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
  line-height: 1.3;
  text-align: left;
}

.card .remove-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  background: #2a09e5;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}

.fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: gold;
  color: black;
  border: none;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
}

.carousel-wrapper {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  padding: 0 60px !important; /* Spazio per le frecce */
}
.carousel-container {
  overflow-x: auto;
  scroll-behavior: smooth;
  white-space: nowrap;
  flex: 1;
}

.carousel {
  display: inline-flex;
  gap: 12px;
}

.arrow {
  background: rgba(0, 0, 0, 0.6);
  color: white;
  border: none;
  font-size: 1.5rem;
  padding: 8px 12px;
  cursor: pointer;
  z-index: 10;
  border-radius: 50%;
  margin: 0 6px;
}

.arrow:hover {
  background: rgba(0, 0, 0, 0.8);
}

.hero {
  padding: 100px 20px 60px;
  background: linear-gradient(to right, #141e30, #243b55);
  color: white;
  text-align: center;
}

.hero-content {
  max-width: 800px;
  margin: 0 auto;
}

.titolo-hero {
  font-size: 2.5rem;
  margin-top: 60px;
  margin-bottom: 20px;
  color: #ffffff;
  text-shadow: 0 2px 4px rgba(0,0,0,0.6);
}

.sottotitolo-hero {
  font-size: 1.2rem;
  margin-bottom: 40px;
  color: #dddddd;
}

.vix-carousel {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
  padding: 20px 0;
}

.vix-container {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  gap: 12px;
  flex: 1;
}

.vix-container::-webkit-scrollbar {
  display: none;
}
.vix-container {
  scrollbar-width: none;
}

.vix-arrow {
  background-color: #2a09e5;
  color: white;
  border: none;
  font-size: 2rem;
  padding: 8px 12px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.vix-arrow:hover {
  background-color: #c40812;
}

.vix-arrow.sinistra {
  margin-left: 10px;
}

.vix-arrow.destra {
  margin-right: 10px;
}

/* Ottimizzazioni per Smart TV */
@media screen and (min-width: 1600px) {
  body {
    zoom: 100%;
    font-size: 28px;
  }

  header {
    padding: 2rem 6%;
  }

  .logo {
    font-size: 3rem;
  }

  .header-controls {
    gap: 2rem;
  }

  #search {
    font-size: 1.5rem;
    padding: 16px 24px;
  }

  #cors-select {
    font-size: 1.2rem;
    padding: 14px 40px 14px 20px;
    min-width: 240px;
  }

  .hero-content h1,
  .titolo-hero {
    font-size: 4rem;
  }

  .sottotitolo-hero {
    font-size: 1.8rem;
  }

  .backup-tools input[type="text"],
  .backup-tools button {
    font-size: 1.3rem;
    padding: 14px 20px;
  }

  .card {
    min-width: 280px;
  }

  .card img {
    height: 400px;
  }

  .resume-badge,
  .remove-btn,
  .fav-btn {
    font-size: 1.1rem;
    padding: 10px 16px;
  }

  .carousel,
  .vix-container {
    gap: 20px;
  }
}

/* Smart TV layout senza zoom eccessivo */
@media screen and (min-width: 1600px) {
  html, body {
    zoom: 80%;
    font-size: 24px;
    overflow-x: hidden;
  }

  main,
  header,
  .hero,
  .player-content,
  .carousel-container,
  .vix-container {
    max-width: 1600px;
    margin: 0 auto;
    padding-left: 40px;
    padding-right: 40px;
  }

  .card {
    min-width: 240px;
  }

  .hero-content h1,
  .titolo-hero {
    font-size: 3.5rem;
  }

  .sottotitolo-hero {
    font-size: 1.6rem;
  }

  .player-info h1 {
    font-size: 3rem;
  }

  .overview {
    font-size: 1.2rem;
  }

  .arrow,
  .vix-arrow {
    font-size: 2rem;
    padding: 10px 14px;
  }

  .resume-badge,
  .remove-btn,
  .fav-btn {
    font-size: 1rem;
    padding: 8px 14px;
  }

  .video-js .vjs-big-play-button {
    width: 80px;
    height: 80px;
    font-size: 2.5em;
  }

  .video-js .vjs-control-bar {
    height: 4em;
    font-size: 1.1rem;
  }
}

.card {
  flex: 0 0 auto !important; /* Non si ridimensiona */
  width: 220px !important; /* Larghezza fissa aumentata */
  min-width: 220px !important;
  max-width: 220px !important;
}

.card-image-wrapper {
  position: relative;
  width: 100%;
  height: 270px;
  overflow: hidden;
}

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

.card-title-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  background: linear-gradient(to top, rgba(0,0,0,0.8), transparent);
  color: white;
  font-size: 0.85rem;
  font-weight: bold;
  padding: 6px 8px;
  box-sizing: border-box;
  text-shadow: 0 1px 2px black;
  white-space: pre-line;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 2.6em;
  line-height: 1.3;
}

.resume-badge {
  position: absolute;
  bottom: 40px;
  left: 10px;
  background: rgba(229, 9, 20, 0.9);
  color: white;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.7rem;
  font-weight: bold;
  z-index: 5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  line-height: 1.2;
  text-align: left;
  max-width: 90%;
}

.card-content {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-meta {
  font-size: 0.8rem;
  color: #ccc;
  display: flex;
  flex-direction: column;
  gap: 4px;
  word-break: break-word;
}

.card-buttons {
  display: flex;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
}

.card-buttons button {
  padding: 4px 6px;
  font-size: 0.8rem;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background-color: transparent;
  color: white;
}

.remove-btn {
  color: #2a09e5;
}

.fav-btn {
  color: #ffcc00;
}

/* Stili per le categorie */
.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
  padding: 0 4%;
  margin-top: 2rem;
}

.category-card {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  border-radius: 12px;
  padding: 2rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid transparent;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.category-card:hover {
  transform: translateY(-5px) scale(1.05);
  border-color: #2a09e5;
  box-shadow: 0 8px 25px rgba(42, 9, 229, 0.3);
}

.category-icon {
  font-size: 3rem;
  margin-bottom: 1rem;
}

.category-name {
  font-size: 1.2rem;
  font-weight: bold;
  color: #fff;
}

/* Pulsanti di navigazione */
.navigation-buttons {
  margin: 2rem auto;
  max-width: 1200px;
}

.nav-btn {
  background: linear-gradient(135deg, #2a09e5, #1a0566);
  color: white;
  border: none;
  padding: 1rem 2rem;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(42, 9, 229, 0.3);
  min-width: 200px;
}

.nav-btn:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 8px 25px rgba(42, 9, 229, 0.5);
  background: linear-gradient(135deg, #1a0566, #2a09e5);
}

/* Pulsante "Carica più" */
.load-more-container {
  text-align: center;
  margin-top: 2rem;
  padding: 0 4%;
}

.load-more-btn {
  background: linear-gradient(135deg, #2a09e5, #1a0566);
  color: white;
  border: none;
  padding: 1rem 2.5rem;
  font-size: 1.1rem;
  font-weight: bold;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(42, 9, 229, 0.3);
}

.load-more-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(42, 9, 229, 0.5);
  background: linear-gradient(135deg, #1a0566, #2a09e5);
}

/* Header per le categorie */
.category-header {
  margin-bottom: 2rem;
  padding: 0 4%;
}

.back-to-categories {
  background: rgba(42, 9, 229, 0.9);
  color: white;
  border: none;
  padding: 0.8rem 1.5rem;
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.3s ease;
  margin-bottom: 1rem;
  display: inline-block;
}

.back-to-categories:hover {
  background: #2a09e5;
  transform: translateX(-5px);
  box-shadow: 0 4px 15px rgba(42, 9, 229, 0.4);
}

/* Responsive per le categorie */
@media (max-width: 768px) {
  .categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
  
  .nav-btn {
    min-width: 150px;
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
  }
  
  .category-card {
    padding: 1.5rem 0.8rem;
  }
  
  .category-icon {
    font-size: 2.5rem;
  }
}

/* Per Smart TV */
@media screen and (min-width: 1600px) {
  .categories-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
  }
  
  .category-card {
    padding: 2.5rem 1.5rem;
  }
  
  .category-icon {
    font-size: 4rem;
  }
  
  .category-name {
    font-size: 1.5rem;
  }
  
  .nav-btn {
    min-width: 250px;
    padding: 1.2rem 2.5rem;
    font-size: 1.3rem;
  }
  
  .load-more-btn {
    padding: 1.2rem 3rem;
    font-size: 1.3rem;
  }
}
/* Stili per la sezione preferiti */
.preferiti-remove:hover {
  background: #b20710 !important;
  transform: translateX(-50%) scale(1.05) !important;
  box-shadow: 0 4px 10px rgba(229, 9, 20, 0.4) !important;
}

#preferiti-section h2 {
  color: #ffcc00;
}

#preferiti-section h2::before {
  background: #ffcc00;
}

/* Migliora il pulsante preferiti nella card */
.card .fav-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 204, 0, 0.95);
  color: #000;
  border: none;
  padding: 8px;
  border-radius: 50%;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.card .fav-btn:hover {
  background: #ffdb4d;
  transform: scale(1.1);
  box-shadow: 0 4px 12px rgba(255, 204, 0, 0.5);
}

/* Indicatore visivo quando è nei preferiti */
.card.in-preferiti .fav-btn {
  background: #ffcc00;
  color: #000;
}

.card.in-preferiti .fav-btn:hover {
  background: #e6b800;
}

/* Aggiungi questo stile per le stelline vuote */
.card .fav-btn:not(.in-preferiti) {
  background: rgba(255, 255, 255, 0.2);
  color: #ccc;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.card .fav-btn:not(.in-preferiti):hover {
  background: rgba(255, 255, 255, 0.3);
  color: #fff;
}
.preferiti-counter {
  background: rgba(255, 204, 0, 0.2);
  border: 2px solid rgba(255, 204, 0, 0.5);
  border-radius: 20px;
  padding: 8px 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.preferiti-counter:hover {
  background: rgba(255, 204, 0, 0.3);
  border-color: #ffcc00;
  transform: scale(1.05);
}

.fav-icon {
  font-size: 1.2rem;
}

#preferiti-count {
  font-size: 1rem;
}
/* Aggiungi questi stili per i filtri anno */
.year-filter {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.year-filter input {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: 1px solid #444;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.95rem;
}

.year-filter input:focus {
  border-color: #2a09e5;
  outline: none;
  box-shadow: 0 0 5px rgba(42, 9, 229, 0.3);
}

.year-filter button {
  background: #2a09e5;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

.year-filter button:hover {
  background: #1a0566;
  transform: translateY(-2px);
}

.year-filter button:last-of-type {
  background: #666;
}

.year-filter button:last-of-type:hover {
  background: #555;
}

/* Footer style */
footer {
  text-align: center;
  padding: 2rem;
  color: #666;
  font-size: 0.9rem;
  border-top: 1px solid #333;
  margin-top: 3rem;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
}

/* Responsive per i filtri */
@media (max-width: 768px) {
  .year-filter {
    flex-direction: column;
    align-items: flex-start;
  }
  
  .year-filter input {
    width: 100%;
    margin-bottom: 10px;
  }
  
  .year-filter button {
    width: 100%;
    margin-bottom: 10px;
  }
}
#allMovies .year-filter,
#allTV .year-filter {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 8px;
  margin-top: 15px;
  margin-bottom: 15px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

#allMovies .year-filter input,
#allTV .year-filter input {
  background: rgba(0, 0, 0, 0.7);
  color: white;
  border: 1px solid #444;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 0.95rem;
}

#allMovies .year-filter input:focus,
#allTV .year-filter input:focus {
  border-color: #2a09e5;
  outline: none;
  box-shadow: 0 0 5px rgba(42, 9, 229, 0.3);
}

#allMovies .year-filter button,
#allTV .year-filter button {
  background: #2a09e5;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
}

#allMovies .year-filter button:hover,
#allTV .year-filter button:hover {
  background: #1a0566;
  transform: translateY(-2px);
}

#allMovies .year-filter button:last-of-type,
#allTV .year-filter button:last-of-type {
  background: #666;
}

#allMovies .year-filter button:last-of-type:hover,
#allTV .year-filter button:last-of-type:hover {
  background: #555;
}
.availability-check {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ccc;
  font-size: 0.9rem;
  margin: 10px 4%;
}

.availability-check .loading-small {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #2a09e5;
  animation: spin 1s ease-in-out infinite;
}

.availability-check .available-count {
  color: #4CAF50;
  font-weight: bold;
}

.availability-check .checking {
  font-style: italic;
  color: #ffcc00;
}

/* Aggiungi al tuo style.css */
.resume-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(229, 9, 20, 0.9);
  color: white;
  padding: 5px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: bold;
  z-index: 10;
  text-align: center;
  backdrop-filter: blur(5px);
  border: 1px solid rgba(255, 255, 255, 0.2);
}
.vertical-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 25px;
  padding: 20px 4%;
  margin: 1rem 0;
}

.grid-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 2rem 4% 1rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.grid-header h2 {
  margin: 0;
  font-size: 2rem;
  color: #fff;
}

.grid-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2rem auto;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  padding: 1rem 2rem;
  border-radius: 10px;
  max-width: 400px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.page-btn {
  background: #2a09e5;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.3s ease;
  font-size: 0.95rem;
}

.page-btn:hover:not(:disabled) {
  background: #1a0566;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(42, 9, 229, 0.3);
}

.page-btn:disabled {
  background: #666;
  cursor: not-allowed;
  opacity: 0.5;
}

.page-info {
  color: white;
  font-weight: bold;
  min-width: 120px;
  text-align: center;
  font-size: 0.95rem;
}

#allMovies .carousel-wrapper,
#allTV .carousel-wrapper,
#category-results .carousel-wrapper {
  display: none;
}

/* Mostra invece le griglie verticali */
.vertical-grid-container {
  display: block;
}

/* Aggiungi alla fine di style.css */

/* Stili per la navigazione TV/telecomando */
.card:focus {
  outline: 3px solid #2a09e5;
  outline-offset: 3px;
  transform: scale(1.05);
  z-index: 20;
  box-shadow: 0 0 20px rgba(42, 9, 229, 0.7);
}

.card:focus .card-title-overlay {
  background: linear-gradient(to top, rgba(42, 9, 229, 0.8), transparent);
}

/* Migliora la visibilità dei pulsanti quando la card è in focus */
.card:focus .card-buttons button {
  background-color: rgba(255, 255, 255, 0.9);
  color: #000;
}

/* Migliora l'interazione per TV/telecomandi */
.vix-arrow:focus,
.nav-btn:focus,
.back-btn:focus,
.carousel-btn:focus,
.page-btn:focus,
#search:focus,
#cors-select:focus {
  outline: 3px solid #2a09e5;
  outline-offset: 2px;
  box-shadow: 0 0 15px rgba(42, 9, 229, 0.5);
}

/* Migliora il focus per gli episodi */
.episode-item:focus {
  outline: 3px solid #2a09e5;
  outline-offset: 2px;
  background: rgba(229, 9, 20, 0.3);
}

/* Stile per la navigazione con tab */
.category-card {
  position: relative;
}

.category-card:focus {
  outline: 3px solid #2a09e5;
  outline-offset: 3px;
  transform: translateY(-5px) scale(1.05);
  z-index: 10;
}

/* Scroll smooth per TV */
.carousel-container {
  scroll-behavior: smooth;
}

/* Migliora la visibilità dei pulsanti nei caroselli */
.arrow:focus {
  background: #2a09e5;
  color: white;
  transform: scale(1.1);
}

/* Migliora lo spazio tra le card nei caroselli */
.carousel {
  gap: 15px;
  padding: 10px 60px;
}

/* Stili per le card nella griglia */
.vertical-grid .card {
  width: 100%;
  min-width: 200px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
  background: rgba(255, 255, 255, 0.03);
}

.vertical-grid .card:hover {
  border-color: #2a09e5;
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-5px) scale(1.02);
}

.vertical-grid .card img {
  height: 280px;
  border-radius: 8px 8px 0 0;
}

.vertical-grid .card-content {
  padding: 12px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 0 0 8px 8px;
}

.vertical-grid .card-meta {
  font-size: 0.85rem;
  color: #ddd;
  margin-bottom: 8px;
}

.vertical-grid .card-buttons {
  margin-top: 8px;
  justify-content: space-around;
}

/* Responsive per la griglia verticale */
@media (max-width: 768px) {
  .vertical-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    padding: 15px 4%;
  }
  
  .vertical-grid .card img {
    height: 220px;
  }
}

@media screen and (min-width: 1200px) {
  .vertical-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 30px;
  }
  
  .vertical-grid .card img {
    height: 300px;
  }
}

@media screen and (min-width: 1600px) {
  .vertical-grid {
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 35px;
    padding: 25px 6%;
  }
  
  .vertical-grid .card img {
    height: 320px;
  }
}