/* Hipo Cookie Consent */
:root {
    --hcc-primary: #1f8a70;
    --hcc-on-primary: #fff;
    --hcc-text: #1f2a2e;
    --hcc-muted: #5b6b70;
    --hcc-bg: #fff;
    --hcc-line: #e3e8ea;
    --hcc-soft: #f4f7f6;
    --hcc-offset: 16px;          /* khoảng cách banner tới mép dưới */
    --hcc-offset-mobile: 0px;
    --hcc-bar-right: 0px;        /* thanh ngang: chừa chỗ bên phải cho nút chat nổi */
}

.hcc[hidden], .hcc-modal[hidden] { display: none !important; }

.hcc, .hcc-modal, .hcc-embed__ph, .hcc-fb-ph {
    font-family: inherit;
    color: var(--hcc-text);
    line-height: 1.5;
    box-sizing: border-box;
}
.hcc *, .hcc-modal * { box-sizing: border-box; }

/* ---------- Banner ---------- */
.hcc {
    position: fixed;
    z-index: 2147483000;
    bottom: var(--hcc-offset);
    max-width: 440px;
    width: calc(100% - 32px);
}
.hcc--left { left: 16px; }
.hcc--center { left: 50%; transform: translateX(-50%); max-width: 760px; }

.hcc-banner {
    background: var(--hcc-bg);
    border: 1px solid var(--hcc-line);
    border-radius: 14px;
    padding: 18px 20px 16px;
    box-shadow: 0 10px 30px rgba(16, 38, 33, .16);
}
.hcc-banner__title { margin: 0 0 6px; font-size: 16px; font-weight: 700; }
.hcc-banner__msg { margin: 0 0 14px; font-size: 14px; color: var(--hcc-muted); }
.hcc-banner__msg a, .hcc-modal__intro a { color: var(--hcc-primary); text-decoration: underline; }
.hcc-banner__btns { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.hcc--center .hcc-banner {
    display: grid; grid-template-columns: 1fr auto; grid-template-areas: "t b" "m b"; column-gap: 24px;
}
.hcc--center .hcc-banner__title { grid-area: t; align-self: end; }
.hcc--center .hcc-banner__msg { grid-area: m; margin: 0; align-self: start; }
.hcc--center .hcc-banner__btns { grid-area: b; flex-direction: column; align-items: stretch; align-self: center; min-width: 170px; }

/* Thanh ngang toàn chiều rộng: chữ bên trái, nút bên phải */
.hcc--bar { left: 0; right: 0; bottom: 0; width: 100%; max-width: none; }
.hcc--bar .hcc-banner {
    display: flex; align-items: center; gap: 12px 32px;
    border: 0; border-top: 3px solid var(--hcc-primary); border-radius: 0;
    padding: 16px max(24px, var(--hcc-bar-right), calc((100% - 1240px) / 2)) 16px max(24px, calc((100% - 1240px) / 2));
    box-shadow: 0 -6px 24px rgba(16, 38, 33, .12);
}
.hcc--bar .hcc-banner__title {
    position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.hcc--bar .hcc-banner__msg { flex: 1 1 auto; margin: 0; font-size: 14.5px; color: var(--hcc-text); }
.hcc--bar .hcc-banner__btns { flex: 0 0 auto; flex-wrap: nowrap; gap: 10px; }
.hcc--bar .hcc-banner__btns .hcc-btn { flex: 0 0 auto; white-space: nowrap; }
.hcc--bar [data-hcc-action="customize"] { order: -2; }
.hcc--bar [data-hcc-action="reject"] { order: -1; }
@media (max-width: 900px) {
    .hcc--bar .hcc-banner { flex-wrap: wrap; }
    .hcc--bar .hcc-banner__btns { width: 100%; justify-content: flex-end; }
}

/* ---------- Nút ---------- */
.hcc-btn {
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.2;
    border-radius: 999px;
    padding: 10px 18px;
    cursor: pointer;
    border: 1px solid transparent;
    min-height: 40px;
    transition: filter .15s, background .15s;
    text-transform: none;
    letter-spacing: 0;
    box-shadow: none;
}
.hcc-btn--primary { background: var(--hcc-primary); color: var(--hcc-on-primary); border-color: var(--hcc-primary); }
.hcc-btn--primary:hover { filter: brightness(.92); }
.hcc-btn--ghost { background: var(--hcc-bg); color: var(--hcc-primary); border-color: var(--hcc-primary); }
.hcc-btn--ghost:hover { background: var(--hcc-soft); }
.hcc-btn--link { background: none; color: var(--hcc-primary); text-decoration: underline; padding: 10px 6px; }
.hcc-btn:focus-visible, .hcc-modal__x:focus-visible, .hcc-switch input:focus-visible + .hcc-switch__track,
.hcc-cat__more summary:focus-visible {
    outline: 3px solid var(--hcc-primary);
    outline-offset: 2px;
}
.hcc-banner__btns .hcc-btn--primary, .hcc-banner__btns .hcc-btn--ghost { flex: 1 1 0; }

/* ---------- Hộp tùy chỉnh ---------- */
html.hcc-lock { overflow: hidden; }
.hcc-modal {
    position: fixed; inset: 0; z-index: 2147483001;
    display: flex; align-items: center; justify-content: center; padding: 16px;
}
.hcc-modal__backdrop { position: absolute; inset: 0; background: rgba(15, 25, 22, .5); }
.hcc-modal__box {
    position: relative;
    background: var(--hcc-bg);
    border-radius: 16px;
    width: 100%; max-width: 600px; max-height: calc(100vh - 32px);
    display: flex; flex-direction: column;
    box-shadow: 0 20px 50px rgba(0, 0, 0, .25);
    outline: none;
}
.hcc-modal__head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 10px; }
.hcc-modal__title { margin: 0; font-size: 20px; font-weight: 700; color: var(--hcc-text); }
.hcc-modal__x {
    background: none; border: 0; font-size: 28px; line-height: 1; color: var(--hcc-muted);
    width: 40px; height: 40px; border-radius: 50%; cursor: pointer; padding: 0;
}
.hcc-modal__x:hover { background: var(--hcc-soft); }
.hcc-modal__body { overflow-y: auto; padding: 0 20px 8px; -webkit-overflow-scrolling: touch; }
.hcc-modal__intro { margin: 0 0 12px; font-size: 14px; color: var(--hcc-muted); }
.hcc-modal__foot {
    display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end;
    padding: 14px 20px 18px; border-top: 1px solid var(--hcc-line);
}

.hcc-cat { border: 1px solid var(--hcc-line); border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; }
.hcc-cat__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.hcc-cat__title { margin: 0; font-size: 15px; font-weight: 700; color: var(--hcc-text); }
.hcc-cat__always { font-size: 13px; font-weight: 600; color: var(--hcc-primary); white-space: nowrap; }
.hcc-cat__desc { margin: 6px 0 0; font-size: 13.5px; color: var(--hcc-muted); }
.hcc-cat__more { margin-top: 8px; font-size: 13px; }
.hcc-cat__more summary { cursor: pointer; color: var(--hcc-primary); font-weight: 600; }

/* Công tắc */
.hcc-switch { position: relative; display: inline-flex; flex: 0 0 auto; cursor: pointer; margin: 0; }
.hcc-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.hcc-switch__track {
    width: 46px; height: 26px; border-radius: 999px; background: #c5cfd2; position: relative; transition: background .15s;
}
.hcc-switch__track::after {
    content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
    background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0, 0, 0, .25);
}
.hcc-switch input:checked + .hcc-switch__track { background: var(--hcc-primary); }
.hcc-switch input:checked + .hcc-switch__track::after { transform: translateX(20px); }

