/* ===== CHATBOT WIDGET ===== */

.chatbot-widget {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  font-family: var(--font-family-base);
}

/* Chatbot Toggle Button */
.chatbot-toggle {
  width: 64px;
  height: 64px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border: none;
  box-shadow: var(--shadow-2xl);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  transition: all var(--transition-normal);
  position: relative;
  overflow: visible;
}

.chatbot-toggle:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-2xl), 0 0 0 8px rgba(41, 18, 75, 0.2);
}

.chatbot-toggle__pulse {
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  opacity: 0.6;
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 0.6;
  }
  50% {
    transform: scale(1.2);
    opacity: 0;
  }
}

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

/* Chatbot Window */
.chatbot-window {
  position: absolute;
  bottom: 80px;
  right: 0;
  width: 380px;
  max-width: calc(100vw - 48px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: var(--bg-primary);
  border-radius: var(--radius-2xl);
  box-shadow: var(--shadow-2xl);
  border: 1px solid var(--color-neutral-200);
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transition: all var(--transition-normal);
  overflow: hidden;
}

.chatbot-widget.open .chatbot-window {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Chatbot Header */
.chatbot-header {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: white;
  padding: var(--space-4) var(--space-6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-2xl) var(--radius-2xl) 0 0;
}

.chatbot-header__info {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.chatbot-header__avatar {
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.chatbot-header__text {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.chatbot-header__title {
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-semibold);
  color: white;
}

.chatbot-header__status {
  font-size: var(--font-size-xs);
  color: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  gap: var(--space-1);
}

.chatbot-header__status::before {
  content: '';
  width: 8px;
  height: 8px;
  background: #10b981;
  border-radius: var(--radius-full);
  display: inline-block;
}

.chatbot-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-full);
  border: none;
  background: rgba(255, 255, 255, 0.2);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

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

/* Chatbot Messages Container */
.chatbot-messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  background: var(--bg-primary);
}

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

.chatbot-messages::-webkit-scrollbar-track {
  background: var(--color-neutral-100);
}

.chatbot-messages::-webkit-scrollbar-thumb {
  background: var(--color-neutral-300);
  border-radius: var(--radius-full);
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
  background: var(--color-neutral-400);
}

/* Chatbot Message */
.chatbot-message {
  display: flex;
  gap: var(--space-3);
  animation: fadeInUp 0.3s ease-out;
  max-width: 85%;
}

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

.chatbot-message--user {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.chatbot-message--bot {
  align-self: flex-start;
}

.chatbot-message__bubble {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-xl);
  font-size: var(--font-size-sm);
  line-height: var(--line-height-relaxed);
  word-wrap: break-word;
}

.chatbot-message--user .chatbot-message__bubble {
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  color: white;
  border-bottom-right-radius: var(--radius-sm);
}

.chatbot-message--bot .chatbot-message__bubble {
  background: var(--color-neutral-100);
  color: var(--text-primary);
  border-bottom-left-radius: var(--radius-sm);
}

.chatbot-message--bot .chatbot-message__bubble strong {
  color: var(--color-primary);
  font-weight: var(--font-weight-semibold);
}

.chatbot-message__bubble p {
  margin: 0;
  margin-bottom: var(--space-2);
}

.chatbot-message__bubble p:last-child {
  margin-bottom: 0;
}

.chatbot-message__bubble ul,
.chatbot-message__bubble ol {
  margin: var(--space-2) 0;
  padding-left: var(--space-5);
}

.chatbot-message__bubble li {
  margin-bottom: var(--space-1);
}

/* Chatbot Suggestions Wrapper */
.chatbot-suggestions-wrapper {
  border-top: 2px solid var(--color-neutral-200);
  background: var(--bg-primary);
  min-height: 0;
}

/* Chatbot Suggestions Toggle Button */
.chatbot-suggestions-toggle {
  width: 100%;
  padding: var(--space-4) var(--space-6);
  background: linear-gradient(135deg, rgba(41, 18, 75, 0.05) 0%, rgba(249, 115, 22, 0.05) 100%);
  border: none;
  border-bottom: 1px solid var(--color-neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  cursor: pointer;
  transition: all var(--transition-fast);
  color: var(--color-primary);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  font-family: var(--font-family-base);
}

.chatbot-suggestions-toggle:hover {
  background: linear-gradient(135deg, rgba(41, 18, 75, 0.08) 0%, rgba(249, 115, 22, 0.08) 100%);
}

.chatbot-suggestions-toggle__text {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.chatbot-suggestions-toggle__icon {
  transition: transform var(--transition-normal);
  transform: rotate(0deg);
}

.chatbot-suggestions-wrapper.expanded .chatbot-suggestions-toggle__icon {
  transform: rotate(180deg);
}

/* Chatbot Suggestions */
.chatbot-suggestions {
  padding: 0;
  background: linear-gradient(135deg, rgba(41, 18, 75, 0.03) 0%, rgba(249, 115, 22, 0.03) 100%);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transition: max-height var(--transition-normal), padding var(--transition-normal), opacity var(--transition-normal), visibility var(--transition-normal);
}

.chatbot-suggestions-wrapper.expanded .chatbot-suggestions {
  max-height: 300px;
  overflow-y: auto;
  padding: var(--space-5) var(--space-6);
  opacity: 1;
  visibility: visible;
}

.chatbot-suggestion {
  padding: var(--space-3) var(--space-5);
  background: white;
  border: 2px solid var(--color-primary);
  border-radius: var(--radius-lg);
  font-size: var(--font-size-sm);
  color: var(--color-primary);
  cursor: pointer;
  transition: all var(--transition-normal);
  white-space: nowrap;
  font-weight: var(--font-weight-semibold);
  box-shadow: var(--shadow-sm);
  min-width: fit-content;
  position: relative;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-5px);
}

.chatbot-suggestions-wrapper.expanded .chatbot-suggestion {
  opacity: 1;
  transform: translateY(0);
}

.chatbot-suggestion::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  transition: left var(--transition-normal);
  z-index: 0;
}

.chatbot-suggestion span {
  position: relative;
  z-index: 1;
}

.chatbot-suggestion:hover {
  color: white;
  border-color: var(--color-primary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.chatbot-suggestion:hover::before {
  left: 0;
}

.chatbot-suggestion:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* Chatbot Input Area */
.chatbot-input-area {
  padding: var(--space-4) var(--space-6);
  background: var(--bg-primary);
  border-top: 1px solid var(--color-neutral-200);
  border-radius: 0 0 var(--radius-2xl) var(--radius-2xl);
}

.chatbot-form {
  display: flex;
  gap: var(--space-2);
  align-items: center;
}

.chatbot-input {
  flex: 1;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-neutral-300);
  border-radius: var(--radius-full);
  font-size: var(--font-size-sm);
  font-family: var(--font-family-base);
  background: var(--bg-primary);
  color: var(--text-primary);
  transition: all var(--transition-fast);
}

.chatbot-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(41, 18, 75, 0.1);
}

.chatbot-send {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: linear-gradient(135deg, var(--color-primary) 0%, var(--color-secondary) 100%);
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.chatbot-send:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}

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

/* Typing Indicator */
.chatbot-typing {
  display: flex;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-4);
  background: var(--color-neutral-100);
  border-radius: var(--radius-xl);
  border-bottom-left-radius: var(--radius-sm);
  width: fit-content;
}

.chatbot-typing span {
  width: 8px;
  height: 8px;
  background: var(--color-neutral-400);
  border-radius: var(--radius-full);
  animation: typing 1.4s ease-in-out infinite;
}

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

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

@keyframes typing {
  0%, 60%, 100% {
    transform: translateY(0);
    opacity: 0.7;
  }
  30% {
    transform: translateY(-10px);
    opacity: 1;
  }
}

/* Responsive */
@media (max-width: 640px) {
  .chatbot-widget {
    bottom: 16px;
    right: 16px;
  }

  .chatbot-window {
    width: calc(100vw - 32px);
    height: calc(100vh - 120px);
    bottom: 72px;
    right: 0;
  }

  .chatbot-toggle {
    width: 56px;
    height: 56px;
  }
}

/* Accessibility */
.chatbot-widget:focus-within .chatbot-window {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
}

.chatbot-message[aria-hidden="true"] {
  display: none;
}

