* {
    margin: 0;
    padding: 0;
    outline: none;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    box-sizing: border-box;
}

body,
html {
    width: 100%;
    min-width: 0 !important;
    overflow-x: hidden;
}

a {
    text-decoration: none;
    color: inherit;
}

.clear {
    clear: both;
    line-height: 0;
}

section {
    max-width: 1205px;
    margin: 0 auto;
    width: 100%;
}

hr {
    color: #eee;
    background-color: #eee;
    border: none;
    height: 1px;
}

.flexContain {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
}

.group:before,
.group:after {
    content: "";
    display: table;
}

.group:after {
    clear: both;
}

.group {
    zoom: 1;
}

.themvaogio, 
a[href*="giohang"], 
.cart, 
.cart-number, 
.giohang {
    display: none !important;
}

#goto-top-page {
    position: fixed;
    bottom: 20px;
    right: 15px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 16px;
    border-radius: 50%;
    width: 38px;
    height: 38px;
    line-height: 38px;
    text-align: center;
    cursor: pointer;
    transition: 0.2s;
}

/* ==========================================================================
   1. GIAO DIỆN SÁNG (LIGHT THEME - MẶC ĐỊNH)
   ========================================================================== */
body {
    background-color: #f4f6f8;
    color: #1e293b;
    transition: background-color 0.25s ease, color 0.25s ease;
}

body .sanPham {
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05) !important;
}
body .sanPham h3 {
    color: #0f172a !important;
}
body .sanPham:hover h3 {
    color: #ff5722 !important;
}
body .xemTatCa {
    background-color: #ffffff !important;
    color: #475569 !important;
    border-color: #e2e8f0 !important;
}

body .chitietSanpham,
body .card-box,
body .user-card-left,
body .review-box,
body .text-reader-container {
    background-color: #ffffff !important;
    border-color: #e2e8f0 !important;
    color: #1e293b !important;
}

/* ==========================================================================
   2. GIAO DIỆN TỐI (DARK THEME)
   ========================================================================== */
body.dark-theme,
html.dark-theme body {
    background-color: #0b0f19 !important;
    color: #f8fafc !important;
}

body.dark-theme .sanPham {
    background-color: #111827 !important;
    border: 1px solid #1f2937 !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4) !important;
}
body.dark-theme .sanPham h3 {
    color: #ffffff !important;
}
body.dark-theme .sanPham:hover h3 {
    color: #ff5722 !important;
}
body.dark-theme .xemTatCa {
    background-color: #111827 !important;
    color: #cbd5e1 !important;
    border-color: #1f2937 !important;
}

body.dark-theme .chitietSanpham,
body.dark-theme .card-box,
body.dark-theme .user-card-left,
body.dark-theme .review-box,
body.dark-theme .text-reader-container {
    background-color: #111827 !important;
    border-color: #1f2937 !important;
    color: #f8fafc !important;
}

body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3,
body.dark-theme h4,
body.dark-theme .profile-row b,
body.dark-theme .reader-toolbar-title {
    color: #f8fafc !important;
}

body.dark-theme .profile-row {
    border-bottom-color: #1f2937 !important;
    color: #94a3b8 !important;
}

/* ==========================================================================
   3. TOÀN DIỆN CHO MOBILE (< 768PX)
   ========================================================================== */
@media screen and (max-width: 768px) {
    /* Khung trang chi tiết sản phẩm: chuyển ảnh và thông tin thành 1 cột */
    .rowdetail.group {
        display: flex !important;
        flex-direction: column !important;
        gap: 15px !important;
    }
    .chitietSanpham .picture,
    .chitietSanpham .price_sale,
    .chitietSanpham .info_product {
        width: 100% !important;
        min-width: 100% !important;
    }

    /* Trang cá nhân (nguoidung.html): xếp 2 cột thành 1 cột */
    .custom-account-box {
        flex-direction: column !important;
        padding: 0 10px !important;
        margin: 15px auto !important;
    }
    .user-card-left, .order-card-right {
        width: 100% !important;
    }
    .vip-tier-grid {
        grid-template-columns: 1fr !important;
    }

    /* Trang nạp mực (napxu.html): xếp thành 1 cột */
    .recharge-wrapper {
        flex-direction: column !important;
        padding: 0 10px !important;
        margin: 15px auto !important;
    }
    .recharge-left, .recharge-right {
        width: 100% !important;
    }

    /* Khối bộ lọc trang chủ */
    .box-filter-truyen {
        padding: 12px 14px !important;
        flex-direction: column !important;
        align-items: stretch !important;
    }
    .box-filter-truyen > div,
    .box-filter-truyen button {
        width: 100% !important;
    }

    /* Bục Bảng phong thần (bxh.html): bục top 1, 2, 3 co giãn tự nhiên */
    .podium-container {
        flex-direction: column !important;
        align-items: center !important;
        gap: 15px !important;
    }
    .podium-item {
        width: 100% !important;
        max-width: 100% !important;
        transform: none !important;
    }

    /* Khối audio player trên mobile */
    .audio-main-layout {
        flex-direction: column !important;
        text-align: center !important;
        padding: 16px !important;
    }
    .player-content-center {
        width: 100% !important;
    }
    .controls-row {
        gap: 14px !important;
    }
    .setting-popup-panel {
        width: 100% !important;
        right: 0 !important;
        bottom: 100% !important;
    }
}
/* ==========================================================================
   TỐI ƯU GIAO DIỆN DARK THEME TOÀN DIỆN (CHỮ SÁNG, ĐỒNG BỘ 100%)
   ========================================================================== */

