.rating-content.collapsed {
    overflow: hidden;
    max-height: 44px;
    transition: max-height 0.3s ease;
}

.rating-content.expanded {
    max-height: 9999px;
}

.show-more-btn {
    color: blue;
    cursor: pointer;
    font-size: 0.9em;
    margin-top: 3px;
}

body {
    background-color: #f4f4f4;
}

.copy-name {
    cursor: pointer;
}

#copy-msg {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(60, 60, 60, 0.95);
  color: #fff;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 16px;
  z-index: 9999;
  transition: opacity 0.3s ease;
}


.rating-box {
    display: flex;
    gap: 10px;
    margin-bottom: 5px;
}

.rating-avatar-box {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
}
.rating-avatar-box img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


.scroll-btn {
  position: fixed;
  bottom: 30px;
  right: 15px;
  z-index: 999;
  background-color: #007bff;
  color: white;
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  font-size: 20px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
  transition: background 0.3s;
}
.scroll-btn:hover {
  background-color: #0056b3;
}


.recommend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 10px;
}

.recommend-item {
    text-align: center;
    border: 1px solid #ddd;
    border-radius: 8px;
    overflow: hidden;
    background: #f9f9f9;
}

.recommend-img {
    width: 100%;
    max-width: 200px; /* hoặc giá trị hợp lý */
    height: auto;
    object-fit: cover;
    margin: 0 auto; /* canh giữa nếu muốn */
    display: block;
}

.recommend-title {
    font-size: 14px;
    padding: 6px;
    color: #007BFF; /* Xanh dương nổi bật */
    text-decoration: underline;
    cursor: pointer;
    transition: color 0.2s ease;
}

.recommend-title:hover {
    color: #0056b3; /* Màu đậm hơn khi rê chuột */
}

/* Gốc comment cha */
.comment-item {
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 12px 15px;
  margin-bottom: 15px;
  background-color: #f9f9f9;
}

/* Tên + thời gian */
.comment-item b {
  font-weight: 600;
}
.comment-item small {
  color: #888;
  font-size: 0.85em;
  margin-left: 8px;
}

/* Nội dung comment */
.comment-item p {
  margin: 8px 0;
  line-height: 1.5;
  font-size: 15px;
  white-space: normal;
  word-break: break-word;
}

/* Nút trả lời / xem trả lời */
.comment-item .reply-btn,
.comment-item .show-replies-btn {
  background-color: #eee;
  border: 1px solid #ccc;
  padding: 5px 10px;
  margin-right: 8px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 4px;
  transition: 0.2s;
}
.comment-item .reply-btn:hover,
.comment-item .show-replies-btn:hover {
  background-color: #ddd;
}

/* Reply container */
.replies-container {
  margin-top: 10px;
  border-left: 2px solid #ccc;
}

button#load-more-comments {
    margin-left: 10px;
    padding: 5px;
    background-color: orange;
    border-radius: 5px;
    margin: 0 auto;
}

/* Mỗi comment trả lời */
.reply-item {
  margin-bottom: 10px;
  padding: 8px 10px;
  background-color: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 6px;
}

.reply-item b {
  font-weight: 600;
}
.reply-item small {
  color: #666;
  font-size: 0.8em;
  margin-left: 6px;
}
.reply-item p {
  margin: 5px 0 0;
  font-size: 14px;
  line-height: 1.4;
}

/* Overlay khi trả lời */
.reply-form-modal .reply-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 1000;
}

.reply-form-modal .reply-box {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  margin: 100px auto;
  position: relative;
  box-shadow: 0 5px 15px rgba(0,0,0,0.2);
}

.action-buttons {
    flex-direction: column;
    align-items: flex-start;
    gap:5px;
  }

.action-buttons button {
    padding: 6px 14px;
    border: none;
    border-radius: 6px;
    background-color: #007bff;
    color: white;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 6px;
    margin-left: 10%;
    width: 120px;
}


.action-buttons button:hover {
    background-color: #0056b3;
}

.action-buttons button.bookmarked {
    background-color: #6c757d;
    cursor: default;
    opacity: 0.7;
}


.rating-text {
    font-size: 14px;
    color: #555;
    margin-top: -4px;
    margin-bottom: 8px;
    margin-left: 35%;
    font-weight: bold;
}

