/* ==========================================
   DGT SOLUTIONS CHATBOT
   ========================================== */

/* ==========================================
   LAUNCHER
   ========================================== */

#dgt-launcher {
  position: fixed;
  bottom: 30px;
  right: 27px;
  width: 55px;
  height: 55px;
  border-radius: 50%;
  background: #f17720;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(24, 95, 165, 0.35);
  z-index: 9999;
  transition: background 0.15s, transform 0.15s;
}

#dgt-launcher:hover {
  background: #f17720;
  transform: scale(1.06);
}

#dgt-launcher svg {
  display: block;
}

/* Notification badge */

#dgt-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #e74c3c;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  font-family: sans-serif;
  display: none;
  align-items: center;
  justify-content: center;
}

/* ==========================================
   CHAT WINDOW
   ========================================== */

#dgt-chat-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  top: auto;
  left: auto;
  width: 460px;
  max-width: calc(100vw - 48px);
  height: 680px;
  max-height: calc(100dvh - 48px);
  display: none;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.18);
  z-index: 100100 !important;
  font-family: 'Roboto', sans-serif;
  box-sizing: border-box;
}

#dgt-chat-window.open {
  display: flex;
}

/* ==========================================
   CHAT HEADER
   ========================================== */

#dgt-head {
  background: #185FA5;
  padding: 16px;
  padding-top: calc(16px + env(safe-area-inset-top));
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Header avatar */

.dgt-hav {
  flex: 0 0 40px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12px;
  color: #fff;
}

.dgt-hav img {
  width: 40px;
  height: 40px;
  object-fit: contain;
}

/* Header text */

#dgt-head .dgt-hinfo {
  flex: 1;
  min-width: 0;
}

.dgt-hinfo h3 {
  font-family: Roboto, Arial, sans-serif;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: -0.25px;
  white-space: nowrap;
  color: #fff;
  margin: 0;
}

.dgt-hinfo p {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.72);
  margin: 0;
}

/* Online indicator */

.dgt-hdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #5DCAA5;
  margin-left: auto;
  flex-shrink: 0;
}

/* Close button */

#dgt-close {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  font-size: 20px;
  line-height: 1;
  padding: 0 0 0 8px;
  flex-shrink: 0;
}

#dgt-close:hover {
  color: #fff;
}

/* ==========================================
   CHAT LOG
   ========================================== */

#dgt-log {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 10px;
  background: #f5f5f5;
  overscroll-behavior: contain;
  touch-action: pan-y;
}

/* ==========================================
   MESSAGE ROWS
   ========================================== */

.dgt-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.dgt-row.u {
  flex-direction: row-reverse;
}

/* ==========================================
   MESSAGE AVATARS
   ========================================== */

.dgt-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dgt-av img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.dgt-av.b {
  background: #185FA5;
  color: #fff;
}

.dgt-av.u {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  background: #edf3f9;
  border: 1px solid #d4e1ef;
  color: #185fa5;
  font: 500 10px/1 Roboto, Arial, sans-serif;
  box-shadow: 0 1px 3px rgba(24, 95, 165, 0.08);
}

/* ==========================================
   MESSAGE BUBBLES
   ========================================== */

.dgt-bub {
  max-width: 78%;
  min-width: 0;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}

/* Bot message */

.dgt-bub.b {
  background: #fff;
  color: #1a1a1a;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.07);
}

/* User message */

.dgt-bub.u {
  background: #185FA5;
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Links */

.dgt-bub a {
  color: #185FA5;
  text-decoration: underline;
}

.dgt-bub.u a {
  color: #B5D4F4;
}

/* ==========================================
   SUGGESTION CHIPS
   ========================================== */

.dgt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 8px;
}

.dgt-chip {
  font-family: inherit;
  font-size: 12px;
  padding: 5px 11px;
  border-radius: 20px;
  border: 1px solid #185FA5;
  color: #185FA5;
  background: #E6F1FB;
  cursor: pointer;
  transition: background 0.12s;
}

