.chatfromai-widget {
  position: fixed;
  z-index: 9999;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  pointer-events: none;
}
.chatfromai-widget * { 
  box-sizing: border-box; 
}

.chatfromai-bubble {
  position: fixed;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  border: none;
  color: white;
  pointer-events: auto;
}
.chatfromai-bubble:hover { transform: scale(1.05); }

.chatfromai-container {
  position: fixed;
  width: 384px;
  height: 500px;
  background: white;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  border: none;
  overflow: hidden;
  display: none;
  flex-direction: column;
  pointer-events: auto;
}
.chatfromai-container.show { display: flex; }

.chatfromai-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  color: white;
  font-weight: 500;
}

.chatfromai-header-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chatfromai-reset-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  padding: 4px;
  border-radius: 4px;
  transition: background-color 0.2s;
}
.chatfromai-reset-btn:hover { background-color: rgba(255,255,255,0.2); }

.chatfromai-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chatfromai-message {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 85%;
}
.chatfromai-message.user {
  margin-left: auto;
  flex-direction: row-reverse;
}

.chatfromai-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.chatfromai-message.assistant .chatfromai-avatar { background: #e5e7eb; }

.chatfromai-bubble-content {
  padding: 12px;
  border-radius: 12px;
  word-break: break-word;
  max-width: 250px;
}
.chatfromai-message.assistant .chatfromai-bubble-content {
  background: #f3f4f6;
  color: #374151;
}
.chatfromai-message.user .chatfromai-bubble-content { color: white; }

.chatfromai-input-container {
  border-top: 1px solid #e5e7eb;
  padding: 12px;
}

.chatfromai-input-form {
  display: flex;
  gap: 8px;
}

.chatfromai-input {
  flex: 1;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  outline: none;
}
.chatfromai-input:focus { border-color: #3b82f6; }

.chatfromai-send-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  background-color: #3b82f6;
  transition: background-color 0.2s;
}
.chatfromai-send-btn:hover {
  background-color: #2563eb;
}
.chatfromai-send-btn:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.chatfromai-typing {
  display: flex;
  gap: 2px;
  padding: 8px;
}
.chatfromai-typing span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #9ca3af;
  animation: chatfromai-blink 1.4s infinite both;
}
.chatfromai-typing span:nth-child(2) { animation-delay: 0.2s; }
.chatfromai-typing span:nth-child(3) { animation-delay: 0.4s; }

@keyframes chatfromai-blink {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}

/* Positions */
.chatfromai-widget.bottom-right .chatfromai-container { bottom: 80px; right: 16px; }
.chatfromai-widget.bottom-right .chatfromai-bubble { bottom: 16px; right: 16px; }
.chatfromai-widget.bottom-left .chatfromai-container { bottom: 80px; left: 16px; }
.chatfromai-widget.bottom-left .chatfromai-bubble { bottom: 16px; left: 16px; }
.chatfromai-widget.top-right .chatfromai-container { top: 80px; right: 16px; }
.chatfromai-widget.top-right .chatfromai-bubble { top: 16px; right: 16px; }
.chatfromai-widget.top-left .chatfromai-container { top: 80px; left: 16px; }
.chatfromai-widget.top-left .chatfromai-bubble { top: 16px; left: 16px; }

/* Sizes */
.chatfromai-container.small { width: 320px; height: 384px; }
.chatfromai-container.medium { width: 384px; height: 500px; }
.chatfromai-container.large { width: 450px; height: 600px; }

.chatfromai-bubble.small { width: 48px; height: 48px; }
.chatfromai-bubble.medium { width: 56px; height: 56px; }
.chatfromai-bubble.large { width: 64px; height: 64px; }

/* Session Dialog - Fixed position but in widget area */
.chatfromai-dialog {
  position: fixed;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  pointer-events: auto;
}

.chatfromai-dialog-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
}

/* Dialog positions based on widget position */
.chatfromai-widget.bottom-right .chatfromai-dialog {
  bottom: 16px;
  right: 16px;
  width: 384px;
  height: 500px;
}

.chatfromai-widget.bottom-left .chatfromai-dialog {
  bottom: 16px;
  left: 16px;
  width: 384px;
  height: 500px;
}

.chatfromai-widget.top-right .chatfromai-dialog {
  top: 16px;
  right: 16px;
  width: 384px;
  height: 500px;
}

.chatfromai-widget.top-left .chatfromai-dialog {
  top: 16px;
  left: 16px;
  width: 384px;
  height: 500px;
}
.chatfromai-dialog.show { display: flex; }

.chatfromai-dialog-content {
  background: white;
  border-radius: 8px;
  padding: 24px;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 4px 24px rgba(0,0,0,0.15);
  position: relative;
  z-index: 10001;
}

.chatfromai-dialog h3 {
  margin: 0 0 8px 0;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
}

.chatfromai-dialog p {
  margin: 0 0 16px 0;
  color: #6b7280;
  font-size: 14px;
}

.chatfromai-dialog-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.chatfromai-dialog-btn {
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  border: none;
}

.chatfromai-dialog-cancel {
  background: white;
  color: #6b7280;
  border: 1px solid #d1d5db;
}

.chatfromai-dialog-confirm {
  background: #ef4444;
  color: white;
}

@media (max-width: 480px) {
  .chatfromai-container { width: calc(100vw - 32px) !important; }
}
/* Branding */
.chatfromai-branding {
  text-align: center;
  padding: 8px 12px 4px;
  /*border-top: 1px solid #e5e7eb;*/
  /*background: #f9fafb;*/
}

.chatfromai-branding a {
  color: #6b7280;
  text-decoration: none;
  font-size: 11px;
  transition: color 0.2s;
}

.chatfromai-branding a:hover {
  color: #374151;
}

.chatfromai-branding strong {
  color: #3b82f6;
}
