/* =========================================
 * Pages: chi-tiet.php
 * Author: Thanh ??
 * Note: Auto-extracted from inline <style>
 * ========================================= */
/* HIỆU ỨNG CHỮ LẤP LÁNH CHO TÁC GIẢ VIP */
    .text-vip-sparkle {
        background: linear-gradient(90deg, #d97706, #fbbf24, #f59e0b, #fef08a, #d97706);
        background-size: 200% auto;
        color: transparent !important;
        -webkit-background-clip: text;
        background-clip: text;
        animation: vipSparkle 3s linear infinite;
        font-weight: 800 !important;
        text-shadow: 0px 0px 8px rgba(251, 191, 36, 0.4);
    }
    @keyframes vipSparkle {
        0% { background-position: 0% center; }
        100% { background-position: 200% center; }
    }

    /* Toast UI */
    #toast-container { position: fixed; top: 80px; right: 20px; z-index: 9999; }
    .toast { display: flex; align-items: center; gap: 12px; min-width: 300px; padding: 16px; margin-bottom: 10px; border-radius: 8px; background: #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.15); border-left: 4px solid var(--primary); animation: slideIn 0.3s ease forwards; }
    .toast.success { border-left-color: var(--success); }
    .toast.error { border-left-color: var(--danger); }
    .toast-icon { font-size: 20px; }
    .toast.success .toast-icon { color: var(--success); }
    .toast.error .toast-icon { color: var(--danger); }
    @keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }
    
    /* STYLE DANH SÁCH CHƯƠNG - KHUNG CUỘN */
    .chapter-grid {
        max-height: 450px; /* Giới hạn chiều cao cho 1000 chương */
        overflow-y: auto;  /* Thêm thanh cuộn dọc */
        border-bottom: 1px solid var(--border);
        border-bottom-left-radius: 12px;
        border-bottom-right-radius: 12px;
    }
    
    /* Custom thanh cuộn cho mượt mắt */
    .chapter-grid::-webkit-scrollbar { width: 6px; }
    .chapter-grid::-webkit-scrollbar-track { background: var(--bg-main); border-radius: 10px; }
    .chapter-grid::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 10px; }
    .chapter-grid::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

    /* TIÊU ĐỀ PHẦN (VOLUME) */
    .volume-header {
        padding: 10px 15px;
        background: var(--bg-surface);
        font-weight: 700;
        color: var(--primary-color, #6366f1);
        font-size: 14px;
        border-bottom: 1px solid var(--border);
        display: flex;
        align-items: center;
        gap: 6px;
        position: sticky;
        top: 0;
        z-index: 10;
        box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    }

    .chap-item {
        display: flex; justify-content: space-between; align-items: center;
        padding: 12px 15px; border-bottom: 1px solid var(--border);
        transition: 0.2s; text-decoration: none; color: var(--text-main);
        min-width: 0; /* Đảm bảo flex con có thể cắt chữ */
        gap: 10px;
    }
    .chap-item:hover { background: var(--bg-hover); padding-left: 20px; }
    
    /* CHỈ CHỈNH SỬA Ở ĐÂY ĐỂ ÉP CHỮ KHÔNG RỚT DÒNG */
    .chap-left { 
        flex: 1; 
        font-weight: 500; 
        white-space: nowrap;       /* Không cho phép rớt dòng */
        overflow: hidden;          /* Ẩn phần chữ tràn ra ngoài */
        text-overflow: ellipsis;   /* Thêm dấu ... ở cuối */
        padding-right: 10px;
    }
    .chap-right { 
        display: flex; 
        align-items: center; 
        gap: 15px; 
        font-size: 12px; 
        flex-shrink: 0; /* Ép giá tiền và badge không bị bóp méo */
    }

    /* Badge */
    /* Related novel cards hover */
    .related-section .novel-card {
        transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
                    box-shadow 0.3s ease,
                    border-color 0.2s ease;
        will-change: transform;
        border: 1px solid var(--border-color, transparent);
        overflow: hidden;           /* [FIX] Chống lòi ảnh ra ngoài khi hover scale */
    }
    .related-section .novel-card .thumb {
        overflow: hidden;           /* [FIX] Wrapper ảnh cũng chặn overflow */
        display: block;
        border-radius: 6px;
    }
    .related-section .novel-card .novel-thumb {
        transition: transform 0.3s ease; /* [FIX] Thêm transition mượt cho ảnh */
        width: 100%;
        display: block;
    }
    .related-section .novel-card:hover .novel-thumb {
        transform: scale(1.08);     /* [FIX] Zoom ảnh nhẹ khi hover thay vì zoom cả card */
    }
    .related-section .novel-card:hover {
        transform: translateY(-5px); /* [FIX] Chỉ dịch lên, bỏ scale(1.02) để ảnh không bị lòi */
        box-shadow: 0 12px 28px rgba(99, 102, 241, 0.15);
        border-color: rgba(99, 102, 241, 0.3);
    }
    .status-locked { color: #f59e0b; background: #fffbeb; border: 1px solid #fcd34d; }
    .status-locked i { font-size: 14px; }
    .status-owned { color: #3b82f6; }
    .status-owned i { font-size: 16px; color: #3b82f6; }
    .status-free { color: #10b981; background: #ecfdf5; border: 1px solid #6ee7b7; text-transform: uppercase; }
    .chap-time { color: var(--text-sec); min-width: 60px; text-align: right; }

    /* STYLE VOTE & ACTION */
    .rating-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
    .stars { display: flex; gap: 2px; cursor: pointer; }
    .stars i { font-size: 18px; color: #e2e8f0; transition: 0.2s; }
    .stars i.active { color: #f59e0b; }
    .rating-text { font-size: 13px; color: var(--text-sec); font-weight: 600; }
    
            .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; margin-bottom: 5px; } 
    .btn { display: inline-flex; align-items: center; justify-content: center; gap: 5px; padding: 8px 14px; border-radius: 8px; font-weight: 500; font-size: 12.5px !important; text-decoration: none; cursor: pointer; transition: 0.2s; border: 1px solid transparent; white-space: nowrap; }
    .btn i { font-size: 15px; }
    
    .btn-read { background: var(--primary); color: #fff; }
    .btn-read:hover { background: #4f46e5; color: #fff; }
    
    .btn-save { background: transparent; color: var(--text-main); border-color: var(--border); }
    .btn-save:hover { border-color: var(--primary); color: var(--primary); }
    
    .btn-nominate { background-color: #ef4444; color: #fff; }
    .btn-nominate:hover { background-color: #dc2626; color: #fff; }

    /* Modal Đề Cử */
    .nominate-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.6); z-index: 1000; align-items: center; justify-content: center; }
    .nominate-modal.active { display: flex; }
    .nm-content { background: var(--bg-card); padding: 25px; border-radius: 12px; width: 90%; max-width: 400px; text-align: center; }
    .nm-title { font-size: 18px; font-weight: 700; margin-bottom: 15px; color: var(--text-main); }
    .nm-desc { font-size: 14px; color: var(--text-sec); margin-bottom: 20px; line-height: 1.5; }
    .nm-balance { font-weight: 600; color: #f59e0b; font-size: 16px; margin: 10px 0 20px; }
    .nm-actions { display: flex; gap: 10px; justify-content: center; }
    .btn-nm-cancel { background: var(--bg-hover); color: var(--text-main); padding: 8px 20px; border-radius: 6px; cursor: pointer; border: none; font-weight: 600; }
    .btn-nm-confirm { background: #ef4444; color: #fff; padding: 8px 20px; border-radius: 6px; cursor: pointer; border: none; font-weight: 600; }

    /* Nút Đảo chiều (Sort) */
    .btn-sort { background: none; border: none; color: var(--primary); font-size: 13px; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 4px; padding: 5px 10px; border-radius: 6px; transition: 0.2s; }
    .btn-sort:hover { background: rgba(99, 102, 241, 0.1); }

    /* Khối section truyện liên quan */
    .related-section { margin-top: 30px; }

    /* [TỐI ƯU SEO] Reset thẻ Heading */
    h2.box-head { margin: 0; font-size: 16px; display: flex; justify-content: space-between; align-items: center; padding-bottom: 15px; border-bottom: 1px solid var(--border); color: var(--text-main); }
    h3.novel-name { margin: 0; font-size: inherit; font-weight: inherit; }

        /* =========================================
       TỐI ƯU RESPONSIVE CHO MOBILE (CHUẨN XÁC)
       ========================================= */
    @media (max-width: 768px) {
        .detail-info { text-align: center; }
        .rating-wrap { justify-content: center; }
        .meta-row { justify-content: center; }
        .actions { justify-content: center; }
        
        /* Nút chia sẻ to hơn trên tablet */
        .btn-share {
            width: 40px;
            height: 40px;
            font-size: 18px;
        }
    }

                @media (max-width: 576px) {
        .actions {
            flex-direction: row; 
            flex-wrap: wrap; 
            gap: 8px;
            margin-bottom: 8px;
            width: 100%;
        }
        .btn-read {
            flex: 1 1 auto;
            min-width: 0;
            padding: 10px 12px;
            font-size: 13px;
        }
        .btn-save {
            flex: 0 1 auto;
            padding: 10px 10px;
            font-size: 12px;
        }
        .btn-nominate {
            flex: 0 1 auto;
            padding: 10px 10px;
            font-size: 12px;
        }
        .btn span, .btn {
            white-space: nowrap; 
            overflow: hidden;
            text-overflow: ellipsis;
        }
        .btn i { font-size: 16px; }
        
        /* Share buttons trên mobile - hiển thị label ẩn, icon to hơn */
        .share-buttons {
            margin-top: 12px;
            margin-bottom: 12px;
            gap: 6px;
            justify-content: center;
        }
        .share-label {
            font-size: 12px;
            margin-right: 2px;
        }
        .btn-share {
            width: 42px;
            height: 42px;
            font-size: 18px;
        }
        /* Ẩn tooltip trên mobile (vì hover ko hoạt động tốt) */
        .btn-share[data-tooltip]:hover::after {
            display: none;
        }
        
        .chapter-grid {
            max-height: 400px; /* Cắt ngắn hơn 1 chút trên Mobile cho dễ vuốt */
        }
    }

    /* =========================================
       RESPONSIVE CHO MÀN HÌNH RẤT NHỎ (<400px)
       ========================================= */
        @media (max-width: 400px) {
        .btn-read {
            flex: 1 1 100%;
        }
        .btn-save {
            flex: 0 1 calc(50% - 4px);
        }
        .btn-nominate {
            flex: 0 1 calc(50% - 4px);
        }
        .btn-share {
            width: 38px;
            height: 38px;
            font-size: 16px;
        }
        .share-label {
            display: none; /* Ẩn chữ "Chia sẻ:" trên màn hình siêu nhỏ */
        }
    }

    /* =========================================
       ANIMATION CHO TRANG CHI TIẾT
       ========================================= */

    /* Fade-in + slide up cho các khối */
    .animate-on-scroll {
        opacity: 0;
        transform: translateY(25px);
        transition: opacity 0.5s cubic-bezier(0.22, 1, 0.36, 1),
                    transform 0.5s cubic-bezier(0.22, 1, 0.36, 1);
    }
    .animate-on-scroll.visible {
        opacity: 1;
        transform: translateY(0);
    }

    /* Cover image hover zoom */
    .detail-cover {
        transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                    box-shadow 0.3s ease;
        will-change: transform;
    }
    .cover-box:hover .detail-cover {
        transform: scale(1.05);
        box-shadow: 0 15px 35px rgba(99, 102, 241, 0.2);
    }

    /* Breadcrumb fade-in từ trái */
    .breadcrumb {
        animation: breadcrumbFade 0.5s ease forwards;
    }
    @keyframes breadcrumbFade {
        from { opacity: 0; transform: translateX(-15px); }
        to { opacity: 1; transform: translateX(0); }
    }

    /* Action buttons hover */
    .btn-read, .btn-save, .btn-nominate {
        transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .btn-read:hover { transform: translateY(-2px) scale(1.02); }
    .btn-save:hover { transform: translateY(-2px); }
    .btn-nominate:hover { transform: translateY(-2px) scale(1.02); }

    /* Chap item hover */
    .chap-item {
        transition: all 0.2s ease;
    }
    .chap-item:hover {
        transform: translateX(4px);
    }

    /* Modal animation */
    .nominate-modal {
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.3s ease;
    }
    .nominate-modal.active {
        opacity: 1;
        pointer-events: auto;
        display: flex;
    }
    .nominate-modal .nm-content {
        transform: scale(0.9) translateY(20px);
        transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    .nominate-modal.active .nm-content {
        transform: scale(1) translateY(0);
    }

    /* =========================================
       NÚT CHIA SẺ MẠNG XÃ HỘI
       ========================================= */
        .share-buttons {
        display: flex;
        align-items: center;
        gap: 8px;
        margin-top: 15px;
        margin-bottom: 15px;
        flex-wrap: wrap;
    }
    .share-label {
        font-size: 13px;
        font-weight: 600;
        color: var(--text-sec);
        margin-right: 5px;
    }
    .btn-share {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border-radius: 50%;
        border: none;
        cursor: pointer;
        color: #fff;
        font-size: 16px;
        transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
        text-decoration: none;
        position: relative;
    }
    .btn-share:hover {
        transform: translateY(-3px) scale(1.1);
        box-shadow: 0 6px 15px rgba(0,0,0,0.2);
    }
    .btn-share.facebook { background: #1877f2; }
        .btn-share.twitter { background: #000; }
    .btn-share.copy-link { background: #64748b; font-size: 14px; }
    .btn-share.messenger { background: #0099ff; }
    .btn-share[data-tooltip]:hover::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: -30px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0,0,0,0.8);
        color: #fff;
        font-size: 11px;
        padding: 4px 10px;
        border-radius: 4px;
        white-space: nowrap;
        z-index: 100;
    }

    @media (prefers-reduced-motion: reduce) {
        .animate-on-scroll { opacity: 1; transform: none; transition: none; }
        .detail-cover { transition: none; }
        .breadcrumb { animation: none; }
        .btn-read:hover, .btn-save:hover, .btn-nominate:hover { transform: none; }
        .chap-item:hover { transform: none; }
    }