/* Import Plus Jakarta Sans font */


* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}



body {
  background-color: #ffffff;
  color: #333;
  line-height: 1.8;
  font-size: 14px;
  transition: all 0.3s ease;
}

.mobile-none{
    display: none !important;
}

.reader-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* Header */
.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: white;
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64PX;
  border-bottom: 3px solid #e9ecef;
}

.container {
  display: flex;
  flex-direction: row;
  width: 100%;
  max-width: 840px;
  margin: 0 auto;

  justify-content: space-between;
}

.menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
}

.menu-btn:hover {
  background: #f8f9fa;
}

.chapter-info {
  flex: 1;
  text-align: center;
  margin: 0 15px;
}

.chapter-title {
  font-size: 16px;
  font-weight: 500;
  color: #333;

  place-content: center;
}

.header-actions {
  display: flex;
  gap: 16px;
}

.action-btn {
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  color: #333;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 11px;
}

.action-btn:hover {
  background: #f8f9fa;
}

/* Main Content */
.reader-content {
  flex: 1;
  padding: 24px 20px;
  max-width: 100%;
}

.chapter-content {
  max-width: 840px;
  margin: 0 auto;
}

.chapter-content p {
  margin-bottom: 16px;
  line-height: inherit;
  font-size: inherit;
}




.nav-btn:hover {
  background: #007bff;
  color: white;
}

.next-btn {
  background: #007bff;
  color: white;
}

.next-btn:hover {
  background: #0056b3;
}

/* Bottom Toolbar */
.bottom-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fff;
  border-top: 1.5px solid #f0f0f0;
  padding: 0 24px;
  height: 64px;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 11;
}

.toolbar-left,
.toolbar-center,
.toolbar-right,
.toolbar-popup {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Toolbar icon buttons */
.toolbar-btn {
  background: none;
  border: none;
  font-size: 22px;
  color: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 54px;
  cursor: pointer;
  transition: color 0.2s;
  padding: 8px;
}

.toolbar-btn:active,
.toolbar-btn:focus {
  color: #1976d2;
}

.text-icon {
  font-size: 20px;
  font-weight: 600;
  color: #222;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 54px;
}

/* Navigation buttons */
.nav-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 500;
  border-radius: 12px;
  border: 1.5px solid #1976d2;
  background: #fff;
  color: #1976d2;
  padding: 0 22px;
  height: 40px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
  margin-right: 8px;
  box-sizing: border-box;
}

.nav-btn i,
.nav-btn svg {
  font-size: 18px;
  vertical-align: middle;
}

.nav-btn.prev-btn i,
.nav-btn.prev-btn svg {
  margin-right: 6px;
}

.nav-btn.next-btn i,
.nav-btn.next-btn svg {
  margin-left: 6px;
}

.nav-btn.next-btn {
  background: #007aff;
  color: #fff;
  border: 1.5px solid #007aff;
  margin-right: 0;
}

.nav-btn:active,
.nav-btn:focus {
  filter: brightness(0.95);
}

.nav-btn.prev-btn {
  background: #fff;
  color: #007aff;
  border: 1.5px solid #007aff;
}

.nav-btn.prev-btn:hover,
.nav-btn.prev-btn:focus {
  background: #f0f8ff;
}

.nav-btn.next-btn:hover,
.nav-btn.next-btn:focus {
  background: #005be8;
  color: #fff;
}

/* Remove last margin on nav-btn group */
.toolbar-center .nav-btn:last-child {
  margin-right: 0;
}

/* Overlay */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
}

.overlay.active {
  display: flex;
}

/* Chapter Dropdown */
.chapter-dropdown {
  width: 840px;
  height: calc(100% - 126px);
  position: fixed;
  top: 62px;
  left: calc((100% - 840px) / 2);
  background: white;
  z-index: 1000;
  display: none;
  overflow-y: auto;
  border-left: 1px solid #e9ecef;
  border-right: 1px solid #e9ecef;
}

.chapter-dropdown.active {
  display: block;
}

.chapter-list {
  padding: 0;
}

