:root {
  --dnp-primary: #00509e;
  --dnp-dark: #00264d;
  --dnp-bg: #f7fbff;
  --dnp-white: #fff;
  --dnp-text: #1e293b;
  --dnp-muted: #64748b;
  --dnp-border: #d6eaf8;
  --dnp-shadow: 0 18px 50px rgba(0, 80, 158, .2);
}

#DNP-chatbot-widget, #DNP-chatbot-widget * { box-sizing: border-box; }
#DNP-chatbot-widget {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 2147483647;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--dnp-text);
}

/* Tự động ẩn huy hiệu Netlify chèn vào làm che nút Chat */
[class*="netlify"], [id*="netlify"], iframe[src*="netlify"], [data-netlify-badge] {
  display: none !important;
}


/* Teaser Greeting Callout Bubble (Hiệu ứng mời chat thu hút chú ý như Astral Pipes) */
.dnp-teaser {
  position: absolute;
  right: calc(3cm + 18px);
  bottom: 14px;
  width: 260px;
  background: #ffffff;
  padding: 12px 14px;
  border-radius: 16px;
  box-shadow: 0 14px 40px rgba(0, 80, 158, 0.18), 0 2px 10px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--dnp-border);
  border-top: 3.5px solid var(--dnp-primary);
  cursor: pointer;
  transform-origin: bottom right;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 2147483646;
  user-select: none;
}
.dnp-teaser::after {
  content: "";
  position: absolute;
  right: -9px;
  bottom: 22px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 9px solid #ffffff;
}
.dnp-teaser::before {
  content: "";
  position: absolute;
  right: -10px;
  bottom: 22px;
  width: 0;
  height: 0;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
  border-left: 9px solid var(--dnp-border);
}
.dnp-teaser-close {
  position: absolute;
  top: 6px;
  right: 8px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--dnp-muted);
  font-size: 16px;
  line-height: 1;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.dnp-teaser-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}
.dnp-teaser-sender {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--dnp-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 5px;
  padding-right: 18px;
}
.dnp-teaser-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #10b981;
  display: inline-block;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: dnpDotPulse 2s infinite;
}

@keyframes dnpDotPulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.2); opacity: 0.8; }
}

.dnp-teaser-text {
  font-size: 13px;
  line-height: 1.45;
  color: var(--dnp-text);
  font-weight: 500;
}
.dnp-teaser-hidden {
  opacity: 0 !important;
  pointer-events: none !important;
  transform: translateX(12px) scale(0.9) !important;
  visibility: hidden;
}

/* Arched Castle/Office Window Launcher (Khung Cửa Sổ Vòm 3cm x 5cm) */
.dnp-launcher {
  width: 110px !important;
  height: 130px !important;
  margin-left: auto;
  border-radius: 55px 55px 15px 15px !important; /* Dáng cửa sổ vòm lâu đài bự hơn */
  background: linear-gradient(180deg, #38bdf8 0%, #e0f2fe 100%) !important; /* Bầu trời sáng sủa bên trong */
  border: 7px solid #f8fafc !important; /* Khung cửa sổ bằng đá trắng/sáng */
  border-bottom: 18px solid #cbd5e1 !important; /* Bệ cửa sổ (Window sill) vững chắc */
  box-shadow: 
    inset 0 12px 24px rgba(0,0,0,0.15), /* Chiều sâu của bậu cửa */
    inset 0 0 18px rgba(255,255,255,0.9), /* Ánh sáng hắt vào */
    0 0 0 3px #ffaa00, /* Viền vàng thương hiệu DNP */
    0 15px 35px rgba(0, 30, 70, 0.25) !important; /* Bóng đổ nhẹ nhàng */
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  position: relative !important;
  overflow: hidden !important;
  padding: 0 !important;
  outline: none !important;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.3s ease !important;
}

/* Kính cửa sổ lấp lánh (Sun Glare) */
.dnp-launcher::before {
  content: "";
  position: absolute;
  top: -40px; left: -70px;
  width: 35px; height: 230px;
  background: rgba(255, 255, 255, 0.6);
  transform: rotate(35deg);
  pointer-events: none;
  z-index: 2;
  transition: left 0.7s ease;
}

/* Đám mây nhỏ trôi lơ lửng ngoài cửa sổ */
.dnp-launcher::after {
  content: "";
  position: absolute;
  top: 30px; left: 20px;
  width: 30px; height: 10px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 12px;
  box-shadow: 12px -7px 0 2px rgba(255, 255, 255, 0.9), 20px 2px 0 0 rgba(255, 255, 255, 0.9);
  pointer-events: none;
  z-index: 1;
}

.dnp-launcher:hover {
  transform: translateY(-6px) scale(1.04) !important;
  box-shadow: 
    inset 0 10px 20px rgba(0,0,0,0.1),
    0 0 0 4px #ffcc00, 
    0 20px 45px rgba(0, 40, 90, 0.3) !important;
}

/* Hiệu ứng kính lướt sáng khi hover */
.dnp-launcher:hover::before {
  left: 140px;
}

.dnp-mascot-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  width: 100%;
  height: 100%;
}

