/* === Chapter Page Core === */
.chapter-reader {
  padding: 30px 0px;
  max-width: 1000px;
  margin: 0 auto;
  color: #fff;
}

.chapter-top-title{
  font-size: 1rem;
  margin-bottom: 20px;
  font-weight: bold;
  text-align: center;
}

/* === Social Buttons === */
.socials {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 10px;
  margin: 10px 7px 30px;
}

.socials a {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: white;
  padding: 6px 10px;
  font-size: 0.7rem;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  height: 26px;
  line-height: 1;
  transition: background 0.3s ease;
}

.socials a:hover {
  background: rgba(255, 255, 255, 0.12);
}

/* === Container Utility === */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 7px;
  margin-bottom: 30px;
}

/* === Breadcrumb === */
.chapter-breadcrumb {
  display: flex;
  flex-wrap: nowrap;
  overflow: hidden;
  white-space: nowrap;
  gap: 6px;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);

  /* ✅ Glass Effect */
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: 6px;
  padding: 10px 15px;
  margin-bottom: 20px;
}

.chapter-breadcrumb a {
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
}

.chapter-breadcrumb a:hover {
  text-decoration: none;
  color: white;
}

/* ✅ Manhwa Title Truncation */
.manhwa-title-truncate {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex-shrink: 1;
}

/* === Chapter Title === */
.chapter-title {
  font-size: 1.2rem;
  margin-bottom: 20px;
  font-weight: bold;
  text-align: start;
}

/* === Description === */
.chapter-description {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 20px;
  text-align: center;
}

/* === Navigation Group (Full Width Buttons) === */
.nav-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: space-between;
  margin-bottom: 25px;
}

.nav-buttons {
  display: flex;
  flex: 1;
  gap: 10px;
}

.nav-btn {
  flex: 1;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  padding: 12px 0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.3s ease;
  text-decoration: none;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}

.nav-btn.disabled {
  opacity: 0.4;
  pointer-events: none;
}

.chapter-selector-wrapper {
  width: 100%;
}

.chapter-link-btn.full-width {
  width: 100%;
  margin-top: 5px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  padding: 12px 0;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.3s ease;
}

.chapter-link-btn.full-width:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* === Chapter Images === */
.chapter-images img {
  width: 100%;
  max-width: 800px;
  display: block;
  margin: 0 auto;
  object-fit: contain;
}

#closeDrawer {
  background: none;
  border: none;
  color: #fff;
  font-size: 1.1rem;
  padding: 4px;
  cursor: pointer;
}

#closeDrawer:hover {
  background: rgba(255, 255, 255, 0.05); /* optional hover effect */
}

/* === Loading / Error === */
.chapter-loading {
  text-align: center;
  padding: 40px 0;
}

.chapter-loading .spinner {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 12px;
}

.chapter-error {
  text-align: center;
  margin-top: 12px;
}

.page-retry-btn {
  margin-top: 8px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* === Responsive Fixes === */
@media (max-width: 768px) {

  .nav-btn,
  .chapter-link-btn.full-width {
    width: 100%;
    padding: 7px 0;
    font-size: 0.7rem;
  }

  html,
  body {
    overflow-x: visible !important;
  }

  /* ✅ IMPORTANT: allow body/page scroll on mobile */
  html, body{
    height: auto !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
  }

  .chapter-reader{
    height: auto !important;
    overflow: visible !important;
  }

  .chapter-images {
    /* make it as wide as the viewport… */
    width: 100vw;
    max-width: none;

    /* …then shift it back so its centre lines up with the page-centre */
    position: relative;
    left: 50%;
    transform: translateX(-50%);

    /* ✅ Do NOT make this an internal scroll container on mobile */
    overflow-y: visible;
    overflow-x: hidden;
    overscroll-behavior-y: auto;

    /* ✅ ensure touch swipe scroll works */
    touch-action: pan-y;

    /* optional: thin, custom scrollbar (mostly desktop/webview) */
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,0.7) rgba(0,0,0,0.2);
  }

  .chapter-images::-webkit-scrollbar {
    width: 1px;
  }
  .chapter-images::-webkit-scrollbar-track {
    background: rgba(0,0,0,0.2);
  }
  .chapter-images::-webkit-scrollbar-thumb {
    background-color: rgba(255,255,255,0.7);
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.3);
  }

  .chapter-images img {
    width: 100%;
    max-width: none;
    display: block;
    margin: 0;
    padding: 0;
  }

  .chapter-drawer {
    width: 90% !important;
    margin: 0 auto; /* center it if necessary */
  }

  .chapter-breadcrumb{
    font-size: 0.7rem;
  }

  .chapter-title{
    font-size: 1rem;
  }

  .chapter-top-title{
    font-size: 0.9rem;
  }

  .chapter-description{
    font-size: 0.7rem;
  }

  .manhwa-title-truncate {
    max-width: 150px;
  }
}

/* === Chapter Drawer === */
.chapter-drawer {
  position: fixed;
  top: 0;
  right: -100%;
  width: 320px;
  height: 100%;
  background: rgba(20, 20, 20, 0.9);
  backdrop-filter: blur(10px);
  border-left: 1px solid rgba(255, 255, 255, 0.1);
  transition: right 0.3s ease-in-out;
  z-index: 9999; /* ✅ VERY IMPORTANT */
  display: flex;
  flex-direction: column;
}

.chapter-drawer.open {
  right: 0;
}

.drawer-header {
  padding: 15px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: bold;
  color: #fff;
}

.drawer-body {
  padding: 0;
  overflow-y: auto;
  flex: 1;
}

.chapter-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 10px;
  margin: 12px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.chapter-card:hover {
  background: rgba(255, 255, 255, 0.06);
}

.chapter-card .thumb img {
  width: 60px;
  height: 100px;
  object-fit: cover;
  border-radius: 5px;
}

.chapter-card .info {
  flex: 1;
  min-width: 0; /* ✅ REQUIRED for ellipsis inside flex */
}

.chapter-card .info .title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 5px;

  white-space: nowrap;     /* ✅ single line only */
  overflow: hidden;        /* ✅ cut overflow */
  text-overflow: ellipsis; /* ✅ show ... */
  display: block;
}

.chapter-card .info .meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #ccc;
}

.vip-badge {
  font-size: 0.7rem;
  background: #ff2e63;
  color: #fff;
  padding: 2px 6px;
  border-radius: 4px;
  text-decoration: none;
}

/* === Scrollbar Styling === */
.drawer-body::-webkit-scrollbar {
  width: 6px;
}

.drawer-body::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.15);
  border-radius: 6px;
}

/* === Additional Responsive Fix === */
@media (max-width: 991px) {
  .main-content {
    padding: 0;
  }

  .chapter-nav {
    flex-direction: column;
  }
}
