/* Fab AI Chat Widget - Themeable via CSS Custom Properties */

.fab-ai-widget {
  --fab-header-bg: #4F46E5;
  --fab-text: #ffffff;
  --fab-border: #e5e7eb;
  --fab-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;

  position: fixed;
  z-index: 999999;
  font-family: var(--fab-font);
  font-size: 14px;
  line-height: 1.5;
  box-sizing: border-box;
}

.fab-ai-widget *,
.fab-ai-widget *::before,
.fab-ai-widget *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Position variants */
.fab-ai-bottom-right {
  bottom: 20px;
  right: 20px;
}

.fab-ai-bottom-left {
  bottom: 20px;
  left: 20px;
}

/* Toggle button */
.fab-ai-toggle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: var(--fab-header-bg);
  color: var(--fab-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.fab-ai-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.fab-ai-toggle:focus-visible {
  outline: 2px solid var(--fab-header-bg);
  outline-offset: 3px;
}

.fab-ai-toggle svg {
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.fab-ai-widget.fab-ai-open .fab-ai-toggle .fab-ai-icon-chat {
  transform: rotate(90deg);
  opacity: 0;
}

.fab-ai-widget.fab-ai-open .fab-ai-toggle .fab-ai-icon-close {
  transform: rotate(0deg);
  opacity: 1;
}

.fab-ai-toggle .fab-ai-icon-close {
  position: absolute;
  transform: rotate(-90deg);
  opacity: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Card-style trigger button */
.fab-ai-toggle-card {
  width: 110px;
  height: 150px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  position: relative;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  background-color: var(--fab-header-bg);
}

.fab-ai-toggle-card:hover {
  transform: scale(1.04);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.fab-ai-toggle-card:focus-visible {
  outline: 2px solid var(--fab-header-bg);
  outline-offset: 3px;
}

.fab-ai-toggle-card .fab-ai-card-overlay {
  width: 100%;
  padding: 8px 6px;
  background: rgba(0, 0, 0, 0.5);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
  letter-spacing: 0.02em;
}

.fab-ai-toggle-card .fab-ai-icon-close {
  display: none;
}

.fab-ai-widget.fab-ai-open .fab-ai-toggle-card {
  display: none !important;
}

/* Hide bubble icons when card style is active */
.fab-ai-toggle-card .fab-ai-icon-chat {
  display: none;
}

/* Chat container */
.fab-ai-chat-container {
  display: flex;
  flex-direction: column;
  width: 350px;
  height: 500px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  overflow: hidden;
  position: absolute;
  bottom: 70px;
  right: 0;

  /* Animation */
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  transform-origin: bottom right;
  transition: opacity 0.25s ease, transform 0.25s ease;
  pointer-events: none;
  visibility: hidden;
}

.fab-ai-widget.fab-ai-open .fab-ai-chat-container {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.fab-ai-bottom-left .fab-ai-chat-container {
  right: auto;
  left: 0;
  transform-origin: bottom left;
}

/* Header */
.fab-ai-chat-header {
  background: var(--fab-header-bg);
  color: var(--fab-text);
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.fab-ai-header-title {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fab-ai-close {
  background: none;
  border: none;
  color: var(--fab-text);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: background 0.15s ease;
  flex-shrink: 0;
}

.fab-ai-close:hover {
  background: rgba(255, 255, 255, 0.15);
}

.fab-ai-close:focus-visible {
  outline: 2px solid var(--fab-text);
  outline-offset: 1px;
}

/* Messages area */
.fab-ai-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-behavior: smooth;
  background: #ffffff;
}

.fab-ai-messages::-webkit-scrollbar {
  width: 5px;
}

.fab-ai-messages::-webkit-scrollbar-track {
  background: transparent;
}

.fab-ai-messages::-webkit-scrollbar-thumb {
  background: var(--fab-border);
  border-radius: 3px;
}

/* Message bubbles */
.fab-ai-message {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  word-wrap: break-word;
  overflow-wrap: break-word;
  animation: fabMsgIn 0.2s ease-out;
}

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

.fab-ai-message-user {
  align-self: flex-end;
  background: #e5e7eb;
  color: #1f2937;
  border-bottom-right-radius: 4px;
}

.fab-ai-message-assistant {
  align-self: flex-start;
  background: #f3f4f6;
  color: #1f2937;
  border-bottom-left-radius: 4px;
}

/* Links inside assistant messages */
.fab-ai-message-assistant a {
  color: var(--fab-header-bg);
  text-decoration: underline;
}

.fab-ai-message-assistant a[target="_blank"]::after {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-left: 3px;
  vertical-align: middle;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E") no-repeat center;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6'/%3E%3Cpolyline points='15 3 21 3 21 9'/%3E%3Cline x1='10' y1='14' x2='21' y2='3'/%3E%3C/svg%3E") no-repeat center;
}

/* Error message with retry */
.fab-ai-message-error {
  align-self: center;
  background: #fef2f2;
  color: #991b1b;
  border-radius: 8px;
  font-size: 13px;
  text-align: center;
  padding: 8px 14px;
}

.fab-ai-retry-btn {
  background: none;
  border: none;
  color: var(--fab-header-bg);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 2px 4px;
  text-decoration: underline;
}

.fab-ai-retry-btn:hover {
  opacity: 0.8;
}

.fab-ai-retry-btn:focus-visible {
  outline: 2px solid var(--fab-header-bg);
  outline-offset: 1px;
  border-radius: 2px;
}

/* Typing indicator */
.fab-ai-typing {
  align-self: flex-start;
  background: #f3f4f6;
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.fab-ai-typing-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9ca3af;
  animation: fabTyping 1.2s ease-in-out infinite;
}

.fab-ai-typing-dot:nth-child(2) {
  animation-delay: 0.15s;
}

.fab-ai-typing-dot:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes fabTyping {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

/* Quick replies */
.fab-ai-quick-replies {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 16px 4px;
  flex-shrink: 0;
}

.fab-ai-quick-reply {
  background: #ffffff;
  color: var(--fab-header-bg);
  border: 1px solid var(--fab-header-bg);
  border-radius: 16px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  font-family: var(--fab-font);
  white-space: nowrap;
}

.fab-ai-quick-reply:hover {
  background: var(--fab-header-bg);
  color: var(--fab-text);
}

.fab-ai-quick-reply:focus-visible {
  outline: 2px solid var(--fab-header-bg);
  outline-offset: 2px;
}

/* Input form */
.fab-ai-form {
  display: flex;
  align-items: flex-end;
  border-top: 1px solid var(--fab-border);
  padding: 10px;
  gap: 8px;
  flex-shrink: 0;
  background: #ffffff;
}

.fab-ai-input {
  flex: 1;
  border: 1px solid var(--fab-border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--fab-font);
  outline: none;
  resize: none;
  max-height: 100px;
  min-height: 40px;
  line-height: 1.4;
  overflow-y: auto;
  background: #ffffff;
  color: #1f2937;
  transition: border-color 0.15s ease;
}

.fab-ai-input::placeholder {
  color: #9ca3af;
}

.fab-ai-input:focus {
  border-color: var(--fab-header-bg);
}

.fab-ai-send {
  background: var(--fab-header-bg);
  color: var(--fab-text);
  border: none;
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.fab-ai-send:hover {
  opacity: 0.85;
}

.fab-ai-send:focus-visible {
  outline: 2px solid var(--fab-header-bg);
  outline-offset: 2px;
}

.fab-ai-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mic button */
.fab-ai-mic {
  background: none;
  border: 1px solid var(--fab-border);
  border-radius: 10px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  color: #6b7280;
  transition: all 0.2s ease;
}

.fab-ai-mic:hover {
  border-color: var(--fab-header-bg);
  color: var(--fab-header-bg);
}

.fab-ai-mic.fab-ai-mic-recording {
  background: #ef4444;
  border-color: #ef4444;
  color: #ffffff;
  animation: fabMicPulse 1s ease-in-out infinite;
}

.fab-ai-mic.fab-ai-mic-processing {
  background: var(--fab-header-bg);
  border-color: var(--fab-header-bg);
  color: #ffffff;
  opacity: 0.7;
  pointer-events: none;
}

/* Voice mode overlay */
.fab-ai-voice-mode {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  color: #ffffff;
}

.fab-ai-voice-logo {
  position: absolute;
  top: 32px;
  left: 50%;
  transform: translateX(-50%);
  max-width: 200px;
  max-height: 60px;
  opacity: 0.9;
  pointer-events: none;
}

.fab-ai-voice-text-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(255,255,255,0.5);
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}

.fab-ai-voice-text-btn:hover {
  color: #fff;
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.08);
}

.fab-ai-voice-status {
  font-size: 18px;
  font-weight: 300;
  opacity: 0.9;
  min-height: 28px;
  text-align: center;
  padding: 0 32px;
}

.fab-ai-voice-talk {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.2);
  background: rgba(255,255,255,0.08);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

.fab-ai-voice-talk:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.3);
}

.fab-ai-voice-talk.recording {
  background: rgba(239,68,68,0.3);
  border-color: #ef4444;
  transform: scale(1.1);
  box-shadow: 0 0 40px rgba(239,68,68,0.4);
}

.fab-ai-voice-talk.recording::before {
  content: '';
  position: absolute;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 2px solid rgba(239,68,68,0.4);
  animation: fabVoiceRipple 1.5s ease-out infinite;
}

.fab-ai-voice-talk.recording svg {
  animation: fabVoicePulse 1s ease-in-out infinite;
}

.fab-ai-voice-talk.thinking {
  background: rgba(79,70,229,0.3);
  border-color: #4F46E5;
  pointer-events: none;
}

.fab-ai-voice-talk.thinking svg {
  animation: fabVoiceSpin 2s linear infinite;
}

.fab-ai-voice-talk.speaking {
  background: rgba(16,185,129,0.3);
  border-color: #10b981;
  pointer-events: none;
}

.fab-ai-voice-talk.speaking svg {
  animation: fabVoiceBounce 0.6s ease-in-out infinite;
}

.fab-ai-voice-hint {
  font-size: 14px;
  opacity: 0.5;
  min-height: 20px;
}

.fab-ai-voice-powered {
  position: absolute;
  bottom: 20px;
  font-size: 12px;
  opacity: 0.3;
}

.fab-ai-voice-powered strong { font-weight: 600; }

@keyframes fabVoicePulse { 0%,100% { opacity: 1; } 50% { opacity: 0.6; } }
@keyframes fabVoiceSpin { 0% { transform: rotate(0); } 100% { transform: rotate(360deg); } }
@keyframes fabVoiceBounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes fabVoiceRipple { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(1.6); opacity: 0; } }

@keyframes fabMicPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.1); }
}

