/* Rapali Chat Widget - CSS */
:root {
  --rapali-cream: #f5f1ea;
  --rapali-warm: #e8e0d3;
  --rapali-mid: #a89b87;
  --rapali-dark: #3d3530;
  --rapali-ink: #1a1614;
  --rapali-accent: #8b6f47;
  --rapali-accent-deep: #5c4530;
}

.rapali-chat-toggle {
  position: fixed !important;
  bottom: 30px !important;
  right: 30px !important;
  width: 64px !important;
  height: 64px !important;
  border-radius: 50% !important;
  background: var(--rapali-ink) !important;
  color: white !important;
  border: none !important;
  cursor: pointer !important;
  box-shadow: 0 12px 40px rgba(60, 45, 30, 0.25) !important;
  z-index: 99999 !important;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-family: 'Manrope', system-ui, sans-serif !important;
  padding: 0 !important;
  margin: 0 !important;
}

.rapali-chat-toggle:hover {
  transform: scale(1.08) !important;
}

.rapali-chat-toggle svg {
  width: 28px !important;
  height: 28px !important;
}

.rapali-badge-dot {
  position: absolute !important;
  top: -2px !important;
  right: -2px !important;
  width: 14px !important;
  height: 14px !important;
  background: var(--rapali-accent) !important;
  border-radius: 50% !important;
  border: 2px solid white !important;
}

.rapali-chat-window {
  position: fixed !important;
  bottom: 110px !important;
  right: 30px !important;
  width: 400px !important;
  height: 620px !important;
  max-height: calc(100vh - 140px) !important;
  background: var(--rapali-cream) !important;
  border-radius: 20px !important;
  box-shadow: 0 12px 40px rgba(60, 45, 30, 0.25) !important;
  display: flex !important;
  flex-direction: column !important;
  overflow: hidden !important;
  z-index: 99998 !important;
  transform: translateY(20px) scale(0.95) !important;
  opacity: 0 !important;
  pointer-events: none !important;
  transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
  font-family: 'Manrope', system-ui, sans-serif !important;
}

.rapali-chat-window.rapali-open {
  transform: translateY(0) scale(1) !important;
  opacity: 1 !important;
  pointer-events: all !important;
}

.rapali-chat-header {
  background: var(--rapali-ink);
  color: white;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 14px;
  border-bottom: 2px solid var(--rapali-accent);
}

.rapali-chat-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--rapali-accent), var(--rapali-accent-deep));
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: white;
}

.rapali-chat-info {
  flex: 1;
}

.rapali-chat-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 19px;
  font-weight: 600;
  color: white;
}

.rapali-chat-status {
  font-size: 11px;
  opacity: 0.7;
  display: flex;
  align-items: center;
  gap: 5px;
  color: white;
}

.rapali-chat-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #6bcf7f;
  border-radius: 50%;
}

.rapali-chat-close {
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  opacity: 0.6;
  font-size: 20px;
  padding: 4px 8px;
  border-radius: 6px;
  line-height: 1;
}

.rapali-chat-close:hover {
  opacity: 1;
}

.rapali-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background-image: 
    radial-gradient(circle at 20% 30%, rgba(139, 111, 71, 0.04) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(60, 45, 30, 0.03) 0%, transparent 50%);
}

.rapali-chat-messages::-webkit-scrollbar { width: 6px; }
.rapali-chat-messages::-webkit-scrollbar-thumb { background: var(--rapali-mid); border-radius: 3px; }

.rapali-message {
  max-width: 80%;
  animation: rapaliSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes rapaliSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.rapali-message.rapali-bot { align-self: flex-start; }
.rapali-message.rapali-user { align-self: flex-end; }

.rapali-message-bubble {
  padding: 12px 16px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
}

.rapali-message.rapali-bot .rapali-message-bubble {
  background: white;
  color: var(--rapali-ink);
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 20px rgba(60, 45, 30, 0.08);
}

.rapali-message.rapali-user .rapali-message-bubble {
  background: var(--rapali-dark);
  color: white;
  border-bottom-right-radius: 4px;
}

.rapali-message-image {
  margin-top: 8px;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(60, 45, 30, 0.08);
  background: var(--rapali-warm);
  display: block;
}

.rapali-message-image img {
  width: 100%;
  height: auto;
  display: block;
}

.rapali-image-caption {
  background: white;
  padding: 8px 12px;
  font-size: 12px;
  color: var(--rapali-dark);
  font-weight: 500;
}

.rapali-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.rapali-quick-reply {
  background: white;
  border: 1px solid var(--rapali-warm);
  color: var(--rapali-dark);
  padding: 7px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
  font-weight: 500;
}

.rapali-quick-reply:hover {
  background: var(--rapali-ink);
  color: white;
  border-color: var(--rapali-ink);
}

.rapali-typing-indicator {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 14px 18px;
  background: white;
  border-radius: 18px;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 20px rgba(60, 45, 30, 0.08);
}

.rapali-typing-indicator span {
  width: 7px;
  height: 7px;
  background: var(--rapali-mid);
  border-radius: 50%;
  animation: rapaliTyping 1.4s infinite ease-in-out;
}

.rapali-typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.rapali-typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes rapaliTyping {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-6px); opacity: 1; }
}

.rapali-chat-input-area {
  padding: 14px 16px;
  background: white;
  border-top: 1px solid var(--rapali-warm);
  display: flex;
  gap: 8px;
  align-items: center;
}

.rapali-chat-input {
  flex: 1;
  border: 1px solid var(--rapali-warm) !important;
  background: var(--rapali-cream) !important;
  border-radius: 24px !important;
  padding: 11px 18px !important;
  font-size: 14px !important;
  font-family: inherit !important;
  outline: none !important;
  color: var(--rapali-ink) !important;
}

.rapali-chat-input:focus {
  border-color: var(--rapali-accent) !important;
  background: white !important;
}

.rapali-send-btn {
  background: var(--rapali-ink);
  color: white;
  border: none;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rapali-send-btn:hover { background: var(--rapali-accent-deep); }
.rapali-send-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.rapali-send-btn svg { width: 18px; height: 18px; }

.rapali-chat-footer {
  text-align: center;
  padding: 8px;
  font-size: 10px;
  color: var(--rapali-mid);
  background: white;
  border-top: 1px solid var(--rapali-warm);
}

.rapali-whatsapp-link {
  display: inline-block;
  margin-top: 8px;
  padding: 10px 18px;
  background: #25d366;
  color: white !important;
  text-decoration: none !important;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}

@media (max-width: 480px) {
  .rapali-chat-window {
    bottom: 0 !important;
    right: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    max-height: 100% !important;
    border-radius: 0 !important;
  }
}
