@import url('https://fonts.googleapis.com/css2?family=Open+Sans:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --chat-widget-primary-color: #5B8DEF;
  }
  
  /* Chat Widget Button */
  .chat-widget-button {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background-color: var(--chat-widget-primary-color);
  border-radius: 50%;
  border: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  cursor: pointer;
  z-index: 9999;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  }
  
  .chat-widget-button:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 16px rgba(0,0,0,0.2);
  }
  
  .chat-widget-button.open {
  transform: rotate(45deg);
  }
  
  /* Style for the icon inside the main button */
  .chat-widget-button-icon {
  width: 28px;
  height: 28px;
  color: white;
  transition: transform 0.3s ease;
  }
  
  /* Chat Widget Panel */
  .chat-widget-panel {
  position: fixed;
  bottom: 90px;
  right: 20px;
  width: 350px;
  height: 500px;
  background-color: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  visibility: hidden;
  overflow: hidden;
  font-family: 'Open Sans', sans-serif;
  }
  
  .chat-widget-panel.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
  }
  
  /* Chat Widget Header */
  .chat-widget-header {
  background-color: var(--chat-widget-primary-color);
  color: white;
  padding: 15px;
  border-top-left-radius: 12px;
  border-top-right-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  }
  
  .chat-widget-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0) 100%);
  pointer-events: none;
  }
  
  .chat-widget-header-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  }
  
  .chat-widget-header-avatar img {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  }
  
  .chat-widget-header-title {
  flex: 1;
  min-width: 0;
  }
  
  .chat-widget-header-title h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  }
  
  .chat-widget-header-title span {
  font-size: 12px;
  opacity: 0.8;
  display: block;
  margin-top: 2px;
  }
  
  .chat-widget-close-btn {
  background: none;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
  }
  
  .chat-widget-close-btn:hover {
  background-color: rgba(255,255,255,0.1);
  }
  
  /* Chat Widget Messages - Fixed scrolling */
  .chat-widget-messages {
  flex: 1;
  padding: 15px;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  }
  
  .chat-widget-messages::-webkit-scrollbar {
  width: 4px;
  }
  
  .chat-widget-messages::-webkit-scrollbar-track {
  background: #f1f1f1;
  border-radius: 2px;
  }
  
  .chat-widget-messages::-webkit-scrollbar-thumb {
  background: #c1c1c1;
  border-radius: 2px;
  }
  
  .chat-widget-messages::-webkit-scrollbar-thumb:hover {
  background: #a8a8a8;
  }
  
  .chat-widget-message {
  padding: 10px 15px;
  border-radius: 18px;
  max-width: 70%;
  word-wrap: break-word;
  line-height: 1.4;
  animation: messageSlideIn 0.3s ease-out;
  flex-shrink: 0;
  }
  
  @keyframes messageSlideIn {
  from {
  opacity: 0;
  transform: translateY(10px);
  }
  to {
  opacity: 1;
  transform: translateY(0);
  }
  }
  
  .chat-widget-message p {
  margin: 0;
  line-height: 1.4;
  font-size: 13px;
  }
  
  .chat-widget-message.assistant {
  background-color: #f1f5f9;
  color: #1e293b;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
  }
  
  .chat-widget-message.user {
  background-color: var(--chat-widget-primary-color);
  color: white;
  align-self: flex-end;
  margin-left: auto;
  border-bottom-right-radius: 4px;
  }
  
  /* Typing Indicator */
  .typing-indicator {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 15px;
  }
  
  .typing-indicator span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #999;
  animation: typing 1.4s infinite ease-in-out;
  }
  
  .typing-indicator span:nth-child(1) {
  animation-delay: -0.32s;
  }
  
  .typing-indicator span:nth-child(2) {
  animation-delay: -0.16s;
  }
  
  @keyframes typing {
  0%, 80%, 100% {
  transform: scale(0.8);
  opacity: 0.5;
  }
  40% {
  transform: scale(1);
  opacity: 1;
  }
  }
  
  /* Chat Widget Input Area */
  .chat-widget-input-area {
  display: flex;
  align-items: center;
  padding: 15px;
  border-top: 1px solid #e2e8f0;
  gap: 10px;
  background: #fafafa;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  flex-shrink: 0;
  }
  
  .chat-widget-input-area input {
  flex: 1;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  padding: 10px 15px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  background: white;
  }
  
  .chat-widget-input-area input:focus {
  border-color: var(--chat-widget-primary-color);
  box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.1);
  }
  
  .chat-widget-input-area input::placeholder {
  color: #94a3b8;
  }
  
  .chat-widget-input-area button {
  background-color: var(--chat-widget-primary-color);
  color: white;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  }
  
  .chat-widget-input-area button:hover {
  background-color: #4a7bd6;
  transform: scale(1.05);
  }
  
  .chat-widget-input-area button:active {
  transform: scale(0.95);
  }
  
  /* Style for the icon inside the send button */
  .chat-widget-send-icon {
  width: 20px;
  height: 20px;
  color: white;
  }
  
  /* ========== OPTIMIZED LAYOUT PRODUCT CAROUSEL ========== */
  .product-carousel-container {
  position: relative;
  margin: 2px auto 4px auto;
  padding: 0;
  width: 100%;
  height: 260px; /* INCREASED from 250px to 260px for better proportions */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
  flex-shrink: 0;
  }
  
  .product-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  }
  
  .product-card {
  position: absolute;
  top: 50%;
  left: 0;
  transform-origin: center center;
  width: 180px;
  height: 230px; /* INCREASED from 220px to 230px for content accommodation */
  background: #fff;
  border-radius: 12px;
  padding: 8px 16px 12px 16px; /* OPTIMIZED: Less top, more bottom for price */
  text-decoration: none;
  color: inherit;
  box-shadow: 0 6px 25px rgba(0,0,0,0.12);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  border: 1px solid #e2e8f0;
  will-change: transform, opacity;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
                opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.3s ease,
                border-color 0.3s ease;
  font-family: inherit;
  }
  
  .product-card:hover {
  /* Enhanced hover effect - CENTER CARD ONLY with debugged logic */
  box-shadow: 0 12px 35px rgba(0,0,0,0.2) !important;
  border-color: var(--chat-widget-primary-color) !important;
  z-index: 150 !important;
  /* Transform handled by debugged JavaScript */
  }
  
  .product-card.hidden-card {
  /* Hidden cards should not respond to hover */
  pointer-events: none !important;
  }
  
  .product-card img {
  width: 100%;
  height: 110px; /* REDUCED from 120px to 110px to save space for price */
  /* Smart image handling: Use contain for better fit with vertical images */
  object-fit: contain;
  object-position: center;
  background: #fff;
  border-radius: 8px;
  margin-bottom: 8px; /* REDUCED from 12px to 8px */
  flex-shrink: 0;
  display: block;
  }
  
  .product-card .product-title {
  font-size: 12px;
  font-weight: 600;
  margin: 0 0 8px 0;
  line-height: 1.3;
  /* REMOVED line-clamp properties to allow natural wrapping */
  color: #1e293b;
  flex-grow: 1;
  text-align: center;
  min-height: 60px;
  }
  
  .product-price-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 10px; /* CONTROLLED spacing from title */
  /* No longer using margin-top: auto which pushed price outside */
  }
  
  /* Standard vertical price layout for single prices */
  .product-card .product-price {
  font-size: 14px;
  font-weight: 700;
  color: var(--chat-widget-primary-color);
  margin: 0;
  }
  
  .product-card .original-price {
  font-size: 12px;
  color: #64748b;
  text-decoration: line-through;
  margin: 0;
  }
  
  /* Optimized horizontal price layout for discounted items */
  .product-card .product-price-horizontal {
  font-size: 14px;
  font-weight: 700;
  color: var(--chat-widget-primary-color);
  margin: 0;
  text-align: center;
  line-height: 1.3;
  }
  
  .product-card .original-price-inline {
  font-size: 13px;
  color: #64748b;
  text-decoration: line-through;
  font-weight: 500;
  }
  
  .carousel-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.95);
  border: 1px solid #e2e8f0;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 18px;
  color: #374151;
  z-index: 200;
  transition: all 0.3s ease;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.1);
  }
  
  .carousel-arrow:hover {
  background: #fff;
  box-shadow: 0 6px 24px rgba(0,0,0,0.15);
  color: var(--chat-widget-primary-color);
  transform: translateY(-50%) scale(1.1);
  border-color: var(--chat-widget-primary-color);
  }
  
  .carousel-arrow:active {
  transform: translateY(-50%) scale(0.95);
  }
  
  .carousel-arrow.prev {
  left: 15px;
  }
  
  .carousel-arrow.next {
  right: 15px;
  }
  
  /* Mobile Responsive Styles */
  @media (max-width: 480px) {
  .chat-widget-panel {
  width: calc(100vw - 20px);
  right: 10px;
  left: 10px;
  bottom: 80px;
  height: calc(100vh - 100px);
  max-height: 600px;
  }
  
  .chat-widget-button {
  bottom: 15px;
  right: 15px;
  width: 56px;
  height: 56px;
  }
  
  .chat-widget-button-icon {
  width: 24px;
  height: 24px;
  }
  
  .product-carousel-container {
  height: 240px; /* INCREASED mobile height for better proportions */
  margin: 6px auto 12px auto;
  padding: 0;
  }
  
  .product-card {
  width: 170px;
  height: 205px; /* ADJUSTED mobile height */
  padding: 8px 14px 10px 14px; /* Optimized mobile padding */
  }
  
  .product-card img {
  height: 85px; /* ADJUSTED mobile image height */
  margin-bottom: 6px;
  object-fit: contain;
  background: #fff;
  }
  
  .product-card .product-title {
  font-size: 11px;
  margin: 0 0 6px 0;
  min-height: 50px;
  }
  
  .product-card .product-price {
  font-size: 14px;
  }
  
  .product-card .product-price-horizontal {
  font-size: 14px;
  }
  
  .product-card .original-price {
  font-size: 11px;
  }
  
  .product-card .original-price-inline {
  font-size: 12px;
  }
  
  .product-price-container {
  margin-top: 8px; /* Proportional mobile spacing */
  }
  
  .carousel-arrow {
  width: 38px;
  height: 38px;
  font-size: 16px;
  }
  
  .carousel-arrow.prev {
  left: 12px;
  }
  
  .carousel-arrow.next {
  right: 12px;
  }
  
  .chat-widget-header {
  padding: 12px;
  }
  
  .chat-widget-header-title h3 {
  font-size: 15px;
  }
  
  .chat-widget-header-title span {
  font-size: 11px;
  }
  
  .chat-widget-messages {
  padding: 12px;
  }
  
  .chat-widget-input-area {
  padding: 12px;
  }
  
  .chat-widget-input-area input {
  padding: 8px 12px;
  font-size: 16px; /* Prevents zoom on iOS */
  }
  
  .chat-widget-input-area button {
  width: 40px;
  height: 40px;
  }
  
  .chat-widget-send-icon {
  width: 18px;
  height: 18px;
  }
  }
  
  /* High contrast mode support */
  @media (prefers-contrast: high) {
  .chat-widget-button {
  border: 2px solid #000;
  }
  
  .chat-widget-panel {
  border: 2px solid #000;
  }
  
  .product-card {
  border: 2px solid #000;
  }
  
  .carousel-arrow {
  border: 2px solid #000;
  }
  }
  
  /* Reduced motion support */
  @media (prefers-reduced-motion: reduce) {
  .chat-widget-button,
  .chat-widget-panel,
  .chat-widget-message,
  .product-card,
  .carousel-arrow {
  transition: none;
  }
  
  .chat-widget-messages {
  scroll-behavior: auto;
  }
  
  @keyframes messageSlideIn {
  from, to {
  opacity: 1;
  transform: translateY(0);
  }
  }
  
  @keyframes typing {
  from, to {
  transform: scale(1);
  opacity: 1;
  }
  }
  }

