/* ==========================================================
   1. DIỆT TẬN GỐC DÒNG "PUBLISHED WITH HONKIT"
   ========================================================== */
.book-summary ul.summary li.divider,
.book-summary ul.summary li a[target="_blank"],
.gitbook-link,
.summary .divider {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
}

/* ==========================================================
   2. TỔNG THỂ SIDEBAR
   ========================================================== */
.book-summary {
    background: #f1f5f9 !important;
    border-right: 1px solid #e2e8f0 !important;
}

/* ==========================================================
   3. MENU ITEMS - DIỆN MẠO MỚI (XANH XÁM)
   ========================================================== */
.book-summary ul.summary li a,
.book-summary ul.summary li span {
    position: relative !important;
    /* Padding trái thụt vào để chừa chỗ cho mũi tên */
    padding: 8px 10px 8px 30px !important;
    margin: 2px 10px !important;
    border-radius: 6px !important;

    color: #475569 !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.5 !important;

    display: block !important;
    white-space: normal !important;
    word-wrap: break-word !important;
    overflow: visible !important;
    transition: all 0.2s ease !important;
}

/* Trạng thái Hover */
.book-summary ul.summary li a:hover {
    background: #eff6ff !important;
    color: #1d4ed8 !important;
    text-decoration: none !important;
}

/* Trạng thái Active (Đang chọn) */
.book-summary ul.summary li.active>a,
.book-summary ul.summary li a:active {
    background: #dbeafe !important;  /* Nền xanh nhạt nổi hơn màu eff6ff */
    color: #1d4ed8 !important;       /* Chữ xanh nước biển đậm */
    font-weight: 700 !important;
    text-decoration: none !important;
}

/* ==========================================================
   4. MŨI TÊN (TRIGGER) - CANH BÊN TRÁI
   ========================================================== */
/* Cần cho các mũi tên được định hướng đặt ở bên trái */
.book-summary ul.summary li {
    position: relative !important;
    /* Để mũi tên absolute ăn theo li */
}

.exc-trigger {
    position: absolute !important;
    left: 8px !important;          /* Dịch mũi tên ra xa chữ */
    right: auto !important;
    top: 12px !important;          /* Căn giữa dòng chữ tốt hơn */
    color: #64748b !important;
    margin: 0 !important;
    padding: 0 !important;
    transition: transform 0.2s ease, color 0.2s ease !important;
    z-index: 2 !important;
    /* Dùng font-size 0 để ẩn icon/chữ cũ nếu có, hiển thị qua ::before */
    font-size: 0 !important; 
}

/* Tạo icon hình tam giác nhỏ như ảnh mới */
.exc-trigger::before {
    content: "\25B8" !important;
    /* Mã Unicode Black Right-Pointing Small Triangle */
    font-size: 11px !important;    /* Chỉnh nhỏ lại 1 chút cho đỡ thô */
    font-family: Arial, sans-serif !important;
    font-weight: normal !important;
    display: inline-block !important;
}

/* Đổi màu mũi tên khi chọn */
.book-summary ul.summary li.active>.exc-trigger {
    color: #1d4ed8 !important;
}

.book-summary ul.summary li:hover>.exc-trigger {
    color: #1d4ed8 !important;
}

/* Khi mở menu, mũi tên xoay xuống */
.expanded>.exc-trigger {
    transform: rotate(90deg) !important;
}

/* ==========================================================
   5. PHÂN CẤP THỤT LỀ
   ========================================================== */
/* Cấp 1 (VD: IV. XCyber Contract) */
.book-summary ul.summary>li>a {
    padding-left: 20px !important;
    /* Có thể không có mũi tên */
}

.book-summary ul.summary>li>.exc-trigger {
    left: 4px !important;
}

/* Cấp 2 (VD: 1. Đăng nhập) */
.book-summary ul.summary li ul li a {
    padding-left: 36px !important;
    /* Dành chỗ cho mũi tên cấp 2 */
}

.book-summary ul.summary li ul>li>.exc-trigger {
    left: 14px !important; /* Đẩy ra xa chữ */
}

