/* Chat widget - matches site design (Outfit/Work Sans, accent #ff6b35) */

.chat-widget {
  font-family: 'Work Sans', sans-serif;
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
}

.chat-widget-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255, 107, 53, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.chat-widget-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(255, 107, 53, 0.5);
}

.chat-widget-btn svg {
  width: 28px;
  height: 28px;
}

.chat-widget-panel {
  position: absolute;
  bottom: calc(56px + 1rem);
  right: 0;
  width: 380px;
  max-width: calc(100vw - 2rem);
  max-height: 480px;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s, visibility 0.25s;
}

.chat-widget-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.chat-widget-header {
  padding: 1rem 1.25rem;
  background: var(--primary);
  color: white;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.1rem;
}

.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  min-height: 200px;
  max-height: 320px;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chat-widget-message {
  max-width: 85%;
  min-width: 0;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.95rem;
  line-height: 1.5;
  overflow-wrap: break-word;
  word-break: break-word;
}

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

.chat-widget-message.assistant {
  align-self: flex-start;
  background: var(--border);
  color: var(--text);
  border-bottom-left-radius: 4px;
}

.chat-widget-message.assistant.error {
  background: #fee2e2;
  color: #991b1b;
}

.chat-widget-message.typing {
  font-style: italic;
  color: var(--text-light);
}

.chat-widget-message a {
  color: var(--accent);
  text-decoration: underline;
  word-break: break-all;
}

.chat-widget-message.user a {
  color: rgba(255, 255, 255, 0.95);
}

.chat-widget-message strong {
  font-weight: 600;
}

.chat-cta-btn {
  display: inline-block;
  margin-top: 0.5rem;
  padding: 0.5rem 1rem;
  background: var(--accent);
  color: white !important;
  text-decoration: none !important;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.chat-cta-btn:hover {
  background: var(--accent-light);
}

.chat-widget-input-area {
  padding: 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  min-width: 0;
  flex-shrink: 0;
}

.chat-widget-input {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: 'Work Sans', sans-serif;
  font-size: 0.95rem;
  resize: none;
  min-height: 44px;
  max-height: 100px;
}

.chat-widget-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(255, 107, 53, 0.2);
}

.chat-widget-send {
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 10px;
  font-family: 'Work Sans', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}

.chat-widget-send:hover:not(:disabled) {
  background: var(--accent-light);
}

.chat-widget-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Mobile: full-width panel, viewport-centered to prevent cutoff */
@media (max-width: 480px) {
  .chat-widget {
    bottom: 1rem;
    right: 1rem;
    left: auto;
  }

  .chat-widget-panel {
    position: fixed;
    left: 1rem;
    right: 1rem;
    width: auto;
    max-width: calc(100vw - 2rem);
    bottom: calc(56px + 1.5rem);
    transform: translateY(10px);
    max-height: 70vh;
    z-index: 9999;
  }

  .chat-widget-panel.open {
    transform: translateY(0);
  }

  .chat-widget-messages {
    max-height: 50vh;
  }
}