/* Lead capture form */
.fab-ai-lead-form {
  align-self: stretch;
  background: linear-gradient(135deg, #f0f0ff 0%, #f9fafb 100%);
  border: 1px solid var(--fab-border);
  border-radius: 12px;
  padding: 14px;
  animation: fabMsgIn 0.3s ease-out;
}

.fab-ai-lead-header {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 10px;
}

.fab-ai-lead-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fab-ai-lead-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--fab-border);
  border-radius: 8px;
  font-size: 13px;
  font-family: var(--fab-font);
  background: #ffffff;
  color: #1f2937;
  outline: none;
  transition: border-color 0.15s ease;
}

.fab-ai-lead-input:focus {
  border-color: var(--fab-header-bg);
}

.fab-ai-lead-input::placeholder {
  color: #9ca3af;
}

.fab-ai-lead-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.fab-ai-lead-submit {
  flex: 1;
  padding: 8px 16px;
  background: var(--fab-header-bg);
  color: var(--fab-text);
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--fab-font);
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.fab-ai-lead-submit:hover {
  opacity: 0.85;
}

.fab-ai-lead-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.fab-ai-lead-dismiss {
  padding: 8px 12px;
  background: none;
  color: #6b7280;
  border: 1px solid var(--fab-border);
  border-radius: 8px;
  font-size: 12px;
  font-family: var(--fab-font);
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.fab-ai-lead-dismiss:hover {
  background: #f3f4f6;
}

.fab-ai-lead-thanks {
  text-align: center;
  color: #059669;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 0;
}

/* Stock notification form */
.fab-ai-stock-form {
  align-self: stretch;
  background: linear-gradient(135deg, #ecfdf5 0%, #f9fafb 100%);
  border: 1px solid #a7f3d0;
  border-radius: 12px;
  padding: 14px;
  animation: fabMsgIn 0.3s ease-out;
}

.fab-ai-stock-header {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 10px;
}

.fab-ai-stock-product-name {
  font-size: 12px;
  font-weight: 400;
  color: #6b7280;
  margin-top: 2px;
}

.fab-ai-stock-fields {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fab-ai-stock-submit {
  flex: 1;
  padding: 8px 16px;
  background: #059669;
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--fab-font);
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}

.fab-ai-stock-submit:hover {
  opacity: 0.85;
}

.fab-ai-stock-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.fab-ai-stock-dismiss {
  padding: 8px 12px;
  background: none;
  color: #6b7280;
  border: 1px solid var(--fab-border);
  border-radius: 8px;
  font-size: 12px;
  font-family: var(--fab-font);
  cursor: pointer;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.fab-ai-stock-dismiss:hover {
  background: #f3f4f6;
}

.fab-ai-stock-thanks {
  text-align: center;
  color: #059669;
  font-size: 13px;
  font-weight: 600;
  padding: 4px 0;
}

/* Booking CTA button */
.fab-ai-cta-wrapper {
  align-self: flex-start;
  animation: fabMsgIn 0.3s ease-out;
  margin-top: 2px;
}

.fab-ai-cta-btn {
  display: inline-block;
  padding: 10px 20px;
  background: #059669;
  color: #ffffff;
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--fab-font);
  transition: background 0.15s ease, transform 0.1s ease;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.3);
}

.fab-ai-cta-btn:hover {
  background: #047857;
  transform: translateY(-1px);
}

.fab-ai-cta-btn:focus-visible {
  outline: 2px solid #059669;
  outline-offset: 2px;
}

/* Product cards */
.fab-ai-products {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  align-self: stretch;
  animation: fabMsgIn 0.3s ease-out;
  margin: 4px 0;
}

.fab-ai-product-card {
  display: flex;
  flex-direction: column;
  background: #ffffff;
  border: 1px solid var(--fab-border);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.15s ease;
}

.fab-ai-product-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.fab-ai-product-image {
  width: 100%;
  height: 120px;
  overflow: hidden;
  background: #f3f4f6;
}

.fab-ai-product-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.fab-ai-product-info {
  padding: 10px 12px 6px;
}

.fab-ai-product-name {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.fab-ai-product-price {
  font-size: 14px;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 2px;
}

.fab-ai-price-sale {
  color: #dc2626;
}

.fab-ai-price-original {
  color: #9ca3af;
  text-decoration: line-through;
  font-size: 12px;
  font-weight: 400;
}

.fab-ai-product-stock {
  font-size: 11px;
  margin-bottom: 2px;
}

.fab-ai-out-of-stock {
  color: #dc2626;
}

.fab-ai-product-link {
  display: block;
  text-align: center;
  padding: 8px 12px;
  margin: 0 12px 10px;
  background: var(--fab-header-bg);
  color: var(--fab-text);
  text-decoration: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--fab-font);
  transition: background 0.15s ease;
}

.fab-ai-product-link:hover {
  opacity: 0.85;
}

.fab-ai-product-link:focus-visible {
  outline: 2px solid var(--fab-header-bg);
  outline-offset: 2px;
}

@media (min-width: 350px) {
  .fab-ai-products {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Header avatar */
.fab-ai-header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  margin-right: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

/* Satisfaction rating */
.fab-ai-satisfaction {
  display: flex;
  gap: 4px;
  margin-top: 4px;
  align-self: flex-start;
  animation: fabMsgIn 0.2s ease-out;
}

.fab-ai-satisfaction button {
  background: none;
  border: 1px solid var(--fab-border);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s ease, border-color 0.15s ease;
  color: #1f2937;
  font-family: var(--fab-font);
}

.fab-ai-satisfaction button:hover {
  background: #f3f4f6;
  border-color: var(--fab-header-bg);
}

.fab-ai-satisfaction button.fab-ai-rated {
  background: var(--fab-header-bg);
  color: var(--fab-text);
  border-color: var(--fab-header-bg);
}

.fab-ai-satisfaction button:disabled {
  opacity: 0.5;
  cursor: default;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .fab-ai-chat-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    border-radius: 0;
    transform: translateY(100%);
    transform-origin: bottom center;
    transition: transform 0.3s ease;
  }

  .fab-ai-widget.fab-ai-open .fab-ai-chat-container {
    transform: translateY(0);
  }


  .fab-ai-widget.fab-ai-open .fab-ai-chat-container {
    z-index: 999999;
  }

  .fab-ai-widget.fab-ai-open .fab-ai-toggle {
    display: none;
  }

  .fab-ai-chat-header {
    position: sticky;
    top: 0;
    z-index: 2;
    padding: 10px 16px;
    padding-top: max(10px, env(safe-area-inset-top));
    padding-right: 16px;
  }

  .fab-ai-header-title {
    font-size: 14px;
  }

  .fab-ai-close {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 26px;
    margin-right: max(0px, calc(env(safe-area-inset-right) - 16px));
  }

  .fab-ai-messages {
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    min-height: 0;
  }

  .fab-ai-form {
    padding: 10px;
    padding-left: max(10px, env(safe-area-inset-left));
    padding-right: max(10px, env(safe-area-inset-right));
    background: #ffffff;
    flex-shrink: 0;
  }

  .fab-ai-footer-bar {
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    flex-shrink: 0;
  }


  .fab-ai-input {
    font-size: 16px; /* Prevents iOS auto-zoom on focus */
  }

  .fab-ai-lead-input {
    font-size: 16px;
  }

  .fab-ai-quick-replies {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    padding-bottom: 8px;
  }

  .fab-ai-quick-replies::-webkit-scrollbar {
    display: none;
  }

  .fab-ai-products {
    grid-template-columns: 1fr;
  }
}

/* Message timestamps */
.fab-ai-msg-time {
  font-size: 10px;
  color: #b0b0b0;
  margin-top: 2px;
  padding: 0 4px;
}

.fab-ai-message-user + .fab-ai-msg-time {
  align-self: flex-end;
  text-align: right;
}

.fab-ai-message-assistant + .fab-ai-msg-time {
  align-self: flex-start;
}

/* Footer bar (emoji + powered by) */
.fab-ai-footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px 8px;
  flex-shrink: 0;
  background: #ffffff;
}

.fab-ai-footer-left {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

.fab-ai-emoji-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 2px 4px;
  border-radius: 6px;
  color: #9ca3af;
  line-height: 1;
  transition: color 0.15s ease, background 0.15s ease;
}

.fab-ai-emoji-btn:hover {
  color: #6b7280;
  background: #f3f4f6;
}

/* Emoji picker panel */
.fab-ai-emoji-picker {
  position: absolute;
  bottom: 32px;
  left: 0;
  background: #ffffff;
  border: 1px solid var(--fab-border);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  padding: 8px;
  width: 260px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
  animation: fabMsgIn 0.15s ease-out;
}

.fab-ai-emoji-picker::-webkit-scrollbar {
  width: 4px;
}

.fab-ai-emoji-picker::-webkit-scrollbar-thumb {
  background: var(--fab-border);
  border-radius: 2px;
}

.fab-ai-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
}