/* Cấp 3 (VD: 1.1 Đối với...) */
.book-summary ul.summary li ul li ul li a {
    padding-left: 52px !important;
}

.book-summary ul.summary li ul li ul>li>.exc-trigger {
    left: 30px !important;
}

/* Cấp 4 */
.book-summary ul.summary li ul li ul li ul li a {
    padding-left: 68px !important;
}

.book-summary ul.summary li ul li ul li ul>li>.exc-trigger {
    left: 46px !important;
}

/* ==========================================================
   6. BỘ NÚT LIÊN HỆ 
   ========================================================== */
.contact-buttons {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 99999 !important;
    /* Đảm bảo luôn nằm trên cùng */
}

.contact-item {
    display: flex !important;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    margin-top: 15px;
    position: relative;
    color: white !important;
    text-decoration: none !important;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    transition: all 0.3s ease;
}

.fb-btn {
    background: #1877F2 !important;
}

.phone-btn {
    background: #FF4B2B !important;
}

.zalo-btn {
    background: #0068FF !important;
}

.contact-item i, .contact-item b {
    font-size: 26px !important;
}

.contact-item:hover {
    transform: scale(1.1) translateY(-5px);
}

/* Vòng tròn tỏa ra (Animation) */
.contact-item::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 50%;
    border: 2px solid currentColor;
    animation: zoom-pulse 1.8s infinite;
}

@keyframes zoom-pulse {
    0% {
        transform: scale(1);
        opacity: 0.6;
    }

    100% {
        transform: scale(1.7);
        opacity: 0;
    }
}

.fb-label,
.phone-label,
.zalo-label {
    position: absolute;
    right: 80px;
    background: white;
    padding: 0 18px;
    border-radius: 25px;
    white-space: nowrap;
    font-weight: bold;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
    line-height: 45px;
    height: 45px;
    font-size: 14px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    pointer-events: none;
}

.fb-label {
    color: #1877F2;
}

.phone-label {
    color: #FF4B2B;
}

.zalo-label {
    color: #0068FF;
}

/* Hover hiện nhãn */
.contact-item:hover .fb-label,
.contact-item:hover .phone-label,
.contact-item:hover .zalo-label {
    opacity: 1;
    visibility: visible;
    right: 85px;
}

/* ==========================================================
   7. SEARCH BAR (GIAO DIỆN PILL - BO TRÒN)
   ========================================================== */
#book-search-input {
    background: #ffffff !important;
    padding: 15px !important;
    border-bottom: none !important;
    position: relative;
    border-radius: 0 !important;
}

#book-search-input input {
    background: #f1f5f9 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 20px !important;
    padding: 8px 15px 8px 35px !important;
    /* Dành chỗ cho icon kính lúp */
    font-size: 13px !important;
    color: #475569 !important;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

#book-search-input input::placeholder {
    color: #94a3b8 !important;
}

/* Thêm icon kính lúp thủ công bằng pseudo-element nếu plugin không tự render */
#book-search-input::before {
    content: "\f002" !important;
    /* FontAwesome Search icon */
    font-family: FontAwesome !important;
    position: absolute !important;
    left: 28px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    color: #94a3b8 !important;
    font-size: 14px !important;
    display: block !important;
    pointer-events: none;
    z-index: 10;
}

/* Tắt icon cũ nếu có */
#book-search-input::after {
    display: none !important;
}

/* ==========================================================
   8. STYLE CHO PHẦN HEADER (Vd: GIỚI THIỆU)
   ========================================================== */
.book-summary ul.summary li.header {
    padding: 10px 15px !important;
    margin: 10px 15px 5px 15px !important;
    background: #eff6ff !important; /* Đổi nền header thành xanh siêu nhạt nếu thích, hoặc giữ xám. Theo yêu cầu mình đặt nền xám. Đổi lại xám */
    background: #e2e8f0 !important;
    border-radius: 6px !important;
    color: #1d4ed8 !important; /* Chữ tiêu đề màu xanh */
    font-size: 13px !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    line-height: 1.5 !important;
}

/* ==========================================================
   9. NÚT SÁNG/TỐI & NÚT FAQ Ở CUỐI TRANG
   ========================================================== */

