/* CSS Variables for easy theming */
:root {
  --chat-primary: #1f2937;
  --chat-primary-hover: #374151;
  --chat-secondary: #00a884;
  --chat-secondary-rgb: 251, 105, 0;
  --chat-bg-gradient-start: #ffffff;
  --chat-bg-gradient-end: #f8fafc;
  --chat-text-primary: #111827;
  --chat-text-secondary: #4b5563;
  --chat-text-muted: #94a3b8;
  --chat-border: rgba(0, 0, 0, 0.1);
  --chat-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
  --chat-bubble-user: #1f2937;
  --chat-bubble-bot: #f3f4f6;
  --chat-input-bg: #f8fafc;
  --chat-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --chat-max-width: 37.5rem;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

/* Reset and base styles */
* {
  box-sizing: border-box;
}

html,
body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100%;
}

.purands-chat-button,
.purands-chat-container,
.purands-chat-container *,
.purands-chat-overlay {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* Floating button with improved animation */
.purands-chat-button {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  width: 4rem;
  height: 4rem;
  border: none;
  border-radius: 50%;
  background: var(--chat-primary);
  color: #fff;
  cursor: pointer;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0.625rem 1.5625rem -0.3125rem rgba(0, 0, 0, 0.25);
  transition: var(--chat-transition);
  padding: 0;
  margin: 0;
  overflow: hidden;
  /* will-change: transform; */
  -webkit-transform: translateZ(0);
  transform: translateZ(0);
}

.purands-chat-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 30%, rgba(255, 255, 255, 0.1) 100%);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.purands-chat-button:hover::before {
  opacity: 1;
}

.purands-chat-button:hover {
  transform: scale(1.1) translateZ(0);
  box-shadow: 0 1.25rem 2.5rem -0.625rem rgba(0, 0, 0, 0.3);
}

.purands-chat-button:active {
  transform: scale(0.95) translateZ(0);
}

.purands-chat-button svg {
  width: 2.5rem;
  height: 2.5rem;
  fill: none;
  transition: transform 0.3s ease;
}

.purands-chat-button.animating svg {
  animation: rotateOut 0.3s ease-out;
}

@keyframes rotateOut {
  from {
    transform: rotate(0deg) scale(1);
  }

  to {
    transform: rotate(90deg) scale(0);
  }
}

/* Chat container with improved styling */
.purands-chat-container {
  position: fixed;
  bottom: 0;
  right: 0;
  max-width: var(--chat-max-width);
  width: calc(100% - 2rem);
  height: 100dvh;
  height: 100lvh;
  height: 100svh;
  padding-bottom: var(--safe-bottom);
  display: none;
  flex-direction: column;
  background: linear-gradient(135deg, var(--chat-bg-gradient-start), var(--chat-bg-gradient-end));
  border: 1px solid var(--chat-border);
  border-radius: 1.5rem;
  box-shadow: var(--chat-shadow);
  overflow: hidden;
  z-index: 9999;
  opacity: 0;
  transform: translateY(20px) scale(0.95) translateZ(0);
  transition: opacity 0.3s ease, transform 0.3s ease;
  contain: layout style paint;
  /* will-change: transform, opacity; */
}

.purands-chat-container.show {
  opacity: 1;
  transform: translateY(0) scale(1) translateZ(0);
}

/* Enhanced header */
.purands-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.purands-chat-logo {
  max-height: 2.5rem;
  object-fit: contain;
  display: block;
}

.purands-chat-close-btn {
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--chat-text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  transition: var(--chat-transition);
  padding: 0;
}

.purands-chat-close-btn:hover {
  background: rgba(0, 0, 0, 0.05);
  transform: rotate(90deg);
}

/* Messages area with improved scrollbar and performance optimizations */
.purands-chat-messages {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
  /* Performance optimizations */
  contain: strict;
  overflow-anchor: none;
  transform: translateZ(0);
  will-change: scroll-position;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: auto;
  /* Disable smooth scroll for better performance */
}

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

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

.purands-chat-messages::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 3px;
  transition: background 0.2s;
}

