@import url('https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100..900;1,100..900&display=swap'); /* Roboto, Inter, Poppins */

/* firefox scrollbar */
* {
  scrollbar-color: #959595 #171717; /* default dark */
  /* scrollbar-color: #959595 rgba(17, 17, 17, 0.25); */
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  font-weight: 400;
  color: white;
}

#player-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: #000;
  position: relative;
  width: 100%;
}

/* --- Modal Overlay starts --- */
#settings-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.153);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}

/* --- Modal Content Box --- */
.modal {
  background-color: #222;
  color: #fff;
  padding: 32px;
  border-radius: 8px;
  min-width: 700px;
  max-width: 90%; /* Responsive */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5); /* shadow */
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: relative;
}

.modal::before:hover {
  color: #fff;
}

/* --- First Row (Download and Local File Input) --- */
.first-row {
  display: flex;
  flex-wrap: wrap; /* wrap on smaller screens */
  align-items: center;
  gap: 8px;
  justify-content: normal;
}

.first-row button {
  background-color: #444;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-family: inherit;
  /* width: 90px; */
}

#donate {
  display:inline-flex;
  align-items:center;
  justify-content: center;
  background:#444;
  height:32px;
  padding:0 12px;
  border-radius:4px;
  text-decoration:none;
  color:#fff;
  font-size:14px;
  line-height:1;
}

#donate img {
  max-height:20px;
  margin-right:6px;
}

.first-row button:hover {
  background-color: #666;
}

#donate:hover {
  background-color: #666;
}

#file-input {
  flex-grow: 1;
  max-width: 200px;
  color: #bbb;
}

#file-input::file-selector-button {
  background-color: #444;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin-right: 8px;
}

#file-input::file-selector-button:hover {
  background-color: #666;
}

/* --- URL Input Section --- */
.url-input-section {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

#url-input {
  flex-grow: 1;
  padding: 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background-color: #333;
  color: #eee;
  outline: none;
  min-width: 200px;
}

#url-input:focus {
  border-color: #007bff;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

#load-playlist {
  background-color: #007bff;
  color: #fff;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

#load-playlist:hover {
  background-color: #0056b3;
}

/* --- EPG Input Section --- */
#epg-input {
  flex-grow: 1;
  padding: 10px;
  border: 1px solid #555;
  border-radius: 4px;
  background-color: #333;
  color: #eee;
  outline: none;
  min-width: 200px;
}

#epg-input:focus {
  border-color: #007bff;
  box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
}

#load-epg {
  background-color: #007bff;
  color: #fff;
  border: none;
  padding: 10px 15px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
}

#load-epg:hover {
  background-color: #0056b3;
}

/* --- Optional: reuse container style --- */
.url-input-section {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px; /* spacing between sections */
}

/* --- Cancel Button --- */
/* #cancel-button {
  width: 70px;
  margin-left: auto;
  margin-right: auto;
  margin-top: 8px;
  display: block;
  background-color: #6c757d;
  color: #fff;
  border: none;
  padding: 8px 15px;
  border-radius: 4px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#cancel-button:hover {
  background-color: #5a6268;
} */

/* footer {
  font-size: 12px;
  color: #888;
  text-align: end;
} */

@media (max-width: 768px) {
  .modal {
    min-width: unset;
    padding: 20px;
  }
  .first-row {
    flex-direction: column;
    align-items: stretch;
  }
  #file-input {
    max-width: 100%;
    word-wrap: break-word;
  }
  .url-input-section {
    flex-direction: column;
    align-items: stretch;
  }
  #load-playlist {
    width: 100%;
  }
}

@media (max-width: 480px) {
  .modal {
    padding: 15px;
  }
  .first-row button, #file-input::file-selector-button, #load-playlist, #cancel-button {
    padding: 10px;
  }
}

/* --- Modal Overlay ends --- */

#main-buttons {
  position: absolute;
  top: 10px;
  right: 30px;
  gap: 8px;
  z-index: 10;
}
#main-buttons button {
  background-color: rgba(39, 39, 39, 0.253);
  color: white;
  border: none;
  padding: 10px;
  cursor: pointer;
  border-radius: 50%;
}
#main-buttons button:hover {
  background-color: rgba(0, 0, 0, 0.5);
}

/* #toggle-playlist:hover {
  background-color: rgba(0, 0, 0, 0.5);
} */

#video-player {
  width: 100%;
  height: 100%;
  max-height: 100%;
  position: absolute;
  top: 0;
  left: 0;
}

#playlist-container {
  flex: 1;
  overflow-y: auto; /* hidden fixes scroll move */
  overflow-x: hidden;
  background-color: rgba(0, 0, 0, 0.0);
  padding: 10px;
  position: absolute; /* Position it over the video */
  right: 0;
  top: 37px;
  bottom: 50px; /* Adjust bottom to leave space for video controls */
  width: 284px; /* fixed width to avoid horizontal expansion */
  max-width: 100%;
  z-index: 1; /* Lower to ensure it's below video controls */
  display: none; /* Hide by default */
}

.fullscreen #playlist-container {
  bottom: 0;
  top: 0;
  width: 300px;
  background-color: rgba(0, 0, 0, 0.8); /* Make it more visible in fullscreen mode */
  display: block; /* Show in fullscreen mode */
  height: 100%;
  position: fixed;
  right: 0;
  z-index: 10; /* Ensure it's above other elements */
  overflow-y: auto; /* Enable scrolling */
}

