﻿.brpro-chapter-wrapper {
  padding: 20px 0 40px;
}

.brpro-chapter-panel {
  background: var(--brpro-panel);
  border-radius: var(--brpro-radius);
  box-shadow: var(--brpro-shadow-soft);
  padding: 30px;
  margin-bottom: 30px;
  border: 1px solid var(--brpro-border);
}

.brpro-chapter-nav {
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--brpro-muted);
}

.brpro-chapter-nav a {
  color: var(--brpro-text);
  text-decoration: none;
  transition: color 0.2s;
}

.brpro-chapter-nav a:hover {
  color: var(--brpro-accent);
}

.brpro-chapter-nav b {
  font-weight: 500;
  margin-right: 5px;
}

.brpro-chapter-nav span {
  display: inline-block;
}

.brpro-chapter-nav span::after {
  content: "/";
  margin: 0 8px;
  color: var(--brpro-muted-2);
}

.brpro-chapter-nav span:last-child::after {
  content: "";
}

.novelread h2 {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 30px;
  color: var(--brpro-text);
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
}

.novelread h2 .book-name {
  font-style: normal;
  color: var(--brpro-accent);
  font-size: 18px;
  font-weight: 500;
  display: block;
  max-width: 100%;
}

.novelread h2 .chapter-name {
  display: block;
  font-size: 24px;
  color: var(--brpro-text);
}

/* Tool control */
.brpro-read-settings-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 30px;
}

.brpro-read-settings {
  display: inline-flex;
  align-items: center;
  background: var(--brpro-panel);
  border: 1px solid var(--brpro-border);
  border-radius: 999px;
  padding: 4px;
  gap: 2px;
  box-shadow: var(--brpro-shadow-soft);
}

.brpro-read-settings button {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  background: transparent;
  color: var(--brpro-muted);
  cursor: pointer;
  transition: all 0.2s ease;
}

.brpro-read-settings button svg {
  width: 18px;
  height: 18px;
}

.brpro-read-settings button:hover {
  background: var(--brpro-bg);
  color: var(--brpro-accent);
  transform: translateY(-2px);
}

.brpro-settings-divider {
  width: 1px;
  height: 18px;
  background: var(--brpro-border);
  margin: 0 4px;
}

/* Content */
.novelcontent {
  line-height: 1.8;
  color: #333;
  text-align: justify;
  word-wrap: break-word;
  min-height: 50vh;
}

.novelcontent p {
  margin-bottom: 1.2em;
}

/* Bottom Controls - Fixed on mobile, floating on PC */
.brpro-read-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--brpro-panel);
  border-top: 1px solid var(--brpro-border);
  padding: 8px 12px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  z-index: 90;
  box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

.brpro-primary-action {
  flex: 1;
  min-width: 0; /* Allow flex shrinking */
}

.brpro-btn-next {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 10px 12px;
  background: linear-gradient(135deg, var(--brpro-accent), var(--brpro-accent-2));
  color: white !important;
  font-size: 14px;
  font-weight: 600;
  border-radius: 999px;
  text-decoration: none;
  box-shadow: 0 4px 12px rgba(232, 93, 4, 0.2);
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
  gap: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brpro-btn-next:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(232, 93, 4, 0.3);
}

.brpro-secondary-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.brpro-action-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: var(--brpro-bg);
  border-radius: 50%;
  color: var(--brpro-muted) !important;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  cursor: pointer;
}

.brpro-action-item span {
  display: none; /* Hide text on mobile bottom bar */
}

.brpro-action-item svg {
  width: 20px;
  height: 20px;
  transition: color 0.2s;
}

.brpro-action-item:hover {
  background: var(--brpro-panel);
  border-color: var(--brpro-accent);
  color: var(--brpro-accent) !important;
  transform: translateY(-2px);
  box-shadow: var(--brpro-shadow-soft);
}

.brpro-action-item:hover svg {
  color: var(--brpro-accent);
}

@media (min-width: 769px) {
  .brpro-read-controls {
    position: fixed;
    top: 50%;
    right: 50px;
    bottom: auto;
    left: auto;
    transform: translateY(-50%);
    flex-direction: column;
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    width: 60px;
    gap: 16px;
  }

  .brpro-primary-action {
    width: 100%;
  }

  .brpro-btn-next {
    width: 60px;
    height: 60px;
    padding: 0;
    border-radius: 50%;
    font-size: 0; /* Hide text */
  }

  .brpro-btn-next svg {
    width: 28px;
    height: 28px;
  }

  .brpro-secondary-actions {
    flex-direction: column;
    gap: 12px;
  }

  .brpro-action-item {
    width: 50px;
    height: 50px;
    background: var(--brpro-panel);
    border: 1px solid var(--brpro-border);
    box-shadow: var(--brpro-shadow-soft);
  }
}

