/**
 * TCH Membership Styles v3.8
 * Full styles for all features, including the centered bug report button.
 */

/* ==========================================================================
   1. FORM & TRANG TÀI KHOẢN
   ========================================================================== */
.tch-form-wrapper {
    max-width: 420px;
    margin: 40px auto;
    padding: 30px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05);
}
.tch-form-title {
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 25px;
    color: #333;
}
.tch-form-row {
    margin-bottom: 20px;
}
.tch-form-row label {
    display: block;
    font-weight: 600;
    margin-bottom: 8px;
    color: #555;
}
.tch-input {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 5px;
    font-size: 16px;
    transition: border-color 0.3s ease;
}
.tch-input:focus {
    outline: none;
    border-color: #FF6F61;
}
.tch-form-row-remember {
    display: flex;
    align-items: center;
    font-size: 14px;
}
.tch-form-row-remember input[type="checkbox"] {
    margin-right: 8px;
}
.tch-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    padding: 12px 16px;
    background-color: #FF6F61;
    color: #fff;
    border: 1px solid transparent;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none !important;
    text-align: center;
    transition: all 0.2s ease;
}
.tch-button.full-width {
    width: 100%;
}
.tch-button:hover {
    background-color: #e66054;
    color: #fff;
}
.tch-button.tch-button-secondary {
    background-color: #f3f4f6;
    color: #1f2937;
    border-color: #d1d5db;
}
.tch-button.tch-button-secondary:hover {
    background-color: #e5e7eb;
    border-color: #9ca3af;
}
.tch-button.tch-button-success {
    background-color: #28a745;
    border-color: #28a745;
    color: #fff;
}
.tch-button.tch-button-success:hover {
    background-color: #218838;
}
.tch-form-links {
    margin-top: 20px;
    text-align: center;
    font-size: 14px;
}
.tch-form-error {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}
.tch-form-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
    padding: 15px;
    border-radius: 5px;
    margin-bottom: 20px;
}
.tch-logged-in-message {
    text-align: center;
}
.tch-logged-in-message p {
    margin-bottom: 15px;
    font-size: 16px;
}
.tch-dashboard-wrapper {
    display: flex;
    gap: 30px;
    margin: 40px auto;
    max-width: 960px;
}
.tch-dashboard-nav {
    flex: 0 0 220px;
}
.tch-dashboard-nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    overflow: hidden;
}
.tch-dashboard-nav li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 20px;
    text-decoration: none;
    color: #333;
    font-weight: 600;
    border-bottom: 1px solid #e5e5e5;
    transition: all .2s ease;
}
.tch-dashboard-nav li:last-child a {
    border-bottom: none;
}
.tch-dashboard-nav li a:hover {
    background: #f8f9fa;
    color: #FF6F61;
}
.tch-dashboard-nav li.active a {
    background: #FF6F61;
    color: #fff;
    border-left: 4px solid #e66054;
    padding-left: 16px;
}
.tch-dashboard-nav li.active a i {
    color: #fff;
}
.tch-dashboard-content {
    flex-grow: 1;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    padding: 30px;
}
.tch-dashboard-content h3 {
    font-size: 22px;
    margin-top: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 10px;
}
.tch-dashboard-info p {
    font-size: 16px;
    line-height: 1.8;
}
.tch-badge {
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    vertical-align: middle;
}
.tch-badge-member {
    background-color: #6c757d;
}
.tch-badge-vip {
    background-color: #ffc107;
    color: #212529;
}
.tch-badge-author {
    background-color: #FF6F61;
    color: white;
}
@media (max-width:768px) {
    .tch-dashboard-wrapper{
        flex-direction:column
    }
    .tch-dashboard-nav{
        flex:1
    }
}

/* ==========================================================================
   2. USER DROPDOWN MENU & BÌNH LUẬN
   ========================================================================== */
