/* =====================================================================
   DARK MODE FOR CUSTOMER PAGES: active when <html data-bs-theme="dark"> (follows the device setting until the visitor uses the moon button, which the browser remembers).
   Bootstrap 5.3 recolors its own parts (forms, modals, tables, menus...). This file changes the --tb-* variables and the
   colors hard-coded in each page's <style>. Loaded AFTER shop.css.
   Approach: --tb-nau (logo brown, used for heading text) becomes light cream -> headings stay readable on dark backgrounds; brown buttons
   become cream buttons with dark text. The header / footer background (--tb-nen-nau) and text on orange (--tb-tren-cam) stay dark.
   Product photos / brand logos keep a white background (photos are shot on white, logos are mostly black text).
   ===================================================================== */
[data-bs-theme="dark"] {
    color-scheme: dark;
    --tb-kem: #14100D;          /* page background */
    --tb-kem-dam: #231A14;      /* alternating section background, hover */
    --tb-soft: #1C1511;
    --tb-mat: #1D1611;          /* card / panel background */
    --tb-ink: #EDE3DA;          /* main text */
    --tb-muted: #B09C8E;
    --tb-line: #3A2D24;
    --tb-nau: #F1D2B6;          /* headings, prices, 'brown' buttons -> light cream */
    --tb-cam-dam: var(--tb-cam);
    --tb-nen-nau: #2A1910;
    --tb-tren-cam: #2B170B;
    --tb-green: #5DBB63;
    --tb-blue: #64A8F0;
    --bs-body-bg: #14100D;
    --bs-body-color: #EDE3DA;
    --bs-emphasis-color: #fff;
    --bs-secondary-color: #B09C8E;
    --bs-border-color: #3A2D24;
    --bs-secondary-bg: #231A14;
    --bs-tertiary-bg: #1C1511;
}

