/* Shared Chatbot Styles */

:root {
  --font-heading: "Plus Jakarta Sans", "Inter", sans-serif;
  --font-body: "Inter", sans-serif;
}

.assistant, .chat-panel, .chat-message, .message-text, .chat-input {
  font-family: var(--font-body);
}

.chat-header-title, .chat-action-btn {
  font-family: var(--font-heading);
}

.assistant {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 8px;
  z-index: 58;
}

.assistant-launcher {
  position: relative;
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 50%;
  background: linear-gradient(135deg, #4F5BFF 0%, #6650F5 55%, #7C3AED 100%);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: 0 10px 32px rgba(79, 91, 255, 0.30);
  border: 1px solid rgba(79, 91, 255, 0.3);
  transition: all 0.2s ease;
}

.assistant-launcher:hover {
  transform: scale(1.08);
  filter: brightness(1.04);
  box-shadow: 0 14px 40px rgba(79, 91, 255, 0.38);
}

.assistant-launcher::before {
  content: "1";
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ff2f3b;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border: 2px solid #fff;
}

.chat-panel {
  position: fixed;
  right: 20px;
  bottom: 90px;
  top: auto;
  width: 380px;
  max-width: calc(100vw - 40px);
  height: min(620px, calc(100dvh - 200px));
  max-height: calc(100dvh - 200px);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f8f9fc 100%);
  border: 1px solid rgba(15, 45, 95, 0.12);
  box-shadow:
    0 28px 78px rgba(3, 17, 42, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 59;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all 0.25s ease;
}

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

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid rgba(15, 45, 95, 0.08);
  flex-shrink: 0;
}

.chat-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

.chat-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #4F5BFF 0%, #6650F5 55%, #7C3AED 100%);
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.chat-header-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.chat-header-title {
  color: #03112A;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
}

.chat-status {
  display: flex;
  align-items: center;
  gap: 4px;
  color: #071C46;
  font-size: 11px;
  font-weight: 600;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #10b981;
}

.chat-close {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: #5d6b85;
  cursor: pointer;
  display: grid;
  place-items: center;
  border-radius: 6px;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.chat-close:hover {
  background: rgba(15, 45, 95, 0.06);
  color: #03112A;
}

.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 12px 16px;
  overflow-y: auto;
  gap: 10px;
  min-height: 0;
}

.chat-message {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.chat-message.user-message {
  justify-content: flex-end;
}

.chat-message.assistant-message {
  justify-content: flex-start;
}

.message-text {
  max-width: 85%;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

.user-message .message-text {
  background: linear-gradient(135deg, #4F5BFF 0%, #6650F5 55%, #7C3AED 100%);
  color: #fff;
  border-radius: 10px 2px 10px 10px;
}

.assistant-message .message-text {
  background: #f0f4ff;
  color: #03112A;
  border-radius: 2px 10px 10px 10px;
}

.typing-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 10px 12px;
  background: #f0f4ff;
  border-radius: 10px 2px 10px 10px;
  width: fit-content;
}

.typing-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4F5BFF;
  animation: typing-bounce 1.4s infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes typing-bounce {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.6;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

.chat-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 16px 12px 16px;
  flex-shrink: 0;
}

.chat-action-btn {
  padding: 8px 12px;
  border: 1px solid rgba(15, 45, 95, 0.12);
  border-radius: 8px;
  background: #fff;
  color: #071C46;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  font-family: inherit;
}

.chat-action-btn:hover {
  background: #f0f4ff;
  border-color: rgba(37, 99, 235, 0.2);
}

.chat-action-btn.whatsapp-btn {
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  color: #fff;
  border-color: transparent;
}

.chat-action-btn.whatsapp-btn:hover {
  background: linear-gradient(135deg, #20ba58 0%, #0d6f62 100%);
  border-color: transparent;
}

.chat-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(15, 45, 95, 0.08);
  flex-shrink: 0;
}

.chat-input-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid rgba(15, 45, 95, 0.12);
  border-radius: 8px;
  padding: 8px 10px;
}

.chat-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: #03112A;
  font-size: 12px;
  font-weight: 500;
  padding: 0;
  font-family: inherit;
  min-height: 32px;
  display: flex;
  align-items: center;
}

.chat-input::placeholder {
  color: rgba(7, 23, 59, 0.5);
}

.chat-input:focus {
  outline: none;
}

.chat-send-btn {
  width: 24px;
  height: 24px;
  border: 0;
  background: transparent;
  color: #4F5BFF;
  cursor: pointer;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.chat-send-btn:hover {
  color: #4F5BFF;
  transform: scale(1.1);
  filter: brightness(1.2);
}

@media (max-width: 768px) {
  .assistant {
    bottom: calc(68px + env(safe-area-inset-bottom) + 16px) !important;
  }
}

@media (max-width: 520px) {
  .assistant {
    right: 12px;
    bottom: calc(68px + env(safe-area-inset-bottom) + 16px) !important;
    padding: 8px;
  }

  .chat-panel {
    right: 12px;
    bottom: 82px;
    width: calc(100vw - 24px);
    max-width: 380px;
    max-height: calc(100dvh - 130px);
  }

  .assistant-launcher {
    width: 52px;
    height: 52px;
  }
}

/* FINAL OVERRIDE - Ensure mobile chatbot is above bottom nav */
@media (max-width: 768px) {
  .assistant {
    bottom: calc(68px + env(safe-area-inset-bottom) + 16px) !important;
  }
}
