/* ---------- READER SHELL LAYOUT ---------- */
/* ---------- READER SHELL LAYOUT ---------- */
/* ---------- READER SHELL LAYOUT ---------- */

/*
  Three-column layout: [sidebar-main] [reader-content] [sidebar-reader]
  On desktop: sidebars push the center content by animating their width.
  On mobile:  sidebars overlay the content (position: fixed).
*/

/* The shell fills the viewport below the header */
#reader-shell {
  display: flex;
  position: fixed;
  top: 0; /* match your header height — consider using a CSS var */
  left: 0;
  right: 0;
  bottom: 0;
  overflow: hidden;
}

/* Center column: scrollable, fills remaining space */
#reader-content {
  flex: 1;
  min-width: 0; /* prevents flex blowout */
  display: flex;
  flex-direction: column;
}

#chapter-reader {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
}

/* ---- DESKTOP SIDEBAR SLOTS (push behavior) ---- */
@media (min-width: 769px) {

  /* Both sidebars sit inside the flex row */
  #sidebar-main,
  #sidebar-reader {
    position: relative; /* override fixed */
    transform: none !important; /* override any translate */
    flex-shrink: 0;
    width: 0;
    overflow: hidden;
    transition: width 0.3s ease;
    /* Keep your existing background/color styles */
  }

  /* Inner content keeps its fixed width so it doesn't squish */
  #sidebar-main > *,
  #sidebar-reader > * {
    width: 256px; /* match the open width */
    min-width: 256px;
  }

  /* Open state — width expands and pushes center content */
  #sidebar-main.active,
  #sidebar-reader.active {
    width: 256px;
  }

  /* Overlays are not needed on desktop */
  #sidebar-main-overlay,
  #sidebar-reader-overlay {

  }
}

/* ---- MOBILE SIDEBAR SLOTS (overlay behavior) ---- */
@media (max-width: 768px) {

  /* Shell is no longer fixed — let the page flow normally */
  #reader-shell {
    position: static;
    display: block;
    overflow: visible;
  }

  #reader-content {
    overflow-y: visible;
  }

  /* Main sidebar slides in from the left */
  #sidebar-main {
    position: fixed;
    top: 0;
    left: 0;
    width: 256px;
    min-height: 100vh;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    z-index: 1000;
    overflow-y: auto;
  }

  #sidebar-main.active {
    transform: translateX(0);
    width: 256px; /* ensure width is set on mobile too */
  }

  /* Reader sidebar slides in from the right */
  #sidebar-reader {
    position: fixed;
    top: 45px;
    right: 0;
    width: 256px;
    min-height: 100vh;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 1000;
    overflow-y: auto;
  }

  #sidebar-reader.active {
    transform: translateX(0);
    width: 256px;
  }

  /* Overlays appear on mobile */
  #sidebar-overlay,
  #sidebar-reader-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
    z-index: 999;
  }

  #sidebar-overlay.active,
  #sidebar-reader-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }
}



/* ---------- PAGE RENDERER ---------- */
/* ---------- PAGE RENDERER ---------- */
/* ---------- PAGE RENDERER ---------- */

#chapter-reader {
  flex: 1;
  min-width: 0;
}

.chapter-page {
  display: block;
}



/* Single page mode */
.mode-single {
  display: flex;
  justify-content: center;
}

.mode-single .chapter-page {
  display: none;
}

.mode-single .chapter-page.active {
  display: block;
}



/* Double page mode */
.mode-double .chapter-pages {
  display: flex;
  justify-content: center;
}

.mode-double .chapter-page,
.mode-double .page-slot {
  display: none;
}

.mode-double .chapter-page.active {
  display: inline-block;
}

.empty-slot {
  background: transparent;
}



/* webtoon mode*/
.mode-webtoon .chapter-pages {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mode-webtoon .chapter-pages img {
  width: 100%;
}








/* ---------- READER SIDEBAR ---------- */
/* ---------- READER SIDEBAR ---------- */
/* ---------- READER SIDEBAR ---------- */
.sidebar-reader {
  /* Width/position handled above per breakpoint */
  background: #89c1cc;
  color: #000;
  display: flex;
  flex-direction: column;
  height: 100%;
}
.sidebar-reader-close {
  font-size: 20px;
  background: none;
  border: none;
  cursor: pointer;
}
#sidebar-reader-open {
  font-size: 24px;
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  vertical-align: middle;
  padding: 0px 5px 0px 25px;
}





/* SIDEBAR BUTTONS */
.reader-btn {
  border: none;
  cursor: pointer;
  transition-duration: 0.2s;
  height: 40px;
  width: 248px;
  margin: 2px 4px 2px 4px;
  background-color: #f7fffe;
}
.reader-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}
#two-btns {
  padding: 0px;
  gap: 0px;
  height: 40px;
}





/* NAVIGATION BUTTONS */
.chapter-navigation, #reader-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}
/* Arrow buttons */
.chapter-navigation .chapter-prev,
.chapter-navigation .chapter-next, #prev-page, #next-page {
  border: none;
  border-radius: 8px;
  width: 36px;
  height: 40px;
  font-size: 22px;
  cursor: pointer;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}
.chapter-navigation .chapter-prev:disabled,
.chapter-navigation .chapter-next:disabled, #prev-page:disabled, #next-page:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
/* Dropdown wrapper */
.chapter-dropdown-wrapper {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  border-radius: 8px;
  padding: 6px 32px 6px 12px; /* right padding leaves room for chevron */
  min-width: 120px;
  cursor: pointer;
}
/* Label */
.chapter-dropdown-label {
  font-size: 11px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  align-self: flex-start;
  pointer-events: none;
}
/* Select */
.chapter-dropdown, #page-dropdown {
  background: transparent;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  font-size: 14px;
  font-weight: 600;
  color: #333;
  cursor: pointer;
  width: 100%;
  padding: 0;
}




/*LIKE + LIBRARY BUTTONS*/
#like-btn {
  display: inline-block;
  width: 40px;
  margin: 2px 2px 2px 4px;
  padding: 0px;
  vertical-align: top;
  justify-content: center;
}
/*Unliked state 8*/
.like-btn .heart-icon {
    fill: none;
    transition: fill 0.2s ease;
}
/* Liked state */
.like-btn.liked .heart-icon {
    fill: gray;
}
#library-btn {
  display: inline-block;
  width: 150px;
  margin: 2px 4px 2px 2px;
  padding: 0px;
  vertical-align: top;
  justify-content: center;
  align-items: center;
}

















/* ---------- READER HEADER ---------- */
/* ---------- READER HEADER ---------- */
/* ---------- READER HEADER ---------- */
.header-reader {
  transition: height 0.3s ease, opacity 0.3s ease;
  height: 50px;
  position: sticky;
  background-color: #547a8c;
}

.header-reader-hidden .header-reader {
  height: 0px;
  opacity: 0;
  pointer-events: none;
}

/* Hide sidebar open buttons when their sidebar is active */
#sidebar-main.active ~ * #sidebar-main-open,
body:has(#sidebar-main.active) #sidebar-main-open {
  display: none;
}

body:has(#sidebar-reader.active) #sidebar-reader-open {
  display: none;
}