/* ==========================================================================
   Rabbit Hole Dominica - AI-Rabbit Chat Widget (Jungle Green & Earth Theme)
   ========================================================================== */

#rh-chat-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  box-shadow: 0 0 20px rgba(16, 185, 129, 0.45), 0 8px 24px rgba(0, 0, 0, 0.4);
  border: 2px solid rgba(255, 255, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 99999;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#rh-chat-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 0 30px rgba(16, 185, 129, 0.7), 0 10px 28px rgba(0, 0, 0, 0.5);
}

#rh-chat-toggle .rabbit-icon {
  font-size: 28px;
  line-height: 1;
  transition: transform 0.3s ease;
}

#rh-chat-toggle.active {
  background: #1e293b;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

/* Chat Widget Container */
#rh-chat-widget {
  position: fixed;
  bottom: 98px;
  right: 24px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 540px;
  max-height: calc(100vh - 120px);
  background: rgba(13, 40, 24, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(16, 185, 129, 0.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99998;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: inherit;
}

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

/* Header */
.rh-chat-header {
  padding: 16px 20px;
  background: linear-gradient(180deg, rgba(20, 60, 36, 0.9), rgba(13, 40, 24, 0.7));
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.rh-chat-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.rh-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #d97706);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.5);
}

.rh-chat-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: 0.5px;
}

.rh-chat-status {
  font-size: 11.5px;
  color: #34d399;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.rh-chat-status::before {
  content: '';
  width: 6px;
  height: 6px;
  background: #10b981;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px #10b981;
}

.rh-chat-close {
  background: none;
  border: none;
  color: #a7f3d0;
  cursor: pointer;
  padding: 4px;
  font-size: 18px;
  line-height: 1;
  transition: color 0.2s;
}

.rh-chat-close:hover {
  color: #ffffff;
}

/* Messages Area */
.rh-chat-body {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(16, 185, 129, 0.3) transparent;
}

.rh-msg {
  max-width: 82%;
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  word-wrap: break-word;
  animation: rhMsgIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.rh-msg-bot {
  align-self: flex-start;
  background: rgba(20, 50, 32, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #ecfdf5;
  border-bottom-left-radius: 4px;
}

.rh-msg-user {
  align-self: flex-end;
  background: linear-gradient(135deg, #059669, #047857);
  color: #ffffff;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 14px rgba(5, 150, 105, 0.35);
}

.rh-msg a {
  color: #6ee7b7;
  text-decoration: underline;
}

.rh-typing {
  display: flex;
  gap: 5px;
  padding: 12px 16px;
  background: rgba(20, 50, 32, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  width: fit-content;
}

.rh-typing span {
  width: 6px;
  height: 6px;
  background: #34d399;
  border-radius: 50%;
  animation: rhDot 1.4s infinite ease-in-out both;
}

.rh-typing span:nth-child(1) { animation-delay: -0.32s; }
.rh-typing span:nth-child(2) { animation-delay: -0.16s; }

@keyframes rhDot {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

/* Quick Action Badges */
.rh-quick-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.rh-quick-btn {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #a7f3d0;
  padding: 6px 11px;
  border-radius: 12px;
  font-size: 11.5px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.rh-quick-btn:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: #34d399;
  color: #ffffff;
}

/* Footer / Input Area */
.rh-chat-footer {
  padding: 12px 16px;
  background: rgba(10, 30, 18, 0.98);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  gap: 8px;
  align-items: center;
}

#rh-chat-input {
  flex: 1;
  background: rgba(20, 50, 32, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  padding: 10px 16px;
  color: #ffffff;
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#rh-chat-input:focus {
  border-color: #34d399;
  box-shadow: 0 0 10px rgba(52, 211, 153, 0.3);
}

#rh-chat-input::placeholder {
  color: #6ee7b7;
  opacity: 0.6;
}

#rh-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #10b981, #059669);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, opacity 0.2s;
}

#rh-chat-send:hover {
  transform: scale(1.05);
}

#rh-chat-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

#rh-chat-send svg {
  width: 16px;
  height: 16px;
  fill: #ffffff;
}

@media (max-width: 480px) {
  #rh-chat-widget {
    bottom: 80px;
    right: 16px;
    width: calc(100vw - 32px);
    height: 480px;
  }
  #rh-chat-toggle {
    bottom: 16px;
    right: 16px;
  }
}
