/**
 * AI Float Chat Styles
 */

/* ===========================
   Floating Button
   =========================== */

.ai-float-button {
  position: fixed;
  bottom: 1.5rem;
  z-index: 9998;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  background-color: #dc2626;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0.2px solid #855b00;
  box-shadow:
    rgba(133, 91, 0, 0.4) 0px 2px 4px,
    rgba(133, 91, 0, 0.3) 0px 7px 13px -3px,
    rgba(133, 91, 0, 0.2) 0px -3px 0px inset;

  transition: all 0.3s ease;
}

.ai-float-button:hover {
  transform: scale(1.1);
  box-shadow:
    0 10px 15px -3px rgba(0, 0, 0, 0.1),
    0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

.ai-float-button:active {
  transform: scale(0.95);
}

.ai-float-button.ai-chat-right {
  right: 1rem;
}

.ai-float-button.ai-chat-left {
  left: 1rem;
}

.ai-float-button svg {
  width: 35px;
  height: 35px;
}

/* ===========================
   Chat Widget
   =========================== */

.ai-chat-widget {
  position: fixed;
  bottom: 1.5rem;
  z-index: 9999;
  width: 440px;
  max-width: calc(100vw - 2rem);
  height: 634px;
  max-height: calc(100vh - 3rem);
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 1rem;
  box-shadow:
    1px 0px 5px rgba(186, 186, 186, 0.02),
    1px 0px 4px rgba(186, 186, 186, 0.15),
    0px 0px 4px rgba(186, 186, 186, 0.5),
    0px 0px 3px rgba(186, 186, 186, 0.85),
    0px 0px 2px rgba(186, 186, 186, 0.98);
  display: flex;
  flex-direction: column;
}

.ai-chat-widget.ai-chat-right {
  right: 1rem;
}

.ai-chat-widget.ai-chat-left {
  left: 1rem;
}

/* ===========================
   Chat Header
   =========================== */

.ai-chat-header {
  padding: 1.5rem;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-shrink: 0;
}

.ai-chat-message.ai-user-message {
  padding: 15px;
  background: rgba(224, 153, 0, 0.2);
  border-radius: 10px;
  max-width: 80%;
  margin-left: auto;
}

.ai-chat-message.ai-assistant-message {
  padding: 15px;
  background: rgba(228, 227, 225, 0.2);
  border-radius: 10px;
  max-width: 80%;
  margin-right: auto;
}

.ai-chat-header-content {
  flex: 1;
  min-width: 0;
}

.ai-chat-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: #111827;
  line-height: 1.5;
  padding-bottom: 0;
}

.ai-chat-tagline {
  font-size: 0.875rem;
  color: #6b7280;
  margin: 0.25rem 0 0 0;
  line-height: 1.25;
}

.ai-chat-header-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: 1rem;
}

.ai-chat-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  color: #6b7280;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ai-chat-icon-btn:hover {
  color: #111827;
}

.ai-chat-icon-btn svg {
  width: 20px;
  height: 20px;
}

/* ===========================
   Messages Container
   =========================== */

.ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Custom scrollbar */
.ai-chat-messages::-webkit-scrollbar {
  width: 8px;
}

.ai-chat-messages::-webkit-scrollbar-track {
  background: #f3f4f6;
  border-radius: 4px;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
  background: #d1d5db;
  border-radius: 4px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #9ca3af;
}

/* ===========================
   Message Bubbles
   =========================== */

.ai-chat-message {
  display: flex;
  gap: 0.75rem;
  font-size: 0.875rem;
  color: #4b5563;
  line-height: 1.5;
}

.ai-message-avatar {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.25rem;
}

.ai-message-avatar svg {
  width: 20px;
  height: 20px;
}

.ai-message-content {
  flex: 1;
  min-width: 0;
}

.ai-message-label {
  display: block;
  font-weight: 700;
  color: #374151;
  margin-bottom: 0.25rem;
}

.ai-message-content p {
  margin: 0;
  word-wrap: break-word;
}

/* ===========================
   Loading Indicator
   =========================== */

.ai-chat-loading {
  display: flex;
  justify-content: flex-start;
  padding: 0.5rem 0;
}

.ai-loading-dots {
  background: #f1f5f9;
  color: #0f172a;
  border-radius: 1rem;
  padding: 0.75rem 1rem;
  display: flex;
  gap: 0.5rem;
}

.ai-loading-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: #94a3b8;
  animation: ai-bounce 1.4s infinite ease-in-out both;
}

.ai-loading-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.ai-loading-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes ai-bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

/* ===========================
   Input Form
   =========================== */

.ai-chat-input-container {
  padding: 1rem 1.5rem;
  border-top: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.ai-chat-form {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.ai-chat-input {
  flex: 1;
  min-width: 0;
  height: 2.5rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  color: #030712;
  outline: none;
  transition: all 0.2s;
}

.ai-chat-input::placeholder {
  color: #6b7280;
}

.ai-chat-input:focus {
  border-color: #9ca3af;
  box-shadow: 0 0 0 3px rgba(156, 163, 175, 0.1);
}

.ai-chat-input:disabled {
  background: #f9fafb;
  cursor: not-allowed;
  opacity: 0.5;
}

.ai-chat-submit {
  height: 2.5rem;
  padding: 0 1rem;
  background-color: #dc2626;
  color: #f9fafb;
  border: none;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
  flex-shrink: 0;
}

.ai-chat-submit:hover:not(:disabled) {
  background-color: #b91c1c;
}

.ai-chat-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.ai-chat-submit:active:not(:disabled) {
  transform: scale(0.98);
}

/* ===========================
   Responsive Design
   =========================== */

@media (max-width: 640px) {
  .ai-chat-widget {
    width: calc(100vw - 2rem);
    height: calc(100vh - 3rem);
    max-height: calc(100vh - 3rem);
  }

  .ai-chat-header {
    padding: 1rem;
  }

  .ai-chat-messages {
    padding: 1rem;
  }

  .ai-chat-input-container {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .ai-float-button {
    width: 3rem;
    height: 3rem;
    bottom: 1rem;
  }

  .ai-float-button.ai-chat-right {
    right: 0.75rem;
  }

  .ai-float-button.ai-chat-left {
    left: 0.75rem;
  }

  .ai-chat-widget {
    bottom: 1rem;
  }

  .ai-chat-widget.ai-chat-right {
    right: 0.75rem;
  }

  .ai-chat-widget.ai-chat-left {
    left: 0.75rem;
  }
}

/* ===========================
   Animations
   =========================== */

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

.ai-chat-message {
  animation: ai-fadeIn 0.3s ease-out;
}

/* ===========================
   Accessibility
   =========================== */

.ai-float-button:focus,
.ai-chat-icon-btn:focus,
.ai-chat-input:focus,
.ai-chat-submit:focus {
  outline: 2px solid #e099008f;
  outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .ai-chat-widget {
    border-width: 2px;
  }

  .ai-chat-input {
    border-width: 2px;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .ai-float-button,
  .ai-chat-message,
  .ai-loading-dot {
    animation: none;
    transition: none;
  }
}
