/* DN Studio — CTA nổi + thanh credit đáy + modal tư vấn, dùng chung mọi mẫu HTML.
   Mỗi template restyle bằng .dn-lead { --dn-lead-*: … } nếu cần. */

.dn-lead,
.dn-lead * { box-sizing: border-box; }

.dn-lead {
  --dn-lead-ink: #10254f;
  --dn-lead-body: #5b6b88;
  --dn-lead-blue: #1a6ff5;
  --dn-lead-blue-dk: #0f57cc;
  --dn-lead-navy: #0c2348;
  --dn-lead-line: #dbe4f2;
  --dn-lead-star: #d64545;
  --dn-lead-radius: 16px;
  --dn-lead-font: "Be Vietnam Pro", "Segoe UI", system-ui, sans-serif;
  font-family: var(--dn-lead-font);
  color: var(--dn-lead-ink);
  -webkit-font-smoothing: antialiased;
}

html.dn-lead-on,
html.dn-lead-on body { overflow: hidden !important; }

/* Chừa chỗ đáy để nội dung mẫu không bị thanh credit che. */
html.dn-has-credit {
  --dn-credit-space: 92px;
}
html.dn-has-credit body {
  padding-bottom: var(--dn-credit-space) !important;
}

/* ---------- Thanh credit ghim giữa đáy ---------- */

.dn-credit {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom, 0px));
  z-index: 95;
  display: flex;
  align-items: stretch;
  width: min(740px, calc(100vw - 24px));
  min-height: 56px;
  padding: 6px;
  gap: 4px;
  background: #0c2348;
  color: #f4f7fb;
  border-radius: 18px;
  box-shadow:
    0 16px 40px rgba(8, 22, 48, .38),
    0 1px 0 rgba(255, 255, 255, .08) inset;
  isolation: isolate;
  font-family: var(--dn-lead-font);
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: 0;
  text-align: left;
  opacity: 0;
  transform: translateX(-50%) translateY(10px);
  transition: opacity .35s ease, transform .45s cubic-bezier(.22, 1, .36, 1);
}
.dn-credit.is-ready {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.dn-lead.is-open .dn-credit {
  visibility: hidden;
  pointer-events: none;
}

.dn-credit a,
.dn-credit button {
  font-family: inherit;
  text-decoration: none;
  letter-spacing: inherit;
  line-height: inherit;
  text-transform: none;
  box-shadow: none;
  appearance: none;
  -webkit-appearance: none;
}

.dn-credit__by,
.dn-credit__cta,
.dn-credit__more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0;
  min-height: 44px;
  border: 0;
  cursor: pointer;
  border-radius: 13px;
}

.dn-credit__by {
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-start;
  padding: 0 12px 0 8px;
  color: #f4f7fb;
  background: transparent;
}
.dn-credit__by:hover {
  background: rgba(255, 255, 255, .08);
}
.dn-credit__by:focus-visible,
.dn-credit__cta:focus-visible,
.dn-credit__more:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.dn-credit__mark {
  height: 28px;
  width: auto;
  max-width: 48px;
  object-fit: contain;
  flex: none;
}

