/* ============================================
   Chat Widget — bookd-4
   Floats bottom-right. Matches teal/amber landing page theme.
   ============================================ */

/* Widget trigger button */
.chat-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--teal, #0D4D4D);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(13, 77, 77, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chat-trigger:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(13, 77, 77, 0.5);
}
.chat-trigger svg { width: 28px; height: 28px; fill: #fff; }

/* Chat window */
.chat-widget {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 48px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.15);
  z-index: 9998;
  overflow: hidden;
  display: none;
  flex-direction: column;
  max-height: 560px;
}
.chat-widget.open { display: flex; }

/* Widget header */
.chat-widget-header {
  background: var(--teal, #0D4D4D);
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.chat-widget-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--amber, #F59E0B);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chat-widget-avatar::after {
  content: '';
  width: 16px;
  height: 16px;
  background: #fff;
  border-radius: 50%;
}
.chat-widget-meta { flex: 1; }
.chat-widget-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  font-family: 'DM Sans', sans-serif;
}
.chat-widget-status {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.65);
  font-family: 'DM Sans', sans-serif;
}
.chat-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: rgba(255,255,255,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
}
.chat-close:hover { color: #fff; }

/* Message list */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  background: var(--off-white, #FAFAF7);
  scroll-behavior: smooth;
}
.chat-messages .msg {
  max-width: 82%;
  padding: 0.6rem 0.9rem;
  border-radius: 12px;
  font-size: 0.875rem;
  line-height: 1.45;
  font-family: 'DM Sans', sans-serif;
}
.chat-messages .msg-in {
  background: var(--gray-200, #E5E5E0);
  color: var(--dark, #1A1A1A);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chat-messages .msg-out {
  background: var(--teal, #0D4D4D);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.chat-messages .msg-out.confirmed {
  background: #065F46;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Slot picker */
.slot-picker {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0 0.75rem;
}
.slot-date-label {
  font-size: 0.8rem;
  font-family: 'DM Sans', sans-serif;
  color: var(--gray-600, #525252);
  padding: 0.5rem 0.75rem 0;
}
.slot-btn {
  background: var(--teal, #0D4D4D);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  transition: background 0.15s;
  text-align: left;
}
.slot-btn:hover { background: var(--teal-light, #0F6B6B); }
.slot-btn + .slot-btn { margin-top: 0.25rem; }

/* Typing indicator */
.chat-typing {
  padding: 0 1.25rem 0.5rem;
  font-size: 0.8rem;
  color: var(--gray-400, #A3A3A3);
  font-style: italic;
  font-family: 'DM Sans', sans-serif;
}

/* Input area */
.chat-input-area {
  padding: 0.75rem;
  border-top: 1px solid var(--gray-200, #E5E5E0);
  display: flex;
  gap: 0.5rem;
  background: #fff;
}
.chat-input {
  flex: 1;
  border: 1.5px solid var(--gray-200, #E5E5E0);
  border-radius: 24px;
  padding: 0.6rem 1rem;
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
.chat-input:focus { border-color: var(--teal, #0D4D4D); }
.chat-send {
  background: var(--teal, #0D4D4D);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 40px;
  height: 40px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.chat-send:hover { background: var(--teal-light, #0F6B6B); }
.chat-send:disabled { opacity: 0.5; cursor: not-allowed; }

/* Quick service buttons */
.chat-services {
  padding: 0.5rem 0.75rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.chat-service-btn {
  background: var(--amber, #F59E0B);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 0.35rem 0.8rem;
  font-size: 0.8rem;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  font-weight: 500;
  transition: background 0.15s;
}
.chat-service-btn:hover { background: var(--amber-dark, #D97706); }

/* Confirm form */
.chat-confirm-form {
  padding: 0.75rem;
  border-top: 1px solid var(--gray-200, #E5E5E0);
  background: #fff;
}
.chat-confirm-form p {
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  margin-bottom: 0.6rem;
  color: var(--dark, #1A1A1A);
}
.chat-confirm-form input {
  width: 100%;
  border: 1.5px solid var(--gray-200, #E5E5E0);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  margin-bottom: 0.5rem;
  outline: none;
  box-sizing: border-box;
}
.chat-confirm-form input:focus { border-color: var(--teal, #0D4D4D); }
.chat-confirm-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}
.btn-confirm-book {
  flex: 1;
  background: #065F46;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem;
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  font-weight: 600;
  cursor: pointer;
}
.btn-cancel-book {
  flex: 1;
  background: var(--gray-200, #E5E5E0);
  color: var(--dark, #1A1A1A);
  border: none;
  border-radius: 8px;
  padding: 0.6rem;
  font-size: 0.875rem;
  font-family: 'DM Sans', sans-serif;
  cursor: pointer;
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar { width: 6px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb {
  background: var(--gray-200, #E5E5E0);
  border-radius: 3px;
}

@media (max-width: 480px) {
  .chat-widget { right: 12px; bottom: 88px; width: calc(100vw - 24px); }
  .chat-trigger { right: 16px; bottom: 16px; }
}