.fab-ai-emoji-grid button {
  background: none;
  border: none;
  font-size: 18px;
  padding: 4px;
  cursor: pointer;
  border-radius: 6px;
  line-height: 1.2;
  transition: background 0.1s ease;
}

.fab-ai-emoji-grid button:hover {
  background: #f3f4f6;
}

/* Powered by branding */
.fab-ai-powered-by {
  font-size: 10px;
  color: #b0b0b0;
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s ease;
}

.fab-ai-powered-by:hover {
  color: #6b7280;
}

.fab-ai-powered-by span {
  font-weight: 700;
  letter-spacing: 0.3px;
  color: #d97757;
}

/* Handoff options */
.fab-ai-handoff-options {
  align-self: stretch;
  background: linear-gradient(135deg, #f0f0ff 0%, #f9fafb 100%);
  border: 1px solid var(--fab-border);
  border-radius: 12px;
  padding: 14px;
  margin: 4px 0;
  animation: fabMsgIn 0.3s ease-out;
}

.fab-ai-handoff-title {
  font-size: 13px;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 10px;
}

.fab-ai-handoff-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.fab-ai-handoff-btn {
  flex: 1;
  min-width: 80px;
  padding: 10px 14px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--fab-font);
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  transition: background 0.15s ease, transform 0.1s ease;
  display: inline-block;
  line-height: 1.4;
}

