/* Styles for visually hidden labels, for accessibility */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Styles to make buttons look like links */
.button-as-link {
    background: none;
    border: none;
    color: #337ab7; /* Or your theme's link color */
    cursor: pointer;
    padding: 0;
    font-size: inherit;
    font-family: inherit;
}
.button-as-link:hover {
    text-decoration: underline;
}

/* Styles for social login buttons */
.social-button {
    border: none;
    padding: 0;
    cursor: pointer;
    display: inline-block;
    margin: 0 10px;
    font-size: 20px;
    color: #fff;
    width: 40px;
    height: 40px;
    line-height: 40px;
    border-radius: 50%;
    text-align: center;
}
.social-button.facebook-link {
    background: #3b5998;
}
.social-button.google.link {
    background: #db4437;
}

/* CLS (Cumulative Layout Shift) Fix for Chapter Images */
.page-chapter img.lazy {
    display: block;
    width: 100%;
    height: auto; /* This will be overridden by aspect-ratio */
    background-color: #f0f0f0; /* Placeholder background */
}


/* Notification Styles */
.notification {
    padding: 10px 20px;
    margin-bottom: 10px;
    border-radius: 5px;
    color: #fff;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    max-width: 300px;
    word-wrap: break-word;
}
.notification.success {
    background-color: #4CAF50;
}
.notification.error {
    background-color: #f44336;
}

/* User Dropdown Styles */
.user-dropdown {
    position: relative;
    display: inline-block;
}
.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    object-fit: cover; /* Ensures the image covers the area without distortion */
}
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    min-width: 200px;
    z-index: 1000;
}
.dropdown-menu ul {
    list-style: none;
    margin: 0;
    padding: 10px 0;
}
.dropdown-menu ul li {
    padding: 5px 20px;
}
.dropdown-menu ul li a, .dropdown-menu ul li .button-as-link {
    color: #333;
    text-decoration: none;
    display: block;
    white-space: nowrap;
    text-align: left;
    width: 100%;
}
.dropdown-menu ul li:hover {
    background-color: #f0f0f0;
}

/* Search Suggestions Styles */
.search_result {
    position: absolute;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 3px;
    max-height: 200px;
    overflow-y: auto;
    width: 100%;
    z-index: 1000;
    display: none;
}
.search_result ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.search_result ul li {
    padding: 8px 10px;
}
.search_result ul li a {
    color: #333;
    text-decoration: none;
    display: block;
}
.search_result ul li:hover {
    background: #f0f0f0;
}

/* Existing Styles */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    display: none;
}
.popup_content {
    background: #fff;
    max-width: 400px;
    margin: 50px auto;
    padding: 20px;
    border-radius: 5px;
    position: relative;
}
.popup_content h2 {
    margin: 0 0 15px;
    font-size: 20px;
    text-align: center;
}
.popup_content ul {
    list-style: none;
    padding: 0;
    margin: 0 0 15px;
}
.popup_content ul li {
    margin-bottom: 10px;
}
.popup_content ul li p {
    margin: 0 0 5px;
    font-weight: bold;
}
.popup_content ul li input {
    width: 100%;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 3px;
}
.popup_content .yes_no {
    text-align: center;
}
.popup_content .yes_no button {
    padding: 8px 20px;
    margin: 0 5px;
    border: none;
    border-radius: 3px;
    cursor: pointer;
}
.popup_content .yes_no .module_login, .popup_content .yes_no .module_register {
    background: #4CAF50;
    color: #fff;
}
.popup_content .yes_no .no {
    background: #f44336;
    color: #fff;
}
.social-login {
    text-align: center;
    margin-top: 10px;
}
.social-login a {
    display: inline-block;
    margin: 0 10px;
    font-size: 20px;
    color: #fff;
    width: 40px;
    height: 40px;
    line-height: 40px;
    border-radius: 50%;
    text-align: center;
}
.social-login .facebook-link {
    background: #3b5998;
}
.social-login .google-link {
    background: #db4437;
}
.clear {
    clear: both;
}