.dnp-mascot-canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain !important;
  display: block !important;
}



.dnp-launcher .dnp-mascot-img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  object-position: center !important;
  filter: drop-shadow(0 6px 14px rgba(0, 30, 70, 0.4)) !important;
  animation: dnpDoniFloat 3.2s ease-in-out infinite !important;
}
.dnp-launcher:hover .dnp-mascot-img {
  animation: dnpDoniWiggle 0.5s ease-in-out infinite alternate !important;
  filter: drop-shadow(0 10px 22px rgba(0, 80, 158, 0.55)) !important;
}

@keyframes dnpDoniFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-4px) rotate(2deg); }
}

@keyframes dnpDoniBreathe {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.035); }
}

@keyframes dnpDoniWiggle {
  0% { transform: rotate(-3deg) translateY(-2px); }
  100% { transform: rotate(4deg) translateY(-5px); }
}

/* Tay vẫy chào vui nhộn 👋 */
.dnp-m-arm-waving {
  transform-origin: 58px 47px;
  animation: dnpArmWave 1.4s ease-in-out infinite;
}

/* Mắt chớp dễ thương */
.dnp-m-eyes {
  animation: dnpEyeBlink 4s ease-in-out infinite;
  transform-origin: 40px 27px;
}

/* Bóng dâng nâng theo chuyển động nhún */
.dnp-m-shadow {
  animation: dnpShadowPulse 3s ease-in-out infinite;
  transform-origin: 40px 85px;
}

@keyframes dnpMascotFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

@keyframes dnpArmWave {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-18deg); }
  50% { transform: rotate(12deg); }
  75% { transform: rotate(-12deg); }
}

@keyframes dnpEyeBlink {
  0%, 94%, 98%, 100% { transform: scaleY(1); }
  96% { transform: scaleY(0.1); }
}

/* Chat container fixed width & height */
.dnp-container {
  position: absolute;
  right: 0;
  bottom: 0px;
  width: 440px; /* Khung chat bự hơn */
  height: calc(100vh - 120px); /* Cách mép trên 100px để không che menu */
  max-height: 850px;
  min-height: 500px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--dnp-white);
  border: 1px solid var(--dnp-border);
  border-radius: 22px;
  box-shadow: 0 26px 70px rgba(15, 23, 42, .18);
  transform-origin: bottom right;
  transition: opacity .25s ease, transform .25s ease;
}
.dnp-hidden { opacity: 0; pointer-events: none; transform: translateY(24px) scale(.94); }
.dnp-visible { opacity: 1; pointer-events: auto; transform: translateY(0) scale(1); }

