/* Fletcher Hills Automotive - Chatbot Widget Styles */

.fh-chatbot {
  --fh-primary: #62152d;
  --fh-primary-light: #8a2040;
  --fh-primary-dark: #4a1022;
  --fh-bg: #0a0a0a;
  --fh-surface: #141414;
  --fh-surface-light: #1a1a1a;
  --fh-border: rgba(255, 255, 255, 0.08);
  --fh-text: rgba(255, 255, 255, 0.85);
  --fh-text-muted: rgba(255, 255, 255, 0.5);
  --fh-radius: 20px;
  --fh-transition: cubic-bezier(0.16, 1, 0.3, 1);

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  zoom: calc(1 / 0.90);
}

/* ── Floating Button ─────────────────────────────────── */

.fh-chatbot-trigger {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 64px;
  height: 64px;
  border-radius: 18px;
  border: none;
  cursor: pointer;
  z-index: 9999;
  background: linear-gradient(135deg, var(--fh-primary), var(--fh-primary-light));
  box-shadow:
    0 4px 15px rgba(98, 21, 45, 0.4),
    0 2px 6px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s var(--fh-transition);
  animation: fh-float 3s ease-in-out infinite;
  overflow: hidden;
}

.fh-chatbot-trigger:hover {
  transform: scale(1.1);
  box-shadow:
    0 6px 25px rgba(98, 21, 45, 0.5),
    0 4px 10px rgba(0, 0, 0, 0.3);
}

.fh-chatbot-trigger:active {
  transform: scale(0.95);
}

.fh-chatbot-trigger svg {
  width: 32px;
  height: 32px;
  transition: all 0.3s var(--fh-transition);
}

.fh-chatbot-trigger.active svg.fh-icon-wrench {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

.fh-chatbot-trigger svg.fh-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

.fh-chatbot-trigger.active svg.fh-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.fh-chatbot-trigger.active {
  border-radius: 50%;
  animation: none;
}

/* Pulse ring */
.fh-chatbot-trigger::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 22px;
  border: 2px solid var(--fh-primary);
  opacity: 0;
  animation: fh-pulse 2.5s ease-out infinite;
}

.fh-chatbot-trigger.active::after {
  animation: none;
  opacity: 0;
}

/* Badge */
.fh-chatbot-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transform: scale(0);
  transition: all 0.3s var(--fh-transition);
}

.fh-chatbot-badge.visible {
  opacity: 1;
  transform: scale(1);
}

/* Preview bubble */
.fh-chatbot-preview {
  position: fixed;
  bottom: 96px;
  right: 24px;
  background: var(--fh-surface);
  border: 1px solid var(--fh-border);
  border-radius: 16px 16px 4px 16px;
  padding: 12px 16px;
  color: var(--fh-text);
  font-size: 13px;
  max-width: 220px;
  z-index: 9998;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(10px) scale(0.95);
  transition: all 0.3s var(--fh-transition);
  pointer-events: none;
}

.fh-chatbot-preview.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ── Chat Window ──────────────────────────────────────── */

.fh-chatbot-window {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 380px;
  height: 520px;
  background: var(--fh-bg);
  border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: scale(0.85) translateY(20px);
  transform-origin: bottom right;
  pointer-events: none;
  transition: all 0.35s var(--fh-transition);
}

.fh-chatbot-window.open {
  opacity: 1;
  transform: scale(1) translateY(0);
  pointer-events: auto;
}

/* ── Header ───────────────────────────────────────────── */