.chapter-item {
  display: flex;
  align-items: center;
  padding: 16px 20px;
  cursor: pointer;
  transition: background 0.2s ease;
  gap: 12px;
}

.chapter-item svg {
  position: absolute;
  left: 11px;
}

.chapter-item:hover {
  background: #f8f9fa;
}

.chapter-item.active {
  background: #f0f8ff;
}

.chapter-item:last-child {
  border-bottom: none;
}

.check-icon {
  color: #007bff;
  flex-shrink: 0;
}

.chapter-info {
  flex: 1;
  display: flex;
  gap: 8px;
}

.chapter-number {
  font-weight: 600;
  color: #333;
}

.chapter-name {
  color: #666;
}

/* Settings Panel */
.settings-panel {
  position: fixed;
  top: 0;
  left: -400px;
  width: 304px;
  height: 100vh;
  background: white;
  box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 10;
  transition: left 0.3s ease;
  overflow-y: auto;
}

.settings-panel.active {
  left: 0;
}

.settings-title {
  display: flex;

  align-items: center;
  gap: 10px;
}

.settings-header svg {
  width: 20px;
  height: 20px;
}

.settings-header {
  display: flex;
  font-size: 18px;
  font-weight: 600;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid #e9ecef;
  gap: 16px;

  justify-content: space-between;
}

.close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  border-radius: 4px;
  color: #666;
}

.close-btn:hover {
  background: #f8f9fa;
}

.settings-content {
  padding: 24px;
}


.setting-group {
  margin-bottom: 24px;
}

.setting-label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  color: #333;
  margin-bottom: 12px;
}

.color-options {
  display: grid;
  grid-template-columns: repeat(5, 0fr);
  gap: 14px;
}

.color-option {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.color-option:hover {
  transform: scale(1.1);
}

.color-option.active {
  border-color: #007bff;
}

.setting-control {
  display: flex;
  align-items: center;
  gap: 0;
}


.control-btn {
  width: 48px;
  height: 48px;
  border: 1px solid #007bff;
  background-color: #fff;
  color: #007bff;
  font-size: 18px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s;
}

.control-btn:hover {
  background-color: #f0f8ff;
}

.control-btn:first-of-type {
  border-radius: 6px 0 0 6px;
  border-right: none;
}

.control-btn:last-of-type {
  border-radius: 0 6px 6px 0;
  background-color: #007bff;
  color: white;
}

.control-btn:last-of-type:hover {
  background-color: #0056b3;
}

.control-value {
  background-color: #f5f5f5;
  border: 1px solid #ddd;
  border-radius: 8px;
  height: 48px;
  width: 152px;
  place-content: center;
  font-size: 14px;
  color: #333;
  min-width: 80px;
  text-align: center;
  margin-right: 8px;
}

.font-select {
  width: 256px;
  height: 48px;
  padding: 10px;
  place-content: center;
  border: 1px solid #ddd;
  border-radius: 8px;
  background-color: #f5f5f5;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
}

.font-select:focus {
  outline: none;
  border-color: #007bff;
}

/* Comments Panel */
.comments-panel {
  position: fixed;
  top: 0;
  right: -400px;
  width: 400px;
  height: 100vh;
  background: white;
  box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
  z-index: 1001;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.comments-panel.active {
  right: 0;
}

.action-btn svg {
  width: 22px;
  height: 22px;
}

.comments-header {
  display: flex;
  align-items: center;
  padding: 11px;
  border-bottom: 1px solid #e9ecef;
  gap: 16px;
  flex-direction: row-reverse;
  justify-content: space-between;
}

.comments-content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.comment-item {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.comment-avatar {
  position: relative;
  flex-shrink: 0;
}

.comment-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #e9ecef;
}

.online-status {
  position: absolute;
  top: 30px;
  right: 0;
  width: 12px;
  height: 12px;
  background: #28a745;
  border-radius: 50%;
  border: 2px solid white;
}

.comment-body {
  flex: 1;
}

.comment-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 4px;
  flex-direction: column;
}

.username {
  font-weight: 600;
  color: #333;
}

.comment-time {
  font-size: 12px;
  color: #999;
}

.comment-text {
  margin-bottom: 8px;
  line-height: 1.4;
  color: #333;
}

.comment-actions {
  display: flex;
  gap: 16px;
}

.comment-actions .action-btn {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 12px;
  padding: 4px 0;

}

.comment-actions .action-btn:hover {
  color: #007bff;
}

.comment-input-section {
  padding: 7px;
  border-top: 1px solid #e9ecef;
}

.comment-input-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
}

