/* Tumen Deal - giao diện công khai */
:root {
    --bg: #ffffff;
    --soft: #f5f6f8;          /* nền phụ: ô nhập, ảnh sản phẩm, vùng đặt cạnh nền trắng */
    --card: #ffffff;
    --text: #1b2330;
    --muted: #667085;
    --line: #e4e7ec;
    --accent: #ee4d2d;
    --accent-dark: #d83f20;
    --ok-bg: #e7f6ec; --ok-text: #14532d; --ok-line: #b7e4c7;
    --err-bg: #fdecea; --err-text: #7f1d1d; --err-line: #f5c2c0;
    --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --shadow-lg: 0 8px 24px rgba(16, 24, 40, .12);
    --radius: 12px;
    color-scheme: light;      /* luôn nền trắng, không đổi theo chế độ tối của thiết bị */
}

@view-transition { navigation: auto; }
[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0; font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--bg); color: var(--text); min-height: 100vh;
    display: flex; flex-direction: column;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
h1 { font-size: clamp(1.4rem, 2.5vw + 1rem, 2rem); line-height: 1.25; margin: 24px 0 14px; }
h2 { font-size: 1.25rem; line-height: 1.3; margin: 32px 0 14px; }
.wrap { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }
main { flex: 1; padding-bottom: 8px; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; border-radius: 6px; }

/* Header */
.site-header {
    position: sticky; top: 0; z-index: 20;
    background: color-mix(in srgb, var(--card) 88%, transparent);
    backdrop-filter: saturate(160%) blur(10px);
    border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: 6px; height: 58px; }
.brand { font-weight: 800; font-size: 1.2rem; color: var(--accent); margin-right: auto; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.brand img { width: 28px; height: 28px; border-radius: 7px; }
.nav a { padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: .95rem; color: var(--muted); }
.nav a:hover, .nav a[aria-current="page"] { color: var(--text); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.nav { display: flex; gap: 2px; }
@media (max-width: 520px) {
    .brand span { display: none; }          /* chừa chỗ cho nút "Nhận deal" trên điện thoại */
    .nav a { padding: 8px 8px; font-size: .88rem; }
}

/* Buttons & forms */
/* Nút chính: gradient cam, bo tròn, đổ bóng nhẹ để nổi bật trên nền trắng */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: linear-gradient(135deg, #ff7a45, var(--accent)); color: #fff; border: 0; border-radius: 999px;
    padding: 10px 22px; font: inherit; font-weight: 700; cursor: pointer;
    box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent);
    transition: filter .15s, transform .1s, box-shadow .15s; text-align: center;
}
.btn:hover { filter: brightness(.95); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 45%, transparent); }
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .6; cursor: progress; }
/* Nút phụ: viền mảnh, hover đổi sang màu thương hiệu */
.btn.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); box-shadow: none; }
.btn.ghost:hover { filter: none; border-color: var(--accent); color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, #fff); box-shadow: none; }
.btn.sm { padding: 5px 12px; font-size: .85rem; border-radius: 8px; }
.btn.block { display: flex; width: 100%; padding: 13px 18px; font-size: 1.05rem; }
input[type=email], input[type=text], input[type=password], input[type=search] {
    flex: 1; min-width: 0; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line);
    background: var(--soft); color: var(--text); font: inherit;
}
input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }

/* Alerts */
.flash, .errors { padding: 12px 16px; border-radius: 10px; margin: 16px 0; border: 1px solid; }
.flash { background: var(--ok-bg); color: var(--ok-text); border-color: var(--ok-line); }
.errors { background: var(--err-bg); color: var(--err-text); border-color: var(--err-line); }

