@import url('https://fonts.googleapis.com/css2?family=Century+Gothic:wght@400;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Audiowide&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Rammetto+One&display=swap');

/* Light Theme */
:root {
  --primary-accent: #FFBF00;
  --bg-color: #ffffff;
  --text-color: #000000;
  --link-color: #666666;
  --link-hover: #000000;
  --container-bg: #f9f9f9;
  --video-bg: #000000;
  --sidebar-bg: #f0f0f0;
  --input-bg: #ffffff;
  --input-text: #000000;
  --active-bg: #e6e6e6;
  --active-color: #000000;
  --hover-bg: #eeeeee;
  --scroll-track: #cccccc;
  --scroll-thumb: #999999;
  --highlight: #FFBF00;
  --clock-bg: #333333;
  --clock-text: #FFD700;
}

/* Dark Theme */
.dark-theme {
  --bg-color: #121212;
  --text-color: #f1f1f1;
  --link-color: #bbbbbb;
  --link-hover: #ffffff;
  --container-bg: #1a1a1a;
  --video-bg: #000000;
  --sidebar-bg: #242424;
  --input-bg: #2f2f2f;
  --input-text: #ffffff;
  --active-bg: #333333;
  --active-color: #ffffff;
  --hover-bg: #3a3a3a;
  --scroll-track: #1c1c1c;
  --scroll-thumb: #555555;
  --highlight: #FFBF00;
  --clock-bg: #222;
  --clock-text: #FFD700;
}

* {
  font-family: 'Century Gothic', 'Segoe UI', sans-serif;
  box-sizing: border-box;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body, html {
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  height: 100%;
  width: 100%;
}

/* Container wraps video + sidebar */
.container {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 1rem;
  padding: 1rem;
  background-color: var(--container-bg);
  height: 100vh;
  max-height: 100vh;
  overflow: hidden;
}

/* Video Section */
.video-container {
  flex: 2;
  position: relative;
  background-color: var(--video-bg);
  border-radius: 0.75rem;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

#player, .jwplayer {
  width: 100% !important;
  height: 100% !important;
  position: absolute;
  top: 0;
  left: 0;
}

#clock {
  position: absolute;
  top: 10px;
  left: 10px;
  background-color: var(--clock-bg);
  color: var(--clock-text);
  font-size: 0.85rem;
  padding: 5px 10px;
  border-radius: 5px;
  z-index: 100;
}

#fallbackMessage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: var(--clock-text);
  background-color: rgba(0,0,0,0.0);
  padding: 2rem 3rem;
  border-radius: 0.75rem;
  font-size: 1.5rem;
  text-align: center;
  z-index: 999;
}

/* Sidebar Section */
.sidebar {
  flex: 1;
  max-width: 360px;
  background-color: var(--sidebar-bg);
  border-radius: 0.75rem;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  overflow: hidden;
}

/* Sidebar Controls */
.top-controls {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.theme-toggle input[type="checkbox"] {
  appearance: none;
  width: 40px;
  height: 20px;
  background-color: var(--scroll-thumb);
  border-radius: 20px;
  position: relative;
  cursor: pointer;
}

.theme-toggle input[type="checkbox"]::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  background-color: white;
  border-radius: 50%;
  top: 2px;
  left: 2px;
  transition: transform 0.3s ease;
}

.theme-toggle input[type="checkbox"]:checked::before {
  transform: translateX(20px);
}

.theme-toggle input[type="checkbox"]:checked {
  background-color: var(--highlight);
}

.channel-text {
  font-family: 'Rammetto One', sans-serif;
  font-size: 1.25rem;
  color: var(--highlight);
}

#channelCount {
  font-size: 0.8rem;
  color: var(--highlight);
}

select, input[type="search"] {
  background-color: var(--input-bg);
  color: var(--input-text);
  border: 1px solid var(--scroll-thumb);
  border-radius: 0.375rem;
  padding: 0.5rem;
  font-size: 0.875rem;
  width: 100%;
}

/* Channel List */
.list-container {
  flex: 1;
  overflow-y: auto;
}

ul.channel-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

ul.channel-list li {
  padding: 0.5rem;
  border-radius: 0.375rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

ul.channel-list li.active {
  background-color: var(--active-bg);
  color: var(--active-color);
}

ul.channel-list li:hover:not(.active) {
  background-color: var(--hover-bg);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.status-online {
  background-color: var(--primary-accent);
}

.status-offline {
  background-color: #8b0000;
}

/* Scrollbars */
.list-container::-webkit-scrollbar {
  width: 8px;
}
.list-container::-webkit-scrollbar-track {
  background: var(--scroll-track);
}
.list-container::-webkit-scrollbar-thumb {
  background-color: var(--scroll-thumb);
  border-radius: 4px;
}
.list-container::-webkit-scrollbar-thumb:hover {
  background-color: var(--highlight);
}

/* JW Player styling */
.jwplayer .jw-controlbar {
  background: rgba(0, 0, 0, 0.5) !important;
  backdrop-filter: blur(6px);
}
.jwplayer .jw-button-color,
.jwplayer .jw-icon,
.jwplayer .jw-text-elapsed,
.jwplayer .jw-text-duration {
  color: var(--highlight) !important;
}
.jwplayer .jw-icon:hover {
  opacity: 0.8;
}
.jwplayer .jw-progress,
.jwplayer .jw-slider-volume .jw-progress,
.jwplayer .jw-knob {
  background-color: rgba(255, 255, 255, 0.5) !important;
}

/* RESPONSIVE DESIGN */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    padding: 0.5rem;
    gap: 0.5rem;
    height: auto;
  }

  .video-container {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 0.5rem;
    height: auto;
  }

  .sidebar {
    max-width: 100%;
    height: auto;
    border-radius: 0.5rem;
    overflow: visible;
  }

  .list-container {
    max-height: 250px;
  }

  #clock {
    font-size: 0.75rem;
    padding: 4px 8px;
  }

  #fallbackMessage {
    font-size: 1rem;
    padding: 1rem 2rem;
  }
}
