@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', 'Audiowide', sans-serif&display=swap);

:root {
  --bg-color: #ffffff;
  --text-color: #000000;
  --link-color: #666666;
  --link-hover: #000000;
  --container-bg: #f0f0f0;
  --video-bg: #000000;
  --sidebar-bg: #e0e0e0;
  --input-bg: #dddddd;
  --input-text: #000000;
  --active-bg: #cccccc;
  --active-color: #000000;
  --hover-bg: #dddddd;
  --scroll-track: #cccccc;
  --scroll-thumb: #999999;
  --highlight: #444444;
  --clock-bg: #cccccc;
  --clock-text: #000000;
  --input-placeholder: #888;
  --input-focus: #007acc33
}

@media (prefers-color-scheme: dark) {
  :root {
    --input-placeholder: #aaa;
    --input-focus: #ffffff33;
  }
}

.dark-theme {
  --bg-color: #121212;
  --text-color: #ffffff;
  --link-color: #bbbbbb;
  --link-hover: #ffffff;
  --container-bg: #1a1a1a;
  --video-bg: #000000;
  --sidebar-bg: #222222;
  --input-bg: #2a2a2a;
  --input-text: #ffffff;
  --active-bg: #444444;
  --active-color: #ffffff;
  --hover-bg: #333333;
  --scroll-track: #1c1c1c;
  --scroll-thumb: #555555;
  --highlight: #777777;
  --clock-bg: #333333;
  --clock-text: #ffffff;
}

* {
  font-family: 'Century Gothic', sans-serif;
  font-weight: 300;
  font-size: 0.875rem;
}

html, body {
  font-size: 100%;
  margin: 0;
  padding: 0;
  background-color: var(--bg-color);
  color: var(--text-color);
  height: 100%;
  width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}

a {
  color: var(--link-color);
  font-size: 12px;
  text-decoration: none;
}

a:hover {
  color: var(--link-hover);
}

.container {
  display: flex;
  height: 100%;
  width: 100%;
  padding: 0;
  box-sizing: border-box;
  background-color: var(--container-bg);
  position: relative;
}

.video-container {
  position: relative;
  flex: 1;
  background-color: var(--video-bg);
  border-radius: 0;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100vh;
}

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

/* Reconnection message styling */
#fallbackMessage {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.9), rgba(118, 75, 162, 0.9));
    padding: 15px 20px;
    border-radius: 15px;
    font-size: 14px;
    text-align: center;
    z-index: 999;
    display: none;
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    animation: pulse 2s infinite;
    min-width: 120px;
}

#fallbackMessage > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

#fallbackMessage > div > div:first-child {
    font-size: 18px;
}

#fallbackMessage > div > div:nth-child(2) {
    font-weight: bold;
    font-size: 14px;
}

#fallbackMessage > div > div:last-child {
    font-size: 11px;
    opacity: 0.8;
}

@keyframes pulse {
    0% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.95);
    }
    50% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0.9;
        transform: translate(-50%, -50%) scale(0.95);
    }
}

#clock {
  position: absolute;
  top: -5px;
  left: -5px;
  background-color: transparent; /* or var(--clock-bg) */
  color: var(--highlight);
  padding: 5px 5px;
  border-radius: 0;
  font-size: 14px;
  z-index: 100;
}

