/*--------------------------------------------------------------
# Sahverra AI Growth Assistant - Chatbot Styling
--------------------------------------------------------------*/

/* Launcher Button */
#sahverra-chat-launcher {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0b5343 0%, #073b31 50%, #031c16 100%);
  border: 2px solid rgba(216, 189, 131, 0.7);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4), 0 0 15px rgba(216, 189, 131, 0.35);
  cursor: pointer;
  z-index: 99998;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  outline: none;
  padding: 0;
}

#sahverra-chat-launcher:hover {
  transform: translateY(-4px) scale(1.05);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.5), 0 0 25px rgba(216, 189, 131, 0.6);
  border-color: #d8bd83;
}

#sahverra-chat-launcher svg,
#sahverra-chat-launcher i {
  color: #d8bd83;
  font-size: 26px;
  transition: transform 0.3s ease;
}

#sahverra-chat-launcher .chat-icon-open {
  display: flex;
  align-items: center;
  justify-content: center;
}

#sahverra-chat-launcher .chat-icon-close {
  display: none;
  font-size: 24px;
}

#sahverra-chat-launcher.is-active .chat-icon-open {
  display: none;
}

#sahverra-chat-launcher.is-active .chat-icon-close {
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Online Pulse Dot on Launcher */
.sahverra-launcher-badge {
  position: absolute;
  top: 1px;
  right: 1px;
  width: 14px;
  height: 14px;
  background-color: #74bf1e;
  border: 2px solid #031c16;
  border-radius: 50%;
}

.sahverra-launcher-badge::after {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 50%;
  border: 2px solid #74bf1e;
  animation: launcherPulse 2s infinite;
}

@keyframes launcherPulse {
  0% { transform: scale(1); opacity: 1; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Teaser / Welcome Tooltip */
#sahverra-chat-teaser {
  position: fixed;
  bottom: 96px;
  right: 24px;
  background: #031c16;
  color: #ffffff;
  border: 1px solid rgba(216, 189, 131, 0.5);
  padding: 10px 16px;
  border-radius: 14px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.4);
  font-size: 13px;
  font-weight: 500;
  z-index: 99997;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  animation: fadeInTeaser 0.5s ease-out;
  transition: opacity 0.3s ease, transform 0.3s ease;
}

#sahverra-chat-teaser:hover {
  transform: translateY(-2px);
  border-color: #d8bd83;
}

#sahverra-chat-teaser .teaser-close {
  color: rgba(255, 255, 255, 0.5);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
}

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

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

/* Main Chat Widget Container */
#sahverra-chat-window {
  position: fixed;
  bottom: 96px;
  right: 24px;
  width: 390px;
  max-width: calc(100vw - 32px);
  height: 580px;
  max-height: calc(100vh - 120px);
  background: linear-gradient(180deg, #073b31 0%, #031c16 100%);
  border: 1px solid rgba(216, 189, 131, 0.35);
  border-radius: 20px;
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.55), 0 0 25px rgba(216, 189, 131, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99999;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: 'Montserrat', 'Roboto', sans-serif;
}

#sahverra-chat-window.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chat Header */
.sahverra-chat-header {
  padding: 16px 20px;
  background: rgba(3, 28, 22, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(216, 189, 131, 0.2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

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

.sahverra-chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #031c16;
  border: 1.5px solid #d8bd83;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.sahverra-chat-avatar img {
  width: 26px;
  height: auto;
  object-fit: contain;
}

.sahverra-chat-avatar-status {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 10px;
  height: 10px;
  background: #74bf1e;
  border: 1.5px solid #031c16;
  border-radius: 50%;
}

.sahverra-chat-info h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -0.2px;
}

.sahverra-chat-info p {
  margin: 2px 0 0;
  font-size: 11px;
  color: #d8bd83;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 5px;
}

.sahverra-chat-info p .status-indicator {
  width: 6px;
  height: 6px;
  background-color: #74bf1e;
  border-radius: 50%;
  display: inline-block;
}

.sahverra-chat-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.sahverra-chat-btn-action {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.65);
  font-size: 16px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sahverra-chat-btn-action:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

/* Chat Body / Messages Stream */
.sahverra-chat-body {
  flex: 1;
  padding: 18px 16px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scroll-behavior: smooth;
}

.sahverra-chat-body::-webkit-scrollbar {
  width: 5px;
}

.sahverra-chat-body::-webkit-scrollbar-thumb {
  background: rgba(216, 189, 131, 0.25);
  border-radius: 10px;
}

.sahverra-chat-body::-webkit-scrollbar-thumb:hover {
  background: rgba(216, 189, 131, 0.45);
}

/* Chat Bubbles */
.sahverra-msg {
  display: flex;
  flex-direction: column;
  max-width: 86%;
  animation: msgPop 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.sahverra-msg-bot {
  align-self: flex-start;
}

.sahverra-msg-user {
  align-self: flex-end;
}

.sahverra-bubble {
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.55;
  word-wrap: break-word;
}

.sahverra-msg-bot .sahverra-bubble {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
  border: 1px solid rgba(216, 189, 131, 0.22);
  border-bottom-left-radius: 4px;
  backdrop-filter: blur(8px);
}

.sahverra-msg-bot .sahverra-bubble strong {
  color: #f5dfa8;
}

.sahverra-msg-user .sahverra-bubble {
  background: linear-gradient(135deg, #d8bd83 0%, #b89855 100%);
  color: #031c16;
  font-weight: 500;
  border-bottom-right-radius: 4px;
  box-shadow: 0 4px 15px rgba(216, 189, 131, 0.2);
}

.sahverra-msg-time {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
}

.sahverra-msg-bot .sahverra-msg-time {
  margin-left: 4px;
}

.sahverra-msg-user .sahverra-msg-time {
  align-self: flex-end;
  margin-right: 4px;
}

/* Card Links in Messages */
.sahverra-chat-card-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.sahverra-chat-card-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(11, 83, 67, 0.5);
  border: 1px solid rgba(216, 189, 131, 0.35);
  color: #ffffff;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.25s ease;
}

.sahverra-chat-card-btn:hover {
  background: #0b5343;
  border-color: #d8bd83;
  color: #d8bd83;
  transform: translateX(3px);
}

.sahverra-chat-card-btn.btn-whatsapp-chat {
  background: #25d366;
  color: #031c16;
  border-color: #25d366;
}

.sahverra-chat-card-btn.btn-whatsapp-chat:hover {
  background: #1ebc59;
  color: #031c16;
  border-color: #1ebc59;
}

/* Suggestion Quick Chips */
.sahverra-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 6px;
}

.sahverra-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(216, 189, 131, 0.3);
  color: #e2e8f0;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  font-weight: 500;
  white-space: nowrap;
}

