/* ============================================================
   DYNAMIC FLOOR SOLUTION LLC — AI Chatbot Widget
   Colors extracted from site design system:
     Accent:  #2B6A8E (navy blue)
     Yellow:  #FFD200
     Dark bg: #0D0D0D / #1E3A5F
     Text:    #F5F5F0
   ============================================================ */

:root {
  --chat-accent:       #2B6A8E;
  --chat-accent-dark:  #1E3A5F;
  --chat-yellow:       #FFD200;
  --chat-bg:           #0f1923;
  --chat-bg-msg:       #1a2840;
  --chat-text:         #F5F5F0;
  --chat-text-muted:   #9bb5c8;
  --chat-user-bg:      #2B6A8E;
  --chat-bot-bg:       #1a2840;
  --chat-border:       rgba(43, 106, 142, 0.3);
  --chat-shadow:       0 20px 60px rgba(0, 0, 0, 0.5), 0 4px 20px rgba(43, 106, 142, 0.2);
  --chat-radius:       20px;
  --chat-btn-size:     64px;
  --chat-width:        380px;
  --chat-height:       520px;
}

/* ── Floating Button ─────────────────────────────────────── */
#dfs-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: var(--chat-btn-size);
  height: var(--chat-btn-size);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--chat-accent) 0%, var(--chat-accent-dark) 100%);
  border: 2px solid rgba(255, 210, 0, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(43, 106, 142, 0.5), 0 2px 8px rgba(0,0,0,0.3);
  z-index: 9998;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: dfs-pulse 3s ease-in-out infinite;
  outline: none;
}

#dfs-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(43, 106, 142, 0.7), 0 2px 12px rgba(0,0,0,0.4);
  animation: none;
}

#dfs-chat-toggle svg {
  width: 30px;
  height: 30px;
  flex-shrink: 0;
}

@keyframes dfs-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(43, 106, 142, 0.5), 0 0 0 0 rgba(43, 106, 142, 0.4); }
  50%       { box-shadow: 0 4px 20px rgba(43, 106, 142, 0.5), 0 0 0 10px rgba(43, 106, 142, 0); }
}

/* ── Notification Badge ──────────────────────────────────── */
#dfs-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: var(--chat-yellow);
  color: #0D0D0D;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--chat-bg);
  animation: dfs-badge-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes dfs-badge-pop {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}

/* ── Chat Window ─────────────────────────────────────────── */
#dfs-chat-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: var(--chat-width);
  height: var(--chat-height);
  background: var(--chat-bg);
  border-radius: var(--chat-radius);
  border: 1px solid var(--chat-border);
  box-shadow: var(--chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  font-family: 'Inter', sans-serif;
  transform: scale(0.92) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.28s cubic-bezier(0.34, 1.4, 0.64, 1), opacity 0.22s ease;
  transform-origin: bottom right;
}

#dfs-chat-window.dfs-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ──────────────────────────────────────────────── */
#dfs-chat-header {
  background: linear-gradient(135deg, var(--chat-accent-dark) 0%, var(--chat-accent) 100%);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 210, 0, 0.2);
  flex-shrink: 0;
}

.dfs-header-icon {
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(255, 210, 0, 0.3);
}

.dfs-header-icon svg {
  width: 20px;
  height: 20px;
}

.dfs-header-info {
  flex: 1;
}

.dfs-header-name {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.dfs-header-status {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.dfs-status-dot {
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  animation: dfs-blink 2s ease-in-out infinite;
}

@keyframes dfs-blink {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

#dfs-chat-close {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: 8px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.8);
  transition: background 0.2s;
  flex-shrink: 0;
}

#dfs-chat-close:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

#dfs-chat-close svg {
  width: 14px;
  height: 14px;
}

/* ── Messages Area ───────────────────────────────────────── */
#dfs-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

#dfs-chat-messages::-webkit-scrollbar {
  width: 3px;
}

#dfs-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

#dfs-chat-messages::-webkit-scrollbar-thumb {
  background: var(--chat-border);
  border-radius: 2px;
}

/* ── Message Bubbles ─────────────────────────────────────── */
.dfs-message {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  animation: dfs-msg-in 0.25s ease;
}

@keyframes dfs-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.dfs-message.dfs-user {
  flex-direction: row-reverse;
}

.dfs-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 12px;
}

.dfs-bot-avatar {
  background: linear-gradient(135deg, var(--chat-accent-dark), var(--chat-accent));
  border: 1px solid rgba(255, 210, 0, 0.3);
}

.dfs-bot-avatar svg {
  width: 14px;
  height: 14px;
}

.dfs-user-avatar {
  background: rgba(255, 255, 255, 0.1);
  color: var(--chat-text-muted);
  font-weight: 600;
}