/* Ensure the sidebar is properly positioned for click detection */
.sidebar {
  position: absolute;
  top: 0;
  left: 0;
  width: 350px;
  height: 100vh;
  max-height: 100vh;
  background: linear-gradient(135deg, #181818, #0e0e0e);
  border-radius: 0;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  overflow: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
  z-index: 1000;
  pointer-events: auto; /* Ensure sidebar receives click events when open */
}

.sidebar.collapsed {
  transform: translateX(-380px);
  opacity: 0;
  pointer-events: none;
}

/* Update toggle button positioning */
.sidebar-toggle {
  position: absolute;
  top: 50%;
  left: 350px;
  transform: translateY(-50%);
  z-index: 1001;
  background-color: var(--sidebar-bg);
  border: none;
  border-radius: 0 8px 8px 0;
  width: 30px;
  height: 80px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
  transition: all 0.3s ease;
}

.sidebar-toggle:hover {
  background-color: var(--hover-bg);
  transform: translateY(-50%) scale(1.05);
}

.sidebar.collapsed ~ .sidebar-toggle {
  left: 0;
}

.arrow-icon {
  font-size: 20px;
  color: var(--text-color);
  transition: transform 0.3s ease;
}

.sidebar.collapsed .arrow-icon {
  transform: rotate(180deg);
}

.sidebar-content {
  padding: 1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
}

/* Optional: Ensure spacing and stacking on smaller screens */
@media (max-width: 600px) {
  .sidebar {
    width: 100%;
    max-width: 100%;
    border-radius: 0;
  }
  .sidebar.collapsed {
    transform: translateX(-100%);
  }
  .sidebar-toggle {
    right: -15px;
    width: 30px;
    height: 30px;
  }
}

.top-controls {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.5rem; /* Adjust margin after removing theme toggle */
}

.search-wrapper {
  margin-top: 0.5rem; /* Adjust margin if theme toggle was above it */
  position: relative;
  width: 100%;
  margin-bottom: 0.75rem;
}

.search-icon {
  position: absolute;
  top: 50%;
  left: 0.75rem;
  transform: translateY(-50%);
  pointer-events: none;
  color: var(--input-placeholder);
}

.search-icon svg {
    width: 20px; /* Adjust size as needed */
    height: 20px;
    display: block; /* Ensure SVG takes up its own block */
}

.search-input {
  width: 100%;
  padding: 0.6rem 0.75rem 0.6rem 2.25rem; /* extra left padding for icon */
  font-size: 1rem;
  color: var(--input-text);
  background-color: var(--input-bg);
  border: 1px solid transparent;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s ease;
  font-family: sans-serif;
  font-weight: 300;
}

.search-input::placeholder {
  color: var(--input-placeholder);
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
  font-size: 14px;
  letter-spacing: 5px;
}

.search-input:focus {
  outline: none;
  border-color: var(--input-focus);
  box-shadow: 0 0 0 3px var(--input-focus);
}

#channelCount {
  text-align: left;
  font-size: 12px;
  font-weight: bold;
  margin-bottom: 0;
  color: var(--highlight);
}

.list-container {
  flex: 1;
  overflow-y: auto;
  min-height: 0; /* Allow flex to shrink properly */
}

ul.channel-list {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 20px;
  letter-spacing: 0;
  word-spacing: 5px;
}

ul.channel-list li {
  margin-top: 5px;
  margin-bottom: 5px;
  padding: 0.5rem;
  cursor: pointer;
  border-radius: 0.375rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
  border-bottom: solid 1px rgba(255, 255, 255, 0.1);
}

ul.channel-list li.active {
  background: linear-gradient(90deg, #667eea, #764ba2);
  color: var(--active-color);
}

ul.channel-list li:hover:not(.active) {
  background-color: rgba(255, 255, 255, 0.1);
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-left: 8px;
  border-radius: 50%;
}

.status-online {
  background-color: #FFBF00;
}

.status-offline {
  background-color: #451208;
}

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

/* JWPlayer Styling (unchanged except for highlight color) */
.jwplayer .jw-controlbar {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.5), 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;
  fill: var(--highlight) !important;
  transition: color 0.3s ease;
}
.jwplayer .jw-icon:hover {
  color: var(--highlight) !important;
  fill: var(--highlight) !important;
}
.jwplayer .jw-progress, .jwplayer .jw-slider-volume .jw-progress, .jwplayer .jw-knob {
  background-color: rgba(255, 255, 255, 0.5) !important;
}
.jwplayer .jw-slider-volume .jw-knob, .jwplayer .jw-slider-horizontal .jw-knob {
  background-color: var(--highlight) !important;
}
.jwplayer .jw-background-color {
  background-color: transparent !important;
}
.jw-svg-icon-buffer path {
  display: none;
}
.jw-svg-icon-buffer {
  background-image: url('http://bisdaktv.store/loading.gif');
  background-repeat: no-repeat;
  background-position: center;
  background-size: 80px 80px;
  width: 100px;
  height: 100px;
  opacity: 0.6;
}