/* Bảng cookie (hộp tùy chỉnh + shortcode) */
.hcc-table-wrap { overflow-x: auto; margin: 8px 0 4px; }
.hcc-table { width: 100%; border-collapse: collapse; font-size: 13px; margin: 0; }
.hcc-table th, .hcc-table td { border: 1px solid var(--hcc-line); padding: 6px 8px; text-align: left; vertical-align: top; }
.hcc-table th { background: var(--hcc-soft); font-weight: 600; }
.hcc-table code { font-size: 12px; background: none; padding: 0; white-space: normal; word-break: break-word; }
.hcc-sc .hcc-table { font-size: 14px; }
.hcc-sc .hcc-table-wrap { margin-bottom: 24px; }

/* ---------- Nội dung nhúng chờ đồng ý ---------- */
.hcc-embed { position: relative; }
.hcc-embed iframe[data-hcc-src] { visibility: hidden; }
.hcc-embed__ph {
    position: absolute; inset: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
    gap: 4px; padding: 16px;
    background: var(--hcc-soft); border: 1px dashed #b8c6c9; border-radius: 12px;
    font-size: 14px; min-height: 160px;
}
.hcc-embed:not(.is-on) { min-height: 180px; }
.hcc-embed__ph p { margin: 0 0 6px; }
.hcc-embed__ph a { color: var(--hcc-primary); margin-left: 10px; }
.hcc-fb-ph {
    background: var(--hcc-soft); border: 1px dashed #b8c6c9; border-radius: 12px;
    padding: 14px; font-size: 14px; text-align: center; margin: 8px 0;
}
.hcc-fb-ph p { margin: 0 0 10px; }

