/**
 * Furiosa Chat Widget v1.0 - Standalone Stylesheet
 * Use this CSS file when embedding the widget on the Furiosa website itself
 * (as an alternative to the JS-injected styles).
 *
 * Include this file in <head> and add the attribute
 *   data-no-inject-css="true"
 * to the script tag if you want to prevent duplicate style injection.
 */

/* ------------------------------------------------------------------ */
/*  FONT                                                              */
/* ------------------------------------------------------------------ */
@import url('https://fonts.googleapis.com/css2?family=Figtree:wght@400;500;600;700&display=swap');

/* ------------------------------------------------------------------ */
/*  CSS CUSTOM PROPERTIES                                             */
/* ------------------------------------------------------------------ */
:root {
  --fc-teal: #00b0c6;
  --fc-teal-hover: #009aad;
  --fc-teal-muted: #b0d4da;
  --fc-navy: #082f3c;
  --fc-navy-light: #0f3e47;
  --fc-navy-deep: #061e28;
  --fc-red: #e74c3c;
  --fc-green: #2ecc71;
  --fc-gray-light: #f5f7f9;
  --fc-gray-bg: #f8fafb;
  --fc-gray-border: #dce4e8;
  --fc-gray-border-light: #e8ecef;
  --fc-gray-border-faint: #f0f2f4;
  --fc-text-primary: #082f3c;
  --fc-text-secondary: #6b7c85;
  --fc-text-muted: #8a9aa2;
  --fc-text-faint: #a0b0b8;
  --fc-bubble-agent: #e8ecef;
  --fc-bubble-agent-text: #1a2e36;
  --fc-font: 'Figtree', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --fc-radius-sm: 8px;
  --fc-radius-md: 10px;
  --fc-radius-lg: 12px;
  --fc-radius-xl: 14px;
  --fc-radius-window: 16px;
  --fc-btn-size: 56px;
  --fc-window-width: 380px;
  --fc-window-height: 520px;
  --fc-z-btn: 999998;
  --fc-z-window: 999999;
}

/* ------------------------------------------------------------------ */
/*  CHAT BUTTON                                                       */
/* ------------------------------------------------------------------ */
.furiosa-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: var(--fc-btn-size);
  height: var(--fc-btn-size);
  border-radius: 50%;
  background: var(--fc-teal);
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 176, 198, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--fc-z-btn);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1),
              box-shadow 0.25s ease;
  outline: none;
  padding: 0;
  font-family: var(--fc-font);
}

.furiosa-chat-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 24px rgba(0, 176, 198, 0.5);
}

.furiosa-chat-btn:active {
  transform: scale(0.95);
}

.furiosa-chat-btn svg {
  width: 26px;
  height: 26px;
  fill: #fff;
  transition: transform 0.2s ease;
}

/* Toggle icon swap: show chat icon normally, close icon when open */
.furiosa-chat-btn svg.furiosa-icon-close {
  display: none;
}

.furiosa-chat-btn.furiosa-chat-btn--open svg.furiosa-icon-chat {
  display: none;
}

.furiosa-chat-btn.furiosa-chat-btn--open svg.furiosa-icon-close {
  display: block;
}

/* Pulse animation for new messages */
@keyframes furiosa-pulse {
  0% {
    box-shadow: 0 4px 16px rgba(0, 176, 198, 0.35);
  }
  50% {
    box-shadow: 0 4px 16px rgba(0, 176, 198, 0.35),
                0 0 0 12px rgba(0, 176, 198, 0.15);
  }
  100% {
    box-shadow: 0 4px 16px rgba(0, 176, 198, 0.35),
                0 0 0 24px rgba(0, 176, 198, 0);
  }
}

.furiosa-chat-btn--pulse {
  animation: furiosa-pulse 1.5s ease-in-out infinite;
}