.star-rating {
    display: inline-block;
    font-size: 24px;
    position: relative;
    unicode-bidi: bidi-override;
    color: #ccc; /* màu nền sao rỗng */
    margin-left: 16%;
}

.star-rating .star {
    display: inline-block;
    position: relative;
    color: #ccc;
}

.star-rating .star::before {
    content: '★';
    position: absolute;
    left: 0;
    top: 0;
    width: 100%; /* sẽ chỉnh bằng JS */
    overflow: hidden;
    color: #000000;
}

#story-tabs-container {
    background: #fff;
    border-top: 2px solid #eee;
    overflow-x: hidden; /* tránh scroll ngang nếu có */
    margin: 0 auto;
    padding-top: 10px;
}

.story-tabs {
    display: flex;
    justify-content: space-around;
    border-bottom: 2px solid #ddd;
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 10px 0;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    cursor: pointer;
    transition: 0.3s;
}

.tab-btn.active {
    border-bottom: 3px solid #f39c12;
    font-weight: bold;
    color: #f39c12;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Khung nhập bình luận */
#comment-form {
  margin-top: 20px;
  border: 1px solid #ddd;
  padding: 15px;
  border-radius: 10px;
  background-color: #f9f9f9;
  max-width: 600px;
}

#comment-form textarea {
  width: 94%;
  height: 80px;
  resize: vertical;
  padding: 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  font-size: 14px;
  margin-bottom: 10px;
}

#comment-form button[type="submit"] {
  background-color: #007bff;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

#comment-form button[type="submit"]:hover {
  background-color: #0056b3;
}

#comment-status {
  margin-top: 8px;
  font-size: 14px;
}

/* Phần hiển thị bình luận */
#comments-container {
  margin-top: 30px;
  max-width: 700px;
}

.comment-item {
  gap: 12px;
  margin-bottom: 15px;
  border-bottom: 1px solid #eee;
  padding-bottom: 10px;
  align-items: flex-start;
  flex-wrap: wrap;
}

.avatar-box {
    display: flex;
    gap: 15px;
}

.time-cmt {
    font-size: 10px;
    margin-left: 10px;
}

.comment-item > div:first-child img {
  width: 40px;
  height: 40px;
  border-radius: 20px;
  object-fit: cover;
}

/* Nội dung chính bên phải */
.comment-item > div:nth-child(2) {
  flex: 1 1 auto;
  min-width: 200px;
}

/* Tên người dùng */
.comment-item > div:nth-child(2) > div:first-child {
  font-weight: bold;
  font-size: 15px;
}

/* Tu vi */
.comment-item .tuvi-text {
  display: block;
  font-size: 13px;
  color: #666;
  margin-top: 2px;
  margin-bottom: 3px;
}

/* Thời gian */
.comment-item > div:nth-child(2) > div:nth-child(3) {
  font-size: 12px;
  color: #999;
  margin: 4px 0;
}

/* Nút trả lời */
.comment-item button.reply-btn {
  margin-top: 4px;
}

/* Khối chứa nút "xem trả lời" và replies */
.comment-item > div:nth-child(3) {
  flex-basis: 100%;
  margin-left: 52px; /* Căn thẳng dòng với nội dung chính */
}

/* Các reply-item */
.reply-item {
  border-left: 2px solid #ccc;
  padding-left: 10px;
  margin: 5px 0;
}

.reply-item b {
  font-weight: bold;
}

.reply-item small {
  color: #888;
  font-size: 12px;
}

.reply-item p {
  margin: 4px 0;
}

.reply-sub-btn {
  margin-top: 5px;
}


.btn_cr button {
  padding: 10px 20px;
  border: 1px solid #ccc;
  background-color: #f0f0f0;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-right: 10px;
  border-radius: 6px;
  font-weight: 500;
}

.btn_cr button.active {
  background-color: #2563eb; /* blue-600 */
  color: #ffffff;
  border-color: #2563eb;
  box-shadow: 0 0 6px rgba(37, 99, 235, 0.4);
}

/* Style cho tag số chương */
.btn_cr .tag {
  background-color: #e0f2fe; /* light blue */
  color: #0c4a6e;             /* dark text */
  padding: 2px 8px;
  border-radius: 8px;
  margin-left: 6px;
  font-weight: bold;
  font-size: 0.85em;
}

/* Modal background */
.modal {
    display: none; /* Ẩn mặc định */
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.6); /* Màu nền mờ */
    backdrop-filter: blur(2px);
}

