/* HIG Development - AI Real Estate Advisor Chatbot Widget Styles */

:root {
  --hig-chat-bg: #070b10;
  --hig-chat-surface: #0e1520;
  --hig-chat-surface-hover: #141f30;
  --hig-chat-border: rgba(18, 121, 215, 0.32);
  --hig-chat-blue: #1279d7;
  --hig-chat-blue-glow: rgba(18, 121, 215, 0.45);
  --hig-chat-gold: #c5a880;
  --hig-chat-text: #f1f5f9;
  --hig-chat-text-muted: #94a3b8;
  --hig-chat-radius: 18px;
}

/* Floating Trigger Button: Robot Head ONLY */
.hig-chatbot-trigger {
  position: fixed;
  left: 1.6rem;
  bottom: 1.7rem;
  z-index: 9990;
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #0b1424 0%, #05080e 100%);
  border: 1.5px solid var(--hig-chat-border);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.6), 0 0 25px rgba(18, 121, 215, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.25s ease,
              border-color 0.25s ease;
  user-select: none;
  padding: 0;
}

.hig-chatbot-trigger:hover {
  transform: translateY(-4px) scale(1.08);
  border-color: var(--hig-chat-blue);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.75), 0 0 35px var(--hig-chat-blue-glow);
}

.hig-chatbot-trigger-robot {
  width: 2.38rem;
  height: 2.38rem;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.hig-chatbot-trigger-robot svg {
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 2px 8px rgba(18, 121, 215, 0.45));
}

.hig-chatbot-trigger-dot {
  position: absolute;
  top: -3px;
  right: -3px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #10b981;
  border: 2px solid #070b10;
  box-shadow: 0 0 8px #10b981;
}

/* Chat Window Modal */
.hig-chatbot-window {
  position: fixed;
  left: 1.6rem;
  bottom: 5.4rem;
  width: 390px;
  max-width: calc(100vw - 2.5rem);
  height: 590px;
  max-height: calc(100vh - 7rem);
  background: var(--hig-chat-bg);
  border: 1px solid var(--hig-chat-border);
  border-radius: var(--hig-chat-radius);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75), 0 0 40px rgba(18, 121, 215, 0.15);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9995;
  direction: rtl;
  font-family: Inter, Tajawal, Arial, sans-serif;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.96);
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.28s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.28s;
  backdrop-filter: blur(20px);
}

.hig-chatbot-window.is-open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Header */
.hig-chat-header {
  padding: 1rem 1.1rem;
  background: linear-gradient(180deg, #0d1624 0%, #080d14 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hig-chat-header-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hig-chat-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--hig-chat-blue) 0%, #073a6e 100%);
  border: 1px solid rgba(18, 121, 215, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.hig-chat-avatar svg {
  width: 1.5rem;
  height: 1.5rem;
  fill: #60a5fa;
}

.hig-chat-title-group h4 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
}

.hig-chat-status {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: #10b981;
  font-weight: 600;
  margin-top: 0.15rem;
}

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

.hig-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.hig-chat-btn-action {
  width: 1.9rem;
  height: 1.9rem;
  border-radius: 6px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: var(--hig-chat-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, color 0.2s;
}

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

.hig-chat-btn-action svg {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
}

/* Quick Topic Pills Bar */
.hig-chat-pills-bar {
  padding: 0.55rem 0.9rem;
  background: #090e15;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.hig-chat-pills-bar::-webkit-scrollbar {
  display: none;
}

.hig-chat-topic-pill {
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--hig-chat-text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.2s ease;
}

.hig-chat-topic-pill:hover {
  background: rgba(18, 121, 215, 0.15);
  border-color: var(--hig-chat-blue);
  color: #ffffff;
}

/* Messages Body */
.hig-chat-messages {
  flex: 1;
  padding: 1rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.hig-chat-messages::-webkit-scrollbar {
  width: 4px;
}

.hig-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.hig-chat-bubble {
  max-width: 88%;
  padding: 0.85rem 1.05rem;
  border-radius: 14px;
  font-size: 0.9rem;
  line-height: 1.7;
  word-break: break-word;
}

.hig-chat-bubble.bot {
  align-self: flex-start;
  background: var(--hig-chat-surface);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--hig-chat-text);
  border-bottom-right-radius: 4px;
}

.hig-chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--hig-chat-blue) 0%, #0d5aa3 100%);
  color: #ffffff;
  border-bottom-left-radius: 4px;
  box-shadow: 0 4px 14px rgba(18, 121, 215, 0.3);
}

.hig-chat-bubble strong {
  color: #ffffff;
  font-weight: 800;
}

.hig-chat-bubble p,
.hig-chat-p {
  margin: 0 0 0.45rem;
  line-height: 1.68;
}

.hig-chat-bubble p:last-child,
.hig-chat-p:last-child {
  margin-bottom: 0;
}

.hig-chat-list {
  margin: 0.35rem 0 0.55rem;
  padding-right: 1.2rem;
  padding-left: 0;
  list-style-type: disc;
}

.hig-chat-list li {
  margin-bottom: 0.35rem;
  line-height: 1.62;
}

.hig-chat-list li strong {
  color: #93c5fd;
}

/* Typing Indicator */
.hig-chat-typing {
  display: none;
  align-self: flex-start;
  padding: 0.6rem 0.9rem;
  background: var(--hig-chat-surface);
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  gap: 4px;
  align-items: center;
}

.hig-chat-typing.is-visible {
  display: flex;
}

.hig-chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hig-chat-blue);
  opacity: 0.4;
  animation: higTypingPulse 1.2s infinite ease-in-out both;
}