/* ------------------------------------------------------------------ */
/*  UNREAD BADGE                                                      */
/* ------------------------------------------------------------------ */
.furiosa-chat-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  background: var(--fc-red);
  color: #fff;
  font-family: var(--fc-font);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  transform: scale(0);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.furiosa-chat-badge--visible {
  transform: scale(1);
}

/* ------------------------------------------------------------------ */
/*  CHAT WINDOW                                                       */
/* ------------------------------------------------------------------ */
@keyframes furiosa-slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.furiosa-chat-window {
  position: fixed;
  bottom: 92px;
  right: 24px;
  width: var(--fc-window-width);
  height: var(--fc-window-height);
  max-height: calc(100vh - 120px);
  border-radius: var(--fc-radius-window);
  background: #fff;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.15),
              0 4px 16px rgba(0, 0, 0, 0.08);
  z-index: var(--fc-z-window);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.3s ease,
              transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  font-family: var(--fc-font);
}

.furiosa-chat-window--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  animation: furiosa-slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ------------------------------------------------------------------ */
/*  HEADER                                                            */
/* ------------------------------------------------------------------ */
.furiosa-chat-header {
  background: linear-gradient(135deg, var(--fc-navy), var(--fc-navy-light));
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.furiosa-chat-header-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.furiosa-chat-header-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.furiosa-chat-header-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 400;
  opacity: 0.85;
}

.furiosa-chat-header-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fc-green);
  flex-shrink: 0;
}

.furiosa-chat-header-dot--offline {
  background: #95a5a6;
}

.furiosa-chat-header-close {
  width: 32px;
  height: 32px;
  border-radius: var(--fc-radius-sm);
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  outline: none;
  padding: 0;
}

.furiosa-chat-header-close:hover {
  background: rgba(255, 255, 255, 0.2);
}

.furiosa-chat-header-close svg {
  width: 16px;
  height: 16px;
  fill: #fff;
}

/* ------------------------------------------------------------------ */
/*  PRE-CHAT FORM / OFFLINE FORM                                      */
/* ------------------------------------------------------------------ */
.furiosa-chat-form {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 24px 20px;
  gap: 14px;
  overflow-y: auto;
}

.furiosa-chat-form-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--fc-text-primary);
  margin: 0;
}

.furiosa-chat-form-subtitle {
  font-size: 13px;
  color: var(--fc-text-secondary);
  margin: 0 0 4px 0;
  line-height: 1.4;
}

.furiosa-chat-form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.furiosa-chat-form-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fc-text-primary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.furiosa-chat-form-input,
.furiosa-chat-form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--fc-gray-border);
  border-radius: var(--fc-radius-md);
  font-family: var(--fc-font);
  font-size: 14px;
  color: var(--fc-text-primary);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
  background: var(--fc-gray-bg);
}

.furiosa-chat-form-input:focus,
.furiosa-chat-form-textarea:focus {
  border-color: var(--fc-teal);
  box-shadow: 0 0 0 3px rgba(0, 176, 198, 0.12);
  background: #fff;
}

.furiosa-chat-form-input::placeholder,
.furiosa-chat-form-textarea::placeholder {
  color: var(--fc-text-faint);
}

.furiosa-chat-form-textarea {
  min-height: 80px;
  resize: vertical;
}

.furiosa-chat-form-submit {
  padding: 12px 24px;
  background: var(--fc-teal);
  color: #fff;
  border: none;
  border-radius: var(--fc-radius-md);
  font-family: var(--fc-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  margin-top: 4px;
  outline: none;
}

.furiosa-chat-form-submit:hover {
  background: var(--fc-teal-hover);
}

.furiosa-chat-form-submit:active {
  transform: scale(0.97);
}

.furiosa-chat-form-submit:disabled {
  background: var(--fc-teal-muted);
  cursor: not-allowed;
}

.furiosa-chat-form-error {
  font-size: 12px;
  color: var(--fc-red);
  margin: 0;
  display: none;
}

.furiosa-chat-form-error--visible {
  display: block;
}

/* Success state (after offline form submission) */
.furiosa-chat-form-success {
  text-align: center;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.furiosa-chat-form-success svg {
  width: 56px;
  height: 56px;
  fill: var(--fc-green);
}

.furiosa-chat-form-success-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--fc-text-primary);
}

