/* chat-widget.css — Floating homepage chatbot widget styles */

:root {
  --lf-brand: #4F46E5;
  --lf-brand-dark: #3730A3;
  --lf-brand-light: #EEF2FF;
  --lf-text: #1F2937;
  --lf-muted: #6B7280;
  --lf-border: #E5E7EB;
  --lf-white: #FFFFFF;
  --lf-user-bg: #4F46E5;
  --lf-user-text: #FFFFFF;
  --lf-bot-bg: #F3F4F6;
  --lf-bot-text: #1F2937;
  --lf-radius: 16px;
  --lf-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.10);
}

/* Bubble launcher */
#lf-bubble {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--lf-brand);
  box-shadow: 0 4px 20px rgba(79,70,229,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 9999;
  border: none;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
#lf-bubble:hover {
  transform: scale(1.07);
  box-shadow: 0 6px 28px rgba(79,70,229,0.55);
}
#lf-bubble svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  pointer-events: none;
}
#lf-bubble-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  background: #EF4444;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  font-family: sans-serif;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s, transform 0.2s;
}
#lf-bubble-badge.visible {
  opacity: 1;
  transform: scale(1);
}

/* Chat window */
#lf-widget {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: var(--lf-white);
  border-radius: var(--lf-radius);
  box-shadow: var(--lf-shadow);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  transform: translateY(20px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(0.34,1.56,0.64,1), opacity 0.2s ease;
}
#lf-widget.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}

/* Header */
#lf-header {
  background: var(--lf-brand);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: var(--lf-radius) var(--lf-radius) 0 0;
}
#lf-header-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
#lf-header-text { flex: 1; min-width: 0; }
#lf-header-name {
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  font-size: 15px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
#lf-header-sub {
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  opacity: 0.8;
  margin: 0;
}
#lf-close {
  background: none;
  border: none;
  cursor: pointer;
  color: #fff;
  opacity: 0.75;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  transition: opacity 0.15s;
}
#lf-close:hover { opacity: 1; }
#lf-close svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }

/* Messages */
#lf-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--lf-border) transparent;
}
#lf-messages::-webkit-scrollbar { width: 4px; }
#lf-messages::-webkit-scrollbar-track { background: transparent; }
#lf-messages::-webkit-scrollbar-thumb { background: var(--lf-border); border-radius: 2px; }

.lf-msg {
  display: flex;
  gap: 6px;
  max-width: 85%;
  animation: lf-fadein 0.2s ease;
}
@keyframes lf-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
.lf-msg--bot { align-self: flex-start; }
.lf-msg--user { align-self: flex-end; flex-direction: row-reverse; }

.lf-msg-bubble {
  padding: 10px 13px;
  border-radius: 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  line-height: 1.5;
}
.lf-msg--bot .lf-msg-bubble {
  background: var(--lf-bot-bg);
  color: var(--lf-bot-text);
  border-bottom-left-radius: 4px;
}
.lf-msg--user .lf-msg-bubble {
  background: var(--lf-user-bg);
  color: var(--lf-user-text);
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.lf-typing {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 13px;
  background: var(--lf-bot-bg);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
}
.lf-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lf-muted);
  animation: lf-bounce 1.2s infinite;
}
.lf-typing span:nth-child(2) { animation-delay: 0.2s; }
.lf-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes lf-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-5px); opacity: 1; }
}

/* Button options */
.lf-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 4px 12px 8px;
}
.lf-option-btn {
  padding: 7px 13px;
  border: 1.5px solid var(--lf-brand);
  border-radius: 999px;
  background: var(--lf-white);
  color: var(--lf-brand);
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.lf-option-btn:hover {
  background: var(--lf-brand);
  color: #fff;
}

/* Lead capture form */
#lf-capture {
  padding: 12px;
  border-top: 1px solid var(--lf-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
#lf-capture input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--lf-border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--lf-text);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
#lf-capture input:focus { border-color: var(--lf-brand); }
#lf-submit {
  padding: 10px;
  background: var(--lf-brand);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
#lf-submit:hover { background: var(--lf-brand-dark); }
#lf-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* Text input bar */
#lf-input-bar {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  border-top: 1px solid var(--lf-border);
}
#lf-input-bar input {
  flex: 1;
  padding: 9px 12px;
  border: 1.5px solid var(--lf-border);
  border-radius: 8px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--lf-text);
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
#lf-input-bar input:focus { border-color: var(--lf-brand); }
#lf-send {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: var(--lf-brand);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
#lf-send:hover { background: var(--lf-brand-dark); }
#lf-send svg { width: 16px; height: 16px; fill: #fff; }

/* Footer branding */
#lf-footer {
  text-align: center;
  padding: 6px 12px 10px;
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  color: var(--lf-muted);
  border-top: 1px solid var(--lf-border);
}
#lf-footer a {
  color: var(--lf-brand);
  text-decoration: none;
  font-weight: 500;
}
#lf-footer a:hover { text-decoration: underline; }

/* Mobile */
@media (max-width: 480px) {
  #lf-widget {
    bottom: 0;
    right: 0;
    left: 0;
    width: 100%;
    max-width: 100%;
    height: 90vh;
    max-height: 90vh;
    border-radius: var(--lf-radius) var(--lf-radius) 0 0;
  }
  #lf-bubble {
    bottom: 16px;
    right: 16px;
  }
}