.fullscreen #toggle-playlist {
  display: block; /* Show toggle button in fullscreen mode */
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 11; /* Ensure it's above the playlist container */
}

.fullscreen #player-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9; /* Ensure it's below the playlist container */
}

.maximized #playlist-container {
  bottom: 0;
  top: 0;
  width: 300px;
  background-color: rgba(0, 0, 0, 0.8); /* Make it more visible in fullscreen/maximized mode */
  display: block; /* Show in fullscreen/maximized mode */
  height: 100%;
  position: fixed;
  right: 0;
  z-index: 10; /* Ensure it's above other elements */
  overflow-y: auto; /* Enable scrolling */
}

.maximized #toggle-playlist {
  display: block; /* Show toggle button in fullscreen/maximized mode */
  position: fixed;
  top: 10px;
  right: 10px;
  z-index: 11; /* Ensure it's above the playlist container */
}

.maximized #player-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 9; /* Ensure it's below the playlist container */
}

.playlist-item {
  margin: 5px 0;
  cursor: pointer;
  padding: 10px;
  border-radius: 5px;
  display: flex;
  align-items: center;
  background: rgba(39, 39, 39, 0.253);
  text-decoration: none; /* Remove underline from hyperlinks */
  color: inherit; /* and inherit text color */
}

.playlist-item:hover, .playlist-item.active {
  background-color: rgba(219, 219, 219, 0.683);
  color: #000;
}

.channel-logo {
  width: 60px;
  height: 20px;
  padding-right: 2%;
  object-fit: contain;
  max-width: 100%;
  max-height: 100%;
  /* filter: drop-shadow(1px 1px 15px rgb(0, 0, 0)); */
}

/* Layout for title + latency */
.channel-latency {
  margin-left: 8px;
  color: #6c6c6c;
  font-size: 12px;
  flex: 0 0 auto;
}

.channel-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0; /* allow flex children to shrink for text-overflow */
  flex: 1;
  mask-image: linear-gradient(to right, black 0 80%, transparent 100%);
}

.channel-title {
  display: block;
  white-space: nowrap;
  max-width: 100%;
}

#overlay-container {
  position: fixed;
  bottom: 50px;
  left: 50%;
  transform: translateX(-50%);
  background-color: rgba(208, 208, 208, 0.62);
  padding: 20px;
  border-radius: 10px;
  z-index: 20;
  width: max-content;
}

.overlay-content {
  display: flex;
  align-items: center;
}

.overlay-logo {
  height: 40px;
  object-fit: contain;
  max-width: 100%;
  max-height: 100%;
  /* filter: drop-shadow(1px 1px 15px rgb(0, 0, 0)); */
}

.overlay-title {
  font-size: 36px;
  color: #000;
  padding-left: 20px;
  /* text-shadow: 2px 2px 4px rgba(0, 0, 0, 1); */
}

/* Responsive styles */
@media (max-width: 850px) {
  body {
    flex-direction: column;
  }
  #playlist-container {
    background-color: rgb(0, 0, 0);
    width: inherit;
    height: 200px;
    position: relative;
    right: 0;
    top: auto;
    bottom: inherit; /* space for controls */
  }
  #overlay-container {
    display: none !important;
  }
}

/* Ensure video.js CSS does not override custom styles */
.video-js .vjs-control-bar {
  z-index: 10 !important; /* Ensure control bar is above playlist container */
}

.vjs-screenshot-button {
  line-height: 1;
  padding: 5px 10px;
  background: #007bff;
  color: white;
  border: none;
  border-radius: 3px;
  cursor: pointer;
}

.vjs-screenshot-button:hover {
  background: #0056b3;
}

#volume-overlay {
  display: none;
  position: fixed;
  bottom: 120px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(219,219,219,0.683);
  color: #000;
  font-size: 32px;
  padding: 16px 32px;
  border-radius: 10px;
  z-index: 21;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

/* EPG Display (Bottom-Left) */
/* 
#epg-display {
  position: fixed;
  bottom: 225px;
  left: 10px;
  background: rgba(34, 34, 34, 0.95);
  border: 1px solid #444;
  border-radius: 8px;
  padding: 12px;
  max-width: 300px;
  z-index: 15;
  color: #fff;
  font-family: Inter, Arial, sans-serif;
  opacity: 1;
  transition: opacity 1.0s ease;
  display: block;
}

#epg-display.hidden {
  opacity: 0;
}

.epg-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.epg-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.epg-time {
  font-size: 12px;
  color: #aaa;
}

.epg-desc {
  font-size: 11px;
  color: #bbb;
  max-height: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
}

@media (max-width: 850px) {
  #epg-display {
    max-width: 250px;
    bottom: 120px;
    left: 5px;
  }
} */

/* Context Menu (tippy.js) */
#ctx-template {
  background-color: #2a2a2a;
  border: 1px solid #444;
  border-radius: 6px;
  padding: 4px 0;
  display: flex;
  flex-direction: column;
  min-width: 150px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.tippy-box {
  background-color:#222 !important;
}

.tippy-content {
  padding:5px !important;
}

.ctx-item {
  padding: 10px;
  border-radius: 5px;
  cursor: pointer;
  display: flex;
  align-items: center;
  white-space: nowrap;
  user-select: none;
}

.ctx-item:hover {
  background-color: #424242;
  color: #fff;
}

.ctx-item i {
  font-size: 16px;
  display: flex;
  align-items: center;
}
