.wpaicb-position-bottom-right {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
}

.wpaicb-position-bottom-left {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 9999;
}

#wpaicb-chatbot {
  --wpaicb-primary: #0ea5e9;
  --wpaicb-primary-dark: #0284c7;
  --wpaicb-accent: #f59e0b;
  --wpaicb-bg: #ffffff;
  --wpaicb-surface: #f8fafc;
  --wpaicb-text: #1e293b;
  --wpaicb-text-light: #64748b;
  --wpaicb-border: #e2e8f0;
  --wpaicb-shadow: rgba(15, 23, 42, 0.08);
  --wpaicb-shadow-lg: rgba(15, 23, 42, 0.12);
  
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
}

.wpaicb-toggle-button {
  background: linear-gradient(135deg, var(--wpaicb-primary) 0%, var(--wpaicb-primary-dark) 100%);
  color: #fff;
  border-radius: 50%;
  border: none;
  width: 60px;
  height: 60px;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--wpaicb-shadow-lg), 0 2px 8px var(--wpaicb-shadow);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 10000;
  animation: wpaicb-pulse 2s infinite;
  font-size: 24px; /* Ensure icon size */
}

.wpaicb-toggle-button:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 32px var(--wpaicb-shadow-lg), 0 4px 12px var(--wpaicb-shadow);
  animation: none;
}

.wpaicb-toggle-button:active {
  transform: scale(0.95);
}

.wpaicb-toggle-button::after {
  /* Content handled by HTML now */
  display: none;
}

@keyframes wpaicb-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.7);
  }
  70% {
    box-shadow: 0 0 0 15px rgba(14, 165, 233, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(14, 165, 233, 0);
  }
}

.wpaicb-window {
  display: none;
  position: absolute;
  right: 0;
  bottom: 70px;
  width: 380px;
  max-height: 600px;
  background: var(--wpaicb-bg);
  border-radius: 24px;
  box-shadow: 0 24px 48px var(--wpaicb-shadow-lg), 0 8px 16px var(--wpaicb-shadow);
  overflow: hidden;
  flex-direction: column;
  animation: wpaicb-slide-up 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid var(--wpaicb-border);
}

@keyframes wpaicb-slide-up {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.wpaicb-position-bottom-left .wpaicb-window {
  left: 0;
  right: auto;
}

.wpaicb-header {
  background: linear-gradient(135deg, var(--wpaicb-primary) 0%, var(--wpaicb-primary-dark) 100%);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.wpaicb-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

.wpaicb-title {
  font-weight: 700;
  font-size: 16px;
  letter-spacing: 0.2px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.wpaicb-title::before {
  /* Content handled by HTML now */
  display: none;
}

.wpaicb-close {
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-weight: 300;
}

.wpaicb-close:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: rotate(90deg);
}

.wpaicb-messages {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
  background: var(--wpaicb-surface);
  background-image: 
    radial-gradient(circle at 20% 50%, rgba(14, 165, 233, 0.03) 0%, transparent 50%),
    radial-gradient(circle at 80% 80%, rgba(245, 158, 11, 0.03) 0%, transparent 50%);
  min-height: 300px;
  scrollbar-width: thin;
  scrollbar-color: var(--wpaicb-border) transparent;
}

.wpaicb-messages::-webkit-scrollbar {
  width: 6px;
}

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

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

.wpaicb-messages::-webkit-scrollbar-thumb:hover {
  background: var(--wpaicb-text-light);
}

.wpaicb-message {
  margin-bottom: 16px;
  display: flex;
  animation: wpaicb-message-fade 0.3s ease-out;
}

@keyframes wpaicb-message-fade {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wpaicb-message-user {
  justify-content: flex-end;
}

.wpaicb-message-bot {
  justify-content: flex-start;
}

.wpaicb-bubble {
  max-width: 75%;
  border-radius: 20px;
  padding: 12px 16px;
  font-size: 14px;
  line-height: 1.5;
  word-wrap: break-word;
  position: relative;
  box-shadow: 0 2px 8px var(--wpaicb-shadow);
}

.wpaicb-message-user .wpaicb-bubble {
  background: linear-gradient(135deg, var(--wpaicb-primary) 0%, var(--wpaicb-primary-dark) 100%);
  color: #fff;
  border-bottom-right-radius: 6px;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
}

.wpaicb-message-bot .wpaicb-bubble {
  background: var(--wpaicb-bg);
  color: var(--wpaicb-text);
  border-bottom-left-radius: 6px;
  border: 1px solid var(--wpaicb-border);
}

.wpaicb-input-row {
  padding: 16px 20px;
  display: flex;
  gap: 10px;
  border-top: 1px solid var(--wpaicb-border);
  background: var(--wpaicb-bg);
  align-items: flex-end;
}

.wpaicb-input {
  flex: 1;
  resize: none;
  border-radius: 24px;
  border: 2px solid var(--wpaicb-border);
  padding: 12px 18px;
  font-size: 14px;
  line-height: 1.5;
  font-family: inherit;
  background: var(--wpaicb-surface);
  color: var(--wpaicb-text);
  transition: all 0.2s ease;
  min-height: 44px;
  max-height: 120px;
}

.wpaicb-input::placeholder {
  color: var(--wpaicb-text-light);
}

.wpaicb-input:focus {
  outline: none;
  border-color: var(--wpaicb-primary);
  background: var(--wpaicb-bg);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.wpaicb-send {
  background: linear-gradient(135deg, var(--wpaicb-primary) 0%, var(--wpaicb-primary-dark) 100%);
  color: #fff;
  border-radius: 50%;
  border: none;
  width: 44px;
  height: 44px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(14, 165, 233, 0.3);
  flex-shrink: 0;
}

.wpaicb-send:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(14, 165, 233, 0.4);
}

.wpaicb-send:active:not(:disabled) {
  transform: scale(0.95);
}

.wpaicb-send:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}

.wpaicb-send::before {
  content: '→';
  font-weight: 600;
}

.wpaicb-typing-indicator {
  padding: 8px 20px 12px;
  font-size: 12px;
  color: var(--wpaicb-text-light);
  font-style: italic;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wpaicb-typing-indicator::before {
  content: '⋯';
  font-size: 20px;
  line-height: 1;
  animation: wpaicb-typing 1.4s infinite;
}

@keyframes wpaicb-typing {
  0%, 60%, 100% {
    opacity: 0.3;
  }
  30% {
    opacity: 1;
  }
}

@media (max-width: 640px) {
  .wpaicb-position-bottom-right,
  .wpaicb-position-bottom-left {
    right: 16px;
    left: auto; /* Reset left for bottom-right */
    bottom: 16px;
  }

  /* Handle bottom-left specifically if needed, but usually on mobile right is standard for thumb reach. 
     If we want to respect the setting: */
  .wpaicb-position-bottom-left {
    left: 16px;
    right: auto;
  }

  .wpaicb-toggle-button {
    /* Keep it circular but maybe slightly smaller if needed, or keep 60px */
    width: 60px;
    height: 60px;
    border-radius: 50%;
    /* Remove the full width override */
  }

  .wpaicb-window {
    position: fixed; /* Ensure it's fixed relative to viewport */
    right: 16px;
    left: 16px;
    width: auto; /* Let left/right handle width */
    bottom: 85px; /* Above the button */
    max-height: 80vh;
    border-radius: 20px;
    transform-origin: bottom right;
  }
  
  .wpaicb-position-bottom-left .wpaicb-window {
    transform-origin: bottom left;
  }

  .wpaicb-messages {
    min-height: 250px;
  }

  .wpaicb-bubble {
    max-width: 85%;
  }
}


