/* =============================================
   Graceful Living Chatbot Widget
   ============================================= */

.chatbot-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: #fff;
  border: 2.5px solid #c4704b;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(196,112,75,0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  opacity: 0;
  transform: translateY(80px);
  pointer-events: none;
  transition: transform 0.55s cubic-bezier(0.34,1.56,0.64,1), box-shadow 0.2s, opacity 0.4s ease;
}
.chatbot-fab.chatbot-fab--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.chatbot-fab.chatbot-fab--visible:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 22px rgba(196,112,75,0.5);
}
.chatbot-fab-logo {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  pointer-events: none;
}

/* Greeting bubble */
.chatbot-greeting {
  position: fixed;
  bottom: 33px;
  right: 78px;
  z-index: 9997;
  background: #fff;
  color: #1a2332;
  font-family: 'Lora', serif;
  font-size: 0.85rem;
  line-height: 1;
  padding: 9px 14px;
  border-radius: 20px;
  box-shadow: 0 2px 14px rgba(26,35,50,0.13);
  white-space: nowrap;
  opacity: 0;
  transform: translateX(10px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.chatbot-greeting.chatbot-greeting--visible {
  opacity: 1;
  transform: translateX(0);
}
.chatbot-greeting::after {
  content: '';
  position: absolute;
  right: -7px;
  top: 50%;
  transform: translateY(-50%);
  border: 7px solid transparent;
  border-right: none;
  border-left-color: #fff;
}

/* Window */
.chatbot-window {
  position: fixed;
  bottom: 90px;
  right: 24px;
  z-index: 9998;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 110px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 40px rgba(26,35,50,0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.92) translateY(16px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.22s cubic-bezier(0.34,1.56,0.64,1), opacity 0.18s ease;
}
.chatbot-window.is-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header */
.chatbot-header {
  background: #1a2332;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.chatbot-header-logo {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.chatbot-header-title {
  flex: 1;
  font-family: 'Playfair Display', serif;
  font-size: 0.97rem;
  font-weight: 600;
  line-height: 1.2;
}
.chatbot-header-sub {
  font-family: 'Lora', serif;
  font-size: 0.68rem;
  color: rgba(255,255,255,0.55);
  margin-top: 1px;
  display: block;
}
.chatbot-close {
  background: none;
  border: none;
  color: rgba(255,255,255,0.7);
  cursor: pointer;
  padding: 4px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.chatbot-close:hover { color: #fff; background: rgba(255,255,255,0.12); }

/* Messages */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.chatbot-messages::-webkit-scrollbar { width: 4px; }
.chatbot-messages::-webkit-scrollbar-thumb { background: rgba(26,35,50,0.12); border-radius: 4px; }

.chatbot-msg {
  max-width: 88%;
  font-family: 'Lora', serif;
  font-size: 0.875rem;
  line-height: 1.6;
  padding: 10px 13px;
  border-radius: 14px;
  word-break: break-word;
}
.chatbot-msg--bot {
  background: #f3f4f6;
  color: #1a2332;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.chatbot-msg--user {
  background: #1a2332;
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

/* Typing indicator */
.chatbot-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 13px;
  background: #f3f4f6;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: 52px;
}
.chatbot-typing span {
  width: 7px;
  height: 7px;
  background: rgba(26,35,50,0.35);
  border-radius: 50%;
  animation: chatbot-bounce 1.2s ease-in-out infinite;
}
.chatbot-typing span:nth-child(2) { animation-delay: 0.18s; }
.chatbot-typing span:nth-child(3) { animation-delay: 0.36s; }
@keyframes chatbot-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-5px); }
}

/* Quick replies area */
.chatbot-replies {
  padding: 8px 12px 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  flex-shrink: 0;
  border-top: 1px solid rgba(26,35,50,0.07);
}
.chatbot-btn-reply {
  font-family: 'Lora', serif;
  font-size: 0.8rem;
  padding: 7px 14px;
  border-radius: 999px;
  border: 1.5px solid #1a2332;
  background: #fff;
  color: #1a2332;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
  line-height: 1;
}
.chatbot-btn-reply:hover {
  background: #1a2332;
  color: #fff;
}
.chatbot-btn-reply--terra {
  background: #c4704b;
  border-color: #c4704b;
  color: #fff;
}
.chatbot-btn-reply--terra:hover {
  background: #b05e3a;
  border-color: #b05e3a;
}
.chatbot-btn-reply--ghost {
  border-color: rgba(26,35,50,0.3);
  color: rgba(26,35,50,0.6);
}
.chatbot-btn-reply--ghost:hover {
  border-color: #1a2332;
  color: #1a2332;
  background: #fff;
}

/* Date/time grid */
.chatbot-date-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(26,35,50,0.07);
}
.chatbot-date-btn {
  font-family: 'Lora', serif;
  font-size: 0.75rem;
  line-height: 1.25;
  padding: 8px 4px;
  border-radius: 10px;
  border: 1.5px solid #1a2332;
  background: #fff;
  color: #1a2332;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, color 0.15s;
}
.chatbot-date-btn:hover { background: #1a2332; color: #fff; }
.chatbot-date-btn strong { display: block; font-size: 0.95rem; }

.chatbot-time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 8px 12px 10px;
  border-top: 1px solid rgba(26,35,50,0.07);
}
.chatbot-time-btn {
  font-family: 'Lora', serif;
  font-size: 0.82rem;
  padding: 8px 6px;
  border-radius: 10px;
  border: 1.5px solid #1a2332;
  background: #fff;
  color: #1a2332;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, color 0.15s;
}
.chatbot-time-btn:hover { background: #1a2332; color: #fff; }

/* Text input */
.chatbot-input-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px 12px;
  border-top: 1px solid rgba(26,35,50,0.07);
  flex-shrink: 0;
}
.chatbot-text-input {
  flex: 1;
  font-family: 'Lora', serif;
  font-size: 0.875rem;
  padding: 9px 12px;
  border-radius: 999px;
  border: 1.5px solid rgba(26,35,50,0.2);
  outline: none;
  color: #1a2332;
  background: #f9f8f6;
  transition: border-color 0.15s;
}
.chatbot-text-input:focus { border-color: #1a2332; }
.chatbot-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1a2332;
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}
.chatbot-send-btn:hover { background: #2c3a50; }

/* Start over bar */
.chatbot-startover {
  text-align: center;
  padding: 6px 12px;
  border-top: 1px solid rgba(26,35,50,0.06);
  flex-shrink: 0;
}
.chatbot-startover button {
  font-family: 'Lora', serif;
  font-size: 0.7rem;
  color: rgba(26,35,50,0.38);
  background: none;
  border: none;
  cursor: pointer;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 2px 6px;
}
.chatbot-startover button:hover { color: rgba(26,35,50,0.7); }

/* Mobile */
@media (max-width: 480px) {
  .chatbot-window {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 80px;
  }
  .chatbot-fab {
    right: 16px;
    bottom: 16px;
  }
}