/* Product grid & card */
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; } }
@media (min-width: 820px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

.card {
    background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
    overflow: hidden; display: flex; flex-direction: column; position: relative; box-shadow: var(--shadow);
    transition: transform .18s, box-shadow .18s, border-color .18s;
}
/* Nút "Mua ngay" cuối thẻ (span trong thẻ <a>, cả thẻ đã là link) */
.card .buy {
    margin-top: auto; padding: 8px 0; border-radius: 999px; text-align: center; font-weight: 700; font-size: .88rem;
    color: #fff; background: linear-gradient(135deg, #ff7a45, var(--accent)); transition: filter .15s;
}
.card:hover .buy { filter: brightness(.93); }
.card .body .price { margin-top: 2px; }
.card .body > .buy { margin-top: auto; }                 /* ghim nút xuống đáy thẻ để các thẻ cùng hàng thẳng nhau */
.card .body > :nth-last-child(2) { margin-bottom: 10px; } /* khoảng cách tối thiểu giữa nội dung và nút */
@media (hover: hover) { .card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); } }
.card .thumb { aspect-ratio: 1; background: var(--soft); overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .ribbon {
    position: absolute; top: 8px; left: 8px; background: var(--accent); color: #fff;
    font-weight: 800; font-size: .8rem; padding: 2px 8px; border-radius: 6px; box-shadow: var(--shadow);
}
.card .body { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 4px; flex: 1; }
.card .name {
    font-size: .9rem; line-height: 1.35; min-height: 2.7em;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.price { color: var(--accent); font-weight: 800; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.old { color: var(--muted); text-decoration: line-through; font-size: .82rem; font-variant-numeric: tabular-nums; }
.badge { background: var(--accent); color: #fff; border-radius: 6px; padding: 1px 8px; font-size: .78rem; font-weight: 800; }
.hot-tag { font-size: .75rem; font-weight: 700; color: var(--accent); }

/* Tìm kiếm & lọc */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.filters input[type=search] { flex: 1 1 240px; }
.filters select { flex: 1 1 140px; min-width: 0; padding: 11px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--soft); color: var(--text); font: inherit; }
.card .avg { font-size: .75rem; color: var(--muted); line-height: 1.3; }
.card .avg b { color: var(--accent); }
.card .drop { font-size: .75rem; font-weight: 600; color: var(--muted); }
.card .drop b { color: var(--accent); font-variant-numeric: tabular-nums; }

/* Tab & khung giờ mã giảm giá */
.tabs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: thin; }
.tabs a { flex: none; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); font-weight: 600; font-size: .9rem; color: var(--muted); }
.tabs a:hover { color: var(--text); }
.tabs a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.slot-bar { background: color-mix(in srgb, var(--accent) 10%, var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 14px; margin: 0 0 14px; font-size: .92rem; }
.slot-bar strong { color: var(--accent); font-variant-numeric: tabular-nums; }
.voucher .soon { color: var(--accent); font-weight: 600; }

/* Fade-in ảnh */
html.js img[data-fade] { opacity: 0; transition: opacity .35s ease; }
html.js img[data-fade].loaded { opacity: 1; }

/* Load more */
.more { display: flex; justify-content: center; padding: 22px 0 6px; }
.more .btn { min-width: 180px; }
.skeleton .thumb, .skeleton .line { background: linear-gradient(90deg, var(--line) 25%, color-mix(in srgb, var(--line) 50%, var(--card)) 50%, var(--line) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
.skeleton .line { height: 12px; border-radius: 6px; margin-top: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Product detail */
.detail { display: grid; gap: 24px; grid-template-columns: 1fr; margin-top: 20px; }
@media (min-width: 760px) { .detail { grid-template-columns: minmax(0, 420px) 1fr; } }
.detail .pic { border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--card); aspect-ratio: 1; }
.detail .pic img { width: 100%; height: 100%; object-fit: cover; }
.detail h1 { margin-top: 0; font-size: 1.4rem; }
.detail .now { font-size: 2rem; font-weight: 800; color: var(--accent); }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); }
.chart-box { position: relative; height: 260px; }
.sticky-cta { position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 40%); }
@media (min-width: 760px) { .sticky-cta { position: static; background: none; padding: 0; } }

/* Vouchers */
.vouchers { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .vouchers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.voucher { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); }
.voucher .code-box { border: 2px dashed var(--accent); color: var(--accent); border-radius: 10px; padding: 8px 12px; font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 800; letter-spacing: .5px; text-align: center; min-width: 108px; word-break: break-all; }
.voucher .info { flex: 1; min-width: 0; font-size: .92rem; }
.voucher .info small { color: var(--muted); display: block; margin-top: 2px; }
.voucher .actions { display: flex; flex-direction: column; gap: 6px; }
@media (max-width: 480px) { .voucher { flex-wrap: wrap; } .voucher .actions { flex-direction: row; width: 100%; } .voucher .actions .btn { flex: 1; } }
.empty { text-align: center; color: var(--muted); padding: 40px 12px; }

/* Subscribe: banner trong trang + hộp thoại ở header */
.sub { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 12%, var(--card)), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 28px 0; }
.sub strong { font-size: 1.05rem; }
.sub .hint { font-size: .85rem; color: var(--muted); margin: 2px 0 0; }
form[data-subscribe] { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.form-msg { flex-basis: 100%; margin: 0; font-size: .88rem; color: var(--err-text); background: var(--err-bg); border: 1px solid var(--err-line); border-radius: 8px; padding: 8px 12px; }
html:not(.js) .js-only { display: none; }

.modal { border: 0; border-radius: var(--radius); padding: 24px; width: min(92vw, 440px); background: var(--card); color: var(--text); box-shadow: var(--shadow-lg); }
.modal::backdrop { background: rgba(0, 0, 0, .55); backdrop-filter: blur(2px); }
.modal[open] { animation: toast-in .2s ease; }
.modal h2 { margin: 0 0 4px; font-size: 1.2rem; }
.modal p { margin: 0; }
.modal .close { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 1rem; cursor: pointer; }
.modal .close:hover { background: color-mix(in srgb, var(--text) 8%, transparent); }

/* Footer */
.site-footer { color: var(--muted); font-size: .82rem; padding: 26px 0 34px; text-align: center; border-top: 1px solid var(--line); margin-top: 24px; }

/* Toast */
#toasts { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: #1b2330; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: .95rem; animation: toast-in .2s ease; pointer-events: auto; }
.toast.err { background: #b42318; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

#install-btn[hidden] { display: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Giá: số tiền tiết kiệm */
.card .save { font-size: .78rem; font-weight: 700; color: #16a34a; }

/* Bố cục có menu loại hàng bên trái */
.shop { display: block; }
.shop-main { min-width: 0; }
.cats ul { list-style: none; margin: 0; padding: 0; display: flex; gap: 8px; overflow-x: auto; padding: 12px 0 4px; scrollbar-width: thin; }
.cats-title { display: none; }
.cats a {
    display: flex; align-items: center; gap: 6px; white-space: nowrap; text-decoration: none; color: var(--text);
    padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--card); font-size: .88rem;
}
.cats a small { color: var(--muted); font-size: .75rem; }
.cats a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }
.cats a[aria-current="page"] small { color: #fff; opacity: .85; }
@media (min-width: 900px) {
    .shop.has-cats { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 16px; }
    .cats { position: sticky; top: 74px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 8px; max-height: calc(100vh - 90px); overflow-y: auto; }
    .cats-title { display: block; font-size: .95rem; margin: 0 8px 8px; }
    .cats ul { display: block; overflow: visible; padding: 0; }
    .cats a { border: 0; border-radius: 8px; justify-content: space-between; white-space: normal; background: transparent; padding: 8px 10px; }
    .cats a:hover { background: color-mix(in srgb, var(--text) 6%, var(--card)); }
    .cats a[aria-current="page"]:hover { background: var(--accent); }
    .shop.has-cats .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) { .shop.has-cats .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Trang chi tiết: breadcrumb, biểu đồ giá */
.crumbs { margin: 16px 0 0; font-size: .85rem; color: var(--muted); }
.crumbs a:hover { color: var(--accent); }
.chart { width: 100%; height: auto; display: block; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--accent); stroke: #fff; stroke-width: 2; }
.chart-label { fill: var(--muted); font-size: 12px; }
.detail .badge { margin: 0 6px; }

/* Trang nội dung (giới thiệu, liên hệ, chính sách) */
.prose { max-width: 760px; padding: 8px 0 24px; }
.prose h2 { margin-top: 26px; }
.prose ul { padding-left: 20px; }
.prose a { color: var(--accent); text-decoration: underline; }

/* Chân trang */
.foot-links { display: flex; gap: 8px 18px; justify-content: center; flex-wrap: wrap; margin-bottom: 10px; font-weight: 600; }
.foot-links a:hover { color: var(--accent); }
.site-footer p { margin: 4px 0; }