.hig-chat-typing span:nth-child(1) { animation-delay: 0s; }
.hig-chat-typing span:nth-child(2) { animation-delay: 0.2s; }
.hig-chat-typing span:nth-child(3) { animation-delay: 0.4s; }

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

/* Quick Replies Container */
.hig-chat-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

.hig-chat-quick-btn {
  background: rgba(18, 121, 215, 0.12);
  border: 1px solid rgba(18, 121, 215, 0.3);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s;
}

.hig-chat-quick-btn:hover {
  background: var(--hig-chat-blue);
  border-color: var(--hig-chat-blue);
}

/* Inline Lead Card in Chat */
.hig-chat-lead-box {
  background: linear-gradient(145deg, #0e1826 0%, #090f18 100%);
  border: 1px solid rgba(18, 121, 215, 0.35);
  border-radius: 12px;
  padding: 0.9rem;
  margin-top: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.hig-chat-lead-title {
  font-size: 0.84rem;
  font-weight: 800;
  color: #ffffff;
}

.hig-chat-lead-inputs {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.hig-chat-lead-inputs input {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  color: #ffffff;
  font-size: 0.88rem;
  outline: none;
}

.hig-chat-lead-inputs input:focus {
  border-color: var(--hig-chat-blue);
}

.hig-chat-lead-btn {
  background: var(--hig-chat-blue);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 0.6rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}

.hig-chat-lead-btn:hover {
  background: #0d5aa3;
}

/* Input Area */
.hig-chat-footer {
  padding: 0.75rem 0.9rem;
  background: #0a0f16;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.hig-chat-input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--hig-chat-surface);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 0.35rem 0.5rem 0.35rem 0.85rem;
  transition: border-color 0.2s;
}

.hig-chat-input-row:focus-within {
  border-color: var(--hig-chat-blue);
  box-shadow: 0 0 12px rgba(18, 121, 215, 0.2);
}

.hig-chat-input-row input {
  flex: 1;
  background: transparent;
  border: none;
  color: #ffffff;
  font-size: 0.9rem;
  padding: 0.4rem 0;
  outline: none;
  font-family: inherit;
}

.hig-chat-input-row input::placeholder {
  color: var(--hig-chat-text-muted);
}

.hig-chat-send-btn {
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 8px;
  background: var(--hig-chat-blue);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
}

.hig-chat-send-btn:hover {
  background: #0d5aa3;
  transform: scale(1.04);
}

.hig-chat-send-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: #ffffff;
}

.hig-chat-sub-footer {
  margin-top: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--hig-chat-text-muted);
}

.hig-chat-sub-footer a {
  color: var(--hig-chat-blue);
  text-decoration: none;
  font-weight: 700;
}

.hig-chat-sub-footer a:hover {
  text-decoration: underline;
}

/* Mobile Responsiveness */
@media (max-width: 640px) {
  .hig-chatbot-trigger {
    left: 1rem;
    bottom: 1rem;
    width: 3.15rem;
    height: 3.15rem;
  }
  .hig-chatbot-trigger-robot {
    width: 2.25rem;
    height: 2.25rem;
  }
  .hig-chatbot-window {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
}