.dnp-header {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
  padding: 16px 18px !important;
  color: white !important;
  background: var(--dnp-primary) !important;
  border-bottom: 1px solid rgba(255,255,255,0.1) !important;
}
.dnp-header-info { display: flex !important; align-items: center !important; gap: 12px !important; min-width: 0 !important; }
.dnp-title { margin: 0 !important; font-size: 15px !important; font-weight: 750 !important; color: white !important; line-height: 1.2 !important; }
.dnp-subtitle { margin-top: 2px !important; font-size: 11px !important; color: #eaf6ff !important; line-height: 1.3 !important; }
.dnp-icon-button {
  width: 32px !important;
  height: 32px !important;
  border: 0 !important;
  border-radius: 10px !important;
  color: white !important;
  background: rgba(255,255,255,.16) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
  line-height: 1 !important;
}
.dnp-icon-button:hover {
  background: rgba(255,255,255,.28) !important;
}

.dnp-header-info .dnp-mascot-wrapper {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  padding: 2px;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
  flex-shrink: 0;
}

.dnp-header-info .dnp-mascot-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.dnp-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  overflow-y: auto;
  background: var(--dnp-bg);
}
.dnp-message { display: flex; max-width: 86%; animation: dnpFadeIn .2s ease; }
.dnp-message.user { align-self: flex-end; max-width: 82%; }
.dnp-bubble { width: 100%; padding: 11px 14px; border-radius: 16px; font-size: 14px; line-height: 1.55; word-break: break-word; }
.dnp-message.bot .dnp-bubble { background: white; border: 1px solid #edf3f8; border-bottom-left-radius: 4px; }
.dnp-message.user .dnp-bubble { color: white; background: var(--dnp-dark); border-bottom-right-radius: 4px; }
.dnp-typing .dnp-bubble { color: var(--dnp-muted); font-style: italic; }

.dnp-actions {
  display: none !important;
}

.dnp-quick-replies {
  display: flex !important;
  gap: 8px !important;
  padding: 10px 12px !important;
  overflow-x: auto !important;
  background: #ffffff !important;
  border-top: 1px solid var(--dnp-border) !important;
  -webkit-overflow-scrolling: touch;
}
.dnp-quick-replies:empty {
  display: none !important;
}

.dnp-chip-row {
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  margin-top: 8px !important;
}

.dnp-chip, .dnp-action {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 32px !important;
  min-height: 32px !important;
  max-height: 32px !important;
  padding: 0 14px !important;
  border: 1.5px solid var(--dnp-primary) !important;
  border-radius: 999px !important;
  color: var(--dnp-primary) !important;
  background: #ffffff !important;
  cursor: pointer !important;
  white-space: nowrap !important;
  font-size: 12px !important;
  font-weight: 600 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
  text-decoration: none !important;
  line-height: 1 !important;
  box-sizing: border-box !important;
  margin: 0 !important;
  vertical-align: middle !important;
  flex-shrink: 0 !important;
  box-shadow: none !important;
  outline: none !important;
  transition: all 0.15s ease !important;
}
.dnp-chip:hover, .dnp-action:hover { color: white !important; background: var(--dnp-primary) !important; }

.dnp-footer { display: flex; gap: 10px; padding: 14px; background: white; border-top: 1px solid var(--dnp-border); }
.dnp-input { flex: 1; min-width: 0; border: 2px solid #e5e7eb; border-radius: 12px; padding: 12px; outline: 0; font-size: 14px; }
.dnp-input:focus { border-color: var(--dnp-primary); }
.dnp-send { border: 0; border-radius: 12px; padding: 0 16px; color: white; background: var(--dnp-primary); cursor: pointer; font-weight: 650; }

.dnp-card { padding: 10px; margin-top: 8px; border: 1px solid var(--dnp-border); border-radius: 12px; background: #f2faff; font-size: 13px; }
.dnp-product-img { display: block; width: 100%; max-width: 310px; margin-top: 8px; border: 2px solid var(--dnp-border); border-radius: 14px; }
.dnp-compare-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 12px; background: white; }
.dnp-compare-table th, .dnp-compare-table td { padding: 8px; border: 1px solid var(--dnp-border); text-align: left; vertical-align: top; }
.dnp-compare-table th { color: white; background: var(--dnp-primary); }

/* Thẻ Vinh danh Giải thưởng Thương hiệu Mạnh Quốc gia 2026 */
.dnp-award-card {
  margin: 4px 0 10px;
  background: linear-gradient(135deg, #fff9f0 0%, #ffffff 100%);
  border: 1.5px solid #f6ad55;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(221, 107, 32, 0.12);
}
.dnp-award-img {
  width: 100%;
  height: auto;
  display: block;
  border-bottom: 1.5px solid #fed7aa;
}
.dnp-award-content {
  padding: 10px 12px;
}
.dnp-award-badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  color: #c05621;
  background: #feebc8;
  border-radius: 999px;
  margin-bottom: 4px;
}
.dnp-award-title {
  font-size: 13px;
  font-weight: 700;
  color: #7b341e;
  margin: 0 0 4px;
  line-height: 1.35;
}
.dnp-award-desc {
  font-size: 11.5px;
  color: #744210;
  line-height: 1.45;
  margin: 0;
}

@media (max-width: 520px) {
  #DNP-chatbot-widget { left: 12px; right: 12px; bottom: 12px; }
  .dnp-container { width: 100%; height: 78vh; bottom: 82px; }
}
@keyframes dnpFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.dnp-bot-face {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e4a8b 50%, #2ba9e1 50%);
  position: relative;
  box-shadow: 0 4px 10px rgba(30, 74, 139, 0.3);
  animation: dnp-bounce 2s infinite ease-in-out;
  display: flex;
  justify-content: center;
}

.dnp-bot-face::before {
  content: "";
  position: absolute;
  top: 14px;
  left: 10px;
  width: 5px;
  height: 8px;
  background: #fff;
  border-radius: 3px;
  animation: dnp-blink 3s infinite;
}

.dnp-bot-face::after {
  content: "";
  position: absolute;
  top: 14px;
  right: 10px;
  width: 5px;
  height: 8px;
  background: #fff;
  border-radius: 3px;
  animation: dnp-blink 3s infinite;
}

.dnp-smile {
  position: absolute;
  top: 24px;
  width: 10px;
  height: 5px;
  border-bottom: 2px solid #fff;
  border-radius: 0 0 10px 10px;
}

@keyframes dnp-bounce {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-3px) rotate(-5deg); }
  75% { transform: translateY(-3px) rotate(5deg); }
}

