/* Diplomas Unlimited Live Chat — Branded Blue Storefront Widget */
#du-live-chat-root {
  --du-chat-cyan: #0099D6;
  --du-chat-cyan-hover: #007FB3;
  --du-chat-cyan-soft: #E6F5FC;
  --du-chat-ink: #0D1520;
  --du-chat-muted: #5E6B7B;
  --du-chat-surface: #F3F7FA;
  --du-chat-border: #DCE5EE;
  --du-chat-green: #0E7A4B;
  --du-chat-amber: #C27803;
  --du-chat-font: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  font-family: var(--du-chat-font);
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99990;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

#du-live-chat-root * {
  box-sizing: border-box;
}

/* Floating Launcher Button */
.du-chat-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--du-chat-ink);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 12px 18px 12px 14px;
  font-family: var(--du-chat-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(13, 21, 32, 0.24);
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  position: relative;
}

.du-chat-launcher:hover {
  background: var(--du-chat-cyan);
  transform: translateY(-2px);
  box-shadow: 0 18px 38px rgba(0, 153, 214, 0.34);
}

.du-chat-launcher-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--du-chat-cyan);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.18s ease;
}

.du-chat-launcher:hover .du-chat-launcher-icon {
  background: rgba(255, 255, 255, 0.2);
}

.du-chat-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.du-chat-status-dot.is-online {
  background: #22C55E;
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.du-chat-status-dot.is-offline {
  background: #F59E0B;
}

.du-chat-unread-badge {
  position: absolute;
  top: -6px;
  right: -4px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #EF4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  border: 2px solid #ffffff;
  box-shadow: 0 4px 10px rgba(239, 68, 68, 0.35);
}

.du-chat-unread-badge.is-visible {
  display: inline-flex;
}

/* Chat Window Panel */
.du-chat-panel {
  position: absolute;
  right: 0;
  bottom: 66px;
  width: 370px;
  max-width: calc(100vw - 28px);
  height: 540px;
  max-height: calc(100vh - 110px);
  background: #ffffff;
  border: 1px solid var(--du-chat-border);
  border-radius: 20px;
  box-shadow: 0 24px 60px rgba(13, 21, 32, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(14px) scale(0.98);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.du-chat-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* Header */
.du-chat-header {
  background: var(--du-chat-ink);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.du-chat-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.du-chat-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0099D6, #006D9B);
  color: #ffffff;
  font-family: 'Baskerville', Georgia, serif;
  font-weight: 700;
  font-size: 16px;
  letter-spacing: -0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.du-chat-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.du-chat-subtitle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
  margin-top: 2px;
}

.du-chat-close-btn {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.du-chat-close-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

/* Optional Contact Capture Strip */
.du-chat-contact-bar {
  background: var(--du-chat-surface);
  border-bottom: 1px solid var(--du-chat-border);
  padding: 8px 14px;
  font-size: 12px;
  color: var(--du-chat-muted);
}

.du-chat-contact-toggle {
  background: none;
  border: none;
  padding: 0;
  color: var(--du-chat-cyan);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  text-decoration: underline;
}

.du-chat-contact-fields {
  display: none;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 8px;
}

.du-chat-contact-fields.is-open {
  display: grid;
}

.du-chat-contact-fields input {
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  border: 1px solid var(--du-chat-border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--du-chat-ink);
  outline: none;
}

.du-chat-contact-fields input:focus {
  border-color: var(--du-chat-cyan);
}

/* Messages Scroll Area */
.du-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #F8FBFD;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.du-chat-msg {
  display: flex;
  flex-direction: column;
  max-width: 84%;
}

.du-chat-msg.is-visitor {
  align-self: flex-end;
  align-items: flex-end;
}

.du-chat-msg.is-agent,
.du-chat-msg.is-system {
  align-self: flex-start;
  align-items: flex-start;
}

.du-chat-bubble {
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.du-chat-msg.is-visitor .du-chat-bubble {
  background: var(--du-chat-cyan);
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.du-chat-msg.is-agent .du-chat-bubble,
.du-chat-msg.is-system .du-chat-bubble {
  background: #ffffff;
  color: var(--du-chat-ink);
  border: 1px solid var(--du-chat-border);
  border-bottom-left-radius: 4px;
}

.du-chat-time {
  font-size: 10.5px;
  color: var(--du-chat-muted);
  margin-top: 3px;
  padding: 0 4px;
}

/* Quick-Start Topic Chips */
.du-chat-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.du-chat-prompt-btn {
  background: #ffffff;
  color: var(--du-chat-ink);
  border: 1px solid var(--du-chat-border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
}

.du-chat-prompt-btn:hover {
  border-color: var(--du-chat-cyan);
  background: var(--du-chat-cyan-soft);
  color: var(--du-chat-ink);
}

/* Offline Lead Form */
.du-chat-offline-form {
  background: #ffffff;
  border: 1px solid var(--du-chat-border);
  border-radius: 14px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.du-chat-offline-form input,
.du-chat-offline-form textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--du-chat-border);
  border-radius: 10px;
  font-size: 13px;
  font-family: var(--du-chat-font);
  color: var(--du-chat-ink);
  outline: none;
}

.du-chat-offline-form input:focus,
.du-chat-offline-form textarea:focus {
  border-color: var(--du-chat-cyan);
}

.du-chat-offline-submit {
  background: var(--du-chat-cyan);
  color: #ffffff;
  border: none;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.du-chat-offline-submit:hover {
  background: var(--du-chat-cyan-hover);
}

/* Composer Footer */
.du-chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 10px 12px;
  background: #ffffff;
  border-top: 1px solid var(--du-chat-border);
}

.du-chat-input {
  flex: 1;
  border: 1px solid var(--du-chat-border);
  border-radius: 20px;
  padding: 9px 14px;
  font-size: 13.5px;
  font-family: var(--du-chat-font);
  color: var(--du-chat-ink);
  resize: none;
  max-height: 92px;
  outline: none;
  background: var(--du-chat-surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.du-chat-input:focus {
  border-color: var(--du-chat-cyan);
  background: #ffffff;
}

.du-chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--du-chat-cyan);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, transform 0.12s ease;
}

.du-chat-send-btn:hover {
  background: var(--du-chat-cyan-hover);
}

.du-chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Optional Mobile SMS Fallback Footer */
.du-chat-sms-footer {
  background: var(--du-chat-surface);
  border-top: 1px solid var(--du-chat-border);
  padding: 7px 14px;
  text-align: center;
  font-size: 11.5px;
  color: var(--du-chat-muted);
}

.du-chat-sms-footer a {
  color: var(--du-chat-cyan);
  font-weight: 600;
  text-decoration: none;
}

.du-chat-sms-footer a:hover {
  text-decoration: underline;
}

/* Mobile Responsive */
@media (max-width: 520px) {
  #du-live-chat-root {
    right: 14px;
    bottom: 14px;
  }

  .du-chat-panel {
    position: fixed;
    right: 10px;
    left: 10px;
    bottom: 72px;
    width: auto;
    max-width: none;
    height: min(76vh, 540px);
    max-height: calc(100vh - 94px);
    border-radius: 18px;
  }

  .du-chat-launcher-text {
    display: none;
  }

  .du-chat-launcher {
    padding: 10px;
  }
}
