/* GBP.GE AI chat widget */
#gb-ai-chat-root {
  --gb-ai-z: 9990;
  position: relative;
  z-index: var(--gb-ai-z);
  font-family: "Segoe UI", system-ui, sans-serif;
}

#gb-ai-chat-fab {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: var(--gb-ai-z);
  min-height: 52px;
  width: auto;
  max-width: calc(100vw - 28px);
  padding: 0 18px 0 16px;
  border: 0;
  border-radius: 999px;
  background: #2563eb;
  color: #fff;
  box-shadow: 0 10px 28px rgba(37, 99, 235, 0.35);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  transition: transform 0.15s ease, background 0.15s ease, padding 0.15s ease;
}

#gb-ai-chat-fab i {
  font-size: 18px;
}

#gb-ai-chat-fab .gb-ai-fab-label {
  white-space: nowrap;
}

#gb-ai-chat-fab.is-open .gb-ai-fab-label {
  display: none;
}

#gb-ai-chat-fab.is-open {
  width: 52px;
  padding: 0;
}

#gb-ai-chat-fab:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}

#gb-ai-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 92px;
  z-index: var(--gb-ai-z);
  width: min(380px, calc(100vw - 24px));
  height: min(560px, calc(100vh - 140px));
  display: none;
  flex-direction: column;
  background: #0f172a;
  color: #e2e8f0;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(2, 6, 23, 0.45);
}

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

.gb-ai-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, #1e3a8a, #2563eb);
  color: #fff;
}

.gb-ai-chat-header strong {
  display: block;
  font-size: 14px;
}

.gb-ai-chat-header span {
  display: block;
  font-size: 11px;
  opacity: 0.85;
  margin-top: 2px;
}

.gb-ai-chat-close {
  border: 0;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  cursor: pointer;
}

.gb-ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #0b1220;
}

.gb-ai-msg {
  max-width: 88%;
  padding: 10px 12px;
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.gb-ai-msg.user {
  align-self: flex-end;
  background: #2563eb;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.gb-ai-msg.assistant {
  align-self: flex-start;
  background: #1e293b;
  color: #e2e8f0;
  border-bottom-left-radius: 4px;
}

.gb-ai-msg time {
  display: block;
  margin-top: 6px;
  font-size: 10px;
  opacity: 0.65;
}

.gb-ai-msg-body {
  display: block;
}

.gb-ai-phone-link {
  color: #bfdbfe;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 600;
}

.gb-ai-phone-link:focus-visible,
.gb-ai-contact-btn:focus-visible {
  outline: 2px solid #93c5fd;
  outline-offset: 2px;
  border-radius: 8px;
}

.gb-ai-contact-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.gb-ai-contact-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(37, 99, 235, 0.18);
  color: #dbeafe;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

.gb-ai-typing {
  align-self: flex-start;
  display: none;
  gap: 4px;
  padding: 10px 12px;
  background: #1e293b;
  border-radius: 14px;
}

.gb-ai-typing.is-on {
  display: inline-flex;
}

.gb-ai-typing i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #94a3b8;
  animation: gbAiDot 1s infinite ease-in-out;
}

.gb-ai-typing i:nth-child(2) { animation-delay: 0.15s; }
.gb-ai-typing i:nth-child(3) { animation-delay: 0.3s; }

@keyframes gbAiDot {
  0%, 80%, 100% { opacity: 0.3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

.gb-ai-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
  background: #0f172a;
}

.gb-ai-chat-form input {
  flex: 1;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #1e293b;
  color: #f8fafc;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  outline: none;
}

.gb-ai-chat-form input:focus {
  border-color: #3b82f6;
}

.gb-ai-chat-form button {
  border: 0;
  background: #2563eb;
  color: #fff;
  border-radius: 12px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
}

.gb-ai-chat-form button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.gb-ai-lead {
  padding: 18px 16px;
  background: #0b1220;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.gb-ai-lead-title {
  margin: 0 0 6px;
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
}

.gb-ai-lead-hint {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.45;
  color: #94a3b8;
}

#gb-ai-lead-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#gb-ai-lead-form input {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: #1e293b;
  color: #f8fafc;
  border-radius: 12px;
  padding: 11px 12px;
  font-size: 13px;
  outline: none;
}

#gb-ai-lead-form input:focus {
  border-color: #3b82f6;
}

#gb-ai-lead-form button {
  border: 0;
  background: #2563eb;
  color: #fff;
  border-radius: 12px;
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  margin-top: 4px;
}

.gb-ai-lead-error {
  margin: 4px 0 0;
  font-size: 12px;
  color: #fca5a5;
}

@media (max-width: 768px) {
  #gb-ai-chat-fab {
    bottom: 84px;
    right: 14px;
    font-size: 14px;
    padding: 0 14px 0 12px;
  }
  #gb-ai-chat-fab .gb-ai-fab-label {
    max-width: 58vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #gb-ai-chat-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 152px;
    height: min(520px, calc(100vh - 220px));
  }
  .gb-ai-contact-btn {
    min-height: 40px;
    padding: 8px 12px;
  }
}