.dgt-chip:hover {
  background: #B5D4F4;
}

a.dgt-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: normal;
  text-align: center;
  max-width: 100%;
  box-sizing: border-box;
}

/* ==========================================
   TYPING INDICATOR
   ========================================== */

.dgt-dots span {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #aaa;
  margin: 0 2px;
  animation: dgt-bob 1.1s infinite;
}

.dgt-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.dgt-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dgt-bob {
  0%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-5px);
  }
}

/* ==========================================
   MESSAGE INPUT AREA
   ========================================== */

#dgt-inp-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid #e0e0e0;
  background: #fff;
  flex-shrink: 0;
  min-width: 0;
  box-sizing: border-box;
}

/* Input */

#dgt-ui {
  flex: 1;
  min-width: 0;
  padding: 9px 13px;
  border-radius: 20px;
  border: 1px solid #ddd;
  background: #f9f9f9;
  color: #1a1a1a;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
}

#dgt-ui::-webkit-search-cancel-button {
  -webkit-appearance: none;
  appearance: none;
}

#dgt-ui:focus {
  border-color: #378ADD;
  background: #fff;
}

/* Send button */

#dgt-sb {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #e6711e;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

#dgt-sb:hover {
  background: #378ADD;
}

#dgt-sb:disabled {
  background: #aaa;
  cursor: default;
}

/* ==========================================
   MOBILE — BELOW 768px
   ========================================== */

/* Floating chat window */

@media (max-width: 768px) {
  #dgt-chat-window {
    width: 460px;
    max-width: calc(100vw - 24px);
    height: 680px;
    max-height: calc(100dvh - 24px);
    top: auto;
    left: auto;
    right: 12px;
    bottom: 12px;
    border-radius: 14px;
  }
}

/* Launcher */

@media (max-width: 768px) {
  #dgt-launcher {
    bottom: 20px !important;
    right: 12px !important;
  }
}

/* Header */

@media (max-width: 768px) {
  #dgt-head {
    padding: 12px;
    gap: 8px;
  }
}

@media (max-width: 768px) {
  #dgt-head .dgt-hinfo h3 {
    font-size: clamp(12px, 3.6vw, 17px);
  }
}

@media (max-width: 768px) {
  #dgt-head .dgt-hinfo p {
    font-size: 12px;
  }
}

@media (max-width: 768px) {
  #dgt-head .dgt-hav {
    flex-basis: 36px;
    width: 36px;
    height: 36px;
  }
}

@media (max-width: 768px) {
  #dgt-head .dgt-hav img {
    width: 36px;
    height: 36px;
  }
}

/* Chat messages */

@media (max-width: 768px) {
  .dgt-bub {
    font-size: 16px;
    line-height: 1.55;
  }
}

@media (max-width: 768px) {
  .dgt-chip {
    font-size: 14px;
    padding: 8px 13px;
  }
}

/* Short conversations stay at bottom */

@media (max-width: 768px) {
  #dgt-log > .dgt-row:first-child {
    margin-top: auto;
  }
}

/* Input */

@media (max-width: 768px) {
  #dgt-ui {
    font-size: 16px;
  }
}

@media (max-width: 768px) {
  #dgt-inp-area {
    position: sticky;
    bottom: 0;
    padding-bottom: calc( 10px + env(safe-area-inset-bottom) );
    background: #fff;
  }
}

/* ==========================================
   SHORT SCREENS
   ========================================== */

@media (max-height: 450px) {
  #dgt-head {
    padding-top: 8px;
    padding-bottom: 8px;
  }
}

@media (max-height: 450px) {
  #dgt-head .dgt-hinfo p {
    display: none;
  }
}

@media (max-height: 450px) {
  #dgt-chat-window #dgt-inp-area {
    padding-top: 8px;
    padding-bottom: 8px;
  }
}

