/* =====================================================================
   TEAM CODE DẠO - MANGA READER & COMIC STYLES (MANGA CSS)
   Tách riêng từ single.php & category-truyen-tranh.php
   Hỗ trợ: Thanh cuộn % tiến độ, cuộn dọc vô tận, phím tắt mũi tên
   ===================================================================== */

/* Thanh tiến độ đọc truyện (% cuộn trang) */
#manga-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    height: 3.5px;
    background: #2563eb;
    width: 0%;
    z-index: 9999;
    transition: width 0.1s ease;
}

.manga-reader-container {
    max-width: 880px;
    margin: 0 auto;
    padding: 20px 12px 50px;
    transition: max-width 0.3s ease;
}
.manga-reader-container.is-fullwidth {
    max-width: 1400px;
}

/* Thanh điều hướng chương truyện */
.reader-toolbar {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 12px 18px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.reader-breadcrumb {
    font-size: 14px;
    color: #94a3b8;
    display: flex;
    align-items: center;
    gap: 6px;
}
.reader-breadcrumb a {
    color: #60a5fa;
    text-decoration: none;
    font-weight: 700;
}
.reader-breadcrumb a:hover {
    text-decoration: underline;
}

.reader-nav-btns {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-chapter-nav {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #0f172a;
    border: 1px solid #334155;
    color: #f8fafc;
    padding: 7px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
    text-decoration: none;
    transition: all 0.15s ease;
}
.btn-chapter-nav:hover {
    background: #2563eb;
    border-color: #2563eb;
    color: #ffffff;
}
.btn-chapter-nav.disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* Khung hiển thị danh sách ảnh truyện */
.manga-images-wrap {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: 30px;
    background: #0b0f19;
}

.manga-page-wrapper {
    position: relative;
    width: 100%;
    max-width: 880px;
    margin: 0 auto;
    background: #0f172a;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    min-height: 300px;
}

.manga-page-wrapper.is-loading {
    background: linear-gradient(90deg, #0b0f19 25%, #1e293b 50%, #0b0f19 75%);
    background-size: 200% 100%;
    animation: tcdShimmer 1.8s infinite;
}

@keyframes tcdShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.manga-page-wrapper .manga-page-num {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(15, 23, 42, 0.75);
    color: #94a3b8;
    font-size: 11.5px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 4px;
    pointer-events: none;
    z-index: 2;
}

.manga-page-img {
    width: 100%;
    max-width: 880px;
    height: auto;
    display: block;
    margin: 0 auto;
    background: #0f172a;
    object-fit: contain;
    transition: opacity 0.35s ease, filter 0.35s ease;
}

.manga-page-img.tcd-lazy {
    opacity: 0.15;
    filter: blur(8px);
}

.manga-page-img.lazy-loaded {
    opacity: 1;
    filter: blur(0);
}

.manga-page-img.lazy-error {
    opacity: 0.8;
    filter: none;
    min-height: 160px;
    background: #1e293b;
    cursor: pointer;
}


/* Thanh điều hướng chân trang */
.reader-footer-nav {
    background: #1e293b;
    border: 1px solid #334155;
    border-radius: 8px;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 30px;
    flex-wrap: wrap;
    gap: 12px;
}

/* Hướng dẫn phím tắt */
.reader-keyboard-hint {
    font-size: 12px;
    color: #64748b;
    text-align: center;
    margin-top: 15px;
}
.reader-keyboard-hint kbd {
    background: #1e293b;
    border: 1px solid #475569;
    border-radius: 4px;
    padding: 2px 6px;
    color: #94a3b8;
    font-family: monospace;
}

@media (max-width: 768px) {
    .reader-toolbar {
        flex-direction: column;
        align-items: flex-start;
    }
    .reader-nav-btns {
        width: 100%;
        justify-content: space-between;
    }
}