/* Nút FAQ (Outline cũ được đổi thành FAQ) */
.faq-sidebar-btn {
    position: fixed;
    /* fix vào cuối */
    bottom: 0px;
    left: 0;
    width: 300px;
    /* Bằng kích thước book-summary */
    padding: 15px 20px;
    background: #eff6ff !important; /* Đặt làm xanh nhạt mặc định */
    border-top: 1px solid #e2e8f0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #1d4ed8 !important; /* Chữ màu xanh đậm mặc định */
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    text-decoration: none;
    z-index: 50;
    box-sizing: border-box;
}

/* Cho màn hình nhỏ, nút FAQ tự thu vừa với độ rộng của sidebar */
@media (max-width: 600px) {
    .faq-sidebar-btn {
        width: 100%;
    }
}

.faq-sidebar-btn:hover,
.faq-sidebar-btn:active {
    background: #dbeafe !important; /* Nền xanh nhạt đậm hơn khi hover hoặc bấm */
    text-decoration: none;
    color: #1e3a8a !important; /* Xanh đậm hơn nữa lúc bấm */
}

.faq-sidebar-btn i {
    font-size: 16px;
    color: #1d4ed8 !important;
}

/* Chừa khoảng trống bên dưới menu để không bị đè bởi nút FAQ */
.book-summary ul.summary {
    padding-bottom: 70px !important;
}

/* Nút Sáng Tối trên góc phải */
.dark-mode-toggle {
    position: fixed;
    top: 20px;
    right: 30px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    z-index: 9999;
    color: #475569;
    font-size: 18px;
    transition: all 0.3s ease;
}

.dark-mode-toggle:hover {
    background: #f1f5f9;
    transform: scale(1.05);
}

/* ==========================================================
   10. CHẾ ĐỘ TỐI (DARK MODE) CƠ BẢN
   ========================================================== */
body.dark-mode {
    background-color: #0f172a !important;
    /* Màu nền chính */
    color: #cbd5e1 !important;
    /* Màu chữ */
}

/* Các thành phần cơ bản */
body.dark-mode .book-header,
body.dark-mode .book-body,
body.dark-mode .page-wrapper {
    background-color: #0f172a !important;
}

body.dark-mode .markdown-section {
    color: #cbd5e1 !important;
}

body.dark-mode .markdown-section h1,
body.dark-mode .markdown-section h2,
body.dark-mode .markdown-section h3,
body.dark-mode .markdown-section h4 {
    color: #f8fafc !important;
}

body.dark-mode .markdown-section p,
body.dark-mode .markdown-section li {
    color: #cbd5e1 !important;
}

body.dark-mode .markdown-section a {
    color: #60a5fa !important;
}

body.dark-mode .book-summary {
    background: #1e293b !important;
    border-right: 1px solid #334155 !important;
}

body.dark-mode .book-summary ul.summary li a,
body.dark-mode .book-summary ul.summary li span {
    color: #94a3b8 !important;
}

body.dark-mode .book-summary ul.summary li a:hover,
body.dark-mode .book-summary ul.summary li.active>a {
    background: #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .exc-trigger {
    color: #94a3b8 !important;
}

body.dark-mode .book-summary ul.summary li.active>.exc-trigger {
    color: #f8fafc !important;
}

body.dark-mode .faq-sidebar-btn {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .faq-sidebar-btn:hover {
    background: #334155 !important;
}

body.dark-mode .faq-sidebar-btn i {
    color: #cbd5e1 !important;
}

body.dark-mode .dark-mode-toggle {
    background: #1e293b;
    border-color: #334155;
    color: #fbd38d;
    /* Nút mặt trăng/mặt trời màu vàng */
}

/* CSS cho thanh search mode tối */
body.dark-mode #book-search-input {
    background: #1e293b !important;
    border-color: transparent !important;
}

body.dark-mode #book-search-input input {
    background: #0f172a !important;
    border-color: #334155 !important;
    color: #f8fafc !important;
}

body.dark-mode .book-summary ul.summary li.header {
    background: #334155 !important;
    color: #cbd5e1 !important;
}