.fab-ai-handoff-btn:hover {
  transform: translateY(-1px);
}

.fab-ai-handoff-email {
  background: var(--fab-header-bg);
  color: var(--fab-text);
}

.fab-ai-handoff-email:hover {
  opacity: 0.85;
}

.fab-ai-handoff-whatsapp {
  background: #25D366;
  color: #ffffff;
}

.fab-ai-handoff-whatsapp:hover {
  background: #1DA851;
}

.fab-ai-handoff-callback {
  background: #f59e0b;
  color: #ffffff;
}

.fab-ai-handoff-callback:hover {
  background: #d97706;
}

/* --- AI Vision: Chat-integrated styles --- */

/* Vision upload button */
.fab-ai-vision-upload-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab-ai-vision-upload-btn svg {
  width: 16px;
  height: 16px;
}

/* Room photo thumbnail in user message */
.fab-ai-vision-room-msg {
  padding: 6px;
}

.fab-ai-vision-room-thumb {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.fab-ai-vision-room-thumb img {
  width: 160px;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
}

.fab-ai-vision-room-label {
  font-size: 11px;
  color: #6b7280;
}

/* Uploading indicator */
.fab-ai-vision-uploading {
  font-size: 13px;
  color: #6b7280;
  font-style: italic;
}

/* Vision result image bubble */
.fab-ai-vision-image-bubble {
  align-self: flex-start;
  max-width: 85%;
  animation: fabMsgIn 0.3s ease-out;
}

.fab-ai-vision-image-container {
  position: relative;
  cursor: pointer;
  border-radius: 12px;
  overflow: hidden;
  background: #f3f4f6;
  min-height: 100px;
}

.fab-ai-vision-image-container img {
  width: 100%;
  display: block;
  border-radius: 12px;
}

.fab-ai-vision-image-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
  border-radius: 12px;
}