/* Cải thiện kích thước vùng cảm ứng cho danh sách truyện */
.list_grid li .book_info .book_name a,
.list_grid li .book_info .last_chapter a {
    display: inline-block; /* Đảm bảo padding được áp dụng đúng */
    padding: 5px 0; /* Thêm khoảng đệm trên và dưới */
    line-height: 1.4; /* Cải thiện chiều cao dòng */
}

.list_grid li .book_info .book_name {
    font-size: 15px; /* Tăng kích thước font cho tên truyện */
    margin-bottom: 5px; /* Thêm khoảng cách giữa tên truyện và chương */
}

.list_grid li .book_info .last_chapter {
    font-size: 14px; /* Tăng kích thước font cho chương */
}

/* Tăng chiều cao cho các item trong danh sách truyện để chứa đủ nội dung */
ul.list_grid li {
    min-height: 290px; /* Đặt chiều cao tối thiểu */
}

ul.list_grid li .book_info {
    height: 64px; /* Giữ chiều cao gốc và căn chỉnh nội dung */
    display: flex;
    flex-direction: column;
    justify-content: center; /* Căn giữa các phần tử theo chiều dọc */
}

/* Lazy Load Fix */
body.light .page-chapter {
    background-color: #f0f0f0; /* Màu nền giữ chỗ */
}
.page-chapter {
    min-height: 400px; /* Chiều cao tối thiểu để giữ chỗ */
    display: flex;
    justify-content: center;
    align-items: center;
}

.page-chapter img.lazy {
    max-width: 100%;
    height: auto;
}

/* Ensure consistent sizing and alignment for all buttons/links in story-detail-menu */
.story-detail-menu li a,
.story-detail-menu li button {
    float: none !important; /* Remove float from <a> tags to allow flexbox alignment */
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-width: 125px !important; /* Consistent minimum width */
    padding: 10px 15px !important; /* Consistent padding: 10px top/bottom, 15px left/right */
    height: 40px !important; /* Consistent height */
    line-height: 1 !important; /* Reset line-height for vertical centering with flex */
}

/* Mobile Width Fix for btn-subscribe */
@media(max-width:1099px) {
    .story-detail-menu li button.btn-subscribe {
        width: 100% !important;
    }
}

/* Fine-tune vertical alignment for btn-subscribe on desktop */
.btn-subscribe {
    position: relative;
    top: -1px;
}

/* Fix for H2 heading style */
.book_detail h2 {
    color: #f18121;
    font-size: 18px;
    font-weight: 400;
    line-height: 40px;
    position: relative;
    width: 100%;
    margin-top: 10px;
    clear: both;
    display: block;
}

/* Styles for login and register buttons in the header */
.login-buttons {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
}

.login-buttons button {
    margin: 0 5px !important;
    display: inline-block !important;
    white-space: nowrap !important;
}

/* Ensure right alignment in mobile view */
@media (max-width: 767px) {
    .login-buttons {
        justify-content: flex-end !important;
    }
}

/* Style cho nút theo dõi/bỏ theo dõi dạng button */
button.button.is-danger.is-rounded {
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: none;
    font-size: 14px;
    padding: 8px 15px;
    transition: background-color 0.3s;
    font-family: inherit;
}

button.button.is-danger.is-rounded.btn-subscribe {
    background-color: #f14668;
    color: #fff;
}

button.button.is-danger.is-rounded.btn-unsubscribe {
    background-color: #777;
    color: #fff;
}

button.button.is-danger.is-rounded:hover {
    opacity: 0.9;
}

/* Styles cho nút thích và theo dõi */
.btn-like.liked {
    background-color: #2c6ed5 !important;
}

.btn-subscribe.followed {
    background-color: #2c6ed5 !important;
}

/* Animation cho thông tin thay đổi */
.number-like, .number-follow {
    transition: all 0.3s ease;
}

.number-like.highlight, .number-follow.highlight {
    background-color: #fffacd;
    padding: 2px 5px;
    border-radius: 3px;
    animation: highlight 1s ease-out;
}

@keyframes highlight {
    0% { background-color: #fffacd; }
    100% { background-color: transparent; }
}