.dfs-msg-bubble {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 16px;
  font-size: 13px;
  line-height: 1.5;
  color: var(--chat-text);
  word-break: break-word;
}

.dfs-message.dfs-bot .dfs-msg-bubble {
  background: var(--chat-bot-bg);
  border: 1px solid var(--chat-border);
  border-bottom-left-radius: 4px;
}

.dfs-message.dfs-user .dfs-msg-bubble {
  background: var(--chat-user-bg);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom-right-radius: 4px;
}

.dfs-msg-bubble p { margin: 0 0 6px; }
.dfs-msg-bubble p:last-child { margin: 0; }
.dfs-msg-bubble strong { color: var(--chat-yellow); font-weight: 600; }
.dfs-msg-bubble ul { margin: 4px 0; padding-left: 16px; }
.dfs-msg-bubble li { margin-bottom: 3px; }

/* ── Typing Indicator ────────────────────────────────────── */
.dfs-typing-indicator {
  display: flex;
  align-items: flex-end;
  gap: 6px;
}

.dfs-typing-dots {
  background: var(--chat-bot-bg);
  border: 1px solid var(--chat-border);
  border-bottom-left-radius: 4px;
  border-radius: 16px;
  padding: 10px 14px;
  display: flex;
  gap: 5px;
  align-items: center;
}

.dfs-typing-dots span {
  width: 7px;
  height: 7px;
  background: var(--chat-text-muted);
  border-radius: 50%;
  animation: dfs-dot 1.4s ease-in-out infinite;
}

.dfs-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.dfs-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dfs-dot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.4; }
  40%            { transform: scale(1);   opacity: 1; }
}

/* ── Quick Options ───────────────────────────────────────── */
#dfs-quick-options {
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex-shrink: 0;
  border-top: 1px solid var(--chat-border);
}

.dfs-quick-btn {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 20px;
  border: 1px solid var(--chat-border);
  background: rgba(43, 106, 142, 0.12);
  color: var(--chat-text-muted);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  transition: all 0.2s;
  white-space: nowrap;
}

.dfs-quick-btn:hover {
  background: var(--chat-accent);
  color: #fff;
  border-color: var(--chat-accent);
}

/* ── Input Area ──────────────────────────────────────────── */
#dfs-chat-input-area {
  padding: 10px 12px;
  border-top: 1px solid var(--chat-border);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.2);
}

#dfs-chat-input {
  flex: 1;
  background: var(--chat-bg-msg);
  border: 1px solid var(--chat-border);
  border-radius: 12px;
  color: var(--chat-text);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  padding: 9px 13px;
  outline: none;
  transition: border-color 0.2s;
  resize: none;
  max-height: 80px;
  min-height: 38px;
  line-height: 1.4;
}

#dfs-chat-input::placeholder {
  color: var(--chat-text-muted);
  opacity: 0.6;
}

#dfs-chat-input:focus {
  border-color: var(--chat-accent);
}

#dfs-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--chat-accent) 0%, var(--chat-accent-dark) 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, opacity 0.15s;
  flex-shrink: 0;
}

#dfs-chat-send:hover {
  transform: scale(1.06);
}

#dfs-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

#dfs-chat-send svg {
  width: 16px;
  height: 16px;
  color: #fff;
}

/* ── Lead Capture Form ───────────────────────────────────── */
.dfs-lead-form {
  background: rgba(43, 106, 142, 0.08);
  border: 1px solid var(--chat-border);
  border-radius: 14px;
  padding: 12px;
  margin: 4px 0;
}

.dfs-lead-form-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--chat-yellow);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.dfs-lead-input {
  width: 100%;
  background: var(--chat-bg-msg);
  border: 1px solid var(--chat-border);
  border-radius: 8px;
  color: var(--chat-text);
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  padding: 7px 10px;
  outline: none;
  box-sizing: border-box;
  margin-bottom: 6px;
  transition: border-color 0.2s;
}

.dfs-lead-input:focus {
  border-color: var(--chat-accent);
}

.dfs-lead-submit {
  width: 100%;
  padding: 8px;
  background: linear-gradient(135deg, var(--chat-accent) 0%, var(--chat-accent-dark) 100%);
  border: none;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}

.dfs-lead-submit:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

/* ── Footer branding ─────────────────────────────────────── */
#dfs-chat-footer {
  padding: 5px 12px 7px;
  text-align: center;
  font-size: 10px;
  color: rgba(155, 181, 200, 0.4);
  font-family: 'Inter', sans-serif;
  flex-shrink: 0;
}

#dfs-chat-footer a {
  color: inherit;
  text-decoration: none;
}

/* ── Mobile: Full Screen ─────────────────────────────────── */
@media (max-width: 480px) {
  #dfs-chat-window {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    height: 100%;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
  }

  #dfs-chat-toggle {
    bottom: 20px;
    right: 20px;
  }
}