.purands-chat-messages::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Enhanced message bubbles */
.purands-chat-message {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  max-width: 100%;
  animation: messageSlideIn 0.3s ease-out;
}

@keyframes messageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px) translateZ(0);
  }

  to {
    opacity: 1;
    transform: translateY(0) translateZ(0);
  }
}

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

.purands-chat-message-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 85%;
  min-width: 0;
}

.purands-chat-bubble {
  display: block;
  position: relative;
  border-radius: 1.25rem;
  padding: 0.75rem 1.25rem;
  font-size: 0.95rem;
  line-height: 1.5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  transition: transform 0.2s ease;
}

.purands-chat-bubble p {
  margin: 0;
  padding: 0;
}

.purands-chat-bubble:hover {
  transform: translateY(-1px) translateZ(0);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.purands-chat-bubble-user {
  background: var(--chat-bubble-user);
  color: #fff;
  border-bottom-right-radius: 0.25rem;
}

.purands-chat-bubble-bot {
  background: var(--chat-bubble-bot);
  color: var(--chat-text-primary);
  border-bottom-left-radius: 0.25rem;
}

.purands-chat-timestamp {
  font-size: 0.75rem;
  color: var(--chat-text-muted);
  padding: 0 0.75rem;
  opacity: 0.8;
}

.purands-typing-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-style: italic;
  color: var(--chat-text-secondary);
}

/* Enhanced typing indicator */
.purands-typing-indicator {
  display: inline-flex;
  gap: 0.3rem;
  align-items: center;
  contain: layout style paint;
  /* will-change: contents; */
}

.purands-typing-dot {
  width: 0.25rem;
  height: 0.25rem;
  background: var(--chat-text-secondary);
  border-radius: 50%;
  animation: typing-bounce 1.4s ease-in-out infinite;
  align-self: center;
  margin: auto 0;
  vertical-align: middle;
}

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

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

@keyframes typing-bounce {

  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }

  30% {
    transform: translateY(-0.75rem);
    opacity: 1;
  }
}

/* Enhanced input area */
.purands-chat-input-wrapper {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-top: 1px solid #e5e7eb;
  padding: 1rem 1.25rem;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  padding-bottom: calc(1rem + var(--safe-bottom));
  background-clip: padding-box;
}

.purands-chat-input-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--chat-input-bg);
  border: 2px solid transparent;
  border-radius: 2rem;
  padding: 0.5rem 0.75rem;
  transition: var(--chat-transition);
}

.purands-chat-input-container:focus-within {
  border-color: var(--chat-secondary);
  /* background: #fff; */
  box-shadow: 0 0 0 3px rgba(0, 168, 132, 0.1);
}

.purands-chat-input-field {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--chat-text-primary);
  font-size: 1rem;
  padding: 0.5rem;
  min-width: 0;
}

.purands-chat-input-field::placeholder {
  color: var(--chat-text-muted);
}

.purands-chat-input-field:hover {
  background: transparent;
  box-shadow: none;
}

.purands-chat-input-field:focus {
  box-shadow: none;
}

.purands-chat-send-button {
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: var(--chat-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--chat-transition);
  flex-shrink: 0;
  padding: 0;
  position: relative;
  overflow: hidden;
}

.purands-chat-send-button::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255, 255, 255, 0.3), transparent);
  opacity: 0;
  transform: scale(0);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.purands-chat-send-button:hover:not(:disabled)::before {
  opacity: 1;
  transform: scale(1);
}

.purands-chat-send-button:hover:not(:disabled) {
  background: var(--chat-primary-hover);
  transform: scale(1.1);
}

.purands-chat-send-button:active:not(:disabled) {
  transform: scale(0.95);
}

.purands-chat-send-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.purands-chat-send-button svg {
  width: 1.25rem;
  height: 1.25rem;
  transition: transform 0.2s ease;
}

.purands-chat-send-button:hover:not(:disabled) svg {
  transform: translateX(2px);
}