/* ---------- Bootstrap utilities with fixed colors (don't follow dark mode by themselves) ---------- */
[data-bs-theme="dark"] body { background: var(--tb-kem); }  /* overrides body { #f4f5f7 } on the Profile / Checkout pages */
[data-bs-theme="dark"] .bg-white { background-color: var(--tb-mat) !important; }
[data-bs-theme="dark"] .bg-light { background-color: var(--tb-kem-dam) !important; }
[data-bs-theme="dark"] .text-dark:where(:not(.badge, .bg-warning, .btn-warning, .bg-info)),
[data-bs-theme="dark"] .text-black { color: var(--tb-ink) !important; }
[data-bs-theme="dark"] .btn-dark { --bs-btn-hover-bg: var(--tb-cam); --bs-btn-hover-border-color: var(--tb-cam); --bs-btn-hover-color: var(--tb-tren-cam); }
[data-bs-theme="dark"] .btn-outline-dark { --bs-btn-hover-color: var(--tb-tren-cam); }
/* Orange buttons / boxes styled inline (Order lookup in the footer, Write post button...) -> dark text */
[data-bs-theme="dark"] [style*="background: var(--tb-cam)"] { color: var(--tb-tren-cam) !important; }
/* Floating notifications at the top (white background set inline) */
[data-bs-theme="dark"] [style*="background: #ffffff"] { background: var(--tb-mat) !important; color: var(--tb-ink); }
[data-bs-theme="dark"] .tb-search input::placeholder { color: var(--tb-muted); }
[data-bs-theme="dark"] .spc-gia-cu { color: #8d7e74; }

/* ---------- Home page ---------- */
[data-bs-theme="dark"] .tb-loi-tat a,
[data-bs-theme="dark"] .tb-tin { background: var(--tb-mat); }
[data-bs-theme="dark"] .tb-hero-nut button:hover { color: var(--tb-tren-cam); }
[data-bs-theme="dark"] .tb-hang a { background: #fff; color: #4C2611; }   /* brand logo tiles: black-text logos need a white background */
[data-bs-theme="dark"] .tb-bn-nut { color: #4C2611; }
[data-bs-theme="dark"] .tb-banner-nho a:hover .tb-bn-nut { background: var(--tb-cam); color: var(--tb-tren-cam); }
[data-bs-theme="dark"] .tb-xh-so { color: #6d5d52; }

/* ---------- Product detail ---------- */
[data-bs-theme="dark"] .p-detail-card { background: transparent; }
[data-bs-theme="dark"] .p-detail-card .btn-danger { --bs-btn-color: var(--tb-tren-cam); color: var(--tb-tren-cam) !important; }
[data-bs-theme="dark"] .variant-btn,
[data-bs-theme="dark"] .nut-chia-se { background: var(--tb-mat); }
[data-bs-theme="dark"] .thumb-box-v3 { background: #fff; }
[data-bs-theme="dark"] .dg-khung,
[data-bs-theme="dark"] .dg-tra-loi { background: var(--tb-kem-dam); border-color: var(--tb-line); }
[data-bs-theme="dark"] .dg-muc { border-bottom-color: var(--tb-line); }
[data-bs-theme="dark"] .dg-diem small { color: var(--tb-muted); }
[data-bs-theme="dark"] .dg-dem-tab { background: #3d2c12; color: #f5c46b; }
[data-bs-theme="dark"] .dg-da-mua { background: #1f3a22; color: #8fd694; }
[data-bs-theme="dark"] .dg-sao .far.fa-star,
[data-bs-theme="dark"] .dg-chon-sao label { color: #5a4a3f; }
[data-bs-theme="dark"] .dg-chon-sao input:checked ~ label,
[data-bs-theme="dark"] .dg-chon-sao label:hover,
[data-bs-theme="dark"] .dg-chon-sao label:hover ~ label { color: #f5a524; }
[data-bs-theme="dark"] #thanhMuaDinh { background: var(--tb-mat); }
[data-bs-theme="dark"] #thanhMuaDinh .tmd-sp { color: var(--tb-muted); }
[data-bs-theme="dark"] #thanhMuaDinh .tmd-nut:not(:disabled) { background: var(--tb-cam); color: var(--tb-tren-cam); }

/* ---------- All products: filters + Select2 ---------- */
[data-bs-theme="dark"] .filter-top-bar,
[data-bs-theme="dark"] .sort-select-wrapper,
[data-bs-theme="dark"] .custom-filter-input,
[data-bs-theme="dark"] .custom-filter-input:focus,
[data-bs-theme="dark"] .custom-filter-input option,
[data-bs-theme="dark"] .select2-container .select2-selection--single,
[data-bs-theme="dark"] .select2-dropdown { background-color: var(--tb-mat); color: var(--tb-ink); border-color: var(--tb-line); }
[data-bs-theme="dark"] .filter-top-bar { border-top-color: var(--tb-cam); }
[data-bs-theme="dark"] .form-label-sm,
[data-bs-theme="dark"] .sort-select,
[data-bs-theme="dark"] .select2-container--default .select2-selection--single .select2-selection__rendered,
[data-bs-theme="dark"] .select2-results__option { color: var(--tb-ink); }
[data-bs-theme="dark"] .sort-select option { background: var(--tb-mat); }
[data-bs-theme="dark"] .select2-search--dropdown .select2-search__field { background: var(--tb-kem); color: var(--tb-ink); border-color: var(--tb-line); }
[data-bs-theme="dark"] .select2-container--default .select2-results__option--selected { background-color: var(--tb-kem-dam); }

/* ---------- Release calendar: month picker ---------- */
[data-bs-theme="dark"] .chon-loc {
    background: var(--tb-mat) url('data:image/svg+xml;utf8,<svg fill="%23F1D2B6" height="24" viewBox="0 0 24 24" width="24" xmlns="http://www.w3.org/2000/svg"><path d="M7 10l5 5 5-5z"/></svg>') no-repeat right 12px center;
}

/* ---------- Brands ---------- */
[data-bs-theme="dark"] .tms-brand-header { border-bottom-color: var(--tb-line); }
[data-bs-theme="dark"] .tms-brand-title { color: var(--tb-ink); }
[data-bs-theme="dark"] .tms-brand-search-box { background: var(--tb-kem-dam); }
/* Logo cards keep a white background with black text as in light mode (most brand logos are black text) */
[data-bs-theme="dark"] .tms-brand-card { border-color: transparent; --bs-secondary-color: #6c757d; --bs-heading-color: #000; }
[data-bs-theme="dark"] .tms-brand-card .text-dark { color: #000 !important; }
[data-bs-theme="dark"] .tms-brand-count { color: #777; }

/* ---------- News ---------- */
[data-bs-theme="dark"] .tin-tab,
[data-bs-theme="dark"] .tin-the,
[data-bs-theme="dark"] .article-container { background: var(--tb-mat); border-color: var(--tb-line); }
[data-bs-theme="dark"] .tin-tab.on { color: var(--tb-tren-cam); }
[data-bs-theme="dark"] .tin-dau h1 small,
[data-bs-theme="dark"] .tin-ngay,
[data-bs-theme="dark"] .article-meta { color: var(--tb-muted); border-color: var(--tb-line); }
[data-bs-theme="dark"] .tin-nhan,
[data-bs-theme="dark"] .article-tag { border-color: var(--tb-line); }
[data-bs-theme="dark"] .tin-nhan.hang_ve { background: #1f3a22; color: #8fd694; border-color: #2c5530; }
[data-bs-theme="dark"] .tin-nhan.thong_bao { background: #3d2c12; color: #f5c46b; border-color: #5a4219; }
[data-bs-theme="dark"] .article-content { color: var(--tb-ink); }
[data-bs-theme="dark"] .article-content h1, [data-bs-theme="dark"] .article-content h2,
[data-bs-theme="dark"] .article-content h3, [data-bs-theme="dark"] .article-content h4 { color: #fff; }
[data-bs-theme="dark"] .article-content strong, [data-bs-theme="dark"] .article-content b { color: #fff; }

/* ---------- Policy / info pages ---------- */
[data-bs-theme="dark"] .policy-menu-link { color: var(--tb-muted); }
[data-bs-theme="dark"] .policy-menu-link:hover { background: var(--tb-kem-dam); }
[data-bs-theme="dark"] .policy-content-box { background: var(--tb-mat); }
[data-bs-theme="dark"] .policy-content-box h3, [data-bs-theme="dark"] .policy-content-box h4,
[data-bs-theme="dark"] .policy-noi-dung h2, [data-bs-theme="dark"] .policy-noi-dung h3 { color: var(--tb-ink); }
[data-bs-theme="dark"] .support-box { background: var(--tb-kem-dam); }

/* ---------- Login / Checkout / Cart ---------- */
[data-bs-theme="dark"] .login-card { background: var(--tb-mat); border-color: var(--tb-line); }
[data-bs-theme="dark"] .login-card h3 { color: var(--tb-ink) !important; }
[data-bs-theme="dark"] .btn-login { background: var(--tb-cam); color: var(--tb-tren-cam); }
[data-bs-theme="dark"] .form-control { border-color: var(--tb-line); }
[data-bs-theme="dark"] .customer-item:hover { background-color: var(--tb-kem-dam); }

/* ---------- Light / dark toggle: show the right icon + text for the current mode ---------- */
.nut-gd .khi-toi { display: none; }
[data-bs-theme="dark"] .nut-gd .khi-sang { display: none; }
[data-bs-theme="dark"] .nut-gd .khi-toi { display: inline; }
