/* ==========================================================================
   Sách Hiếm (sachhiem.net) — Responsive Mobile/Tablet & Desktop Enhancement
   Desktop (> 860px): Preserves the classic 3-column Sách Hiếm layout.
   Mobile/Tablet (<= 860px): Collapsible menu drawer + 100% fluid reading view.
   ========================================================================== */

/* Global sensible media & box sizing */
img, video {
  max-width: 100%;
  height: auto;
}

iframe {
  max-width: 100%;
}

/* Mobile Menu Toggle Bar (hidden on Desktop) */
.sh-mobile-menu-bar {
  display: none;
  background: #800000;
  color: #ffffff;
  padding: 10px 14px;
  font-family: Roboto, Tahoma, Arial, sans-serif;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 4px;
  margin: 6px 0;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}

.sh-pagination {
  margin: 14px 0;
  line-height: 1.8;
  word-wrap: break-word;
}

.sh-pagination a {
  display: inline-block;
  padding: 2px 6px;
  margin: 2px;
  border: 1px solid #d0d0d0;
  background: #fdfdfd;
  color: #800000;
  border-radius: 3px;
}

.sh-pagination .sh-page-current {
  display: inline-block;
  padding: 2px 7px;
  margin: 2px;
  font-weight: bold;
  background: #800000;
  color: #ffffff;
  border-radius: 3px;
}

/* Tablet & Mobile Responsive Rules (<= 860px) */
@media screen and (max-width: 860px) {
  body {
    margin-left: 8px !important;
    margin-right: 8px !important;
    font-size: 17px !important;
    line-height: 1.5 !important;
    overflow-x: hidden;
  }

  /* Make outer layout tables 100% fluid and stack columns */
  table.sh-layout-table,
  body > table,
  body > div > table {
    width: 100% !important;
    max-width: 100% !important;
  }

  table.sh-layout-table > tbody > tr > td#header,
  table.sh-layout-table > tbody > tr > td#nav,
  table.sh-layout-table > tbody > tr > td#main,
  table.sh-layout-table > tbody > tr > td#news,
  table.sh-layout-table > tbody > tr > td#footer,
  td#header,
  td#nav,
  td#main,
  td#news,
  td#footer {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
  }

  td#header {
    height: auto !important;
    min-height: 85px;
    background-size: cover !important;
  }

  /* Allow top category bar to scroll horizontally or wrap neatly on mobile */
  td#header table {
    width: 100% !important;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  td#header td.TDban {
    white-space: nowrap;
    padding: 6px 8px !important;
    font-size: 13px !important;
  }

  /* Show collapsible drawer button on mobile */
  .sh-mobile-menu-bar {
    display: flex !important;
  }

  td#nav.sh-nav-collapsed {
    display: none !important;
  }

  td#nav.sh-nav-expanded {
    display: block !important;
  }

  td#nav > table,
  td#main > table,
  td#news > table {
    width: 100% !important;
  }

  .indentLR50 {
    padding-left: 3% !important;
    padding-right: 3% !important;
  }

  .indent50 {
    padding-left: 12px !important;
  }

  h4, h5 {
    margin-left: 14px !important;
    margin-right: 14px !important;
  }

  /* Stack dual-column monthly archive and multi-chapter book iframes */
  table.sh-monthly-split > tbody > tr > td {
    display: block !important;
    width: 100% !important;
  }

  iframe[name="monthly"],
  iframe[name=" right"],
  iframe[name="right"],
  iframe[name="left"] {
    width: 100% !important;
  }
}
