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

header {
  background-color: #111;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

header .logo {
  font-size: 1.2rem;
  font-weight: bold;
  display: flex;
  align-items: center;
  text-decoration: none;
  color: white;
}

header .logo img {
  height: 36px;
  vertical-align: middle;
}

nav a {
  color: #fff;
  margin-left: 1rem;
  text-decoration: none;
}

nav a.active, nav a:hover {
  text-decoration: underline;
}

.hero {
  padding: 2rem;
  background: linear-gradient(to right, #222, #111);
  text-align: center;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  padding: 2rem;
}

.video-grid img {
  width: 100%;
  border-radius: 6px;
  transition: 0.3s;
}

.video-grid img:hover {
  transform: scale(1.03);
  cursor: pointer;
}

.video-grid p {
  text-align: center;
  margin-top: 0.5rem;
  font-size: 0.9rem;
}

.video-wrapper {
  max-width: 1000px;
  margin: 2rem auto;
  text-align: center;
}

.video-wrapper video {
  width: 100%;
  border-radius: 8px;
}

.suggested-section {
  padding-left: -0.5rem;
  padding-right: 0rem;
  text-align: left;
}

.suggested-section h3 {
  margin-bottom: 1rem;
  font-size: 1.2rem;
}

.suggested-grid {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 0rem;
  gap: 1rem;
  margin-left: -0.5rem;
  width: 100%;
}

.suggested-grid .video-card-wrapper {
  flex: 0 0 265px;
}

.suggested-grid .video-card-wrapper img {
  width: 100%;
  height: auto;
  object-fit: cover;
}

.suggested-grid::after {
  content: '';
  flex: 0 0 2rem; /* spazio finale per far vedere l'ultima card */
}

.suggested-grid a {
  flex: 0 0 calc((100% - 4rem) / 6);  /* 5 video per riga con 1rem di gap */
  margin: 0 0.5rem;   
  scroll-snap-align: start;
  text-align: center;
  text-decoration: none;
  color: white;
}

.suggested-grid a p {
  margin-top: 0.5rem;
  font-size: 0.9rem;
}


.suggested-grid::-webkit-scrollbar {
  display: none; /* Nasconde la scrollbar */
}



.suggested-grid img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  object-fit: cover;
}

.suggested-grid img:hover {
  transform: scale(1.05);
}


.video-info-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(to right, #1e1e1e, #2c2c2c);
  color: #fff;
  padding: 1rem 1.5rem;
  border-radius: 12px 12px 0 0;
  font-size: 1.1rem;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  transition: background 0.3s ease, transform 0.2s ease;
  user-select: none;
}



.video-info-toggle:hover {
  background: #2a2a2a;
}

.info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #222;
  padding: 0.75rem 1rem;
  cursor: pointer;
  border-radius: 6px;
}

#arrow {
  transition: transform 0.3s ease;
  font-size: 1.1rem;
  margin-left: 0.5rem;
  color: #ccc;
}

#arrow.rotate {
  transform: rotate(180deg);
  color: #fff;
}


.video-description {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.6s ease;
  background: #111;
  color: #ddd;
  padding: 1rem 1.5rem; /* NON cambia */
  border-radius: 0 0 8px 8px;
  width: 100%;
  box-sizing: border-box;
  font-size: 1rem;
  line-height: 1.5;
  opacity: 0;
  transition: max-height 0.6s ease, opacity 0.3s ease;
}


.video-description.expanded {
  max-height: 300px; 
  padding: 1rem 1.5rem;
  opacity: 1;
}


.video-info-container {
  max-width: 1200px;
  margin: 0 auto 4rem auto;
}


.video-scroll-container {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  padding: 1rem 2rem;
  scroll-snap-type: x mandatory;
  scroll-padding: 1rem 2rem; 
  position: relative;
}

.video-scroll-container::after {
  content: '';
  flex: 0 0 2rem; 
}


.video-scroll-container::-webkit-scrollbar {
  display: none;
}

.video-card-wrapper {
  flex: 0 0 auto;
  width: 280px;
  margin: 0 0.5rem;
  scroll-snap-align: start;
}

.video-card-wrapper img {
  width: 100%;
  border-radius: 8px;
  display: block;
}

.video-card-wrapper a {
  text-decoration: none;
  color: white;
}

.video-card-wrapper a p {
  margin-top: 0.5rem;
  color: white;
  font-size: 0.9rem;
  text-align: center;
}


.video-card-wrapper a:hover {
  text-decoration: underline;
}


.video-preview-popup {
  position: absolute;
  width: 320px; 
  max-width: 90vw; 
  background: #111;
  color: white;
  border-radius: 10px;
  padding: 1rem;
  z-index: 1000;
  box-shadow: 0 0 20px rgba(0,0,0,0.7);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  overflow-wrap: break-word;
  word-break: break-word;
  overflow: hidden;
}



.video-preview-popup.visible {
  opacity: 1;
  pointer-events: auto;
}

.video-preview-popup.hidden {
  opacity: 0;
  pointer-events: none;
}

.video-preview-popup img {
  width: 100%;
  max-height: 180px;
  object-fit: cover;
  border-radius: 6px;
  margin-bottom: 0.75rem;
}

.video-preview-popup h4 {
  font-size: 1.2rem;
  margin-bottom: 0.5rem;
}

.video-preview-popup p {
  font-size: 0.9rem;
  color: #ccc;
  margin-bottom: 0.75rem;
}

.play-btn {
  background: white;
  color: black;
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  text-decoration: none;
  font-weight: bold;
  font-size: 0.9rem;
  display: inline-block;
}

.scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background-color: rgba(0,0,0,0.5);
  border: none;
  color: white;
  font-size: 2rem;
  padding: 0.5rem 1rem;
  cursor: pointer;
  z-index: 1;
}

.scroll-btn.left {
  left: 1rem;
}

.scroll-btn.right {
  right: 1rem;
}

.suggested-wrapper {
  position: relative;
  margin: 2rem 0;
}

.suggested-wrapper .scroll-btn {
  position: absolute;
  top: 40%; /* leggermente più alta per evitare sovrapposizione */
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 1.6rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  z-index: 3;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
  transition: background 0.2s ease, transform 0.2s ease;
  display: flex;
  justify-content: center;
  align-items: center;
  backdrop-filter: blur(6px);
}

.suggested-wrapper .scroll-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-50%) scale(1.1);
}

.suggested-wrapper .scroll-btn.left {
  left: -2rem;
}

.suggested-wrapper .scroll-btn.right {
  right: -1.7rem;
}



/* Miglioramenti visuali per homepage a categorie */

.category-row {
  margin-bottom: 4rem;       /* Spazio tra una categoria e l'altra */
  padding: 0 2rem;
}

.category-row h2 {
  font-size: 1.6rem;         /* Titolo più grande */
  margin-bottom: 1rem;
  padding-left: 0.5rem;      /* Spazio dal bordo sinistro */
}

/* Scroll container orizzontale per ogni categoria */
.category-row .video-scroll-section {
  position: relative;
  display: flex;
  align-items: center;
}

.category-row .video-scroll-container {
  display: flex;
  gap: 1rem;
  overflow-x: auto;
  scroll-behavior: smooth;
  scroll-snap-type: x mandatory;
  scroll-padding: 0 0; /* completamente allineato a sinistra */
  margin-left: -0.5rem; 
  width: 100%;
}

.category-row .video-card-wrapper {
  flex: 0 0 calc((100% - 4rem) / 5); 
  scroll-snap-align: start;
}

.category-row .scroll-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: linear-gradient(145deg, #1c1c1c, #2a2a2a);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 1.8rem;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
  transition: transform 0.2s ease, background 0.3s ease;
}

.category-row .scroll-btn:hover {
  background: linear-gradient(145deg, #333, #444);
  transform: translateY(-50%) scale(1.1);
}


.category-row .scroll-btn.left {
  left: -2rem;
}

.category-row .scroll-btn.right {
  right: -2rem;
}


.preview-link {
  text-decoration: none;
  color: white;
  display: block;
}

.preview-link img {
  width: 100%;
  border-radius: 8px;
  margin-bottom: 0.5rem;
}


nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

#search-input {
  background-color: #222;
  border: 1px solid #444;
  color: white;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  font-size: 1rem;
  outline: none;
  transition: border 0.2s ease;
}

#search-input::placeholder {
  color: #888;
}

#search-input:focus {
  border-color: #888;
}

/* Applica padding come alle categorie normali */
.search-row {
  margin-bottom: 4rem;
  padding: 0 0rem;
}

/* Oppure: spazio a sinistra ancora maggiore se vuoi */
.search-row .video-scroll-section {
  padding-left: 2rem;
}

/* Mantieni lo stesso stile dei popup */
.search-row .video-card-wrapper {
  flex: 0 0 calc((100% - 4rem) / 5);
  scroll-snap-align: start;
}





/* CSS AREA CREATOR */
.video-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);  /* due colonne fisse */
  gap: 1.5rem;
}


.video-item {
  display: flex;
  gap: 1.5rem;
  padding: 0.5rem 0;
  align-items: flex-start; 
  border-radius: 0; 
  background-color: transparent;
  cursor: pointer; 
}

.video-item img {
  width: 240px; 
  height: 135px;
  object-fit: cover;
  border-radius: 6px;
  cursor: pointer;
}

.video-info {
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.video-info h4 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: bold;
}

.video-info p {
  margin: 0.3rem 0 0;
  color: #aaa;
  font-size: 0.95rem;
}


.playlist-card {
  position: relative;
  width: 240px;
  height: 135px;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease;
}

.playlist-card:hover {
  transform: scale(1.03);
}

.playlist-thumb-main {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.8);
}

.playlist-thumb-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  backdrop-filter: blur(4px);
  background: rgba(0,0,0,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: bold;
  font-size: 1rem;
  text-shadow: 0 0 5px black;
}

.playlist-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
}

.video-list.videos-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1.5rem;
}

.video-list.playlist-column {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.playlist-card.active {
  opacity: 1;
  border: 2px solid #e50914;
}

/* Posizionamento e layout playlist + video */
.playlist-wrapper {
  display: flex;
  align-items: flex-start;
  gap: 2rem;
}

.tab-bar {
  display: flex;
  gap: 2rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid #444;
  font-size: 1.2rem;
  padding-bottom: 0.5rem;
}

.tab-button {
  background: none;
  color: #aaa;
  border: none;
  font-weight: bold;
  padding: 0.8rem 1.2rem;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: all 0.3s ease;
  font-size: 1.1rem;
}

.tab-button.active {
  color: #fff;
  border-bottom: 3px solid #e50914;
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

.tab-content.active {
  display: block;
}

.video-thumb-wrapper {
  position: relative;
  display: inline-block;
}

.video-thumb-wrapper img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 6px;
  transition: opacity 0.3s ease;
}

.edit-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.6);
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.video-thumb-wrapper:hover .edit-icon {
  opacity: 1;
}

.video-thumb-wrapper:hover img {
  opacity: 0.4;
}

.edit-icon:hover {
  background-color: #e50914;
}

.clickable-info {
  cursor: pointer;
}


@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}


footer {
  background: #111;
  padding: 1rem;
  text-align: center;
}