/* Enhanced carousel */
.purands-chat-carousel {
  display: flex;
  align-items: flex-start;
  min-height: 30rem;
  gap: 1rem;
  overflow-x: auto;
  padding: 0;
  margin: 0;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.purands-chat-carousel::-webkit-scrollbar {
  display: none;
}

/* Enhanced product cards */
.purands-chat-card {
  background: #ffffff;
  border: 1px solid #e5e5e5;
  border-radius: 1rem;
  min-width: 17.5rem;
  max-width: 17.5rem;
  height: 30rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  flex: 0 0 auto;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  cursor: pointer;
}

.purands-chat-card-buttons button {
  margin-bottom: 5px;
}

.purands-chat-card-image-container {
  position: relative;
  width: 100%;
  height: 12rem;
  background: #f5f5f5;
  overflow: hidden;
  flex-shrink: 0;
}

.purands-chat-card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.purands-chat-card:hover .purands-chat-card-image {
  transform: scale(1.05);
}

.purands-chat-card-no-image {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  color: #8e8e93;
}

.purands-chat-card-content {
  padding: 1.25rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.purands-chat-card-title {
  color: var(--chat-text-primary);
  margin-bottom: 0.75rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.purands-chat-card-title p {
  margin: 0;
  padding: 0;
}

.purands-chat-card-description {
  font-size: 0.875rem;
  color: var(--chat-text-secondary);
  line-height: 1.5;
  margin-bottom: 1rem;
  flex: 1;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.purands-chat-card-button {
  width: 100%;
  padding: 0.75rem;
  background: transparent;
  border: 2px solid var(--chat-secondary);
  border-radius: 2rem;
  color: var(--chat-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--chat-transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  margin-top: auto;
}

.purands-chat-card-button:hover {
  background: var(--chat-secondary);
  color: #fff;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 168, 132, 0.3);
}

/* Container for suggestion cards */
.purands-suggestion-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  padding: 0;
  margin: 1rem 0;
  opacity: 0;
  transition: opacity 0.3s ease-in-out;
}

/* Individual suggestion card */
.purands-suggestion-card {
  display: flex;
  align-items: center;
  flex: 0 0 auto;
  cursor: pointer;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: rgba(var(--chat-secondary-rgb), 0.1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  max-height: 250px;
  margin-right: 1rem;
  /* will-change: transform, box-shadow; */
  backface-visibility: hidden;
  -webkit-font-smoothing: antialiased;
  width: 100%;
}

.purands-suggestion-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 4px;
  height: 100%;
  background: var(--chat-secondary);
  border-radius: 0 0.25rem 0.25rem 0;
}

/* Alternating layout for suggestion cards */
.purands-suggestion-card:nth-child(even) {
  flex-direction: row-reverse;
}

/* .purands-suggestion-card:nth-child(even) .purands-suggestion-image {
   order: 2; 
} */
.purands-suggestion-card:nth-child(even) .purands-suggestion-text {
  order: 1;
}

.purands-suggestion-card:hover {
  transform: translateY(-2px) translateZ(0);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Card image (landscape) */
.purands-suggestion-image {
  flex: 0 0 40%;
  max-width: 40%;
  height: auto;
  display: block;
  /* width: 50%; */
  /* aspect-ratio: 16/9; */
  object-fit: cover;
  background: #f5f5f5;
  background-image: linear-gradient(90deg, #f5f5f5 25%, #e5e5e5 50%, #f5f5f5 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

.purands-suggestion-image[src] {
  animation: none;
  background: none;
}

@keyframes shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

.purands-suggestion-text {
  flex: 1 1 60%;
  max-width: 60%;
  padding: 1rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--chat-text-primary);
  border-radius: 0.5rem;
  position: relative;
  height: 100%;
  align-content: center;
}

/* No image placeholder for suggestions */
.purands-suggestion-no-image {
  flex: 0 0 40%;
  max-width: 40%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f5f5f5;
  color: #999;
  font-size: 0.875rem;
}

/* Loading state for suggestions */
.purands-suggestions-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 2rem;
  color: var(--chat-text-secondary);
  font-size: 0.875rem;
}

.purands-loading-spinner {
  width: 1.5rem;
  height: 1.5rem;
  border: 2px solid rgba(0, 0, 0, 0.1);
  border-top-color: var(--chat-secondary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Welcome message styling */
.purands-chat-window-title {
  font-size: 1.125rem;
  font-weight: 600;
  margin: 0;
  color: var(--chat-text-primary);
}

/* Footer styling */
.purands-chat-footer {
  text-align: center;
  font-size: 0.75rem;
  color: var(--chat-text-muted);
  /* background-color: rgba(255, 255, 255, 0.95); */
  padding: 0.75rem;
  flex-shrink: 0;
  line-height: 1.5;
}

.purands-chat-footer a {
  color: var(--chat-text-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
}

.purands-chat-footer a:hover {
  color: var(--chat-secondary);
  text-decoration: underline;
}

/* Loading state for input */
.purands-chat-input-container.loading {
  position: relative;
  overflow: hidden;
}

.purands-chat-input-container.loading::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--chat-secondary), transparent);
  animation: loading-slide 1.5s ease-in-out infinite;
}

@keyframes loading-slide {
  0% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

/* Accessibility improvements */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Focus visible for keyboard navigation */
.purands-chat-button:focus-visible,
.purands-chat-close-btn:focus-visible,
.purands-chat-send-button:focus-visible,
.purands-chat-card-button:focus-visible {
  outline: 3px solid var(--chat-secondary);
  outline-offset: 2px;
}

/* Mobile optimizations */
@media (max-width: 768px) {

  /* Use hardware acceleration for mobile transforms */
  .purands-chat-container,
  .purands-chat-button,
  .purands-suggestion-card {
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
  }

  /* Optimize touch targets */
  .purands-suggestion-card {
    min-height: 44px;
    touch-action: manipulation;
  }

  .purands-chat-container {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    height: 100lvh !important;
    height: 100svh !important;
    padding-bottom: var(--safe-bottom) !important;
    border-radius: 0 !important;
    margin: 0 !important;
    bottom: 0 !important;
  }

  .purands-chat-card-title {
    -webkit-line-clamp: 1;
  }

  .purands-chat-card-description {
    -webkit-line-clamp: 2;
  }
}

@media (max-width: 480px) {
  .purands-chat-container {
    position: fixed !important;
    inset: 0 !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh !important;
    height: 100lvh !important;
    height: 100svh !important;
    border-radius: 0 !important;
    margin: 0 !important;
    bottom: 0 !important;
  }

  .purands-chat-header {
    padding: 1rem !important;
    border-radius: 0;
  }

  .purands-chat-messages {
    padding: 1rem !important;
  }

  .purands-chat-input-wrapper {
    padding: 0.75rem 1rem !important;
  }

  .purands-chat-card {
    min-width: 15rem;
    max-width: 15rem;
    height: 24rem;
  }

  .purands-chat-footer {
    display: none;
  }
}

/* Disable hover effects on mobile */
@media (hover: none) {
  .purands-suggestion-card:hover {
    transform: none;
  }

  .purands-chat-bubble:hover {
    transform: none;
  }
}

/* Overlay */
.purands-chat-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 9998;
  display: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.purands-chat-overlay.show {
  opacity: 1;
}

/* Prevent body scroll when chat is open on mobile */
body.purands-chat-open {
  overflow: hidden;
  position: fixed;
  width: 100%;
  height: 100%;
}

/* ===========================================
   CENTERED INPUT INTERFACE STYLES
   =========================================== */

/* Centered input container */
.purands-center-input-container {
  position: relative;
  z-index: 9997;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  pointer-events: none;
  width: 100%;
  margin: 2rem auto;
  padding: 2rem 0;
}

/* Position variants using margin for spacing */
.purands-center-input-container[data-position="center"] {
  margin: 4rem auto;
}

.purands-center-input-container[data-position="top"] {
  margin: 2rem auto 4rem auto;
}

.purands-center-input-container[data-position="bottom"] {
  margin: 4rem auto 2rem auto;
}

/* Input wrapper */
.purands-center-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 2rem;
  padding: 0.75rem;
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: all;
  max-width: 90vw;
  width: clamp(20rem, 80vw, 70rem);
}

.purands-center-input-wrapper:hover {
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.25);
  transform: translateY(-2px);
}

.purands-center-input-wrapper:focus-within {
  border-color: var(--chat-secondary);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.25),
    0 0 0 3px rgba(var(--chat-secondary-rgb), 0.2);
}

/* Visual indicator when there's chat history */
.purands-center-input-wrapper.has-history {
  border-color: rgba(var(--chat-secondary-rgb), 0.3);
  box-shadow: 0 1rem 3rem rgba(0, 0, 0, 0.2),
    0 0 0 1px rgba(var(--chat-secondary-rgb), 0.2);
}

.purands-center-input-wrapper.has-history:hover {
  border-color: var(--chat-secondary);
  box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.25),
    0 0 0 2px rgba(var(--chat-secondary-rgb), 0.3);
  cursor: pointer;
}

.purands-center-input-wrapper.has-history::before {
  position: absolute;
  right: 3.5rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1rem;
  opacity: 0.6;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.purands-center-input-wrapper.has-history:hover::before {
  opacity: 1;
}

/* Center input field */
.purands-center-input-field {
  flex: 1;
  border: none;
  background: transparent;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--chat-text-primary);
  outline: none;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.purands-center-input-field::placeholder {
  color: var(--chat-text-muted);
  opacity: 0.8;
}

.purands-center-input-field:hover {
  background: transparent;
  box-shadow: none;
}

.purands-center-input-field:focus {
  background: transparent;
  box-shadow: none;
}

/* Center send button */
.purands-center-send-button {
  width: 2.5rem;
  height: 2.5rem;
  border: none;
  border-radius: 50%;
  background: var(--chat-secondary);
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  margin-left: 0.5rem;
  flex-shrink: 0;
}

.purands-center-send-button:hover:not(:disabled) {
  background: color-mix(in srgb, var(--chat-secondary) 90%, black);
  transform: scale(1.05);
}

.purands-center-send-button:active {
  transform: scale(0.95);
}

.purands-center-send-button:disabled {
  background: var(--chat-text-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.purands-center-send-button svg {
  width: 1rem;
  height: 1rem;
}

/* Center suggestions */
.purands-center-suggestions {
  margin-top: 1.5rem;
  opacity: 0;
  transform: translateY(-10px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: all;
  width: 100%;
  display: flex;
  justify-content: center;
}

.purands-center-suggestions.show {
  opacity: 1;
  transform: translateY(0);
}

.purands-center-suggestion-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
  max-width: clamp(20rem, 80vw, 70rem);
  width: 100%;
}

.purands-center-suggestion-card {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 1.5rem;
  padding: 1.5rem;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
  min-height: 120px;
  opacity: 1;
}

.purands-center-suggestion-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 1rem 2.5rem rgba(0, 0, 0, 0.15);
  border-color: var(--chat-secondary);
}

.purands-center-suggestion-card:active {
  transform: translateY(-2px);
}

.purands-center-suggestion-image {
  max-width: 180px;
  height: 120px;
  object-fit: cover;
  border-radius: 1rem;
  flex-shrink: 0;
}

.purands-center-suggestion-no-image {
  width: 80px;
  height: 80px;
  background: #f3f4f6;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.purands-center-suggestion-no-image span {
  font-size: 0.75rem;
  color: var(--chat-text-muted);
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

.purands-center-suggestion-text {
  flex: 1;
  font-size: 1rem;
  color: var(--chat-text-primary);
  font-weight: 500;
  line-height: 1.4;
  text-align: left;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
}

/* ===========================================
   MODAL CHAT INTERFACE STYLES
   =========================================== */

/* Modal chat container (80% VW/VH) */
.purands-chat-modal {
  position: fixed !important;
  top: 50% !important;
  left: 50% !important;
  transform: translate(-50%, -50%) scale(0.9) !important;
  width: 80vw !important;
  height: 80vh !important;
  max-width: 80vw !important;
  max-height: 80vh !important;
  border-radius: 1.5rem !important;
  bottom: auto !important;
  right: auto !important;
  z-index: 9999;
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.purands-chat-modal.show {
  opacity: 1 !important;
  transform: translate(-50%, -50%) scale(1) !important;
}

/* Body class for modal open state */
body.purands-chat-modal-open {
  overflow: hidden;
}

/* ===========================================
   INLINE CHAT INTERFACE STYLES
   =========================================== */

/* Inline chat container (integrated into page) */
.purands-chat-inline {
  position: relative !important;
  width: 100% !important;
  max-width: 1600px !important;
  height: auto;
  min-height: 500px !important;
  /* max-height: 800px !important; */
  margin: 2rem auto !important;
  border-radius: 1.5rem !important;
  z-index: 1 !important;
  opacity: 0;
  transform: translateY(20px) !important;
  transition: opacity 0.3s ease, transform 0.3s ease !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: hidden !important;
}

.purands-chat-inline.show {
  opacity: 1 !important;
  transform: none !important;
}


/* Hide header in page mode */
.purands-chat-inline .purands-chat-header {
  display: none !important;
}

/* Remove background from input wrapper in page mode */
.purands-chat-inline .purands-chat-input-wrapper {
  background: transparent !important;
  backdrop-filter: none !important;
  border-top: none !important;
}

/* Messages area for inline chat - full height with hidden scrollbar */
.purands-chat-inline .purands-chat-messages {
  height: 100% !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  scrollbar-width: none !important;
  /* Firefox */
  -ms-overflow-style: none !important;
  /* IE/Edge */
}

.purands-chat-inline .purands-chat-messages::-webkit-scrollbar {
  display: none !important;
  /* Chrome/Safari */
}

/* Modal responsive adjustments */
@media (max-width: 768px) {
  .purands-center-input-wrapper {
    width: clamp(16rem, 80vw, 25rem);
    padding: 0.5rem;
  }

  .purands-center-input-field {
    font-size: 0.9rem;
    padding: 0.5rem 0.75rem;
  }

  .purands-center-send-button {
    width: 2rem;
    height: 2rem;
    margin-left: 0.25rem;
  }

  .purands-center-send-button svg {
    width: 0.875rem;
    height: 0.875rem;
  }

  .purands-center-suggestion-cards {
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    max-width: clamp(16rem, 85vw, 50rem);
    gap: 0.75rem;
  }

  .purands-center-suggestion-card {
    padding: 1rem;
    min-height: 100px;
    gap: 0.75rem;
  }

  .purands-center-suggestion-image {
    width: 60px;
    height: 60px;
  }

  .purands-center-suggestion-no-image {
    width: 60px;
    height: 60px;
  }

  .purands-center-suggestion-text {
    font-size: 0.9rem;
  }

  .purands-chat-modal {
    width: 95vw !important;
    height: 90vh !important;
    max-width: 95vw !important;
    max-height: 90vh !important;
    border-radius: 1rem !important;
  }
}

@media (max-width: 480px) {
  .purands-center-input-wrapper {
    width: clamp(14rem, 90vw, 20rem);
  }

  .purands-center-suggestion-cards {
    grid-template-columns: 1fr;
    max-width: clamp(14rem, 95vw, 25rem);
    gap: 0.5rem;
  }

  .purands-center-suggestion-card {
    padding: 1rem;
    min-height: 80px;
    gap: 0.75rem;
    flex-direction: row;
  }

  .purands-center-suggestion-image {
    width: 50px;
    height: 50px;
  }

  .purands-center-suggestion-no-image {
    width: 50px;
    height: 50px;
  }

  .purands-center-suggestion-text {
    font-size: 0.85rem;
    line-height: 1.3;
  }

  .purands-chat-modal {
    width: 100vw !important;
    height: 100vh !important;
    max-width: 100vw !important;
    max-height: 100vh !important;
    border-radius: 0 !important;
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
  }

  .purands-chat-modal.show {
    transform: none !important;
  }
}

/* Chat Modal Styles */
.purands-chat-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.purands-chat-modal-overlay.show {
  opacity: 1;
}

.purands-chat-modal-container {
  background: white;
  border-radius: 12px;
  width: 80vw;
  max-width: 1600px;
  height: 80vh;
  position: relative;
  transform: scale(0.9);
  transition: transform 0.3s ease;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  display: flex;
  flex-direction: column;
}

.purands-chat-modal-container.show {
  transform: scale(1);
}

.purands-chat-modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #f9fafb;
  flex-shrink: 0;
}

.purands-chat-modal-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
}

.purands-chat-modal-logo {
  max-height: 32px;
  max-width: 150px;
  width: auto;
  height: auto;
  object-fit: contain;
}

.purands-chat-modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: #6b7280;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  transition: background-color 0.2s ease;
}

.purands-chat-modal-close:hover {
  background-color: #e5e7eb;
}

.purands-chat-modal-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.purands-chat-modal-body .purands-chat-container {
  width: 100% !important;
  height: 100% !important;
  position: relative !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  display: flex !important;
  flex-direction: column !important;
  background: white !important;
}

/* Additional performance optimizations */
.purands-chat-message {
  contain: layout style;
  transform: translateZ(0);
}

.purands-chat-carousel {
  /* contain: layout; */
  transform: translateZ(0);
}

/* Optimize modal scroll performance */
.purands-chat-modal-body .purands-chat-messages {
  contain: strict;
  transform: translateZ(0);
  will-change: scroll-position;
  backface-visibility: hidden;
}

/* =========================================
   MARKDOWN STYLES FOR CHAT CONTENT
   ========================================= */

/* Override theme styles for chat message content */
.purands-chat-message h1,
.purands-chat-message h2,
.purands-chat-message h3,
.purands-chat-message h4,
.purands-chat-message h5,
.purands-chat-message h6 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  margin: 0.75rem 0 0.5rem 0 !important;
  color: var(--chat-text-primary) !important;
  border: none !important;
  background: none !important;
  padding: 0 !important;
}

/* Specific heading sizes */
.purands-chat-message h1 {
  font-size: 1.5rem !important;
}

.purands-chat-message h2 {
  font-size: 1.375rem !important;
}

.purands-chat-message h3 {
  font-size: 1.25rem !important;
}

.purands-chat-message h4 {
  font-size: 1.125rem !important;
}

.purands-chat-message h5 {
  font-size: 1rem !important;
}

.purands-chat-message h6 {
  font-size: 0.875rem !important;
}

/* First heading in message should have no top margin */
.purands-chat-message h1:first-child,
.purands-chat-message h2:first-child,
.purands-chat-message h3:first-child,
.purands-chat-message h4:first-child,
.purands-chat-message h5:first-child,
.purands-chat-message h6:first-child {
  margin-top: 0 !important;
}

/* Reset list styles and let marked.js handle structure */
.purands-chat-bubble ul,
.purands-chat-bubble ol {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--chat-text-primary);
  background: none;
  border: none;
}

.purands-chat-bubble ul li,
.purands-chat-bubble ol li {
  line-height: 1.5;
  color: var(--chat-text-primary);
  background: none;
  border: none;
}

/* Custom bullet styling */
.purands-chat-bubble ul {
  list-style: none;
}

.purands-chat-bubble ul li::before {
  content: '•';
  color: var(--chat-secondary);
  font-weight: 600;
  margin-right: 0.5rem;
}

.purands-chat-bubble ol {
  list-style: decimal;
  list-style-position: outside;
}

/* Nested list styling */
.purands-chat-bubble ul ul li::before {
  content: '◦';
  font-size: 0.875rem;
}

.purands-chat-bubble ul ul ul li::before {
  content: '▪';
  font-size: 0.75rem;
}

/* Clean up paragraphs in lists */
.purands-chat-bubble ul li p,
.purands-chat-bubble ol li p {
  margin: 0;
  padding: 0;
  display: inline;
}