/* Full Circle Farm — homepage chat assistant */
#fcf-chat-widget {
  --fcf-chat-primary: var(--theme-color, #344e41);
  --fcf-chat-accent: var(--theme-color2, #fee074);
  --fcf-chat-surface: #ffffff;
  --fcf-chat-text: #1a1a1a;
  --fcf-chat-muted: #5c6670;
  --fcf-chat-border: #e4e8eb;
  --fcf-chat-shadow: 0 12px 40px rgba(52, 78, 65, 0.22);
  --fcf-chat-radius: 16px;
  --fcf-chat-font: "Poppins", system-ui, -apple-system, sans-serif;

  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 10000;
  font-family: var(--fcf-chat-font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--fcf-chat-text);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  max-width: calc(100vw - 32px);
}

#fcf-chat-widget.is-hidden {
  display: none;
}

#fcf-chat-widget .fcf-chat-panel {
  display: none;
  flex-direction: column;
  width: min(360px, calc(100vw - 32px));
  height: min(480px, calc(100vh - 120px));
  background: var(--fcf-chat-surface);
  border-radius: var(--fcf-chat-radius);
  box-shadow: var(--fcf-chat-shadow);
  overflow: hidden;
  border: 1px solid rgba(52, 78, 65, 0.08);
}

#fcf-chat-widget.is-open .fcf-chat-panel {
  display: flex;
}

#fcf-chat-widget .fcf-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--fcf-chat-primary) 0%, #466556 100%);
  color: #fff;
}

#fcf-chat-widget .fcf-chat-header__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}

#fcf-chat-widget .fcf-chat-header__logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.35);
  flex-shrink: 0;
}

#fcf-chat-widget .fcf-chat-header__text {
  min-width: 0;
}

#fcf-chat-widget .fcf-chat-header__title {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#fcf-chat-widget .fcf-chat-header__status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.92;
}

#fcf-chat-widget .fcf-chat-header__status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #7dd87d;
  box-shadow: 0 0 0 2px rgba(125, 216, 125, 0.35);
}

#fcf-chat-widget .fcf-chat-header__actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

#fcf-chat-widget .fcf-chat-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#fcf-chat-widget .fcf-chat-icon-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

#fcf-chat-widget .fcf-chat-icon-btn:focus-visible {
  outline: 2px solid var(--fcf-chat-accent);
  outline-offset: 2px;
}

#fcf-chat-widget .fcf-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #f7f9f8;
}

#fcf-chat-widget .fcf-chat-msg {
  max-width: 88%;
  margin-bottom: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 13px;
  word-wrap: break-word;
}

#fcf-chat-widget .fcf-chat-msg--bot {
  background: #fff;
  color: var(--fcf-chat-text);
  border: 1px solid var(--fcf-chat-border);
  border-bottom-left-radius: 4px;
}

#fcf-chat-widget .fcf-chat-msg--user {
  margin-left: auto;
  background: var(--fcf-chat-primary);
  color: #fff;
  border-bottom-right-radius: 4px;
}

#fcf-chat-widget .fcf-chat-msg--error {
  background: #fff5f5;
  color: #9b2c2c;
  border: 1px solid #fed7d7;
}

#fcf-chat-widget .fcf-chat-input-row {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--fcf-chat-border);
  background: var(--fcf-chat-surface);
}

#fcf-chat-widget .fcf-chat-input {
  flex: 1;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--fcf-chat-border);
  border-radius: 12px;
  font: inherit;
  color: var(--fcf-chat-text);
  background: #fff;
}

#fcf-chat-widget .fcf-chat-input:focus {
  outline: none;
  border-color: var(--fcf-chat-primary);
  box-shadow: 0 0 0 3px rgba(52, 78, 65, 0.12);
}

#fcf-chat-widget .fcf-chat-send {
  min-width: 44px;
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 12px;
  background: var(--fcf-chat-primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

#fcf-chat-widget .fcf-chat-send:hover:not(:disabled) {
  background: #2a3f34;
}

#fcf-chat-widget .fcf-chat-send:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

#fcf-chat-widget .fcf-chat-send:focus-visible {
  outline: 2px solid var(--fcf-chat-accent);
  outline-offset: 2px;
}

#fcf-chat-widget .fcf-chat-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 0 18px 0 14px;
  border: none;
  border-radius: 999px;
  background: var(--fcf-chat-primary);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(52, 78, 65, 0.35);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#fcf-chat-widget .fcf-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(52, 78, 65, 0.4);
}

#fcf-chat-widget .fcf-chat-launcher:focus-visible {
  outline: 3px solid var(--fcf-chat-accent);
  outline-offset: 3px;
}

#fcf-chat-widget .fcf-chat-launcher__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  font-size: 18px;
}

#fcf-chat-widget.is-open .fcf-chat-launcher {
  display: none;
}

@media (max-width: 767px) {
  #fcf-chat-widget {
    right: max(10px, env(safe-area-inset-right));
    bottom: max(80px, env(safe-area-inset-bottom));
  }

  #fcf-chat-widget .fcf-chat-launcher__label {
    display: none;
  }

  #fcf-chat-widget .fcf-chat-launcher {
    width: 56px;
    height: 56px;
    padding: 0;
    justify-content: center;
    border-radius: 50%;
  }

  #fcf-chat-widget .fcf-chat-panel {
    width: min(340px, calc(100vw - 20px));
    height: min(420px, calc(100vh - 160px));
  }
}