.fh-chatbot-header {
  background: linear-gradient(135deg, var(--fh-primary), var(--fh-primary-light));
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.fh-chatbot-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.fh-chatbot-avatar svg {
  width: 22px;
  height: 22px;
}

.fh-chatbot-header-info {
  flex: 1;
}

.fh-chatbot-header-name {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.fh-chatbot-header-status {
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.fh-chatbot-header-status::before {
  content: '';
  width: 7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
}

.fh-chatbot-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  border-radius: 10px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
  flex-shrink: 0;
}

.fh-chatbot-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

.fh-chatbot-close svg {
  width: 16px;
  height: 16px;
  color: #fff;
}

/* ── Messages ─────────────────────────────────────────── */

.fh-chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.fh-chatbot-messages::-webkit-scrollbar {
  width: 4px;
}

.fh-chatbot-messages::-webkit-scrollbar-track {
  background: transparent;
}

.fh-chatbot-messages::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}

.fh-chatbot-message {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.5;
  animation: fh-messageIn 0.3s var(--fh-transition);
  word-wrap: break-word;
}

.fh-chatbot-message a {
  color: var(--fh-primary-light);
  text-decoration: underline;
}

.fh-chatbot-message.bot {
  align-self: flex-start;
  background: var(--fh-surface-light);
  color: var(--fh-text);
  border-bottom-left-radius: 4px;
}

.fh-chatbot-message.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--fh-primary), var(--fh-primary-light));
  color: #fff;
  border-bottom-right-radius: 4px;
}

.fh-chatbot-message.bot ul,
.fh-chatbot-message.bot ol {
  margin: 6px 0;
  padding-left: 18px;
}

.fh-chatbot-message.bot li {
  margin-bottom: 4px;
}

/* ── Typing Indicator ─────────────────────────────────── */

.fh-chatbot-typing {
  align-self: flex-start;
  background: var(--fh-surface-light);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  padding: 14px 20px;
  display: flex;
  gap: 5px;
  animation: fh-messageIn 0.3s var(--fh-transition);
}

.fh-chatbot-typing span {
  width: 7px;
  height: 7px;
  background: var(--fh-text-muted);
  border-radius: 50%;
  animation: fh-bounce 1.2s ease-in-out infinite;
}

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

.fh-chatbot-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

/* ── Quick Actions ────────────────────────────────────── */

.fh-chatbot-quick-actions {
  padding: 0 16px 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  flex-shrink: 0;
}

.fh-chatbot-quick-btn {
  background: transparent;
  border: 1px solid rgba(98, 21, 45, 0.4);
  color: var(--fh-text);
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.fh-chatbot-quick-btn:hover {
  background: var(--fh-primary);
  border-color: var(--fh-primary);
  color: #fff;
}

/* ── Input Area ───────────────────────────────────────── */

.fh-chatbot-input-area {
  padding: 12px 16px;
  border-top: 1px solid var(--fh-border);
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-shrink: 0;
  background: var(--fh-bg);
}

.fh-chatbot-input {
  flex: 1;
  background: var(--fh-surface);
  border: 1px solid var(--fh-border);
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--fh-text);
  font-size: 14px;
  font-family: inherit;
  resize: none;
  outline: none;
  min-height: 40px;
  max-height: 80px;
  line-height: 1.4;
  transition: border-color 0.2s;
}

.fh-chatbot-input::placeholder {
  color: var(--fh-text-muted);
}

.fh-chatbot-input:focus {
  border-color: var(--fh-primary);
}

.fh-chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: none;
  background: var(--fh-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.fh-chatbot-send:hover {
  background: var(--fh-primary-light);
  transform: scale(1.05);
}

.fh-chatbot-send:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.fh-chatbot-send svg {
  width: 18px;
  height: 18px;
}

/* ── Animations ───────────────────────────────────────── */

@keyframes fh-pulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.15); }
}

@keyframes fh-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

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

@keyframes fh-messageIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Mobile ───────────────────────────────────────────── */

@media (max-width: 768px) {
  .fh-chatbot-trigger {
    bottom: 16px;
    right: 16px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
  }

  .fh-chatbot-trigger svg {
    width: 28px;
    height: 28px;
  }

  .fh-chatbot-trigger::after {
    border-radius: 20px;
  }

  .fh-chatbot-preview {
    bottom: 80px;
    right: 16px;
  }

  .fh-chatbot-window {
    bottom: 0;
    right: 0;
    width: 100%;
    height: 100%;
    border-radius: 0;
    transform-origin: bottom center;
  }

  .fh-chatbot-window.open {
    border-radius: 0;
  }
}
