/* ===================================================
   LOCALFLOW — Chat widget (24/7 concierge)
   Floating bottom-right bubble + panel. Reuses theme
   tokens from theme.css; no new design system here.
   =================================================== */

.chat-widget {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 90;
  font-family: var(--font-sans);
}

.chat-widget-bubble {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--green);
  color: var(--white);
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: none;
  cursor: pointer;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: background 0.15s, transform 0.15s;
}

.chat-widget-bubble:hover {
  background: var(--green-mid);
  transform: translateY(-1px);
}

.chat-widget-bubble-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber-light);
  box-shadow: 0 0 0 4px rgba(240, 160, 48, 0.25);
}

.chat-widget-panel {
  position: fixed;
  right: 24px;
  bottom: 88px;
  width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 120px));
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-radius: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2), 0 6px 12px rgba(0, 0, 0, 0.08);
  display: none;
  flex-direction: column;
  overflow: hidden;
  z-index: 95;
}

.chat-widget-panel.chat-widget-panel-open {
  display: flex;
}

.chat-widget-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--green);
  color: var(--white);
}

.chat-widget-header-title {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.chat-widget-header-title strong {
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 1rem;
}

.chat-widget-header-title span {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 2px;
}

.chat-widget-close {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 6px;
  transition: background 0.15s;
}

.chat-widget-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--white);
}

.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  background: var(--cream);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-widget-msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--ink);
  word-wrap: break-word;
}

.chat-widget-msg-assistant {
  align-self: flex-start;
  background: var(--white);
  border: 1px solid var(--cream-dark);
  border-bottom-left-radius: 4px;
}

.chat-widget-msg-user {
  align-self: flex-end;
  background: var(--green);
  color: var(--white);
  border-bottom-right-radius: 4px;
}

.chat-widget-msg-error {
  align-self: flex-start;
  background: rgba(212, 130, 10, 0.08);
  border: 1px solid rgba(212, 130, 10, 0.4);
  color: var(--ink-mid);
  font-size: 0.85rem;
}

.chat-widget-msg-error .chat-widget-retry {
  margin-top: 8px;
  background: var(--amber);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.chat-widget-msg-error .chat-widget-retry:hover {
  background: var(--amber-light);
}

.chat-widget-input {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--cream-dark);
  background: var(--white);
}

.chat-widget-input input {
  flex: 1;
  padding: 10px 12px;
  border: 1px solid var(--cream-dark);
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  background: var(--cream);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}

.chat-widget-input input:focus {
  border-color: var(--green);
}

.chat-widget-send {
  background: var(--green);
  color: var(--white);
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.chat-widget-send:hover {
  background: var(--green-mid);
}

.chat-widget-send[disabled] {
  background: var(--ink-light);
  cursor: progress;
}

.chat-widget-capture {
  border-top: 1px solid var(--cream-dark);
  padding: 12px 14px;
  background: var(--cream-dark);
}

.chat-widget-capture-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.chat-widget-capture input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--cream-dark);
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  background: var(--white);
  color: var(--ink);
  outline: none;
}

.chat-widget-capture input:focus {
  border-color: var(--green);
}

.chat-widget-capture-btn {
  width: 100%;
  background: var(--amber);
  color: var(--white);
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

.chat-widget-capture-btn:hover {
  background: var(--amber-light);
}

.chat-widget-capture-btn[disabled] {
  background: var(--ink-light);
  cursor: progress;
}

.chat-widget-capture-success {
  font-family: var(--font-sans);
  font-size: 0.85rem;
  color: var(--green);
  font-weight: 600;
  margin: 0;
  text-align: center;
}

@media (max-width: 600px) {
  .chat-widget {
    right: 16px;
    bottom: 16px;
  }
  .chat-widget-panel {
    right: 16px;
    bottom: 76px;
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
  }
}
