/* Phụng Hoàn Academy — công cụ nổi dùng chung toàn website */
:root{
  --pha-tool-cream:#fffaf0;
  --pha-tool-paper:#fffdf8;
  --pha-tool-teal:#0f4c4c;
  --pha-tool-teal-deep:#083737;
  --pha-tool-burgundy:#7a1832;
  --pha-tool-gold:#c99f45;
  --pha-tool-ink:#263334;
}

/* Ẩn các nút cũ để không bị trùng với bộ nút dùng chung. */
body > #socialProofWidget,
body > a.zalo-float,
body > a.zalo{
  display:none!important;
}

.pha-global-interest,
.pha-global-contact,
.pha-global-scroll{
  box-sizing:border-box;
  font-family:Arial,"Helvetica Neue",sans-serif;
}
.pha-global-interest *,
.pha-global-contact *,
.pha-global-scroll *{box-sizing:border-box}

/* Hộp lượt quan tâm gần đây */
.pha-global-interest{
  position:fixed;
  left:max(16px,env(safe-area-inset-left));
  bottom:max(16px,env(safe-area-inset-bottom));
  z-index:2147481000;
  width:min(390px,calc(100vw - 118px));
  padding:14px 48px 13px 15px;
  border:1px solid rgba(201,159,69,.34);
  border-radius:19px;
  background:rgba(255,253,248,.97);
  color:var(--pha-tool-ink);
  box-shadow:0 18px 48px rgba(19,42,42,.20);
  backdrop-filter:blur(12px);
  -webkit-backdrop-filter:blur(12px);
  transform:translateY(16px);
  opacity:0;
  visibility:hidden;
  transition:opacity .28s ease,transform .28s ease,visibility .28s ease;
}
.pha-global-interest.is-visible{transform:none;opacity:1;visibility:visible}
.pha-global-interest.is-updating .pha-global-interest-message{animation:phaGlobalSwap .42s ease}
.pha-global-interest-top{display:flex;align-items:center;gap:8px;min-width:0;margin-bottom:6px}
.pha-global-interest-dot{
  width:10px;height:10px;flex:0 0 10px;border-radius:50%;
  background:#2e9e72;
  animation:phaGlobalPulse 2s infinite;
}
.pha-global-interest-count{font-size:.88rem;font-weight:900;color:var(--pha-tool-teal-deep);white-space:nowrap}
.pha-global-interest-badge{
  margin-left:auto;padding:4px 8px;border-radius:999px;
  background:#f3e3b4;color:#74510c;
  font-size:.61rem;font-weight:900;letter-spacing:.035em;text-transform:uppercase;white-space:nowrap;
}
.pha-global-interest-message{font-size:.84rem;line-height:1.46;color:#3b3b35;margin:0 0 4px}
.pha-global-interest-message strong{color:var(--pha-tool-burgundy)}
.pha-global-interest-note{display:block;font-size:.66rem;line-height:1.35;color:#77736c}
.pha-global-interest-link{display:inline-block;margin-top:7px;color:var(--pha-tool-burgundy);font-size:.76rem;font-weight:900;text-decoration:none}
.pha-global-interest-link:hover{text-decoration:underline}
.pha-global-interest-close{
  position:absolute;right:10px;top:9px;width:29px;height:29px;
  display:grid;place-items:center;border:0;border-radius:50%;
  background:rgba(15,76,76,.09);color:var(--pha-tool-teal-deep);
  font-size:1.05rem;line-height:1;cursor:pointer;
}
.pha-global-interest-close:hover{background:rgba(15,76,76,.16)}

/* Nút Zalo và số điện thoại bên trái */
.pha-global-contact{
  position:fixed;
  left:max(0px,env(safe-area-inset-left));
  top:50%;
  z-index:2147480900;
  display:grid;
  gap:8px;
  transform:translateY(-50%);
}
.pha-global-contact a{
  width:174px;min-height:48px;
  display:flex;align-items:center;gap:10px;
  padding:7px 12px 7px 8px;
  border:1px solid rgba(255,255,255,.56);
  border-left:0;
  border-radius:0 999px 999px 0;
  color:#fff;text-decoration:none;font-weight:800;
  box-shadow:0 10px 28px rgba(5,29,31,.22);
  transition:transform .22s ease,width .22s ease,filter .22s ease;
}
.pha-global-contact a:hover{transform:translateX(4px);filter:brightness(1.06)}
.pha-global-contact-zalo{background:linear-gradient(135deg,#1687f8,#0868c9)}
.pha-global-contact-phone{background:linear-gradient(135deg,#0f5a58,#083b3b)}
.pha-global-contact-icon{
  width:34px;height:34px;flex:0 0 34px;display:grid;place-items:center;
  border-radius:50%;background:rgba(255,255,255,.18);
  font-size:.8rem;font-weight:900;
}
.pha-global-contact-phone .pha-global-contact-icon{font-size:1rem}
.pha-global-contact-copy{min-width:0;display:grid;line-height:1.12}
.pha-global-contact-copy small{font-size:.61rem;font-weight:700;opacity:.82;text-transform:uppercase;letter-spacing:.04em}
.pha-global-contact-copy strong{font-size:.83rem;white-space:nowrap}

/* Cụm điều khiển cuộn bên phải */
.pha-global-scroll{
  position:fixed;
  right:max(14px,env(safe-area-inset-right));
  bottom:max(18px,env(safe-area-inset-bottom));
  z-index:2147480900;
  display:grid;gap:9px;
}
.pha-global-scroll button{
  position:relative;
  width:46px;height:46px;
  display:grid;place-items:center;
  border:1px solid rgba(201,159,69,.42);
  border-radius:15px;
  background:rgba(8,55,55,.94);
  color:#fffaf0;
  box-shadow:0 10px 30px rgba(5,29,31,.24);
  font-size:1.2rem;font-weight:900;cursor:pointer;
  transition:transform .2s ease,background .2s ease;
}
.pha-global-scroll button:hover{transform:translateY(-2px);background:#0f5a58}
.pha-global-scroll button::after{
  content:attr(data-label);
  position:absolute;right:54px;top:50%;transform:translateY(-50%);
  padding:6px 9px;border-radius:8px;background:#17393a;color:#fff;
  font-size:.68rem;font-weight:700;white-space:nowrap;
  opacity:0;visibility:hidden;pointer-events:none;transition:.18s ease;
}
.pha-global-scroll button:hover::after,.pha-global-scroll button:focus-visible::after{opacity:1;visibility:visible}

/* Trang đọc Ebook có thanh điều khiển ở đáy. */
body.pha-global-reader .pha-global-interest{bottom:82px}
body.pha-global-reader .pha-global-scroll{bottom:82px}

@keyframes phaGlobalPulse{
  0%{box-shadow:0 0 0 0 rgba(46,158,114,.42)}
  70%{box-shadow:0 0 0 9px rgba(46,158,114,0)}
  100%{box-shadow:0 0 0 0 rgba(46,158,114,0)}
}
@keyframes phaGlobalSwap{0%{opacity:.18;transform:translateY(5px)}100%{opacity:1;transform:none}}


@media (max-width:1024px){
  .pha-global-contact{top:48%;gap:7px}
  .pha-global-contact a{
    width:46px;min-height:44px;padding:5px 6px;
    border-radius:0 16px 16px 0;overflow:hidden;
  }
  .pha-global-contact a:hover,.pha-global-contact a:focus-visible{width:157px;transform:none}
  .pha-global-contact-icon{width:32px;height:32px;flex-basis:32px;font-size:.72rem}
  .pha-global-contact-copy{display:none}
  .pha-global-contact a:hover .pha-global-contact-copy,
  .pha-global-contact a:focus-visible .pha-global-contact-copy{display:grid}
}

@media (max-width:720px){
  .pha-global-interest{
    left:max(10px,env(safe-area-inset-left));
    bottom:max(10px,env(safe-area-inset-bottom));
    width:calc(100vw - 78px);
    max-width:390px;
    padding:11px 38px 10px 12px;
    border-radius:15px;
  }
  .pha-global-interest-top{gap:6px;flex-wrap:wrap;padding-right:3px}
  .pha-global-interest-count{font-size:.77rem}
  .pha-global-interest-badge{margin-left:0;font-size:.54rem;padding:3px 6px}
  .pha-global-interest-message{font-size:.74rem}
  .pha-global-interest-note{font-size:.59rem}
  .pha-global-interest-link{font-size:.69rem;margin-top:5px}
  .pha-global-interest-close{right:7px;top:7px;width:26px;height:26px}

  .pha-global-contact{top:48%;gap:7px}
  .pha-global-contact a{
    width:46px;min-height:44px;padding:5px 6px 5px 6px;
    border-radius:0 16px 16px 0;
    overflow:hidden;
  }
  .pha-global-contact a:hover,.pha-global-contact a:focus-visible{width:157px;transform:none}
  .pha-global-contact-icon{width:32px;height:32px;flex-basis:32px;font-size:.72rem}
  .pha-global-contact-copy{display:none}
  .pha-global-contact a:hover .pha-global-contact-copy,
  .pha-global-contact a:focus-visible .pha-global-contact-copy{display:grid}

  .pha-global-scroll{right:max(8px,env(safe-area-inset-right));bottom:max(10px,env(safe-area-inset-bottom));gap:7px}
  .pha-global-scroll button{width:43px;height:43px;border-radius:13px;font-size:1.08rem}
  .pha-global-scroll button::after{display:none}

  body.pha-global-reader .pha-global-interest{bottom:92px}
  body.pha-global-reader .pha-global-scroll{bottom:92px}
}

@media (max-width:390px){
  .pha-global-interest{width:calc(100vw - 68px)}
  .pha-global-interest-badge{display:none}
  .pha-global-scroll button{width:39px;height:39px}
}

@media (prefers-reduced-motion:reduce){
  .pha-global-interest,.pha-global-interest-message,.pha-global-interest-dot,
  .pha-global-contact a,.pha-global-scroll button{animation:none!important;transition:none!important}
}

/* Reset bắt buộc: tránh các trang có selector nav{} làm thanh trắng kéo dài. */
nav.pha-global-contact,
nav.pha-global-scroll{
  margin:0!important;
  padding:0!important;
  width:auto!important;
  max-width:none!important;
  min-width:0!important;
  min-height:0!important;
  background:transparent!important;
  border:0!important;
  border-radius:0!important;
  box-shadow:none!important;
  backdrop-filter:none!important;
  -webkit-backdrop-filter:none!important;
}
nav.pha-global-contact{
  right:auto!important;
  bottom:auto!important;
}
nav.pha-global-scroll{
  top:auto!important;
  left:auto!important;
  transform:none!important;
}
