/* CSS non minificato - palette con arancione chiaro, sfondi canali chiari e ricerca bianca */
body {
  margin: 0;
  padding: 0;
  font-family: Arial, sans-serif;
  background: #0d0d0d;
  display: flex;
  height: 100vh;
  width: 100%;
  overflow: hidden;
}
.hidden { display: none !important; }

/* ===== SIDEBAR MENU ===== */
.menu {
  position: relative;
  z-index: 1000;
  width: 180px;
  background: linear-gradient(135deg, rgba(28,28,28,0.9), rgba(18,18,18,0.9));
  color: #e0e0e0;
  padding: 0;
  box-sizing: border-box;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  opacity: 0;
  transform: translateY(-20px);
  animation: fadeIn 1s ease-out 1.5s forwards;
  border-right: 2px solid #333;
}

/* ===== TOP BAR INSIDE MENU ===== */
.menu-top-bar {
  margin-bottom: 4px;
  position: relative;
  width: 100%;
  height: 60px;
  background: #ff9500;
  border-bottom: 2px solid #e68a00;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  z-index: 1002;
}

.menu-top-bar .web-tv-title {
  font-family: 'Pacifico', cursive;
  font-size: 28px;
  color: #fff;
  text-decoration: none;
  margin: 10px 15px;
  padding: 10px;
  background-color: #ff9500;
  border: 1px solid transparent;
  border-radius: 4px;
  box-sizing: border-box;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s, border-color 0.3s;
}

.menu-top-bar .web-tv-title:hover {
  background-color: #e68a00;
  color: #fff;
}

.menu-top-bar .web-tv-title:focus {
  outline: none;
  border: 1px solid #fff;
  background-color: #ff9500;
}

/* ===== SCROLLABLE MENU CONTENT ===== */
.menu-content {
  flex: 1;
  padding: 15px 15px 30px 15px; /* padding bottom aumentato per Fire TV */
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  min-height: 0; /* Permette al flex di funzionare correttamente */
}
@keyframes fadeIn { to { opacity: 1; transform: translateY(0); } }
.menu a:focus { outline: none; border: 1px solid #e0e0e0; }

/* ===== SEARCH INPUT ===== */
#searchInput {
  margin-bottom: 20px;
  padding: 10px 10px 10px 45px;
  width: 100%;
  border-radius: 4px;
  border: 1px solid #ccc;
  font-size: 16px;
  box-sizing: border-box;
  height: 40px;
  background-color: #fff;   /* sfondo bianco */
  color: #222;              /* testo scuro */
  display: flex;
  align-items: center;
  transition: all 0.3s ease;
  position: relative;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23666' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
  background-size: 18px 18px;
}
#searchInput:focus {
  outline: none;
  border: 1px solid #ff9500;
  box-shadow: 0 0 15px rgba(255,149,0,0.5);
  transform: scale(1.02);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23ff9500' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
}

/* ===== SCROLL TOP BUTTON ===== */
.scroll-top-button {
  background-color: #444 !important;
  color: #ddd !important;
  border: 1px solid #555 !important;
  padding: 10px !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  margin: 0 0 15px 0 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  font-size: 16px !important;
  border-radius: 4px !important;
  transition: all 0.3s ease !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  box-sizing: border-box !important;
  text-decoration: none !important;
  width: 100% !important;
}

.scroll-top-button:hover {
  background-color: #555 !important;
  border-color: #555 !important;
  color: #ddd !important;
}

.scroll-top-button:focus {
  outline: none !important;
  border: 1px solid #fff !important;
  background-color: #ff9500 !important;
  color: #fff !important;
  box-shadow: 0 0 12px rgba(255,149,0,0.7) !important;
  transform: scale(1.03) !important;
}

/* ===== CHANNEL BUTTONS ===== */
.channel a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  width: 100%;
  height: 80px;
  padding: 8px;
  box-sizing: border-box;
  position: relative;
  margin-bottom: 8px;
  border-radius: 6px;
  transition: background-color 0.3s, transform 0.3s, border-color 0.3s;
}
.channel .channel-image {
  width: 60px;
  height: 40px;
  object-fit: contain;
  margin-bottom: 6px;
  border-radius: 4px;
  visibility: hidden;
  transition: all 0.3s ease-in-out;
}
.channel-image.lazy { opacity: 0; filter: brightness(0.8); transform: scale(0.9); }
.channel-image.loaded { opacity: 1; filter: brightness(1); transform: scale(1); visibility: visible; }