.tch-user-panel.logged-in {
    position: relative;
}
.tch-avatar-button {
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    border-radius: 50%;
    overflow: hidden;
    display: block;
    width: 40px;
    height: 40px;
    border: 2px solid transparent;
    transition: border-color 0.2s;
}
.tch-avatar-button:hover {
    border-color: #FF6F61;
}
.tch-avatar-button img {
    display: block;
    width: 100%;
    height: 100%;
}
.tch-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 240px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.1);
    border: 1px solid #eee;
    z-index: 1001;
}
.tch-dropdown.active {
    display: block;
    animation: tch-dropdown-fadein 0.2s ease;
}
@keyframes tch-dropdown-fadein {
    from { opacity: 0; transform: translateY(-10px); }
    to { opacity: 1; transform: translateY(0); }
}
.tch-dropdown-header {
    padding: 15px;
    border-bottom: 1px solid #f0f0f0;
}
.tch-dropdown-header strong {
    display: block;
    font-size: 15px;
}
.tch-dropdown-header small {
    display: block;
    font-size: 12px;
    color: #888;
}
.tch-dropdown-menu {
    list-style: none;
    margin: 0;
    padding: 5px 0;
}
.tch-dropdown-menu li a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 15px;
    font-size: 14px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
}
.tch-dropdown-menu li a:hover {
    background: #f8f9fa;
    color: #FF6F61;
}
.tch-dropdown-footer {
    padding: 10px 15px;
    border-top: 1px solid #f0f0f0;
    background: #fdfdfd;
}
.tch-dropdown-footer a {
    color: #d9534f;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.comment-author .tch-badge {
    margin-left: 0.5rem;
    font-size: 0.7rem;
    padding: 2px 8px;
}

/* ==========================================================================
   3. HUY HIỆU & ICON TRUYỆN
   ========================================================================== */
.single-truyen .story-thumb-container {
    position: relative;
    overflow: visible !important;
}
.single-truyen .story-badge {
    position: absolute;
    bottom: 8px;
    left: 50%;
    transform: translateX(-50%);
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 50px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    z-index: 20 !important;
}
.single-truyen .story-badge:hover {
    transform: translateX(-50%) scale(1.05);
}
.single-truyen .story-badge i {
    font-size: 16px;
    line-height: 1;
}
.single-truyen .story-member-badge {
    background-image: linear-gradient(145deg, #e8e8e8, #c5c5c5);
    color: #4a4a4a;
    text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.7);
}
.single-truyen .story-vip-badge {
    background-image: linear-gradient(145deg, #FFD700, #FFA500);
    color: white;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}
.single-truyen .vip-chapter-icon {
    color: #E6A400;
    font-size: 1em;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    transform: translateY(-1px);
}
.story-card-vip-icon {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #FFD700;
    font-size: 16px;
    z-index: 5;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 1px 3px rgba(0,0,0,0.3);
    transition: transform 0.3s ease;
}
.story-card a:hover .story-card-vip-icon {
    transform: scale(1.1);
}

/* ==========================================================================
   4. HIỂN THỊ TRONG TỦ TRUYỆN & GIAO DIỆN CHUNG
   ========================================================================== */
.tch-library-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 20px;
}
.tch-library-grid .story-card h3 {
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1.4;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.chapter-list .chapter-link {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-top: 0.75rem;
    padding-bottom: 0.75rem;
}

/* ==========================================================================
   5. HỆ THỐNG POPUP & BÁO LỖI
   ========================================================================== */
body.tch-popup-open {
    overflow: hidden;
}
.tch-popup-container {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.tch-popup-modal {
    position: relative;
    width: 100%;
    max-width: 500px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    animation: tch-popup-fadein 0.3s ease;
}
@keyframes tch-popup-fadein {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}
.tch-popup-close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 32px;
    height: 32px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    font-size: 20px;
    line-height: 32px;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #888;
    z-index: 10;
}
.tch-popup-close:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
}
.tch-popup-content {
    padding: 25px 30px;
}
.tch-popup-content .tch-form-title {
    font-size: 1.25rem;
    margin-bottom: 1.5rem;
}
.tch-form-message {
    margin-bottom: 1rem;
}
.tch-form-message p {
    margin: 0;
}
.tch-button-report {
    display: flex;
    margin: 2rem auto;
    background: none;
    border: 1px solid #d1d5db;
    color: #4b5563;
    padding: 6px 12px;
    font-size: 0.875rem;
    border-radius: 5px;
    cursor: pointer;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}
.tch-button-report:hover {
    background-color: #f3f4f6;
    color: #1f2937;
}