/* Ensure controls show on hover */
.jwplayer:hover .jw-controlbar,
.jwplayer:hover .jw-controls {
    display: block !important;
}

/* Update responsive styles */
@media screen and (max-width: 768px) {
  .container {
    padding: 0;
  }
  
  .sidebar {
    width: 100%;
    max-width: 320px;
  }
  
  .sidebar-toggle {
    left: 320px;
    width: 25px;
    height: 60px;
  }
  
  .sidebar.collapsed ~ .sidebar-toggle {
    left: 0;
  }
  
  .video-container {
    height: 100vh;
    border-radius: 0;
    aspect-ratio: auto;
  }

  #player, #player .jwplayer, .jwplayer {
    width: 100% !important;
    height: 100vh !important;
  }
  
  .list-container {
    height: calc(100vh - 180px);
    max-height: calc(100vh - 180px);
  }
}

/* Hide orientation-specific styles */
@media screen and (max-width: 768px) and (orientation: portrait) {
  body {
    transform: none;
    width: 100%;
    height: 100%;
    position: relative;
  }
}

#categoryFilter {
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 5px;
  border: 1px solid #ccc;
  color: var(--text-color);
  width: 100%;
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  cursor: default;
  background-color: var(--hover-bg);
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
}

.filter-label {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text);
}

.watermark {
  position: fixed;
  bottom: 1px;
  right: 1px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  opacity: 1;
  z-index: 1000;
  pointer-events: none;
}

/* Add startup overlay styles */
.startup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease-out;
}

.startup-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}

.startup-content {
    text-align: center;
    color: white;
    animation: fadeInUp 0.8s ease-out;
}

.startup-title {
    font-family: 'Audiowide', cursive;
    font-size: 3rem;
    margin-bottom: 0.5rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.startup-subtitle {
    font-size: 1.2rem;
    margin-bottom: 2rem;
    opacity: 0.9;
}

.start-watching-btn {
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    color: white;
    padding: 1rem 2rem;
    font-size: 1.1rem;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0 auto;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.start-watching-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.2);
}

.btn-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

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

/* Hide scrollbar during startup */
body.startup-mode {
    overflow: hidden;
}

/* Hide JW error overlays and text, and remove gray bg */
.jwplayer.jw-state-error,
.jwplayer.jw-state-error .jw-wrapper,
.jwplayer.jw-state-error .jw-preview,
.jwplayer.jw-state-error .jw-display {
  background: transparent !important;
}
.jwplayer .jw-error-msg,
.jwplayer.jw-state-error .jw-title,
.jwplayer.jw-state-error .jw-controls,
.jwplayer.jw-state-error .jw-display,
.jwplayer.jw-state-error .jw-text {
  display: none !important;
}

/* Add remote control styles */
.remote-control {
    position: fixed;
    bottom: 15px;
    right: 15px;
    background: linear-gradient(135deg, rgba(0, 0, 0, 0.9), rgba(30, 30, 30, 0.9));
    border-radius: 20px;
    padding: 15px;
    backdrop-filter: blur(15px);
    z-index: 1002;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5), 
                0 0 0 1px rgba(255, 255, 255, 0.1);
}

.remote-control:hover {
    transform: translateY(-3px) scale(1.02);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), 
                0 0 0 1px rgba(255, 255, 255, 0.2);
}

.remote-buttons {
    display: grid;
    grid-template-areas: 
        ". up ."
        "left center right"
        ". down .";
    gap: 4px;
    margin-bottom: 12px;
}

.remote-btn[data-action="up"] { grid-area: up; }
.remote-btn[data-action="left"] { grid-area: left; }
.remote-btn[data-action="right"] { grid-area: right; }
.remote-btn[data-action="down"] { grid-area: down; }