/* Nút đóng */
.modal .close {
    color: #aaa;
    position: absolute;
    top: 10px;
    right: 15px;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
}

.modal .close:hover {
    color: #000;
}

/* Nút báo cáo */
#report-btn {
    padding: 6px 14px;
    background-color: #ff4c4c;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 10%;
    margin-top: 5px;
    width: 120px;
}

#report-btn:hover {
    background-color: #e03d3d;
}

/* Khung form */
#report-form {
    position: fixed;
    bottom: 10%; /* cách đáy màn hình 10% */
    left: 50%;
    transform: translateX(-50%);
    background-color: #fff;
    padding: 20px 25px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 550px;
    width: 70%;
    z-index: 1001;
    font-family: "Segoe UI", Roboto, sans-serif;
    margin: 0 auto;
}

/* Nhãn */
#report-form label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #333;
}

/* Textarea */
#report-form textarea {
    padding: 10px 12px;
    border: 1px solid #ccc;
    border-radius: 8px;
    resize: vertical;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.3s;
    height:150px;
    width: 92%;
}

#report-form textarea:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 3px #007bff66;
}

/* Nút gửi */
#report-form button[type="submit"] {
    margin-top: 12px;
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 18px;
    font-size: 16px;
    border-radius: 8px;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

#report-form button[type="submit"]:hover {
    background-color: #218838;
}

/* Thông báo trạng thái */
#report-status {
    font-size: 14px;
    margin-top: 12px;
}

.genre-item {
    background-color: #d32f2f;
    color: #ffffff;
    border-radius: 5px;
    padding: 5px 10px;
    margin: 5px 5px 0 0; /* Khoảng cách giữa các thẻ */
    display: inline-block; /* Đảm bảo mỗi <span> là một block nhỏ */
}

.new-star {
    position: absolute;
    top: 1px;
}

.rating-tag {
    font-weight: bold;
    font-size: 16px;
    color: #333;
    background-color: #fd4724;
    padding: 4px;
    border-radius: 4px;
    font-size: 17px;
}

button#chapterListButton {
    padding: 5px;
    font-size: 20px;
    border-radius: 7px;
}

button#reviewButton {
    padding: 5px;
    font-size: 20px;
    border-radius: 7px;
}

.note {
    background-color: #D3D3D3;
    padding: 3px 15px;
    margin-top: 6px;
    border-radius: 10px;
}

p.note{
    margin:1px;
}

.green-button {
    background-color: #2e7d32;
    color: #ffffff;
    padding: 10px;
    border-radius: 10px;
}

.blue-button {
    background-color: #1565c0;
    color: white;
    padding: 10px;
    border-radius: 10px;
}

.yellow-button {
    background-color: #ffeb3b;
    color: black;
    padding: 10px;
    border-radius: 10px;
    margin-left: 3px;
}

.blue-button .icon, .yellow-button .icon, .green-button .icon {
    margin-left: 10px;
}

#searchChapter {
    flex: 1;  
}

button#sortButton {
    height: 40px;
    border-radius: 5px;
    margin-right: 3px;
}

.content {
    margin: 0 auto;
    background-color: #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    padding: 20px;
    width: 100%;
    overflow-y: auto;
    border-radius: 8px;
    box-sizing: border-box;
}

.header, .description {
    width: 100%;
    box-sizing: border-box;
}

.chapter-container {
    width: 100%;
    box-sizing: border-box;
    min-height: 500px;
}

.header {
    display: flex;
    align-items: flex-start;
    margin-bottom: 20px;
    position: relative;
}

.description {
    margin: 20px 0;
    line-height: 1.6;
}

.chapter-container {
    margin-top: 20px;
}

.avatar-container {
    width: 150px;
    flex-shrink: 0;
    position: relative;
}

.avatar {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    margin: 0;
}

.rating-tag {
    position: absolute;
    top: 0;
    left: 0;
    background-color: rgba(255, 255, 0, 0.8);
    color: #000;
    padding: 3px 6px;
    font-weight: bold;
    border-radius: 3px;
    z-index: 10;
}

.btn_top {
    margin-top: 17px;
}

.title {
    font-size: 1.5em;
    font-weight: bold;
}

.author {
    font-size: 1em;
    color: #555;
}

.status-container {
    margin: 10px 0;
    font-weight: bold;
}

