/* HomeIP AI Chat Widget */

.homeip-ai-chat-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 99999;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.homeip-ai-chat-button {
  width: 62px;
  height: 62px;
  border: none;
  border-radius: 22px;
  background: #111827;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 18px 42px rgba(15, 23, 42, 0.24);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.homeip-ai-chat-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 22px 50px rgba(15, 23, 42, 0.30);
}

.homeip-ai-chat-button svg {
  width: 28px;
  height: 28px;
  display: block;
}

.homeip-ai-chat-panel {
  position: absolute;
  right: 0;
  bottom: 78px;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 560px;
  max-height: calc(100vh - 120px);
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 24px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.24);
  overflow: hidden;
  display: none;
  flex-direction: column;
}

.homeip-ai-chat-root.is-open .homeip-ai-chat-panel {
  display: flex;
}

.homeip-ai-chat-header {
  min-height: 76px;
  padding: 16px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.20), transparent 38%),
    #111827;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.homeip-ai-chat-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.homeip-ai-chat-logo {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.20);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.homeip-ai-chat-logo img {
  width: 32px !important;
  height: 32px !important;
  max-width: 32px !important;
  max-height: 32px !important;
  object-fit: contain !important;
  display: block !important;
}

.homeip-ai-chat-title {
  min-width: 0;
}

.homeip-ai-chat-title strong {
  display: block;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.2;
}

.homeip-ai-chat-title span {
  display: block;
  margin-top: 3px;
  color: #cbd5e1;
  font-size: 12px;
  line-height: 1.3;
}

.homeip-ai-chat-close {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.10);
  color: #ffffff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.homeip-ai-chat-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.homeip-ai-chat-messages {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  background: #f8fafc;
}

.homeip-ai-message {
  display: flex;
  margin-bottom: 12px;
}

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

.homeip-ai-bubble {
  max-width: 86%;
  padding: 11px 13px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.homeip-ai-message.assistant .homeip-ai-bubble {
  background: #ffffff;
  color: #111827;
  border: 1px solid #e5e7eb;
  border-bottom-left-radius: 6px;
}

.homeip-ai-message.user .homeip-ai-bubble {
  background: #2563eb;
  color: #ffffff;
  border-bottom-right-radius: 6px;
}

.homeip-ai-quick-actions {
  padding: 12px 16px 0;
  background: #f8fafc;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.homeip-ai-quick-actions button {
  border: 1px solid #dbeafe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.homeip-ai-quick-actions button:hover {
  background: #dbeafe;
}

.homeip-ai-chat-input-area {
  padding: 14px;
  background: #ffffff;
  border-top: 1px solid #e5e7eb;
}

.homeip-ai-chat-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.homeip-ai-chat-input {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  resize: none;
  border: 1px solid #d1d5db;
  border-radius: 16px;
  padding: 11px 12px;
  font-size: 14px;
  line-height: 1.45;
  outline: none;
  box-sizing: border-box;
}

.homeip-ai-chat-input:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.10);
}

.homeip-ai-send-button {
  width: 46px;
  min-width: 46px;
  height: 44px;
  border: none;
  border-radius: 16px;
  background: #2563eb;
  color: #ffffff;
  font-weight: 900;
  cursor: pointer;
}

.homeip-ai-send-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.homeip-ai-chat-note {
  margin-top: 9px;
  color: #6b7280;
  font-size: 11px;
  line-height: 1.4;
}

.homeip-ai-typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}

.homeip-ai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #94a3b8;
  animation: homeipAiTyping 1s infinite ease-in-out;
}

.homeip-ai-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.homeip-ai-typing span:nth-child(3) {
  animation-delay: 0.30s;
}

@keyframes homeipAiTyping {
  0%, 80%, 100% {
    transform: scale(0.75);
    opacity: 0.45;
  }

  40% {
    transform: scale(1);
    opacity: 1;
  }
}

@media (max-width: 600px) {
  .homeip-ai-chat-root {
    right: 14px;
    bottom: 14px;
  }

  .homeip-ai-chat-panel {
    right: -4px;
    bottom: 76px;
    width: calc(100vw - 28px);
    height: min(580px, calc(100vh - 105px));
    border-radius: 22px;
  }

  .homeip-ai-chat-button {
    width: 58px;
    height: 58px;
  }
}
/* Live Chat Label + Blue/Green Button */

.homeip-ai-chat-root::after {
  content: "Live Chat";
  position: absolute;
  right: 0;
  bottom: 72px;
  background: #ffffff;
  color: #111827;
  border: 1px solid #dbeafe;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.14);
}

.homeip-ai-chat-root.is-open::after {
  display: none;
}

.homeip-ai-chat-button {
  background: linear-gradient(135deg, #2563eb 0%, #10b981 100%) !important;
  box-shadow: 0 18px 42px rgba(37, 99, 235, 0.28) !important;
}

.homeip-ai-chat-button:hover {
  box-shadow: 0 22px 50px rgba(16, 185, 129, 0.30) !important;
}

@media (max-width: 600px) {
  .homeip-ai-chat-root::after {
    bottom: 68px;
    font-size: 12px;
    padding: 7px 11px;
  }
}