.hcc-footer-links a { white-space: nowrap; }

/* ---------- Điện thoại ---------- */
@media (max-width: 600px) {
    .hcc, .hcc--left, .hcc--center, .hcc--bar {
        left: 0; right: 0; bottom: var(--hcc-offset-mobile); transform: none;
        width: 100%; max-width: none;
    }
    .hcc-banner {
        border-radius: 16px 16px 0 0; border-bottom: 0; padding: 16px 16px calc(14px + env(safe-area-inset-bottom));
        max-height: 70vh; overflow-y: auto;
    }
    /* Nâng banner lên trên các nút nổi (Liên hệ, chat) ở mép dưới */
    .hcc--lifted { left: 8px; right: 8px; width: auto; }
    .hcc--lifted .hcc-banner { border-radius: 14px; border-bottom: 1px solid var(--hcc-line); padding-bottom: 14px; max-height: calc(100vh - var(--hcc-offset-mobile) - 16px); }
    .hcc--center .hcc-banner { display: block; }
    .hcc--bar .hcc-banner { display: block; padding-left: 16px; padding-right: 16px; }
    .hcc--bar .hcc-banner__msg { margin-bottom: 12px; font-size: 13.5px; }
    .hcc--bar .hcc-banner__btns { width: auto; justify-content: flex-start; }
    .hcc--bar .hcc-banner__btns .hcc-btn--primary, .hcc--bar .hcc-banner__btns .hcc-btn--ghost { flex: 1 1 auto; }
    .hcc--bar.hcc--lifted .hcc-banner { border: 1px solid var(--hcc-line); border-top: 3px solid var(--hcc-primary); }
    .hcc--center .hcc-banner__msg { margin-bottom: 12px; }
    .hcc--center .hcc-banner__btns { flex-direction: row; min-width: 0; }
    .hcc-banner__btns .hcc-btn { padding: 10px 14px; white-space: nowrap; }
    .hcc-banner__btns .hcc-btn--primary, .hcc-banner__btns .hcc-btn--ghost { flex: 1 1 auto; }
    .hcc-banner__btns .hcc-btn--link { padding: 10px 4px; }
    .hcc-banner__msg { font-size: 13.5px; }
    .hcc-modal { padding: 0; align-items: flex-end; }
    .hcc-modal__box { max-width: none; max-height: 92vh; border-radius: 16px 16px 0 0; }
    .hcc-modal__foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
    .hcc-modal__foot .hcc-btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
    .hcc-btn, .hcc-switch__track, .hcc-switch__track::after { transition: none; }
}