.vip-status, .free-status, .hot-status, .story-status {
    display: inline-block;
    border-radius: 5px;
    padding: 5px 10px;
    margin: -5px 5px 0 0;
}

.vip-status {
    background-color: #FFD700;
}

.free-status {
    background-color: #32CD32;
}

.hot-status {
    background-color: #FF4500;
}

.story-status {
    background-color: #e0e0e0;
}

.genre {
    background-color: #fff;
    color: white;
}

.search-container {
    display: flex;
    width: 95%;
    top: 0;
    background-color: white;
    padding: 1px;
    z-index: 10;
}

input[type="number"] {
    padding: 10px;
    width: 100%;
    margin-bottom: 10px;
    border-radius: 5px;
}

.tag {
    background-color: #00FFCC; /* Màu nền */
    border-radius: 4px; /* Bo tròn các góc */
    padding: 2px 6px; /* Khoảng cách bên trong */
    margin-left: 10px; /* Khoảng cách bên trái */
    font-weight: bold; /* Đậm chữ */
}

ul {
    list-style-type: none;
    padding: 0;
}

li {
    margin: 5px 0;
}

.chapter-list {
    list-style: none;
    padding: 0;
}

.chapter-item {
    padding: 10px 0;
    border-bottom: 1px solid #ccc;
}

.pagination {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.page-link {
    margin: 0 5px;
    padding: 10px 15px;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-decoration: none;
    color: #007bff;
}

.page-link:hover {
    background-color: #007bff;
    color: white;
}

.infor1 {
    margin-bottom: auto;
    margin-left:2%;
}

#toggle-button {
    display: none; /* Ẩn nút trên desktop */
    background-color: #cccccc;; /* xanh dương đậm */
    color: #000000;
}

p.note {
    border:1px;
}

#paginationControls button.active {
    background-color: #4CAF50; /* Màu nền nổi bật */
    color: white; /* Màu chữ trắng */
    font-weight: bold; /* In đậm chữ */
    border: 1px solid #4CAF50; /* Đường viền cùng màu nền */
    cursor: default; /* Không cho phép nhấn lại */
}

#paginationControls button {
    padding: 8px 12px;
    margin: 0 2px;
    border: 1px solid #ccc;
    background-color: #f1f1f1;
    color: #333;
    font-size: 14px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#paginationControls button:hover:not(.active) {
    background-color: #ddd; /* Đổi màu khi hover trừ khi là nút active */
}

.description.collapsed {
    max-height: 80px;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.description.expanded {
    max-height: none;
    transition: max-height 0.3s ease;
}

#toggle-button {
    display: inline-block;
    margin-top: 10px;
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
}

#toggle-button:hover {
    background-color: #0056b3;
}

/* Fullscreen overlay để nền mờ (tùy chọn) */
.reply-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

/* Form chính */
.reply-box {
    background: #fff;
    padding: 25px 20px;
    border-radius: 10px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    position: relative;
    animation: fadeIn 0.3s ease-in-out;
}

/* Textarea */
#reply-content {
    width: 100%;
    height: 120px;
    padding: 12px 14px;
    border: 1px solid #ccc;
    border-radius: 6px;
    resize: vertical;
    font-size: 15px;
    box-sizing: border-box;
    margin-bottom: 15px;
    transition: border 0.2s;
}

#reply-content:focus {
    border-color: #2196f3;
    outline: none;
    box-shadow: 0 0 5px rgba(33, 150, 243, 0.3);
}

/* Nút */
.reply-actions {
    text-align: right;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.reply-actions button {
    padding: 10px 18px;
    font-size: 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s ease;
}

#send-reply-btn {
    background-color: #2196f3;
    color: white;
}

#send-reply-btn:hover {
    background-color: #1976d2;
}

#close-reply-btn {
    background-color: #e0e0e0;
    color: #333;
}

#close-reply-btn:hover {
    background-color: #ccc;
}

/* Fade in animation */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}


@media (min-width: 1024px) {
        #main-wrapper {
            width: 80%;
            max-width: 1200px;
            margin: 0 auto;
            box-sizing: border-box;
            padding: 0 10px;
        }
    }