/* ==========================================================================
   6. HỆ THỐNG BÌNH LUẬN
   ========================================================================== */
.comments-area{margin-top:2rem}.comments-title,#reply-title{font-size:1.5rem;font-weight:700;margin-bottom:2rem;padding-bottom:1rem;border-bottom:1px solid #e5e7eb}.comment-list{list-style:none;padding:0;margin:0}.comment-list .comment{display:flex;gap:1rem;margin-bottom:1.5rem}.comment-list .children{list-style:none;padding-left:3rem;margin-top:1.5rem}.comment-author .avatar{width:48px;height:48px;border-radius:50%;border:2px solid #fff;box-shadow:0 2px 4px rgba(0,0,0,.1)}.comment-body{flex:1;background-color:#f9fafb;border-radius:8px;padding:1rem;border:1px solid #e5e7eb}.comment-meta{display:flex;align-items:center;margin-bottom:.5rem}.comment-author .fn{font-weight:700;font-size:1rem;color:#111827;text-decoration:none}.comment-author .fn a{text-decoration:none;color:inherit}.comment-metadata{font-size:.8rem;color:#6b7280;margin-left:auto}.comment-metadata a{text-decoration:none;color:inherit}.comment-content{color:#374151;line-height:1.6}.comment-content p{margin-bottom:0}.reply{margin-top:.75rem}.comment-reply-link{font-size:.875rem;font-weight:600;color:#4b5563;text-decoration:none;transition:color .2s}.comment-reply-link:hover{color:#FF6F61}#respond{margin-top:2.5rem}#respond .comment-form{background-color:#f9fafb;padding:1.5rem;border-radius:8px;border:1px solid #e5e7eb}#respond .comment-form-comment textarea{width:100%;padding:12px;border:1px solid #ddd;border-radius:5px;font-size:1rem;transition:border-color .3s ease;min-height:120px}#respond .comment-form-comment textarea:focus{outline:none;border-color:#FF6F61}#respond .form-submit .submit{display:inline-flex;align-items:center;justify-content:center;gap:8px;width:auto;padding:12px 24px;background-color:#FF6F61;color:#fff;border:1px solid transparent;border-radius:5px;font-size:1rem;font-weight:700;cursor:pointer;text-decoration:none!important;text-align:center;transition:all .2s ease}#respond .form-submit .submit:hover{background-color:#e66054}.tch-comment-login-message{padding:2rem;text-align:center;background-color:#f9fafb;border:2px dashed #e5e7eb;border-radius:8px}.tch-comment-login-message p{font-size:1.1rem;color:#4b5563;margin:0}.tch-comment-login-message a{color:#FF6F61;font-weight:600;text-decoration:none}.tch-comment-login-message a:hover{text-decoration:underline}

/* ==========================================================================
   7. [CẬP NHẬT] CSS CHO NÚT ĐĂNG NHẬP RESPONSIVE
   ========================================================================== */

.tch-button-login {
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600; /* medium */
    transition: all 0.2s ease;
    text-decoration: none;
}

/* [CẬP NHẬT] Mặc định trên mobile: là một icon trơn, không có vòng tròn */
.tch-button-login {
    color: #4b5563; /* gray-600 */
    padding: 0.5rem; /* Tăng vùng có thể bấm mà không cần viền */
    border-radius: 50%;
}
.tch-button-login:hover {
     background-color: #f3f4f6; /* Thêm nền xám rất nhạt khi hover */
     color: #FF6F61; /* Đổi màu icon khi hover */
}
.tch-button-login span {
    display: none; /* Ẩn chữ trên mobile */
}

/* Từ breakpoint sm (640px) trở lên */
@media (min-width: 640px) {
    .tch-button-login {
        width: auto;
        height: auto;
        background-color: #FF6F61; /* primary */
        color: white;
        padding: 0.5rem 1rem; /* tương đương py-2 px-4 */
        border-radius: 8px; /* rounded-button */
        border: 1px solid transparent;
    }
    .tch-button-login:hover {
        background-color: #e66054;
        color: white;
    }
    .tch-button-login i {
        display: none; /* Ẩn icon trên desktop */
    }
    .tch-button-login span {
        display: inline; /* Hiện chữ trên desktop */
    }
}