.input-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #007bff;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 14px;
}

.comment-input {
  flex: 1;
  width: 48px;
  height: 48px;
  place-content: center;
  padding: 10px;
  border: 1px solid #dee2e6;
  border-radius: 10px;
  outline: none;
  font-size: 14px;
}

.comment-input:focus {
  border-color: #007bff;
}

.send-btn {
  height: 48px;
  width: 84px;
  place-content: center;
  background: #ffffff;
  color: #535557;

  border: 1px solid #E5E7EA;
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
}

.send-btn:hover {
  background: #1486ff;
}

/* Theme Classes */
.theme-dark {
  background-color: #2c2c2c;
  color: #e0e0e0;
}

.theme-sepia {
  background-color: #f4f1e8;
  color: #5c4b37;
}

.theme-gray {
  background-color: #e8e8e8;
  color: #333;
}

.theme-green {
  background-color: #e8f5e8;
  color: #2d5a2d;
}

.theme-blue {
  background-color: #e8f4f8;
  color: #1e3a5f;
}

.theme-pink {
  background-color: #fdf2f8;
  color: #7c2d5a;
}

.theme-purple {
  background-color: #f3e8ff;
  color: #5b2c87;
}

.theme-pinky {
  background-color: #e4459c;
  color: #ffffff;
}

.theme-purpless {
  background-color: #955dcf;
  color: #c3b2d3;
}

/* Thêm style cho popup */
.popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.25);
  display: none;
  z-index: 100;
}

.popup-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #fff;
  padding: 24px;
  border-radius: 10px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.popup-content p {
  margin-bottom: 24px;
}

.popup-content button {
  place-content: center;
  max-width: 143px;
  height: 48px;
  width: 35vw;
}

.popup-close {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 18px;
  cursor: pointer;
  background: none;
  border: none;
  font-size: 22px;
  color: #222;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  padding: 8px;
}



.comment-text{
  width: 200px;
  white-space: normal;
  overflow-wrap: break-word;
}


.mobile {
  display: none;
}

.reader-header .container i {
  font-size: 22px;
}

/* Responsive */
@media (max-width: 768px) {
  .custom-image-class-mobile {
    margin: 0 !important;
    padding: 0 !important;
  }
  .settings-panel,
  .comments-panel {
    width: 100%;
  }

  .settings-panel {
    left: -100%;
  }

  .comments-panel {
    right: -100%;
    height: calc(100vh - 64px);
    box-shadow: none;
  }

  .mobile-none{
      display: flex !important;
  }

  .comment-input-section {
    box-shadow: -2px -6px 8px 0px rgba(0, 0, 0, 0.1)
  }

  .chapter-navigation {
    flex-direction: column;
  }

  .nav-btn {
    justify-content: center;
    white-space: nowrap;
  }

  .header-actions,
  .toolbar-center,
  #homeBtn,
  #fullscreenBtn,
  .input-avatar,
  .send-btn {
    display: none;
  }

  .mobile {
    display: block;
  }

  .reader-header .container {
    flex-direction: row-reverse;
  }


  .toolbar-left,
  .toolbar-center,
  .toolbar-right {

    width: 38%;
    justify-content: space-between;
  }

  .toolbar-btn {
    padding: 11px;

  }

  .settings-panel.active {
    bottom: 37px;
    top: unset;
    height: auto;
  }

  .color-options {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
  }

  .control-value,
  .font-select {
    width: -webkit-fill-available;
  }

  .settings-title svg {
    display: none;
  }

  .comment-input-wrapper i {
    position: absolute;
    right: 20px;
    font-size: 26px;
    color: #007aff;
  }

  .chapter-dropdown {
    width: 80vw;
    right: 0;
    left: unset;
  }
}