/* CSS cho thiết bị di động */
@media (max-width: 768px) {
    * {
        text-decoration: none; /* Bỏ gạch chân cho tất cả các phần tử */
    }

    .infor1 {
        
        width: 100%;
        margin-left: 0em;
    }

    .new-star {
        position: absolute;
        top: 5px;
        left: 91px;
    }
    
    button#chapterListButton {
        padding: 5px;
        font-size: 12px;
        border-radius: 7px;
    }

    button#reviewButton {
        padding: 5px;
        font-size: 12px;
        border-radius: 7px;
    }

    .header {
        flex-direction: column; /* Đặt các phần tử theo chiều dọc */
        align-items: center; /* Căn chỉnh sang trái */
        gap: 10px;
    }

    .avatar-container {
        position: relative;
        display: inline-block; /* hoặc block, tuỳ ý bạn */
    }

    .avatar {
        display: block;
        width: 100%; /* Đổi chiều rộng của avatar */
        max-height: 300px;
        margin-right: 0; /* Bỏ khoảng cách bên phải */
        margin-bottom: 10px; /* Thêm khoảng cách phía dưới */
        position: static;
    }

    .rating-tag {
        position: absolute;
        top: 0;
        left: 0;
        background-color: rgba(255, 255, 0, 0.8);
        color: #000;
        padding: 3px 6px;
        font-weight: bold;
        border-radius: 3px;
        z-index: 10;
    }

    .title {
        font-size: 1.2em; /* Điều chỉnh kích thước tiêu đề */
        padding-bottom: 8px;
    }

    .author, .status-container {
        font-size: 0.9em; /* Điều chỉnh kích thước văn bản */
    }

    /* Ẩn phần giới thiệu ban đầu trên mobile */
    .description.collapsed {
        max-height: 50px; /* Chiều cao tối đa */
        overflow: hidden; /* Ẩn nội dung thừa */
        transition: max-height 0.3s ease; /* Hiệu ứng chuyển động khi thay đổi */
    }

    .description.expanded {
        max-height: none; /* Hiển thị toàn bộ nội dung */
    }
    /* CSS cho nút Xem thêm */
    #toggle-button {
        margin-top: 10px; /* Khoảng cách phía trên */
        margin-left: auto; /* Tự động tạo khoảng cách bên trái */
        display: block; /* Để đảm bảo nó có thể căn lề */
        border: none; /* Không có viền */
        padding: 10px 15px; /* Khoảng cách bên trong */
        border-radius: 5px; /* Bo góc */
        cursor: pointer; /* Con trỏ chuột */
    }

    .btn_cr {
        display: flex;
        margin-top: 10px;
        height: 35px;
    }

    .btn_cr button {
        width: 50%; /* Mỗi nút sẽ chiếm 50% chiều rộng của div cha */
        box-sizing: border-box; /* Đảm bảo padding và border không làm tăng kích thước */
        padding: 10px; /* Thêm khoảng cách xung quanh chữ */
        border: none; /* Bỏ viền mặc định của button */
        font-size: 16px; /* Kích thước chữ */
        cursor: pointer; /* Hiển thị con trỏ khi hover */
        background-color: #fff;
    }

    .btn_top {
        display: flex;
        width: 100%;
    }

    .btn_top .button {
        flex: 1; /* Chia đều chiều rộng cho mỗi nút */
        text-align: center; /* Canh giữa nội dung của nút */
        padding: 10px 0;
        margin: 5px; /* Khoảng cách giữa các nút */
        text-decoration: none;
        border-radius: 5px;
    }

    #report-btn {
        padding: 8px 16px;
        background-color: #ff4c4c;
        color: white;
        border: none;
        border-radius: 6px;
        cursor: pointer;
        margin-left: 15%;
        margin-top: -5px;
    }

    .star-rating {
        margin-top: -10px;
        margin-bottom: 5px;
        margin-left: 15%;
    }

    .action-buttons {
        flex-direction: row; /* nằm ngang cho mobile */
        align-items: center;
        gap: 3px;
    }

    .action-buttons button {
        padding: 8px 16px;
        border: none;
        border-radius: 6px;
        background-color: #007bff;
        color: white;
        font-size: 14px;
        cursor: pointer;
        transition: background-color 0.2s ease;
        white-space: nowrap; /* Ngăn chữ xuống dòng */
        display: flex;
        flex-direction: row; /* Đảm bảo icon và chữ nằm ngang */
        align-items: center;
        gap: 6px;
        margin-top: -5px;
    }
}