.remote-btn[data-action="left"],
.remote-btn[data-action="right"],
.remote-btn[data-action="up"],
.remote-btn[data-action="down"] {
    width: 38px;
    height: 38px;
    font-size: 14px;
}

.remote-btn {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #667eea, #764ba2);
    color: white;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3),
                inset 0 -2px 5px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.remote-btn:hover {
    background: linear-gradient(145deg, #764ba2, #667eea);
    transform: translateY(-2px) scale(1.1);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.remote-btn:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.3);
}

.number-pad {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.num-btn {
    width: 36px;
    height: 36px;
    font-size: 14px;
    font-weight: bold;
    border: none;
    border-radius: 12px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
}

.num-btn:hover {
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    transform: translateY(-1px) scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.num-btn:active {
    transform: translateY(0) scale(0.95);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.keyboard-guide {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 30px;
    border-radius: 15px;
    backdrop-filter: blur(15px);
    z-index: 1003;
    display: none;
    max-width: 300px;
}

.keyboard-guide.show {
    display: block;
    animation: fadeIn 0.3s ease;
}

.keyboard-guide h3 {
    margin-top: 0;
    color: #667eea;
}

.key-item {
    display: flex;
    justify-content: space-between;
    margin: 10px 0;
    font-size: 14px;
}

.key-item span:first-child {
    font-weight: bold;
    color: #667eea;
}

.close-guide {
    width: 100%;
    padding: 10px;
    margin-top: 15px;
    border: none;
    border-radius: 8px;
    background: #667eea;
    color: white;
    cursor: pointer;
}

/* Add styles for channel input display */
.channel-input-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 20px 40px;
    border-radius: 15px;
    font-size: 48px;
    font-weight: bold;
    z-index: 1004;
    animation: pulse 0.3s ease;
}

@keyframes pulse {
    0% { transform: translate(-50%, -50%) scale(0.8); }
    50% { transform: translate(-50%, -50%) scale(1.1); }
    100% { transform: translate(-50%, -50%) scale(1); }
}

.channel-display {
    position: fixed;
    top: 20px;
    right: 20px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 15px 25px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    z-index: 1001;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
}

.channel-display.show {
    opacity: 1;
    transform: translateY(0);
}

.channel-display.show-input {
    font-size: 36px;
    padding: 20px 40px;
}

.channel-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.channel-number {
    background: #667eea;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-weight: bold;
    font-size: 18px;
}

.channel-name {
    font-size: 16px;
}

/* Update channel list numbering */
#channelList li {
    position: relative;
    padding-left: 50px;
}

#channelList li::before {
    content: attr(data-number);
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: bold;
    min-width: 30px;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translate(-50%, -40%); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

/* Add remote control toggle button */
.remote-control-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 30px;
  height: 80px;
  background: linear-gradient(135deg, var(--sidebar-bg), #333); /* Standardize default background */
  border: none;
  border-radius: 8px 0 0 8px;
  color: var(--text-color);
  font-size: 20px;
  cursor: pointer;
  z-index: 1003;
  transition: all 0.3s ease;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
}

.remote-control-toggle:hover {
  background: linear-gradient(135deg, var(--hover-bg), #444); /* Standardize hover background */
  transform: translateY(-50%) scale(1.05) translateX(2px); /* Combine scale and translateX for hover */
}

.remote-control.hidden {
    transform: translateX(100px);
    opacity: 0;
    pointer-events: none;
}

/* Update remote control toggle icon size */
.remote-control-toggle .toggle-icon {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

@media (max-width: 768px) {
    .remote-control-toggle {
        width: 25px;
        height: 60px;
        font-size: 16px;
    }
    
    .remote-control.hidden {
        transform: translateX(80px);
    }
    
    .remote-control {
        bottom: 10px;
        right: 10px;
        padding: 15px;
    }
    
    .remote-btn, .num-btn {
        width: 40px;
        height: 40px;
        font-size: 16px;
    }
    
    .channel-display {
        top: 10px;
        right: 10px;
        padding: 10px 20px;
    }
}