.dn-credit__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.dn-credit__kicker {
  font-size: 10.5px;
  font-weight: 500;
  color: #b7c6de;
  white-space: nowrap;
}
.dn-credit__site {
  font-size: 12.5px;
  font-weight: 700;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dn-credit__cta {
  flex: 0 0 auto;
  padding: 0 16px;
  background: var(--dn-lead-blue);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 10px 22px -12px rgba(26, 111, 245, .95);
}
.dn-credit__cta:hover { background: var(--dn-lead-blue-dk); }
.dn-credit__cta:active { transform: translateY(1px); }
.dn-credit__cta-short { display: none; }

.dn-credit__more {
  flex: 0 0 auto;
  padding: 0 14px 0 16px;
  color: #e8eef8;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(255, 255, 255, .08);
}
.dn-credit__more:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.dn-credit__more svg {
  width: 14px;
  height: 14px;
  flex: none;
}
.dn-credit__more-short { display: none; }

/* ---------- FAB góc phải dưới ---------- */

.dn-lead-fab {
  --dn-lead-fab-size: 50px;
  --dn-lead-fab-gap: 11px;
  position: fixed;
  right: 20px;
  bottom: var(--dn-credit-space, 92px);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: var(--dn-lead-fab-gap);
}

.dn-lead-fab__btn {
  position: relative;
  width: var(--dn-lead-fab-size);
  height: var(--dn-lead-fab-size);
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(12, 35, 72, .24);
  opacity: 0;
  transform: translateX(26px) scale(.82);
  transition: opacity .45s ease, transform .45s cubic-bezier(.22, 1, .36, 1), box-shadow .25s ease;
}
.dn-lead-fab.is-ready .dn-lead-fab__btn { opacity: 1; transform: none; }
.dn-lead-fab.is-ready .dn-lead-fab__btn:hover,
.dn-lead-fab.is-ready .dn-lead-fab__btn:focus-visible {
  transform: scale(1.09);
  box-shadow: 0 12px 28px rgba(12, 35, 72, .32);
  outline: none;
}

.dn-lead-fab.is-ready .dn-lead-fab__btn:nth-child(6) { transition-delay: 0s; }
.dn-lead-fab.is-ready .dn-lead-fab__btn:nth-child(5) { transition-delay: .06s; }
.dn-lead-fab.is-ready .dn-lead-fab__btn:nth-child(4) { transition-delay: .12s; }
.dn-lead-fab.is-ready .dn-lead-fab__btn:nth-child(3) { transition-delay: .18s; }
.dn-lead-fab.is-ready .dn-lead-fab__btn:nth-child(2) { transition-delay: .24s; }
.dn-lead-fab.is-ready .dn-lead-fab__btn:nth-child(1) { transition-delay: .30s; }

.dn-lead-fab__ico { width: 24px; height: 24px; fill: currentColor; stroke: none; }
.dn-lead-fab__zalo { font-size: 12px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }

.dn-lead-fab__label {
  position: absolute;
  right: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%) translateX(10px);
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--dn-lead-navy);
  color: #f4f7fb;
  font-family: var(--dn-lead-font);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 4px 14px rgba(12, 35, 72, .22);
  transition: opacity .25s ease, transform .25s ease;
}
.dn-lead-fab__btn:hover .dn-lead-fab__label,
.dn-lead-fab__btn:focus-visible .dn-lead-fab__label {
  opacity: 1;
  transform: translateY(-50%);
}