@keyframes dnp-blink {
  0%, 95%, 100% { transform: scaleY(1); }
  97.5% { transform: scaleY(0.1); }
}

/* Tùy chọn Video Avatar AI */
.dnp-mascot-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center bottom;
  border-radius: 65px 65px 22px 22px;
  pointer-events: none;
}

/* =========================================
   DNP LIVE2D AVATAR (SPINE WEB ENGINE)
========================================= */
.dnp-live2d-avatar {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 65px 65px 22px 22px;
  overflow: hidden;
  background: #00264d;
}

.dnp-live2d-layer {
  position: absolute;
  top: 0; 
  left: 0;
  width: 100%; 
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  will-change: transform;
}

/* Thở lơ lửng cho phần Thân (Body Idle) */
.dnp-live2d-body {
  transform-origin: center bottom;
  animation: l2dIdleFloat 4s infinite ease-in-out;
}
@keyframes l2dIdleFloat {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-1.5px) scale(1.005); }
}

/* Trạng thái Đang Suy nghĩ (Nghiêng đầu nhẹ) */
.dnp-live2d-body.is-thinking {
  animation: l2dThinking 2s infinite ease-in-out;
}
@keyframes l2dThinking {
  0%, 100% { transform: rotate(0deg) translateY(0); }
  50% { transform: rotate(1.5deg) translateY(1.5px); }
}

/* Chớp Mắt (Mí mắt màu da kéo xuống che mắt) */
.dnp-live2d-eyelids {
  transform-origin: center 40%; /* Tâm chớp mắt (tùy chỉnh theo layer) */
  transform: scaleY(0);
}
.dnp-live2d-eyelids.is-blinking {
  animation: l2dBlink 0.15s alternate 2 ease-in-out;
}
@keyframes l2dBlink {
  0% { transform: scaleY(0); }
  100% { transform: scaleY(1); }
}

/* Vẫy Tay Chào (Cổ tay xoay mượt) */
.dnp-live2d-hand {
  transform-origin: 75% 85%; /* Tọa độ khớp cổ tay */
}
.dnp-live2d-hand.is-waving {
  animation: l2dWaveHand 2.5s ease-in-out;
}
@keyframes l2dWaveHand {
  0%, 100% { transform: rotate(0deg); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(7deg); }
  60% { transform: rotate(-6deg); }
  80% { transform: rotate(3deg); }
}

/* Khi ở chế độ Roaming, ẩn hình ảnh tĩnh trong launcher để con pet nổi lên che */
body:has(#dnp-roaming-pet) .dnp-launcher .dnp-mascot-img {
  display: none !important;
}

/* Xử lý Ẩn/Hiện Launcher & Mascot khi Chatbot Mở/Đóng ở chế độ Roaming */

/* Khi chat mở, ẩn hoàn toàn launcher */
#DNP-chatbot-widget.is-open .dnp-launcher {
  transform: scale(0) !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Ẩn hình ảnh tĩnh trong Header để Canvas vẽ Mascot thuật toán */
body:has(#dnp-roaming-pet) .dnp-header-info .dnp-mascot-img {
  display: none !important;
}

/* Ẩn ảnh tĩnh trong Launcher vì đã có con Pet thật bay bên ngoài */
body:has(#dnp-roaming-pet) .dnp-launcher .dnp-mascot-img {
  display: none !important;
}
