/* References

   1. Layout & Flexbox:
      - W3Schools: https://www.w3schools.com/css/css3_flexbox.asp
      - MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox
      - CSS-Tricks: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

   2. Box Model, Padding, Margin, Borders, Shadow:
      - W3Schools: https://www.w3schools.com/css/css_box.asp
      - MDN: https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model
      - CSS-Tricks: https://css-tricks.com/almanac/properties/b/box-shadow/

   3. Text, Headings, Links:
      - W3Schools: https://www.w3schools.com/css/css_text.asp
      - MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
      - CSS-Tricks: https://css-tricks.com/almanac/properties/t/text-align/
      - freeCodeCamp: https://www.freecodecamp.org/news/css-text-properties/

   4. Images & Logos:
      - W3Schools: https://www.w3schools.com/css/css3_object-fit.asp
      - MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit
      - CSS-Tricks: https://css-tricks.com/almanac/properties/o/object-fit/

   5. Lists:
      - W3Schools: https://www.w3schools.com/css/css_list.asp
      - MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/list-style
      - CSS-Tricks: https://css-tricks.com/almanac/properties/l/list-style/

   6. Forms & Inputs:
      - W3Schools: https://www.w3schools.com/css/css_form.asp
      - MDN: https://developer.mozilla.org/en-US/docs/Learn/CSS/Styling_text_inputs
      - CSS-Tricks: https://css-tricks.com/snippets/css/styling-cross-browser-compatible-inputs/

   7. Buttons:
      - W3Schools: https://www.w3schools.com/css/css_buttons.asp
      - MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Buttons
      - CSS-Tricks: https://css-tricks.com/snippets/css/styling-cross-browser-compatible-buttons/

   8. Dark Mode / Theme Toggle:
      - W3Schools: https://www.w3schools.com/howto/howto_css_dark_mode.asp
      - MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/@media/prefers-color-scheme
      - CSS-Tricks: https://css-tricks.com/a-complete-guide-to-dark-mode-on-the-web/

   9. Responsive Design & Media Queries:
      - W3Schools: https://www.w3schools.com/css/css_rwd_mediaqueries.asp
      - MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/Media_Queries/Using_media_queries
      - CSS-Tricks: https://css-tricks.com/snippets/css/media-queries-for-standard-devices/

   10. Transitions & Animations:
      - W3Schools: https://www.w3schools.com/css/css3_transitions.asp
      - MDN: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Transitions/Using_CSS_transitions
      - CSS-Tricks: https://css-tricks.com/almanac/properties/t/transition/

*/

body {
  background: #82d2f3;
  font-family: Arial, sans-serif;
  margin: 0;
  padding: 20px;
  text-align: center;
  transition: background 0.3s, color 0.3s;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 20px;
}

/* Logo */
.logo {
  height: 120px;
  display: block;
  margin: 0 auto 10px;
}

/* Headings */
h1 {
  color: #222;
  margin-bottom: 10px;
  transition: color 0.3s;
}

h2 {
  text-align: center;
  transition: color 0.3s;
}

/* Channels container */
.channels-container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  gap: 20px;
  align-items: flex-start;
}

/* Individual column */
.channel-column {
  flex: 1 1 48%;
  box-sizing: border-box;
  min-width: 300px;
  background: #fff;
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.1);
  text-align: left;
  word-wrap: break-word;
  white-space: normal;
  transition: background 0.3s, color 0.3s, box-shadow 0.3s;
}

/* Column headings */
.channel-column h2 {
  color: #000000;
  border-bottom: 2px solid #0073e6;
  padding-bottom: 5px;
}

/* Channel lists */
.channels-list ul {
  list-style: none;
  padding-left: 0;
  margin: 10px 0 20px 0;
}

/* Channel list items */
.channels-list li {
  margin: 4px 0;
  padding: 10px 8px;
  background: #f8f8f8;
  border-radius: 4px;
  min-height: 60px;
  display: flex;
  align-items: center;
  overflow: visible;
  transition: background 0.3s, color 0.3s;
}

/* Channel list links */
.channels-list li a {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: #0073e6;
  word-wrap: break-word;
  transition: color 0.3s;
}

.channels-list li a:hover {
  text-decoration: underline;
}

