/* Global Finance Chat Widget (site-aligned theme) */
#gf-chat-widget {
  --gf-primary: #009245;
  --gf-primary-light: #009c38;
  --gf-bg: #ffffff;
  --gf-msg-user: linear-gradient(180deg, #009245 0%, #009c38 100%);
  --gf-msg-bot: #f2faf4;
  --gf-text: #0e1a12;
  --gf-text-light: #6b7280;
  --gf-border: rgba(0, 0, 0, 0.08);
  --gf-shadow: 0 16px 42px rgba(0, 0, 0, 0.16);
  --gf-radius: 18px;

  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 999999;
}

#gf-chat-toggle {
  width: 60px;
  height: 60px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gf-primary) 0%, var(--gf-primary-light) 100%);
  border: 1px solid rgba(255, 255, 255, 0.28);
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(0, 146, 69, 0.34);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

#gf-chat-toggle:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 40px rgba(0, 146, 69, 0.4);
}

#gf-chat-toggle svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  transition: opacity 0.2s;
}

#gf-chat-toggle .gf-close-icon {
  position: absolute;
  opacity: 0;
}

#gf-chat-widget.gf-open #gf-chat-toggle .gf-chat-icon { opacity: 0; }
#gf-chat-widget.gf-open #gf-chat-toggle .gf-close-icon { opacity: 1; }

#gf-chat-toggle .gf-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 999px;
  background: #ef4444;
  border: 2px solid #fff;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
}

#gf-chat-toggle .gf-badge.gf-show { opacity: 1; }

#gf-chat-window {
  position: absolute;
  bottom: 74px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 120px);
  background: var(--gf-bg);
  border-radius: var(--gf-radius);
  border: 1px solid var(--gf-border);
  box-shadow: var(--gf-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(18px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
}

#gf-chat-widget.gf-open #gf-chat-window {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#gf-chat-header {
  background: linear-gradient(180deg, var(--gf-primary) 0%, var(--gf-primary-light) 100%);
  color: #fff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

#gf-chat-header .gf-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: #ffffff url("/assets/Natalya.png") center center / cover no-repeat;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0;
  color: transparent;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.18);
}

#gf-chat-header .gf-info h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

#gf-chat-header .gf-info p {
  margin: 2px 0 0;
  font-size: 12px;
  opacity: 0.96;
}

#gf-chat-header .gf-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d9ffe9;
  margin-right: 4px;
  vertical-align: middle;
}

#gf-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}

.gf-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  word-wrap: break-word;
  white-space: pre-wrap;
  animation: gf-fadeIn 0.2s ease;
}

@keyframes gf-fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.gf-message.gf-bot {
  background: var(--gf-msg-bot);
  color: var(--gf-text);
  align-self: flex-start;
  border: 1px solid rgba(0, 146, 69, 0.1);
  border-bottom-left-radius: 4px;
}

.gf-message.gf-user {
  background: var(--gf-msg-user);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.gf-typing {
  display: flex;
  gap: 4px;
  padding: 12px 16px;
  align-self: flex-start;
  background: var(--gf-msg-bot);
  border: 1px solid rgba(0, 146, 69, 0.1);
  border-radius: 12px;
  border-bottom-left-radius: 4px;
}

.gf-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #86a18f;
  animation: gf-bounce 1.4s ease-in-out infinite;
}

.gf-typing span:nth-child(2) { animation-delay: 0.2s; }
.gf-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes gf-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
}

#gf-chat-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--gf-border);
  display: flex;
  gap: 8px;
  align-items: flex-end;
  flex-shrink: 0;
  background: var(--gf-bg);
}

#gf-chat-input {
  flex: 1;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--gf-text);
  outline: none;
  resize: none;
  max-height: 80px;
  line-height: 1.4;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#gf-chat-input:focus {
  border-color: var(--gf-primary);
  box-shadow: 0 0 0 3px rgba(0, 146, 69, 0.14);
}

#gf-chat-input::placeholder {
  color: #9ca3af;
}

#gf-chat-send {
  width: 42px;
  height: 42px;
  border: none;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--gf-primary) 0%, var(--gf-primary-light) 100%);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 8px 20px rgba(0, 146, 69, 0.26);
}

#gf-chat-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0, 146, 69, 0.34);
}

#gf-chat-send:disabled {
  background: #c4c8ce;
  box-shadow: none;
  cursor: not-allowed;
}

#gf-chat-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

#gf-chat-footer {
  text-align: center;
  padding: 7px;
  font-size: 11px;
  color: var(--gf-text-light);
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}

#gf-chat-messages::-webkit-scrollbar {
  width: 6px;
}

#gf-chat-messages::-webkit-scrollbar-thumb {
  background: rgba(0, 146, 69, 0.26);
  border-radius: 999px;
}

@media (max-width: 480px) {
  #gf-chat-widget {
    bottom: 16px;
    right: 16px;
  }

  #gf-chat-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 100px);
    bottom: 68px;
    right: 0;
  }

  #gf-chat-toggle {
    width: 54px;
    height: 54px;
  }
}