.furiosa-chat-form-success-text {
  font-size: 13px;
  color: var(--fc-text-secondary);
  line-height: 1.5;
}

/* ------------------------------------------------------------------ */
/*  MESSAGES AREA                                                     */
/* ------------------------------------------------------------------ */
.furiosa-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 8px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  scroll-behavior: smooth;
  background: var(--fc-gray-light);
}

.furiosa-chat-messages::-webkit-scrollbar {
  width: 5px;
}

.furiosa-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.furiosa-chat-messages::-webkit-scrollbar-thumb {
  background: #c8d0d4;
  border-radius: 3px;
}

/* ------------------------------------------------------------------ */
/*  MESSAGE BUBBLES                                                   */
/* ------------------------------------------------------------------ */
@keyframes furiosa-fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.furiosa-chat-message {
  display: flex;
  flex-direction: column;
  max-width: 80%;
  animation: furiosa-fadeIn 0.25s ease;
}

/* Visitor messages: right-aligned, teal */
.furiosa-chat-message.visitor {
  align-self: flex-end;
  align-items: flex-end;
}

.furiosa-chat-message.visitor .furiosa-chat-message-bubble {
  background: var(--fc-teal);
  color: #fff;
  border-bottom-right-radius: 4px;
}

/* Agent messages: left-aligned, light gray */
.furiosa-chat-message.agent {
  align-self: flex-start;
  align-items: flex-start;
}

.furiosa-chat-message.agent .furiosa-chat-message-bubble {
  background: var(--fc-bubble-agent);
  color: var(--fc-bubble-agent-text);
  border-bottom-left-radius: 4px;
}

/* System messages: centered, no background */
.furiosa-chat-message.system {
  align-self: center;
  align-items: center;
  max-width: 90%;
}

.furiosa-chat-message.system .furiosa-chat-message-bubble {
  background: transparent;
  color: var(--fc-text-muted);
  font-size: 12px;
  text-align: center;
  padding: 6px 12px;
}

/* Bubble base */
.furiosa-chat-message-bubble {
  padding: 10px 14px;
  border-radius: var(--fc-radius-xl);
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* Sender name (shown above agent bubbles) */
.furiosa-chat-message-sender {
  font-size: 11px;
  font-weight: 600;
  color: var(--fc-text-secondary);
  margin-bottom: 3px;
  padding: 0 4px;
}

/* Timestamp */
.furiosa-chat-message-time {
  font-size: 10px;
  color: var(--fc-text-faint);
  margin-top: 3px;
  padding: 0 4px;
}

/* ------------------------------------------------------------------ */
/*  TYPING INDICATOR                                                  */
/* ------------------------------------------------------------------ */
.furiosa-chat-typing {
  display: none;
  align-self: flex-start;
  padding: 10px 16px;
  background: var(--fc-bubble-agent);
  border-radius: var(--fc-radius-xl);
  border-bottom-left-radius: 4px;
  margin-bottom: 4px;
  animation: furiosa-fadeIn 0.25s ease;
}

.furiosa-chat-typing--visible {
  display: flex;
  align-items: center;
  gap: 4px;
}

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

.furiosa-chat-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fc-text-muted);
}

.furiosa-chat-typing-dot:nth-child(1) {
  animation: furiosa-bounce 1.2s ease-in-out infinite 0s;
}

.furiosa-chat-typing-dot:nth-child(2) {
  animation: furiosa-bounce 1.2s ease-in-out infinite 0.15s;
}

.furiosa-chat-typing-dot:nth-child(3) {
  animation: furiosa-bounce 1.2s ease-in-out infinite 0.3s;
}