/* Channel logos */
.channels-list img {
  width: 100px;
  height: 100px;
  object-fit: contain;
  vertical-align: middle;
  flex-shrink: 0;
}

/* Search container */
#search-container {
  margin: 15px 0;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

#search-input {
  width: 250px;
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  transition: border-color 0.2s, background 0.3s, color 0.3s;
}

#search-input:focus {
  border-color: #0073e6;
  outline: none;
}

#clear-search {
  display: none;
  background: #f2f2f2;
  border: 1px solid #ccc;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

#clear-search:hover {
  background: #0073e6;
  color: white;
  border-color: #0073e6;
}

/* Schedule */
#schedule {
  text-align: left;
  width: 60%;
  margin: 0 auto;
  transition: color 0.3s;
}

/* Footer */
footer {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #111;
  color: #fff;
  text-align: center;
  padding: 10px 0;
  font-size: 14px;
  z-index: 100;
  transition: background 0.3s, color 0.3s;
}

footer a {
  color: white;
}

footer a:hover {
  color: #d9d9d9;
}

/* Header logo */
.header-logo {
  height: 200px;
  width: auto;
}

/* Logo container */
.logo-container {
  width: 350px;
  height: 125px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto;
  overflow: hidden;
}

/* Logo image */
.logo {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  margin: 2px auto;
}

/* Highlight styles */
.past {
  opacity: 0.5;
}

.current {
  border-left: 4px solid red;
  padding-left: 6px;
  background: #fffaf8;
}

/* -------------------------------
   DARK MODE
---------------------------------*/
/* Theme toggle button */
#theme-toggle {
  position: fixed;
  top: 12px;
  right: 12px;
  min-width: 44px;
  height: auto;
  padding: 6px 10px;
  border-radius: 50%;
  border: none;
  font-size: 14px;
  line-height: 1.1;
  cursor: pointer;
  background: #f4f4f4;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  z-index: 99999;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  transition: background 0.3s, color 0.3s, transform 0.2s;
  white-space: pre;
  font-weight: bold;
}


#theme-toggle:hover {
  background-color: lightgray;
  transform: scale(1.06);
}

#theme-toggle .theme-label {
  font-size: 10px;
  /* smaller font so it fits nicely */
  line-height: 1.1;
  margin-top: 2px;
  display: block;
  white-space: pre;
  /* respects <br> in innerHTML */
}

/* Dark mode styling */
body.dark-mode #theme-toggle {
  background: #222;
  color: #f4f4f4;
}

/* Base dark mode */
body.dark-mode {
  background: #121212;
  color: #f1f1f1;
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4,
body.dark-mode h5,
body.dark-mode h6 {
  color: #f1f1f1;
}

body.dark-mode .channel-column h2 {
  color: #f1f1f1;
  border-bottom-color: #66aaff;
}

body.dark-mode header p {
  color: #ccc;
}

body.dark-mode .channel-column {
  background: #1e1e1e;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.04);
}

body.dark-mode .channels-list li {
  background: #222;
  color: #f1f1f1;
}

body.dark-mode a {
  color: #66aaff;
}

body.dark-mode #schedule {
  color: #f1f1f1;
}

body.dark-mode #schedule h2 {
  color: #ddd;
}

body.dark-mode #schedule ul li {
  background: #1e1e1e;
  color: #f1f1f1;
  box-shadow: 0 1px 3px rgba(255, 255, 255, 0.05);
}

body.dark-mode #schedule ul li .title {
  color: #f1f1f1;
}

body.dark-mode #schedule ul li .synopsis {
  color: #ccc;
}

body.dark-mode .past {
  opacity: 0.6;
}

/* ============================================
   INDEX PAGE STYLES
   ============================================ */

/* Hide Now & Next under 500px */
@media (max-width: 768px) {
  .mini-epg {
    display: none !important;
  }
}

/* Wrap Now/Next text */
.mini-epg div {
  white-space: normal;
  overflow-wrap: break-word;
  word-break: break-word;
  max-width: 100%;
  margin-bottom: 2px;
}

/* Dark mode Now & Next */
body.dark-mode .mini-epg {
  color: #e6e6e6 !important;
}

/* Channel name area */
.channel-name {
  min-width: 180px;
  display: inline-block;
}