/* 1. NỀN CHUNG VÀ MÀU CHỮ TOÀN TRANG */
body.dark-theme,
html.dark-theme {
    background-color: #0b0f19 !important;
    color: #e2e8f0 !important;
}

/* 2. SỬA LỖI MẤT CHỮ TRÊN HEADER */
body.dark-theme .header,
body.dark-theme .header .header-nav-pc a.nav-link-item,
body.dark-theme .header-nav-pc li a {
    color: #f1f5f9 !important;
}

body.dark-theme .header-nav-pc li a:hover {
    color: #ff5722 !important;
}

/* 3. SỬA LỖI TIÊU ĐỀ TRANG BXH & PHONG THẦN */
body.dark-theme .bxh-container h1,
body.dark-theme h1,
body.dark-theme h2,
body.dark-theme h3 {
    color: #ffffff !important;
}

body.dark-theme p,
body.dark-theme span:not(.badge-vip) {
    color: #cbd5e1;
}

/* 4. CHUYỂN TOÀN BỘ KHỐI TRẮNG (CARD) SANG TONE TỐI SANG TRỌNG */
body.dark-theme .card-box,
body.dark-theme .user-card-left,
body.dark-theme .custom-auth-modal,
body.dark-theme .napxu-card,
body.dark-theme .box-detail-story,
body.dark-theme .thong-tin-truyen,
body.dark-theme .lienhe-box,
body.dark-theme div[style*="background: #fff"],
body.dark-theme div[style*="background:#fff"],
body.dark-theme div[style*="background-color: #fff"],
body.dark-theme div[style*="background: white"],
body.dark-theme div[style*="background-color: white"],
body.dark-theme section div[style*="background: rgb(255, 255, 255)"] {
    background: #131b2e !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    color: #f8fafc !important;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45) !important;
}

/* 5. CÁC THẺ PODIUM TOP 1, 2, 3 TRÊN TRANG BXH */
body.dark-theme .top-user-card,
body.dark-theme div[style*="border-radius: 16px"] {
    background: #1e293b !important;
    color: #f8fafc !important;
}

/* 6. BẢNG XẾP HẠNG & LỊCH SỬ GIAO DỊCH */
body.dark-theme table,
body.dark-theme .history-table {
    background: #131b2e !important;
    color: #f8fafc !important;
}

body.dark-theme .history-table th,
body.dark-theme table th {
    background: #1e293b !important;
    color: #94a3b8 !important;
    border-bottom: 2px solid #334155 !important;
}

body.dark-theme .history-table td,
body.dark-theme table td {
    border-bottom: 1px solid #1e293b !important;
    color: #e2e8f0 !important;
}

/* 7. TRANG NẠP MỰC: CÁC GÓI NẠP & FORM THANH TOÁN */
body.dark-theme .goi-nap-item,
body.dark-theme div[style*="border: 1px solid #e2e8f0"] {
    background: #1e293b !important;
    border-color: #334155 !important;
    color: #ffffff !important;
}

body.dark-theme .goi-nap-item b,
body.dark-theme .goi-nap-item span {
    color: #ffffff !important;
}

body.dark-theme input,
body.dark-theme select,
body.dark-theme textarea {
    background: #0f172a !important;
    border: 1px solid #334155 !important;
    color: #ffffff !important;
}

body.dark-theme input::placeholder,
body.dark-theme textarea::placeholder {
    color: #64748b !important;
}

/* 8. SỬA KHUNG QR VIETQR KHÔNG BỊ NỀN ĐEN CHE MÃ */
body.dark-theme img[src*="vietqr"],
body.dark-theme .qr-container,
body.dark-theme img[alt*="VietQR"] {
    background: #ffffff !important;
    padding: 10px !important;
    border-radius: 8px !important;
}

/* 9. NÚT CHUYỂN ĐỔI THEME TRÊN HEADER */
.btn-theme-toggle {
    background: rgba(255, 255, 255, 0.1) !important;
    border: 1px solid rgba(255, 255, 255, 0.2) !important;
    border-radius: 50% !important;
    width: 36px !important;
    height: 36px !important;
    color: #ffb703 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
}