.dn-lead-fab__btn--kakao     { background: #FEE500; color: #3C1E1E; }
.dn-lead-fab__btn--whatsapp  { background: #25D366; }
.dn-lead-fab__btn--messenger { background: linear-gradient(145deg, #00C6FF 0%, #0068FF 42%, #A033FF 70%, #FF5280 88%, #FF7061 100%); }
.dn-lead-fab__btn--zalo      { background: #0068FF; }
.dn-lead-fab__btn--phone     { background: #22c55e; }
.dn-lead-fab__btn--map       { background: #EA4335; }

.dn-lead-fab__btn--phone::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 1.5px solid rgba(34, 197, 94, .7);
  opacity: 0;
  pointer-events: none;
}
.dn-lead-fab.is-ready .dn-lead-fab__btn--phone::before { animation: dn-lead-halo 2.4s ease-out infinite; }
.dn-lead-fab__btn--phone:hover::before,
.dn-lead-fab__btn--phone:focus-visible::before { animation-play-state: paused; }

/* Rung nhẹ theo nhịp: tất cả cùng rung → dừng → rung lại, có khoảng nghỉ. */
.dn-lead-fab.is-ready .dn-lead-fab__ico,
.dn-lead-fab.is-ready .dn-lead-fab__zalo {
  animation: dn-lead-beat 5.6s ease-in-out infinite;
  transform-origin: 50% 55%;
}
.dn-lead-fab.is-ready .dn-lead-fab__btn:hover .dn-lead-fab__ico,
.dn-lead-fab.is-ready .dn-lead-fab__btn:hover .dn-lead-fab__zalo,
.dn-lead-fab.is-ready .dn-lead-fab__btn:focus-visible .dn-lead-fab__ico,
.dn-lead-fab.is-ready .dn-lead-fab__btn:focus-visible .dn-lead-fab__zalo {
  animation-play-state: paused;
}

@keyframes dn-lead-halo {
  0%   { transform: scale(.92); opacity: .85; }
  100% { transform: scale(1.55); opacity: 0; }
}
@keyframes dn-lead-beat {
  0%, 8%, 38%, 46%, 100% { transform: rotate(0); }
  1.5%  { transform: rotate(-11deg); }
  3%    { transform: rotate(10deg); }
  4.5%  { transform: rotate(-7deg); }
  6%    { transform: rotate(4deg); }
  39.5% { transform: rotate(-11deg); }
  41%   { transform: rotate(10deg); }
  42.5% { transform: rotate(-7deg); }
  44%   { transform: rotate(4deg); }
}

@media (hover: none) {
  .dn-lead-fab__label {
    width: 1px; height: 1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap;
  }
}

/* ---------- Overlay + dialog (layout theo site gốc) ---------- */

.dn-lead__overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 30, 74, .45);
}
.dn-lead.is-open .dn-lead__overlay { display: flex; }

.dn-lead__dialog {
  position: relative;
  width: min(900px, 100%);
  max-height: min(680px, calc(100dvh - 48px));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 34px 70px -38px rgba(11, 33, 82, .42), 0 2px 8px -4px rgba(11, 33, 82, .12);
  overflow: hidden;
}

.dn-lead__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 26px 0;
  flex: none;
}
.dn-lead__title {
  margin: 0;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.25;
  color: var(--dn-lead-ink);
}
.dn-lead__close {
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: #eaf2fe;
  color: var(--dn-lead-ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  flex: none;
}
.dn-lead__close:hover,
.dn-lead__close:focus-visible { background: #d7e6fc; outline: none; }
.dn-lead__close svg { width: 16px; height: 16px; }

.dn-lead__body {
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  gap: 8px;
  min-height: 0;
  flex: 1 1 auto;
  overflow: hidden;
  padding: 18px 22px 24px;
}

.dn-lead__aside {
  background: #eaf2fe;
  color: var(--dn-lead-ink);
  padding: 22px 20px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow: auto;
}

.dn-lead .dn-logo {
  --dnl-mark: 48px;
  --dnl-name: 20px;
  --dnl-tag: 10px;
  --dnl-ink: #01175d;
  --dnl-rule: rgba(1, 23, 93, .20);
  display: inline-flex;
  align-items: center;
  gap: 11px;
  line-height: 1;
  white-space: nowrap;
}
.dn-lead .dn-logo__mark {
  height: var(--dnl-mark);
  width: auto;
  max-width: none;
  flex: none;
}
.dn-lead .dn-logo__tx {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-left: 12px;
  border-left: 1px solid var(--dnl-rule);
}
.dn-lead .dn-logo__name {
  font-size: var(--dnl-name);
  font-weight: 800;
  letter-spacing: -.02em;
  color: #0058fa;
  line-height: 1;
}
.dn-lead .dn-logo__name > span { color: var(--dnl-ink); }
.dn-lead .dn-logo__tag {
  font-size: var(--dnl-tag);
  font-weight: 600;
  line-height: 1.34;
  letter-spacing: .012em;
  color: var(--dnl-ink);
}
.dn-lead .dn-logo__tag > span { color: #fd5e00; font-weight: 700; }

.dn-lead__lead {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--dn-lead-body);
}

.dn-lead__ways {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.dn-lead__way {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.dn-lead__way:hover strong,
.dn-lead__way:focus-visible strong { color: var(--dn-lead-blue); }
.dn-lead__way:focus-visible { outline: none; }
.dn-lead__way-ic {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  flex: none;
  box-shadow: 0 8px 16px -10px rgba(11, 33, 82, .5);
  transition: transform .22s cubic-bezier(.22, 1, .36, 1), box-shadow .22s ease;
}
.dn-lead__way-ic svg { width: 42px; height: 42px; display: block; }
.dn-lead__way-ic--chat {
  display: grid;
  place-items: center;
  background: #0068FF;
}
.dn-lead__way-zalo {
  color: #fff;
  font-family: var(--dn-lead-font);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: -.045em;
  line-height: 1;
}
.dn-lead__way:hover .dn-lead__way-ic,
.dn-lead__way:focus-visible .dn-lead__way-ic {
  transform: translateY(-1px);
  box-shadow: 0 10px 18px -8px rgba(11, 33, 82, .55);
}
.dn-lead__way small {
  display: block;
  font-size: 12px;
  line-height: 1.3;
  color: var(--dn-lead-body);
}
.dn-lead__way strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--dn-lead-ink);
  overflow-wrap: anywhere;
}

.dn-lead__main {
  padding: 6px 10px 4px 18px;
  overflow: auto;
  background: #fff;
}
.dn-lead__form-intro {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.55;
  color: var(--dn-lead-ink);
}

.dn-lead-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.dn-lead__form { display: flex; flex-direction: column; gap: 12px; }
.dn-lead__field { display: block; margin: 0; min-width: 0; }

.dn-lead__field input,
.dn-lead__field select,
.dn-lead__field textarea {
  width: 100%;
  display: block;
  margin: 0;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.45;
  color: var(--dn-lead-ink);
  background: #fff;
  border: 1px solid var(--dn-lead-line);
  border-radius: 9px;
  padding: 0 12px;
  height: 42px;
  -webkit-appearance: none;
  appearance: none;
}
.dn-lead__field textarea {
  height: 84px;
  min-height: 84px;
  padding: 10px 12px;
  resize: vertical;
}
.dn-lead__field input::placeholder,
.dn-lead__field textarea::placeholder { color: #8a97ad; }
.dn-lead__field input:focus,
.dn-lead__field select:focus,
.dn-lead__field textarea:focus {
  outline: 0;
  border-color: var(--dn-lead-blue);
  box-shadow: 0 0 0 3px rgba(26, 111, 245, .14);
}
.dn-lead__field input.is-need,
.dn-lead__field select.is-need,
.dn-lead__field textarea.is-need,
.dn-lead__field input.is-need:focus,
.dn-lead__field select.is-need:focus,
.dn-lead__field textarea.is-need:focus {
  animation: dn-lead-need .72s ease-in-out infinite;
}
@keyframes dn-lead-need {
  0%, 100% {
    background: #fff;
    border-color: #e24b4b;
    box-shadow: 0 0 0 0 rgba(226, 75, 75, 0);
  }
  50% {
    background: #ffd6d6;
    border-color: #c81e1e;
    box-shadow: 0 0 0 3px rgba(226, 75, 75, .28);
  }
}
.dn-lead__field select {
  padding-right: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6b88' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9.5l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
}
.dn-lead__field select:invalid,
.dn-lead__field select.is-empty { color: #8a97ad; }

.dn-lead__hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.dn-lead__err {
  margin: 0;
  padding: 10px 12px;
  border-radius: 9px;
  background: #fdecec;
  border: 1px solid #f6c9ca;
  color: #9d2226;
  font-size: 13px;
  line-height: 1.5;
}
.dn-lead__ok {
  margin: 0;
  padding: 18px 4px 8px;
  color: #14663a;
  font-size: 15px;
  line-height: 1.6;
}
.dn-lead__ok strong { font-weight: 700; color: var(--dn-lead-ink); }

.dn-lead__submit {
  width: 100%;
  margin: 4px 0 0;
  min-height: 50px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: var(--dn-lead-blue);
  color: #fff;
  cursor: pointer;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 11px;
  box-shadow: 0 18px 32px -18px rgba(26, 111, 245, .95);
}
.dn-lead__submit:hover { background: var(--dn-lead-blue-dk); }
.dn-lead__submit:active { transform: translateY(1px); }
.dn-lead__submit:focus-visible { outline: 2px solid var(--dn-lead-navy); outline-offset: 2px; }
.dn-lead__submit:disabled { opacity: .65; cursor: wait; transform: none; }
.dn-lead__submit svg { width: 16px; height: 16px; }

.dn-lead__note {
  margin: 0;
  text-align: center;
  font-size: 12px;
  color: var(--dn-lead-body);
}

@media (max-width: 760px) {
  html.dn-has-credit { --dn-credit-space: 84px; }

  .dn-credit {
    width: calc(100vw - 16px);
    min-height: 52px;
    padding: 5px;
    border-radius: 16px;
    bottom: max(10px, env(safe-area-inset-bottom, 0px));
  }
  .dn-credit__by { padding: 0 8px 0 6px; gap: 8px; }
  .dn-credit__mark { height: 24px; max-width: 40px; }
  .dn-credit__kicker { font-size: 9.5px; }
  .dn-credit__site { font-size: 11px; }
  .dn-credit__cta { padding: 0 12px; font-size: 12.5px; }
  .dn-credit__more { padding: 0 10px 0 12px; font-size: 12.5px; }

  .dn-lead-fab {
    --dn-lead-fab-size: 44px;
    --dn-lead-fab-gap: 9px;
    right: 12px;
    bottom: var(--dn-credit-space, 84px);
  }
  .dn-lead-fab__ico { width: 21px; height: 21px; }
  .dn-lead-fab__zalo { font-size: 10.5px; }

  .dn-lead__overlay { padding: 10px; align-items: flex-end; }
  .dn-lead__dialog {
    width: 100%;
    max-height: calc(100dvh - 16px);
    border-radius: 16px 16px 10px 10px;
  }
  .dn-lead__head { padding: 16px 16px 0; }
  .dn-lead__body {
    grid-template-columns: 1fr;
    overflow: auto;
    padding: 14px 14px 18px;
  }
  .dn-lead__main { order: -1; padding: 4px 2px 12px; }
  .dn-lead__aside { padding: 16px; }
  .dn-lead__title { font-size: 18px; }
  .dn-lead__ways { display: grid; grid-template-columns: 1fr 1fr; }
  .dn-lead .dn-logo { white-space: normal; }
}

@media (max-width: 640px) {
  .dn-credit__cta-full,
  .dn-credit__more-full { display: none; }
  .dn-credit__cta-short,
  .dn-credit__more-short { display: inline; }
}

@media (max-width: 480px) {
  .dn-credit__kicker,
  .dn-credit__mark { display: none; }
  .dn-credit__site { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  .dn-credit,
  .dn-credit.is-ready {
    opacity: 1;
    transform: translateX(-50%);
    transition: none;
  }
  .dn-credit__cta:active { transform: none; }
  .dn-lead-fab__btn { opacity: 1; transform: none; transition: none; }
  .dn-lead-fab.is-ready .dn-lead-fab__btn--phone::before,
  .dn-lead-fab.is-ready .dn-lead-fab__ico,
  .dn-lead-fab.is-ready .dn-lead-fab__zalo { animation: none; }
  .dn-lead__field input.is-need,
  .dn-lead__field select.is-need,
  .dn-lead__field textarea.is-need,
  .dn-lead__field input.is-need:focus,
  .dn-lead__field select.is-need:focus,
  .dn-lead__field textarea.is-need:focus {
    animation: none;
    background: #ffd6d6;
    border-color: #c81e1e;
    box-shadow: 0 0 0 3px rgba(226, 75, 75, .22);
  }
  .dn-lead__submit:active { transform: none; }
}