.sahverra-chip:hover {
  background: rgba(216, 189, 131, 0.15);
  border-color: #d8bd83;
  color: #ffffff;
  transform: translateY(-1px);
}

.sahverra-chip.chip-highlight {
  background: rgba(216, 189, 131, 0.2);
  border-color: #d8bd83;
  color: #fcebc2;
}

/* Typing Indicator Animation */
.sahverra-typing {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(216, 189, 131, 0.2);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  width: fit-content;
}

.sahverra-typing span {
  width: 6px;
  height: 6px;
  background: #d8bd83;
  border-radius: 50%;
  animation: typingBounce 1.4s infinite ease-in-out both;
}

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

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

/* Inline Quick Form in Chat */
.sahverra-chat-form {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(216, 189, 131, 0.3);
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sahverra-chat-form input,
.sahverra-chat-form select,
.sahverra-chat-form textarea {
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 8px 10px;
  color: #ffffff;
  font-size: 12px;
  outline: none;
  font-family: inherit;
}

.sahverra-chat-form input:focus,
.sahverra-chat-form select:focus,
.sahverra-chat-form textarea:focus {
  border-color: #d8bd83;
  background: rgba(255, 255, 255, 0.12);
}

.sahverra-chat-form select option {
  background: #031c16;
  color: #ffffff;
}

.sahverra-chat-form button {
  background: linear-gradient(135deg, #74bf1e 0%, #5ea813 100%);
  color: #031c16;
  border: none;
  border-radius: 8px;
  padding: 9px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sahverra-chat-form button:hover {
  background: #74bf1e;
  transform: translateY(-1px);
}

/* Chat Input Footer */
.sahverra-chat-footer {
  padding: 12px 16px;
  background: rgba(3, 28, 22, 0.95);
  border-top: 1px solid rgba(216, 189, 131, 0.2);
  flex-shrink: 0;
}

.sahverra-chat-input-wrap {
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(216, 189, 131, 0.3);
  border-radius: 25px;
  padding: 4px 6px 4px 16px;
  transition: all 0.25s ease;
}

.sahverra-chat-input-wrap:focus-within {
  border-color: #d8bd83;
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 12px rgba(216, 189, 131, 0.25);
}

#sahverra-chat-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
  padding: 6px 0;
}

#sahverra-chat-input::placeholder {
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
}

#sahverra-chat-send-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #d8bd83 0%, #b89855 100%);
  border: none;
  color: #031c16;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.25s ease;
  flex-shrink: 0;
}

#sahverra-chat-send-btn:hover {
  transform: scale(1.08);
  background: #f5dfa8;
}

#sahverra-chat-send-btn i,
#sahverra-chat-send-btn svg {
  font-size: 16px;
  margin-left: 2px;
}

.sahverra-chat-powered {
  text-align: center;
  font-size: 10px;
  color: rgba(216, 189, 131, 0.6);
  margin-top: 6px;
  letter-spacing: 0.3px;
}

/* Adjustments for scroll-to-top button */
.scroll-top {
  bottom: 96px !important;
  right: 28px !important;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
  #sahverra-chat-window {
    bottom: 0;
    right: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }

  #sahverra-chat-launcher {
    bottom: 20px;
    right: 20px;
    width: 56px;
    height: 56px;
  }

  #sahverra-chat-teaser {
    bottom: 84px;
    right: 16px;
  }
}