.fab-ai-vision-image-container:hover .fab-ai-vision-image-overlay {
  background: rgba(0, 0, 0, 0.2);
}

.fab-ai-vision-zoom-icon {
  color: #ffffff;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fab-ai-vision-image-container:hover .fab-ai-vision-zoom-icon {
  opacity: 1;
}

.fab-ai-vision-save-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  padding: 6px 12px;
  background: none;
  border: 1px solid var(--fab-border);
  border-radius: 8px;
  font-size: 12px;
  font-family: var(--fab-font);
  color: var(--fab-header-bg);
  cursor: pointer;
  transition: background 0.15s ease;
}

.fab-ai-vision-save-btn:hover {
  background: #f3f4f6;
}

.fab-ai-vision-save-btn svg {
  flex-shrink: 0;
}

/* Vision actions row (download + cart + wishlist) */
.fab-ai-vision-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
}

.fab-ai-vision-actions .fab-ai-vision-save-btn {
  margin-top: 0;
}

.fab-ai-vision-remaining {
  text-align: center;
  font-size: 11px;
  color: #999;
  padding: 6px 12px;
  margin: 4px 0;
  line-height: 1.4;
}

.fab-ai-vision-product-actions {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.fab-ai-vision-cart-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--fab-border);
  border-radius: 8px;
  color: var(--fab-header-bg);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease;
}

