

body {
  flex-direction: row-reverse; /* Sidebar on right */
  min-height: 100vh;
  margin: 0;
  background-color:#F2F0EE;
}

/* Keep your existing btop styles */
.btop {
  width: 100%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  background-color: var(--alabaster);
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Navbar links styling */
.btop .nav-link, a {
  position: relative;
  color: var(--light-blue);
  margin-left: 15px;
  font-weight: bold;
  text-decoration:none;
}

.btop .nav-link:before {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0px;
  width: 0px;
  height: 1px;
  background-color: var(--light-blue);
  transition: width 1s .5s;
}

.btop .nav-link:hover:before {
  width: 100%;
  transition: width 1s;
}


/* FOOTER */
.bfooter {
  width: 100%;
  position: fixed;
  bottom: 0;
  left: 0;
  z-index: 1000;
  background-color: var(--alabaster);
  text-align: center;
  padding: 10px 20px;
}

/* Navbar styles */
.navbar .navbar-brand {
  font-size: 10px;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
}

.navbar-nav .nav-link {
  margin-right: 1rem;
  font-size: 10px;
  padding-top: 0;  
  padding-bottom: 0;
}

.nav-item{padding:0px;}

.navbar-toggler {
  margin-right: 1rem;
}

/* Offcanvas background */
.offcanvas {
  background-color: #111;
}

.navbar-nav .nav-link {
  background-color: transparent !important;
}

.offcanvas .nav-link {
  background-color: #111;
  color: #000;
}

@media (min-width: 992px) {
  .navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.1);
  }
}

@media (max-width: 991.98px) {
  .offcanvas .btn-close {
    filter: invert(1) brightness(2);
  }
}

.navbar .container-fluid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
}

/* --- DESKTOP --- */
/* --- Sidebar (fixed on desktop) --- */
#sidebar {
  position: fixed;
  top: 100px; /* below decorative border */
  right: 40px;
  width: 260px;
  background-color: rgba(255, 255, 255, 0.85);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  font-family: var(--bodyfont);
  z-index: 10;
  height: auto;
  max-height: 80vh;
  overflow-y: auto;
}



/* --- MOBILE --- */
@media (max-width: 768px) {
  #sidebar {
    display: none; /* hide sidebar on mobile */
  }

  #mobileNav {
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: #C3B092;
    padding: 0.5rem;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.2);
    z-index: 1000 !important;
  }
#mobileNav select {
  flex: 1;
  margin: 0 0.25rem;
  padding: 0.5rem;
  border-radius: 4px;
  background: #DDDCD8;
  font-size: 0.9rem;
  color: #000;
  appearance: auto;
  -webkit-appearance: menulist;
  border: 1px solid #aaa;
}

  #mobileNav button {
    flex: 1;
    margin: 0 0.25rem;
    padding: 0.5rem;
    border: none;
    border-radius: 4px;
    background: #DDDCD8;
    font-size: 0.9rem;
  }

  #mobileNav button:hover {
    background: #EAEAE9;
  }

  body {
    padding-bottom: 4rem; /* space so content isn't hidden behind bottom nav */
  }
}

#sidebar h2 {
  font-size: 2rem;
  margin-bottom: 1rem;
}

select {
  width: 100%;
  padding: 0.5rem;
  margin-bottom: 0.5rem;
  border-radius: 4px;
  border: none;
}


button {
  width: 100%;
  padding: 0.6rem;
  background: #DDDCD8;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  margin-top: 0.5rem;
}

button:hover { background: #EAEAE9; }

/* --- Comic Layout --- */
#content-wrapper {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin: 80px auto 40px auto; /* Push below decorative top border */
  width: calc(100% - 160px); /* Fit within your side borders */
  position: relative;
  z-index: 5; /* Below decorative border, above background */
}

/* Viewer */
#viewer {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  text-align: center;
}

#viewer img {
  display: block;
  margin: 0 auto 2rem auto;
  box-shadow: 0 2px 10px rgba(0,0,0,0.6);
  width: auto;
  max-width: none;
  height: auto;
}
@media (max-width: 768px) {
  #viewer img {
    max-width: 100%;
    width: 100%;
    height: auto;
  }
}


#chapterTitle {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

#content {
  display: flex;
  flex-direction: row-reverse;
}
@media (max-width: 768px) {
  .bfooter, .bbotr { display: none; }
}
.left, .right { pointer-events: none !important; }


/* Fix mobile dropdowns not opening inside fixed containers */
@supports (-webkit-touch-callout: none) {
  #mobileNav select {
    position: static !important;
    transform: translateZ(0);
  }

  #mobileNav {
    -webkit-overflow-scrolling: touch;
    overflow: visible !important;
  }

  select {
    z-index: 999999 !important;
    background-color: #DDDCD8;
  }
}