/* ============================================================================
   BANNER ĐỒNG Ý COOKIE + CHUÔNG THÔNG BÁO ĐẨY (Cài đặt → Cookie & Thông báo)
   Không phụ thuộc theme: màu nhấn lấy --dmdc-cc-accent (cài đặt) → --color-primary (theme).
   ============================================================================ */
.dmdc-cc, .dmdc-ccm, .dmdc-wp, .dmdc-wp-bell, .dmdc-cc-reopen {
  --dp-accent: var(--dmdc-cc-accent, var(--color-primary, #D02329));
  --dp-ink: #1c1213;
  --dp-body: #4b4546;
  --dp-muted: #857b7c;
  --dp-line: #ece6e5;
  --dp-soft: #f8f4f3;
  --dp-radius: 16px;
  --dp-shadow: 0 18px 50px rgba(28, 18, 19, .18), 0 2px 8px rgba(28, 18, 19, .08);
  font-family: inherit;
  color: var(--dp-body);
  box-sizing: border-box;
}
.dmdc-cc *, .dmdc-ccm *, .dmdc-wp *, .dmdc-wp-bell * { box-sizing: border-box; }

/* ---------- Nút dùng chung ---------- */
.dmdc-pbtn {
  appearance: none; -webkit-appearance: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 10px 18px; margin: 0; border-radius: 10px; border: 1.5px solid transparent;
  font: inherit; font-size: 14px; font-weight: 600; line-height: 1.2; letter-spacing: 0; text-transform: none;
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background-color .2s, border-color .2s, color .2s, transform .15s;
}
.dmdc-pbtn:active { transform: translateY(1px); }
.dmdc-pbtn:focus-visible { outline: 3px solid color-mix(in srgb, var(--dp-accent) 35%, transparent); outline-offset: 2px; }
.dmdc-pbtn--primary { background: var(--dp-accent); color: #fff; border-color: var(--dp-accent); }
.dmdc-pbtn--primary:hover { filter: brightness(.92); color: #fff; }
.dmdc-pbtn--ghost { background: #fff; color: var(--dp-ink); border-color: #d9d1d0; }
.dmdc-pbtn--ghost:hover { border-color: var(--dp-ink); color: var(--dp-ink); }
.dmdc-pbtn--link { background: none; border-color: transparent; color: var(--dp-ink); padding-left: 6px; padding-right: 6px; text-decoration: underline; text-underline-offset: 3px; }
.dmdc-pbtn--link:hover { color: var(--dp-accent); }

/* ---------- Banner ---------- */
.dmdc-cc {
  position: fixed; z-index: 2147482000; background: #fff; box-shadow: var(--dp-shadow);
  opacity: 0; transform: translateY(18px); transition: opacity .35s ease, transform .35s ease; pointer-events: none;
}
.dmdc-cc.is-in { opacity: 1; transform: none; pointer-events: auto; }
.dmdc-cc__icon { flex: 0 0 auto; width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center;
  background: color-mix(in srgb, var(--dp-accent) 10%, #fff); color: var(--dp-accent); }
.dmdc-cc__icon svg { width: 22px; height: 22px; }
.dmdc-cc__title { margin: 0 0 6px; font-size: 17px; font-weight: 700; line-height: 1.3; color: var(--dp-ink); }
.dmdc-cc__text { margin: 0; font-size: 14px; line-height: 1.6; color: var(--dp-body); }
.dmdc-cc__text a { color: var(--dp-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.dmdc-cc__text a:hover { color: var(--dp-accent); }
.dmdc-cc__actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* Kiểu hộp nổi ở góc */
.dmdc-cc--box { bottom: 24px; width: min(440px, calc(100vw - 32px)); border-radius: var(--dp-radius); padding: 22px; }
.dmdc-cc--box.dmdc-cc--left { left: 24px; }
.dmdc-cc--box.dmdc-cc--right { right: 24px; }
.dmdc-cc--box .dmdc-cc__head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 18px; }
.dmdc-cc--box .dmdc-cc__actions .dmdc-pbtn--primary,
.dmdc-cc--box .dmdc-cc__actions .dmdc-pbtn--ghost { flex: 1 1 0; }
.dmdc-cc--box .dmdc-cc__actions .dmdc-pbtn--link { order: 3; flex: 1 0 100%; min-height: 32px; padding-top: 4px; padding-bottom: 0; }

/* Kiểu thanh ngang cuối màn hình */
.dmdc-cc--bar { left: 0; right: 0; bottom: 0; border-radius: 18px 18px 0 0; padding: 20px max(24px, calc((100vw - 1216px) / 2)); }
.dmdc-cc--bar .dmdc-cc__inner { display: flex; gap: 28px; align-items: center; justify-content: space-between; }
.dmdc-cc--bar .dmdc-cc__head { display: flex; gap: 14px; align-items: flex-start; flex: 1 1 auto; min-width: 0; }
.dmdc-cc--bar .dmdc-cc__actions { flex: 0 0 auto; flex-wrap: nowrap; }

/* Kiểu hộp giữa màn hình */
.dmdc-cc-backdrop { position: fixed; inset: 0; z-index: 2147481999; background: rgba(28, 18, 19, .45); opacity: 0; transition: opacity .3s; }
.dmdc-cc-backdrop.is-in { opacity: 1; }
.dmdc-cc--center { left: 50%; top: 50%; width: min(520px, calc(100vw - 32px)); border-radius: 20px; padding: 28px; transform: translate(-50%, -46%); }
.dmdc-cc--center.is-in { transform: translate(-50%, -50%); }
.dmdc-cc--center .dmdc-cc__head { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.dmdc-cc--center .dmdc-cc__actions .dmdc-pbtn--primary, .dmdc-cc--center .dmdc-cc__actions .dmdc-pbtn--ghost { flex: 1 1 0; }
.dmdc-cc--center .dmdc-cc__actions .dmdc-pbtn--link { order: 3; flex: 1 0 100%; }

/* ---------- Hộp tùy chỉnh ---------- */
.dmdc-ccm { position: fixed; inset: 0; z-index: 2147482100; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(28, 18, 19, .5); opacity: 0; visibility: hidden; transition: opacity .25s, visibility 0s linear .25s; }
.dmdc-ccm.is-open { opacity: 1; visibility: visible; transition: opacity .25s; }
.dmdc-ccm__panel { position: relative; width: min(640px, 100%); max-height: min(86vh, 760px); display: flex; flex-direction: column;
  background: #fff; border-radius: 20px; box-shadow: var(--dp-shadow); transform: translateY(12px); transition: transform .25s; }
.dmdc-ccm.is-open .dmdc-ccm__panel { transform: none; }
.dmdc-ccm__head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 22px 24px 16px; border-bottom: 1px solid var(--dp-line); }
.dmdc-ccm__title { margin: 0; font-size: 20px; font-weight: 700; color: var(--dp-ink); line-height: 1.3; }
.dmdc-ccm__close { appearance: none; border: 0; background: var(--dp-soft); width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: var(--dp-ink); flex: 0 0 auto; }
.dmdc-ccm__close:hover { background: #efe6e4; }
.dmdc-ccm__close svg { width: 16px; height: 16px; }
.dmdc-ccm__body { padding: 18px 24px; overflow-y: auto; overscroll-behavior: contain; }
.dmdc-ccm__intro { margin: 0 0 16px; font-size: 14px; line-height: 1.65; }
.dmdc-ccm__intro a { color: var(--dp-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.dmdc-ccm__cat { border: 1px solid var(--dp-line); border-radius: 14px; margin-bottom: 10px; background: #fff; }
.dmdc-ccm__cat[open] { background: var(--dp-soft); }
.dmdc-ccm__row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; list-style: none; }
.dmdc-ccm__row::-webkit-details-marker { display: none; }
.dmdc-ccm__chev { width: 16px; height: 16px; color: var(--dp-muted); transition: transform .2s; flex: 0 0 auto; }
.dmdc-ccm__cat[open] .dmdc-ccm__chev { transform: rotate(90deg); }
.dmdc-ccm__name { flex: 1 1 auto; font-size: 15px; font-weight: 600; color: var(--dp-ink); }
.dmdc-ccm__desc { margin: 0; padding: 0 16px 16px 44px; font-size: 13.5px; line-height: 1.6; color: var(--dp-body); }
.dmdc-ccm__always { font-size: 12px; font-weight: 600; color: #1f7a3f; background: #e6f4ea; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.dmdc-ccm__foot { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; padding: 16px 24px 20px; border-top: 1px solid var(--dp-line); }

/* Công tắc */
.dmdc-sw { position: relative; flex: 0 0 auto; width: 46px; height: 26px; }
.dmdc-sw input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.dmdc-sw span { position: absolute; inset: 0; border-radius: 999px; background: #d4cbca; transition: background-color .2s; }
.dmdc-sw span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .2); transition: transform .2s; }
.dmdc-sw input:checked + span { background: var(--dp-accent); }
.dmdc-sw input:checked + span::after { transform: translateX(20px); }
.dmdc-sw input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--dp-accent) 35%, transparent); outline-offset: 2px; }

/* Nút mở lại cài đặt cookie */
.dmdc-cc-reopen { position: fixed; bottom: 24px; z-index: 1030; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: #fff; color: var(--dp-accent); box-shadow: 0 6px 18px rgba(28, 18, 19, .18); display: inline-flex; align-items: center; justify-content: center; }
.dmdc-cc-reopen svg { width: 22px; height: 22px; }
.dmdc-cc-reopen--left { left: 24px; }
.dmdc-cc-reopen--right { right: 24px; }

/* ---------- Thông báo đẩy: chuông + hộp mời ---------- */
.dmdc-wp-bell { position: fixed; bottom: 24px; z-index: 1030; width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--dp-accent); color: #fff; box-shadow: 0 8px 22px rgba(28, 18, 19, .24);
  display: inline-flex; align-items: center; justify-content: center; opacity: 0; transform: scale(.7); transition: opacity .3s, transform .3s; }
.dmdc-wp-bell.is-in { opacity: 1; transform: none; }
.dmdc-wp-bell svg { width: 24px; height: 24px; }
.dmdc-wp-bell--left { left: 24px; }
.dmdc-wp-bell--right { right: 24px; }
.dmdc-wp-bell.has-reopen.dmdc-wp-bell--left { left: 80px; }
.dmdc-wp-bell.is-on::after { content: ""; position: absolute; top: 9px; right: 10px; width: 10px; height: 10px; border-radius: 50%; background: #2fbf71; border: 2px solid var(--dp-accent); }
.dmdc-wp-bell:focus-visible { outline: 3px solid color-mix(in srgb, var(--dp-accent) 40%, transparent); outline-offset: 3px; }
.dmdc-wp-bell.is-ring svg { animation: dmdcRing 1.2s ease 2; transform-origin: 50% 10%; }
@keyframes dmdcRing { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(16deg); } 30% { transform: rotate(-14deg); } 45% { transform: rotate(10deg); } 60% { transform: rotate(-6deg); } 75% { transform: rotate(3deg); } }

.dmdc-wp { position: fixed; bottom: 88px; z-index: 1990; width: min(360px, calc(100vw - 32px)); padding: 20px; border-radius: var(--dp-radius);
  background: #fff; box-shadow: var(--dp-shadow); opacity: 0; transform: translateY(12px); transition: opacity .3s, transform .3s; pointer-events: none; }
.dmdc-wp.is-in { opacity: 1; transform: none; pointer-events: auto; }
.dmdc-wp--left { left: 24px; }
.dmdc-wp--right { right: 24px; }
.dmdc-wp--nobell { bottom: 24px; }
.dmdc-wp__head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 14px; }
.dmdc-wp__icon { flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; overflow: hidden; background: var(--dp-soft);
  display: inline-flex; align-items: center; justify-content: center; }
.dmdc-wp__icon img { width: 100%; height: 100%; object-fit: contain; }
.dmdc-wp__title { margin: 0 0 4px; font-size: 15.5px; font-weight: 700; line-height: 1.35; color: var(--dp-ink); }
.dmdc-wp__text { margin: 0; font-size: 13.5px; line-height: 1.55; }
.dmdc-wp__actions { display: flex; gap: 8px; }
.dmdc-wp__actions .dmdc-pbtn { flex: 1 1 0; min-height: 40px; }
.dmdc-wp__close { position: absolute; top: 10px; right: 10px; width: 30px; height: 30px; border: 0; border-radius: 50%; background: transparent;
  color: var(--dp-muted); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.dmdc-wp__close:hover { background: var(--dp-soft); color: var(--dp-ink); }
.dmdc-wp__close svg { width: 14px; height: 14px; }
.dmdc-wp__note { margin: 10px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--dp-muted); }
.dmdc-wp__note.is-ok { color: #1f7a3f; }
.dmdc-wp__note.is-err { color: #b3261e; }

/* ---------- Điện thoại ---------- */
@media (max-width: 640px) {
  .dmdc-cc--box, .dmdc-cc--bar { left: 12px !important; right: 12px !important; bottom: 12px; width: auto; border-radius: 18px; padding: 18px; }
  .dmdc-cc--bar .dmdc-cc__inner { flex-direction: column; align-items: stretch; gap: 16px; }
  .dmdc-cc--bar .dmdc-cc__actions { flex-wrap: wrap; }
  .dmdc-cc--bar .dmdc-cc__actions .dmdc-pbtn--primary, .dmdc-cc--bar .dmdc-cc__actions .dmdc-pbtn--ghost { flex: 1 1 0; }
  .dmdc-cc--bar .dmdc-cc__actions .dmdc-pbtn--link { order: 3; flex: 1 0 100%; }
  .dmdc-cc__icon { display: none; }
  .dmdc-cc__head { margin-bottom: 14px !important; }
  .dmdc-cc__text { font-size: 13.5px; }
  .dmdc-ccm { align-items: flex-end; padding: 0; }
  .dmdc-ccm__panel { max-height: 92vh; border-radius: 20px 20px 0 0; }
  .dmdc-ccm__head, .dmdc-ccm__body, .dmdc-ccm__foot { padding-left: 18px; padding-right: 18px; }
  .dmdc-ccm__foot .dmdc-pbtn { flex: 1 1 calc(50% - 4px); }
  .dmdc-ccm__foot .dmdc-pbtn--primary { flex-basis: 100%; order: -1; }
  .dmdc-ccm__desc { padding-left: 16px; }
  .dmdc-wp-bell { bottom: 16px; width: 48px; height: 48px; }
  .dmdc-wp-bell--left { left: 16px; }
  .dmdc-wp-bell--right { right: 16px; }
  .dmdc-wp { left: 12px !important; right: 12px !important; width: auto; bottom: 76px; }
  .dmdc-wp--nobell { bottom: 12px; }
  .dmdc-cc-reopen { bottom: 16px; }
  .dmdc-cc-reopen--left { left: 16px; }
  .dmdc-cc-reopen--right { right: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .dmdc-cc, .dmdc-ccm, .dmdc-ccm__panel, .dmdc-wp, .dmdc-wp-bell { transition: none !important; }
  .dmdc-wp-bell.is-ring svg { animation: none; }
}
@media print { .dmdc-cc, .dmdc-ccm, .dmdc-wp, .dmdc-wp-bell, .dmdc-cc-reopen, .dmdc-cc-backdrop { display: none !important; } }