.linea {
  margin-top: 30px;
}

.linea h3 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 20px;
  color: var(--brpro-text);
  border-left: 4px solid var(--brpro-accent);
  padding-left: 12px;
}

.brpro-recommend-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-top: 20px;
}

.brpro-recommend-list .nlist {
  display: contents; /* unwrap ul to let li participate in grid */
}

.brpro-recommend-list .nlist li {
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Dark mode setting overrides */
body.black {
  background: #1a1a1a;
  color: #a0a0a0;
}

body.black .brpro-home,
body.black .brpro-chapter-wrapper {
  background: #1a1a1a;
}

body.black .brpro-chapter-panel {
  background: #242424;
  border-color: #333;
}

body.black .brpro-topbar {
  background: rgba(36, 36, 36, 0.95);
  border-color: #333;
}

body.black .brpro-search-input {
  color: #ccc;
}

body.black .brpro-search-input::placeholder {
  color: #666;
}

body.black .brpro-mobile-search-btn {
  color: #ccc;
}

body.black .brpro-mobile-search-btn:hover {
  background: #333;
}

body.black .brpro-action-shelf {
  color: #ccc;
}

body.black .brpro-user-profile {
  background: #1a1a1a;
  border-color: #333;
  color: #ccc;
}

body.black .brpro-topbar-user-name {
  color: #ccc;
}

body.black .brpro-user-profile:hover {
  background: #2a2a2a;
  border-color: var(--brpro-accent);
}

body.black .brpro-brand-text {
  color: #ccc;
}

body.black .novelread h2,
body.black .brpro-chapter-nav a,
body.black .linea h3,
body.black .brpro-modal-header h4 {
  color: #ccc;
}

body.black .novelcontent,
body.black .brpro-share-modal p {
  color: #999;
}

body.black .brpro-read-settings {
  background: #1a1a1a;
  border-color: #333;
}

body.black .brpro-settings-divider {
  background: #333;
}

body.black .brpro-read-settings button:hover {
  background: #2a2a2a;
}

body.black .brpro-read-controls {
  background: #1a1a1a;
  border-color: #333;
}

body.black .brpro-action-item {
  background: #242424;
  border-color: #333;
  color: #ccc !important;
}

body.black .brpro-action-item:hover {
  background: #2a2a2a;
  border-color: var(--brpro-accent);
}

body.black .popwindowbox {
  background: #242424;
  border: 1px solid #333;
}

body.black .brpro-modal-close {
  color: #888;
}

body.black .brpro-modal-close:hover {
  background: #1a1a1a;
  color: #ccc;
}

body.black .brpro-share-input-group input {
  background: #1a1a1a;
  border-color: #333;
  color: #ccc;
}

/* Modal styling overrides */
.brpro-share-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.brpro-share-modal.show {
  display: flex;
}

.brpro-share-modal .popwindowbg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
}

.brpro-share-modal .popwindowbg button {
  width: 100%;
  height: 100%;
  background: transparent;
  border: none;
  cursor: default;
}

.brpro-share-modal .popwindowbox {
  position: relative;
  max-width: 400px;
  width: 90%;
  border-radius: var(--brpro-radius);
  background: var(--brpro-panel);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  z-index: 1001;
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.brpro-share-modal .popwindowbody {
  padding: 0;
}

.brpro-share-modal .popshare {
  padding: 0;
}

.brpro-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--brpro-border);
}

.brpro-modal-header h4 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--brpro-text);
}

.brpro-modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--brpro-muted);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.2s;
}

.brpro-modal-close:hover {
  background: var(--brpro-bg);
  color: var(--brpro-text);
}

.brpro-share-modal .popsharetxt {
  padding: 24px;
  font-size: 14px;
  color: var(--brpro-muted);
  line-height: 1.5;
}

.brpro-share-modal .popsharetxt p {
  margin: 0 0 16px 0;
}

.brpro-share-input-group {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.brpro-share-input-group input {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid var(--brpro-border);
  border-radius: 8px;
  background: var(--brpro-bg);
  color: var(--brpro-text);
  font-size: 14px;
  outline: none;
  min-width: 0;
}

.brpro-share-input-group input:focus {
  border-color: var(--brpro-accent);
}

.brpro-share-input-group button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  background: var(--brpro-accent);
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
}

.brpro-share-input-group button:hover {
  background: var(--brpro-accent-2);
}

@media (max-width: 768px) {
  .brpro-chapter-panel {
    padding: 20px 15px;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  
  .novelread h2 {
    font-size: 22px;
  }
  
  .brpro-recommend-list {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .brpro-chapter-wrapper {
    padding-bottom: 80px; /* Add space for the fixed bottom bar */
  }
}