/* ===== CHANNEL STATES ===== */
.channel a {
  background-color: #2e2e2e !important; /* grigio scuro per tutti i canali */
  color: #e0e0e0 !important; /* testo chiaro per tutti i canali */
  border-color: transparent !important;
}
.channel a:focus {
  background-color: #ff9500 !important; /* arancione solo quando selezionato */
  color: #fff !important;
  border-color: #fff !important; /* contorno bianco per focus */
}
.channel a:hover {
  background-color: #3a3a3a !important; /* grigio medio per hover su canali normali */
  color: #e0e0e0 !important;
  border-color: transparent !important;
}
.channel a:focus:hover {
  background-color: #e68a00 !important; /* arancione scuro per hover su focus */
  color: #fff !important;
  border-color: #fff !important; /* contorno bianco per hover su focus */
}
.channel span {
  display: block;
  width: 100%;
  text-align: center;
  font-size: 13px;
  line-height: 1.2;
  word-break: break-word;
  white-space: normal;
}

/* ===== CATEGORY BUTTONS ===== */
.category-button,
#toggleCategoriesButton {
  margin-bottom: 20px;
  padding: 10px;
  width: 100%;
  border-radius: 4px;
  border: 1px solid #555;
  font-size: 16px;
  height: 40px;
  background-color: #444;
  color: #ddd;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* Stato normale (non selezionato) */
.category-button:hover,
#toggleCategoriesButton:hover {
  background-color: #555;
}

/* Quando il pulsante riceve il focus (tramite telecomando) */
.category-button:focus,
#toggleCategoriesButton:focus {
  background-color: #ff9500;
  color: #fff;
  border: 1px solid #fff;
  outline: none;
  /* EFFETTO OMBRA AGGIUNTO */
  box-shadow: 0 0 12px rgba(255,149,0,0.7);
  transform: scale(1.03);
}

/* Stato "attivo" (selezionato) senza focus */
.category-button.active,
#toggleCategoriesButton.active {
  background-color: #ff9500;
  color: #fff;
  border: 1px solid #fff;
  outline: none;
  box-shadow: none;
}

/* Stato "attivo + focus" */
.category-button.active:focus,
#toggleCategoriesButton.active:focus {
  background-color: #e68a00;
  color: #fff;
  border: 1px solid #fff;
  outline: none;
  box-shadow: 0 0 12px rgba(255,149,0,0.7);
  transform: scale(1.03);
}