/* Center category headings */
.channel-category h3 {
  text-align: center;
}

/* Channels layout */
.channels-container {
  display: flex;
  gap: 20px;
}

/* Responsive stacking */
@media (max-width: 952px) {
  .channels-container {
    flex-direction: column;
  }

  .channel-column {
    width: 100%;
  }
}

/* INDEX layout specifics */
body>.channels-container {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  max-width: 1400px;
  margin: 0 auto;
  align-items: flex-start;
}

body>.channels-container .channel-column {
  flex: 1 1 48%;
  box-sizing: border-box;
  text-align: left;
}

body>.channels-container .channel-column h2 {
  margin-top: 0;
}

.channel-link {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.channel-logo {
  background-color: transparent !important;
  box-shadow: none !important;
  border: none !important;
  max-width: 100px;
  max-height: 40px;
  object-fit: contain;
  flex-shrink: 0;
  background: #fff;
}

.channel-number {
  width: 150px;
  text-align: center;
  font-weight: bold;
  color: #000;
}

body.dark-mode .channel-number {
  color: #fff;
}

#channel-logo {
  flex-grow: 1;
  font-size: 14px;
  word-break: break-word;
  padding: 0;
  margin: 0;
  vertical-align: middle;
  line-height: 1.1;
}

#channel-name {
  text-align: center;
  font-size: 15px;
  font-weight: bold;
  color: #000;
}

body.dark-mode #channel-name {
  color: #e0e0e0;
}

body.dark-mode #channel-logo {
  background: #1e1e1e;
  box-shadow: 0 0 3px rgba(255, 255, 255, 0.1);
}

/* ============================================
   LISTINGS PAGE STYLES
   ============================================ */

h1,
h2 {
  color: #222;
}

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

li {
  margin-bottom: 1em;
  padding: 8px;
  background: #fff;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.programme-img {
  width: 105px;
  height: 148px;
  object-fit: contain;
  border-radius: 6px;
  flex-shrink: 0;
}

.programme-text {
  flex: 1;
}

.title {
  font-weight: bold;
}

.logo-container img.logo {
  max-width: 300px;
  height: auto;
  display: block;
  margin: 0 auto;
}

.synopsis {
  font-style: italic;
  color: #555;
  margin-left: 1em;
}

#loading {
  font-weight: bold;
  color: #0073e6;
  margin-bottom: 1em;
  text-align: center;
}

#schedule {
  text-align: left;
  width: 70%;
  margin: 0 auto;
}

.past {
  opacity: 0.8;
}

/* Main button styling */
.custom-btn {
  background-color: grey;
  color: #fff;
  border: 2px solid #ffd95c;
  font-weight: bold;
  box-shadow:
    0 0 0 0 #ffd95c,
    /* initial solid border */
    0 0 20px 10px rgba(255, 217, 92, 0.4);
  /* fading glow */
  transition: box-shadow 0.3s, transform 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
}

.custom-btn:hover {
  background-color: #000;
  box-shadow: 0 0 30px 15px rgba(255, 217, 92, 0.5);
  transform: translateY(-2px);
  /* optional lift */
}

body.dark-mode .custom-btn {
  color: #fff;
  background-color: grey;
  border: 2px solid #fff;
  box-shadow:
    0 0 0 0 #fff,
    0 0 20px 10px grey;
  transition: box-shadow 0.3s, transform 0.2s;
}

/* Positioning (unchanged) */
#scroll-top,
#scroll-now,
#prev-day,
#next-day {
  position: fixed;
  z-index: 9999;
}

#scroll-top {
  left: 10px;
  bottom: 40px;
}

#scroll-now {
  right: 10px;
  bottom: 40px;
}

#prev-day {
  left: 10px;
  top: 50%;
  width: 130px;
}

#next-day {
  right: 10px;
  top: 50%;
  width: 130px;
}

/* Hover */
/* .custom-btn:hover {
  background-color: var(--button-hover);
  transform: scale(1.05);
}


body.dark-mode .custom-btn {
  background-color: #444;
}

body.dark-mode .custom-btn:hover {
  background-color: #222;
} */

#logo-image {
  width: 100px;
  height: auto;
  display: block;
  margin: 0 auto;
}