/* ------------------------------------------------------------------ */
/*  INPUT AREA                                                        */
/* ------------------------------------------------------------------ */
.furiosa-chat-input {
  display: flex;
  align-items: flex-end;
  padding: 12px 14px;
  border-top: 1px solid var(--fc-gray-border-light);
  gap: 10px;
  background: #fff;
  flex-shrink: 0;
}

.furiosa-chat-input-field {
  flex: 1;
  padding: 10px 14px;
  border: 1.5px solid var(--fc-gray-border);
  border-radius: var(--fc-radius-lg);
  font-family: var(--fc-font);
  font-size: 14px;
  color: var(--fc-text-primary);
  outline: none;
  resize: none;
  min-height: 20px;
  max-height: 100px;
  line-height: 1.4;
  transition: border-color 0.2s ease;
  background: var(--fc-gray-bg);
  box-sizing: border-box;
}

.furiosa-chat-input-field:focus {
  border-color: var(--fc-teal);
  background: #fff;
}

.furiosa-chat-input-field::placeholder {
  color: var(--fc-text-faint);
}

/* Input meta (character counter) */
.furiosa-chat-input-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px 8px 14px;
  background: #fff;
  flex-shrink: 0;
}

.furiosa-chat-input-counter {
  font-size: 11px;
  color: var(--fc-text-faint);
}

.furiosa-chat-input-counter--warn {
  color: var(--fc-red);
}

/* Send button */
.furiosa-chat-input-send {
  width: 38px;
  height: 38px;
  border-radius: var(--fc-radius-md);
  border: none;
  background: var(--fc-teal);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.2s ease, transform 0.15s ease;
  outline: none;
  padding: 0;
}

.furiosa-chat-input-send:hover {
  background: var(--fc-teal-hover);
}

.furiosa-chat-input-send:active {
  transform: scale(0.9);
}

.furiosa-chat-input-send:disabled {
  background: var(--fc-teal-muted);
  cursor: not-allowed;
}

.furiosa-chat-input-send svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* ------------------------------------------------------------------ */
/*  POWERED BY FOOTER                                                 */
/* ------------------------------------------------------------------ */
.furiosa-chat-footer {
  text-align: center;
  padding: 6px 14px 10px;
  font-size: 11px;
  color: var(--fc-text-faint);
  background: #fff;
  flex-shrink: 0;
  border-top: 1px solid var(--fc-gray-border-faint);
}

.furiosa-chat-footer a {
  color: var(--fc-teal);
  text-decoration: none;
  font-weight: 600;
}

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

/* ------------------------------------------------------------------ */
/*  MOBILE RESPONSIVE                                                 */
/* ------------------------------------------------------------------ */
@media (max-width: 480px) {
  .furiosa-chat-window {
    width: 100%;
    height: 100%;
    max-height: 100%;
    bottom: 0;
    right: 0;
    border-radius: 0;
  }

  .furiosa-chat-btn {
    bottom: 16px;
    right: 16px;
  }

  .furiosa-chat-header {
    padding: 16px;
    border-radius: 0;
  }

  .furiosa-chat-form {
    padding: 20px 16px;
  }

  .furiosa-chat-messages {
    padding: 12px 12px 8px 12px;
  }

  .furiosa-chat-input {
    padding: 10px 12px;
  }

  .furiosa-chat-message {
    max-width: 88%;
  }
}

/* ------------------------------------------------------------------ */
/*  REDUCED MOTION                                                    */
/* ------------------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  .furiosa-chat-btn,
  .furiosa-chat-window,
  .furiosa-chat-badge,
  .furiosa-chat-message,
  .furiosa-chat-typing {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }

  .furiosa-chat-typing-dot {
    animation: none !important;
  }

  .furiosa-chat-btn--pulse {
    animation: none !important;
    box-shadow: 0 4px 16px rgba(0, 176, 198, 0.35),
                0 0 0 8px rgba(0, 176, 198, 0.2);
  }
}