/* ===== MENU LINKS GENERICI ===== */
.menu a {
  color: #e0e0e0;
  text-decoration: none;
  margin: 10px 0;
  padding: 15px 10px;
  background-color: #2e2e2e;
  border-radius: 4px;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;       /* garanzia di altezza costante */
  border: 1px solid transparent;
  transition: background-color 0.3s;
}
.menu a:hover { background-color: #3a3a3a; }
.menu a:focus {
  outline: none;
  border: 1px solid #fff;
  background-color: #3a3a3a;
}
.menu a.active { background-color: #ff9500; color: #111; }

/* ===== PULSANTE PREFERITI ===== */
.menu a.preferiti {
  /* Reset completo per evitare ereditarietà */
  color: #ddd !important;
  text-decoration: none !important;
  margin: 0 0 10px 0 !important;
  padding: 10px !important;
  background-color: #444 !important;
  border-radius: 4px !important;
  text-align: center !important;
  width: 100% !important;
  box-sizing: border-box !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 40px !important;
  min-height: 40px !important;
  max-height: 40px !important;
  border: 1px solid #555 !important;
  transition: background-color 0.3s, border-color 0.3s, transform 0.2s, box-shadow 0.3s !important;
  cursor: pointer !important;
  font-size: 16px !important;
  line-height: 1 !important;
}
.menu a.preferiti:hover { 
  background-color: #555 !important;
  border-color: #555 !important;
  color: #ddd !important;
}
.menu a.preferiti:focus {
  outline: none !important;
  border: 1px solid #fff !important;
  background-color: #ff9500 !important;
  color: #fff !important;
  box-shadow: 0 0 12px rgba(255,149,0,0.7) !important;
  transform: scale(1.03) !important;
}
.menu a.preferiti.active {
  background-color: #ffd700 !important;
  color: #000 !important;
  border-color: #ffd700 !important;
}
.menu a.preferiti.active:hover {
  background-color: #ffdf00 !important;
  color: #000 !important;
  border-color: #ffd700 !important;
}
.menu a.preferiti.active:focus {
  outline: none !important;
  background-color: #ffd700 !important;
  color: #000 !important;
  border: 1px solid #ffd700 !important;
  box-shadow: 0 0 12px rgba(255,215,0,0.7) !important;
  transform: scale(1.03) !important;
}

/* ===== OVERRIDE PER WEB TV (ALTEZZA FISSA DI 50px) ===== */
.web-tv-title {
  font-family: 'Pacifico', cursive;
  font-size: 20px;             /* dimensione leggermente ridotta per stare in 50px */
  color: #ffcc00;
  text-decoration: none;
  margin: 10px 0;
  width: 100%;
  height: 50px;                /* fissa l'altezza esattamente come ".menu a" */
  padding: 0;                  /* azzera il padding verticale */
  background-color: #2e2e2e;   /* stesso sfondo di ".menu a" */
  border-radius: 4px;
  text-align: center;
  box-sizing: border-box;
  display: flex;
  align-items: center;         /* centra verticalmente il testo */
  justify-content: center;
  border: 1px solid transparent;
  transition: background-color 0.3s;
}
.web-tv-title:hover {
  background-color: #3a3a3a;
}
.web-tv-title:focus {
  outline: none;
  border: 1px solid #e0e0e0;
  background-color: #3a3a3a;
}
.web-tv-title.active {
  background-color: transparent !important; 
  color: #ffcc00 !important;
  border: none !important;
  box-shadow: none !important;
}

/* ===== VIDEO CONTAINER ===== */
.video-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;
}
.video-container video,
.video-js,
#clappr-container,
.youtube-player,
.twitch-player {
  width: 100vw !important;
  height: 100vh !important;
}
.video-container video:focus { outline: none !important; }
.video-container:focus { outline: 1px solid #111 !important; box-shadow: none !important; }
#android-video {
  -webkit-tap-highlight-color: transparent !important;
  outline: none !important;
  box-shadow: none !important;
}

/* ===== EPG BUTTONS ===== */
.epg-button {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 9999;
  display: flex;
  gap: 10px;
}
.epg-button button {
  background-color: #ff9500;
  color: #fff;
  border: none;
  padding: 10px 16px;
  cursor: pointer;
  border-radius: 4px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.3s;
}
.epg-button button:hover { background-color: #ffc266; }
.epg-button .favorite-button.favorited {
  background-color: #ffd700;
  color: #000;
}

/* ===== EPG MODAL ===== */
.epg-modal {
  display: none;
  position: absolute;
  z-index: 9998;
  top: 40px;
  height: 100%;
  cursor: pointer;
  left: 180px;
  width: calc(100% - 180px);
}
.epg-modal-content {
  background-color: rgba(60, 60, 60, 0.95);
  margin-top: -40px;
  width: 100%;
  height: 100%;
  color: #e0e0e0;
  padding: 20px;
  box-sizing: border-box;
  overflow-y: auto;
}
.epg-item {
  background-color: transparent;
  padding: 12px 0;
  margin-bottom: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
}
.epg-item:last-child {
  border-bottom: none;
}
.epg-item strong { 
  font-size: 16px; 
  color: #fff; 
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}
.epg-item .epg-time { 
  font-size: 13px; 
  margin: 2px 0; 
  color: #ccc; 
  display: block;
}
.epg-item .epg-time:first-of-type {
  text-align: left;
}
.epg-item .epg-time:last-of-type {
  text-align: right;
  margin-top: -18px;
}

/* ===== FAQ & WELCOME ===== */
.video-container .faq-container {
  position: absolute;
  top: 50%;
  left: 180px;
  width: calc(100% - 180px);
  transform: translateY(-50%);
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center;
  z-index: 1100;
}
.welcome-message {
  opacity: 0;
  transform: translateY(-40px);
  animation: fadeIn 1s ease-out 1.5s forwards;
  color: #ddd;
  font-size: 18px;
  text-align: center;
}

.welcome-message img {
  display: block;
  margin: 20px auto;
  max-width: 100%;
  height: auto;
  opacity: 0;
  transform: translateY(-40px);
  animation: fadeIn 1s ease-out 1.5s forwards;
}
.welcome-message h2 {
  font-size: 20px;
  margin-top: 20px;
  margin-bottom: 10px;
  color: #ff9500;
}
.welcome-message p,
.welcome-message ul,
.welcome-message li {
  font-size: 16px;
  line-height: 1.2;
}
.welcome-message ul {
  list-style-type: disc;
  padding-left: 20px;
  text-align: left;
  display: inline-block;
  margin: 0 auto;
}


/* ===== UTILITIES ===== */
.scroll-top-button {
  margin-top: 10px !important;
  background-color: #333 !important;
  transition: background-color 0.3s ease;
}
.scroll-top-button:hover { background-color: #444 !important; }
.scroll-top-button i { margin-right: 10px; }

.elimina-tutti-button {
  background-color: #cc4444;
  color: #fff;
  border: none;
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 4px;
  font-size: 14px;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  margin-bottom: 10px;
}
.elimina-tutti-button:hover { background-color: #dd5555; }
.elimina-tutti-button:focus {
  outline: 1px solid #fff;
  box-shadow: 0 0 10px 3px rgba(255,255,255,0.8);
}

/* ===== SCROLLBAR HIDE ===== */
.menu-content {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.menu-content::-webkit-scrollbar { display: none; }

/* ===== FIRE TV SCROLL FIX ===== */
@media (max-width: 1920px) {
  .menu-content {
    padding-bottom: 50px; /* Extra padding per Fire TV */
    -webkit-overflow-scrolling: touch; /* Smooth scroll su dispositivi touch */
  }
}

/* ===== FAQ PAGE OVERRIDE ===== */
body.faq-page .menu {
  opacity: 1 !important;
  transform: translateY(0) !important;
  animation: none !important;
}

/* ===== EPG BAR STYLES ===== */
.epg-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100px;
  background: rgba(0,0,0,1);
  border-top: 2px solid #ff9500;
  z-index: 10000;
}

.epg-bar.hidden {
  display: none;
}

.epg-bar-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  padding: 0 20px;
  position: relative;
}

.epg-bar-left {
  display: flex;
  align-items: center;
  flex: 1;
}

.epg-channel-info {
  display: flex;
  align-items: center;
}

.epg-channel-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.epg-bar-channel-name {
  margin: 0;
  font-size: 18px;
  font-weight: bold;
  color: #fff;
  letter-spacing: 0.5px;
}

.epg-bar-current-program {
  margin: 0;
  font-size: 14px;
  color: #ff9500;
  font-weight: 500;
  max-width: 400px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epg-bar-right {
  display: flex;
  align-items: center;
  gap: 20px;
}

.epg-bar-time {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.epg-bar-time-text {
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  font-family: 'Courier New', monospace;
  letter-spacing: 1px;
}

.epg-bar-progress {
  width: 200px;
  height: 4px;
  background: rgba(255,255,255,0.2);
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.epg-bar-progress-fill {
  height: 100%;
  background: #ff9500;
  border-radius: 2px;
  width: 0%;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .epg-bar {
    height: 90px;
  }
  
  .epg-bar-content {
    padding: 0 15px;
  }
  
  
  .epg-bar-channel-name {
    font-size: 16px;
  }
  
  .epg-bar-current-program {
    font-size: 12px;
    max-width: 250px;
  }
  
  .epg-bar-progress {
    width: 150px;
  }
  
  .epg-bar-time-text {
    font-size: 14px;
  }
}