.fab-ai-vision-cart-btn:hover {
  background: var(--fab-header-bg);
  color: var(--fab-text);
}

.fab-ai-vision-cart-btn.fab-ai-vision-btn-done {
  pointer-events: none;
  background: var(--fab-header-bg);
  color: var(--fab-text);
  border-color: var(--fab-header-bg);
}

.fab-ai-vision-btn-loading {
  opacity: 0.5;
  pointer-events: none;
}

.fab-ai-vision-btn-error {
  border-color: #dc2626 !important;
  color: #dc2626 !important;
}

/* Vision lightbox — inside widget, above everything */
.fab-ai-vision-lightbox {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 99999999;
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fabLightboxIn 0.2s ease-out;
}

@keyframes fabLightboxIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.fab-ai-vision-lightbox-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.fab-ai-vision-lightbox-content img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 8px;
  display: block;
}

.fab-ai-vision-lightbox-close {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 36px;
  height: 36px;
  background: #ffffff;
  border: none;
  border-radius: 50%;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  color: #1f2937;
  transition: background 0.15s ease;
}

.fab-ai-vision-lightbox-close:hover {
  background: #f3f4f6;
}

.fab-ai-vision-lightbox-download {
  position: absolute;
  bottom: -44px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  background: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  color: #1f2937;
  transition: background 0.15s ease;
  white-space: nowrap;
}

