/* Floating live chat widget — glossy bottom-right panel */

.dg-chat-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 9000;
  width: 58px;
  height: 58px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--white);
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.92), rgba(30, 58, 138, 0.95));
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  box-shadow:
    0 12px 32px rgba(15, 31, 77, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: transform 220ms ease, box-shadow 220ms ease;
}

.dg-chat-fab:hover {
  transform: translateY(-3px) scale(1.03);
}

.dg-chat-fab svg { width: 26px; height: 26px; }

.dg-chat-fab .dg-chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--gold-500);
  color: var(--primary-900);
  font-size: 11px;
  font-weight: 700;
  display: none;
  place-items: center;
}

.dg-chat-fab.has-unread .dg-chat-badge { display: grid; }

.dg-chat-panel {
  position: fixed;
  right: 22px;
  bottom: 92px;
  z-index: 8999;
  width: min(360px, calc(100vw - 32px));
  max-height: min(520px, calc(100vh - 120px));
  display: flex;
  flex-direction: column;
  border-radius: 20px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(24px) saturate(200%);
  -webkit-backdrop-filter: blur(24px) saturate(200%);
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 24px 64px rgba(15, 31, 77, 0.22);
  transform: translateY(16px) scale(0.96);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, transform 220ms ease;
}

.dg-chat-panel.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.dg-chat-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  background: linear-gradient(135deg, rgba(30, 58, 138, 0.92), rgba(37, 99, 235, 0.88));
  color: var(--white);
}

.dg-chat-head h3 {
  font-size: 15px;
  font-weight: 700;
  color: var(--white);
  margin: 0;
}

.dg-chat-head p {
  font-size: 12px;
  opacity: 0.88;
  margin: 2px 0 0;
}

.dg-chat-close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  color: var(--white);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.dg-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  max-height: 300px;
  background: rgba(248, 250, 252, 0.55);
}

.dg-chat-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-break: break-word;
}

.dg-chat-msg.visitor {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.dg-chat-msg.admin {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.95);
  color: var(--gray-800);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-bottom-left-radius: 4px;
}

.dg-chat-msg time {
  display: block;
  font-size: 10px;
  opacity: 0.72;
  margin-top: 4px;
}

.dg-chat-login {
  padding: 20px 16px;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.7);
  text-align: center;
}

.dg-chat-login p {
  font-size: 13px;
  color: var(--gray-600);
  margin-bottom: 14px;
  line-height: 1.5;
}

.dg-chat-google-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--gray-200);
  border-radius: 999px;
  background: var(--white);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}

.dg-chat-input-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid rgba(226, 232, 240, 0.8);
  background: rgba(255, 255, 255, 0.75);
}

.dg-chat-input-row textarea {
  flex: 1;
  min-height: 44px;
  max-height: 100px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--gray-200);
  font-family: inherit;
  font-size: 14px;
  resize: none;
  background: rgba(255, 255, 255, 0.95);
  line-height: 1.4;
}

.dg-chat-icon-send {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--white);
  background: linear-gradient(135deg, var(--primary-700), var(--primary-600));
  box-shadow: 0 6px 16px rgba(30, 58, 138, 0.25);
}

.dg-chat-icon-send svg {
  width: 18px;
  height: 18px;
}

.dg-chat-empty {
  text-align: center;
  color: var(--gray-500);
  font-size: 13px;
  padding: 24px 12px;
}

@media (max-width: 480px) {
  .dg-chat-fab { right: 16px; bottom: 16px; }
  .dg-chat-panel { right: 16px; bottom: 82px; }
}