.fab-ai-vision-lightbox-download:hover {
  background: #f3f4f6;
}

/* Mobile lightbox */
@media (max-width: 768px) {
  .fab-ai-vision-lightbox-content {
    max-width: 95vw;
  }

  .fab-ai-vision-lightbox-content img {
    max-width: 95vw;
    max-height: 80vh;
  }

  .fab-ai-vision-lightbox-close {
    top: -8px;
    right: -8px;
    width: 40px;
    height: 40px;
  }
}

/* Notification badge */
.fab-ai-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  background: #ef4444;
  color: #ffffff;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  pointer-events: none;
  animation: fabAiBadgePop 0.3s ease;
}
.fab-ai-widget.fab-ai-open .fab-ai-badge {
  display: none !important;
}
@keyframes fabAiBadgePop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* Proactive message bubble */
.fab-ai-proactive {
  position: absolute;
  bottom: 70px;
  right: 0;
  background: #ffffff;
  color: #1f2937;
  padding: 12px 36px 12px 16px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  width: 250px;
  font-size: 14px;
  line-height: 1.5;
  animation: fabAiProactiveFadeIn 0.4s ease;
  cursor: default;
  z-index: 1;
}
.fab-ai-proactive::after {
  content: '';
  position: absolute;
  bottom: -8px;
  right: 20px;
  width: 0; height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-top: 8px solid #ffffff;
}
.fab-ai-bottom-left .fab-ai-proactive {
  right: auto;
  left: 0;
}
.fab-ai-bottom-left .fab-ai-proactive::after {
  right: auto;
  left: 20px;
}
.fab-ai-proactive-text {
  display: block;
}
.fab-ai-proactive-close {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  background: transparent;
  color: #9ca3af;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: color 0.15s, background 0.15s;
  line-height: 1;
  padding: 0;
}
.fab-ai-proactive-close:hover {
  color: #4b5563;
  background: #f3f4f6;
}
.fab-ai-widget.fab-ai-open .fab-ai-proactive {
  display: none !important;
}
@keyframes fabAiProactiveFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (max-width: 768px) {
  .fab-ai-proactive {
    width: 45vw;
    font-size: 13px;
    padding: 10px 32px 10px 12px;
  }
}

/* AI Vision product page button */
.fab-ai-vision-product-btn {
  border: none;
  cursor: pointer;
  padding: 10px 20px;
  font-weight: 600;
  line-height: 1.4;
  margin: 10px 0;
  width: 100%;
  text-align: center;
  transition: opacity 0.2s;
}
.fab-ai-vision-product-btn:hover {
  opacity: 0.85;
}
