/* Shop AI Chat Widget Styles */

.shop-ai-chat-container {
  /* CSS Variables for customization */
  --bubble-size: 60px;
  --bubble-color: #667eea;
  --window-width: 380px;
  --window-height: 600px;
  --border-radius: 16px;
  --header-color: #667eea;
  --header-text-color: #ffffff;
  --background-color: #f9fafb;
  --user-message-color: #667eea;
  --bot-message-color: #ffffff;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  pointer-events: none;
}

.shop-ai-chat-container * {
  pointer-events: auto;
}

.shop-ai-chat-container.position-bottom-left {
  right: auto;
  left: 20px;
}

/* Chat Bubble */
.shop-ai-chat-bubble {
  width: var(--bubble-size);
  height: var(--bubble-size);
  border-radius: calc(var(--bubble-size) / 2);
  background: var(--bubble-color);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Bubble shapes */
.shop-ai-chat-bubble[data-shape="circle"] {
  border-radius: 50%;
}

.shop-ai-chat-bubble[data-shape="rounded-square"] {
  border-radius: 20%;
}

.shop-ai-chat-bubble[data-shape="square"] {
  border-radius: 8px;
}

.shop-ai-chat-bubble:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 30px rgba(0, 0, 0, 0.4);
}

.shop-ai-chat-bubble svg {
  width: calc(var(--bubble-size) * 0.47);
  height: calc(var(--bubble-size) * 0.47);
  color: white;
  stroke-width: 2;
}

/* Greeting Card */
.shop-ai-greeting-card {
  position: fixed;
  bottom: 30px;
  right: calc(var(--bubble-size) + 30px);
  background: white;
  border-radius: 12px;
  padding: 14px 16px;
  padding-right: 32px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 280px;
  z-index: 9998;
  animation: greetingFadeIn 0.5s ease-out;
  cursor: default;
}

.shop-ai-chat-container.position-bottom-left .shop-ai-greeting-card {
  right: auto;
  left: calc(var(--bubble-size) + 30px);
}

.shop-ai-greeting-card.hiding {
  animation: greetingFadeOut 0.4s ease-in forwards;
}

.shop-ai-greeting-dismiss {
  position: absolute;
  top: 8px;
  right: 8px;
  background: transparent;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  transition: all 0.2s ease;
  padding: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.shop-ai-greeting-dismiss:hover {
  background: #f3f4f6;
  color: #6b7280;
  transform: scale(1.1);
}

.shop-ai-greeting-dismiss:active {
  transform: scale(0.95);
}

.shop-ai-greeting-content {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-family);
}

.shop-ai-greeting-emoji {
  font-size: 24px;
  line-height: 1;
  flex-shrink: 0;
}

.shop-ai-greeting-text {
  color: #1f2937;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
}

@keyframes greetingFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes greetingFadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* Chat Window */
.shop-ai-chat-window {
  position: fixed;
  bottom: calc(var(--bubble-size) + 60px);
  right: 20px;
  width: var(--window-width);
  height: var(--window-height);
  max-height: calc(100vh - 140px);
  background: white;
  border-radius: var(--border-radius);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.shop-ai-chat-container.position-bottom-left .shop-ai-chat-window {
  right: auto;
  left: 20px;
}

.shop-ai-chat-window.open {
  display: flex;
}

/* Chat Header */
.shop-ai-chat-header {
  background: var(--header-color);
  color: var(--header-text-color);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Header sizes */
.shop-ai-chat-header[data-size="small"] {
  padding: 12px 16px;
}

.shop-ai-chat-header[data-size="small"] .shop-ai-header-text {
  font-size: 14px;
  font-weight: 500;
}

.shop-ai-chat-header[data-size="medium"] {
  padding: 16px 20px;
}

.shop-ai-chat-header[data-size="medium"] .shop-ai-header-text {
  font-size: 16px;
  font-weight: 600;
}

.shop-ai-chat-header[data-size="large"] {
  padding: 24px;
}

.shop-ai-chat-header[data-size="large"] .shop-ai-header-text {
  font-size: 18px;
  font-weight: 700;
}

.shop-ai-chat-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.shop-ai-chat-close,
.shop-ai-chat-clear {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: var(--header-text-color);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.shop-ai-chat-close {
  font-size: 24px;
}

.shop-ai-chat-clear:hover,
.shop-ai-chat-close:hover {
  background: rgba(255, 255, 255, 0.3);
}

.shop-ai-chat-clear svg {
  width: 16px;
  height: 16px;
}

/* Messages */
.shop-ai-chat-messages {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--background-color);
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scroll-behavior: smooth;
  touch-action: pan-y;
  will-change: scroll-position;
}

.shop-ai-message {
  max-width: 80%;
  padding: 8px 12px;
  border-radius: var(--border-radius);
  font-size: 14px;
}

.shop-ai-message.user {
  background: var(--user-message-color);
  color: white;
  align-self: flex-end;
  margin-bottom: 8px;
}

.shop-ai-message.assistant {
  background: var(--bot-message-color);
  color: #1f2937;
  align-self: flex-start;
  line-height: 1.6;
  display: block;
}

.shop-ai-message.assistant.shop-ai-typing {
  display: flex;
}

/* Message Content Styles */
.shop-ai-message p {
  margin: 0 0 4px 0;
}

.shop-ai-message p:last-child {
  margin-bottom: 0;
}

.shop-ai-message h1,
.shop-ai-message h2,
.shop-ai-message h3 {
  margin: 8px 0 4px 0;
  font-weight: 600;
  color: #111827;
}

.shop-ai-message h1 {
  font-size: 18px;
}

.shop-ai-message h2 {
  font-size: 16px;
}

.shop-ai-message h3 {
  font-size: 15px;
}

.shop-ai-message strong {
  font-weight: 600;
  color: #111827;
}

.shop-ai-message em {
  font-style: italic;
}

.shop-ai-message a {
  color: #667eea;
  text-decoration: none;
  font-weight: 500;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  display: inline;
  max-width: 100%;
}

.shop-ai-message a:hover {
  text-decoration: underline;
}

.shop-ai-message ul,
.shop-ai-message ol {
  margin: 8px 0;
  padding-left: 20px;
  line-height: 1.6;
}

.shop-ai-message ol {
  counter-reset: item;
}

.shop-ai-message li {
  margin: 4px 0;
  line-height: 1.5;
}

/* Nested lists */
.shop-ai-message li ul,
.shop-ai-message li ol {
  margin-top: 4px;
  margin-bottom: 4px;
}

/* Ensure images in lists display properly */
.shop-ai-message li img {
  margin-top: 4px;
  display: block;
}

/* Product Images */
.shop-ai-product-image {
  display: block;
  max-width: 200px;
  height: auto;
  border-radius: 8px;
  margin: 6px 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Images during streaming - no animation, visible immediately */
.shop-ai-message.streaming .shop-ai-product-image {
  opacity: 1;
  transform: none;
}

/* Images when finalized - animate in */
.shop-ai-message:not(.streaming) .shop-ai-product-image.animate-in {
  opacity: 0;
  animation: imageSlideIn 0.4s ease-out forwards;
}

/* Image animation - slides in and fades in */
@keyframes imageSlideIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Input */
.shop-ai-chat-input-container {
  padding: 16px;
  background: white !important;
  border-top: 1px solid #e5e7eb;
}

.shop-ai-chat-input {
  display: flex;
  gap: 8px;
  background: #f3f4f6 !important;
  border-radius: 24px;
  padding: 4px;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  align-items: center;
}

.shop-ai-chat-input:focus-within {
  border-color: rgba(102, 126, 234, 0.3);
  background: #ffffff !important;
}

.shop-ai-chat-input textarea {
  flex: 1;
  border: none;
  background: transparent !important;
  padding: 9px 12px;
  outline: none;
  font-family: var(--font-family);
  font-size: 14px;
  box-shadow: none !important;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  resize: none;
  height: auto;
  min-height: 36px;
  max-height: 150px;
  line-height: 1.43;
  overflow-y: hidden;
  transition: height 0.1s ease;
  vertical-align: middle;
  display: block;
  box-sizing: border-box;
  color: #1f2937 !important;
}

.shop-ai-chat-input textarea:focus {
  outline: none;
  box-shadow: none !important;
  border: none;
  background: transparent !important;
}

/* Prevent autofill styling in Chrome, Safari, and other WebKit browsers */
.shop-ai-chat-input textarea:-webkit-autofill,
.shop-ai-chat-input textarea:-webkit-autofill:hover,
.shop-ai-chat-input textarea:-webkit-autofill:focus,
.shop-ai-chat-input textarea:-webkit-autofill:active {
  -webkit-background-clip: text;
  -webkit-text-fill-color: #1f2937 !important;
  background-color: transparent !important;
  box-shadow: 0 0 0 1000px transparent inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

.shop-ai-chat-send {
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: 50%;
  background: var(--user-message-color);
  border: none;
  color: white;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: transform 0.1s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shop-ai-chat-send:active {
  transform: scale(0.95);
}

.shop-ai-typing {
  gap: 4px;
  align-items: center;
  min-height: 40px;
  justify-content: flex-start;
}

.shop-ai-typing-dot {
  width: 8px !important;
  height: 8px !important;
  min-width: 8px !important;
  min-height: 8px !important;
  border-radius: 50% !important;
  background-color: #667eea !important;
  background: #667eea !important;
  animation: typing-wave 0.9s infinite ease-in-out !important;
  flex-shrink: 0 !important;
  display: inline-block !important;
  opacity: 1 !important;
  visibility: visible !important;
  position: relative !important;
  margin: 0 !important;
  padding: 0 !important;
}

.shop-ai-typing-dot:nth-child(1) {
  animation-delay: 0s !important;
}

.shop-ai-typing-dot:nth-child(2) {
  animation-delay: 0.15s !important;
}

.shop-ai-typing-dot:nth-child(3) {
  animation-delay: 0.3s !important;
}

@keyframes typing-wave {
  0%, 60%, 100% {
    transform: translateY(0);
  }
  30% {
    transform: translateY(-5px);
  }
}

/* Restoring Conversation Indicator */
.shop-ai-message.restoring {
  opacity: 0.7;
  font-style: italic;
  color: #6b7280;
  font-size: 14px;
  animation: fade-in 0.3s ease-in;
}

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(5px);
  }
  to {
    opacity: 0.7;
    transform: translateY(0);
  }
}

/* Tool Usage Indicator - Minimalistic Style */
.shop-ai-tool-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: #f3f4f6;
  border-radius: 12px;
  font-size: 12px;
  color: #6b7280;
  margin: 4px 4px 4px 0;
  animation: fadeIn 0.2s ease-in;
  font-weight: 500;
}

.shop-ai-tool-indicator svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.7;
}

.shop-ai-tool-indicator.tool-success {
  background: #f3f4f6;
  color: #059669;
}

.shop-ai-tool-indicator.tool-success svg {
  opacity: 1;
}

/* Container for tool indicators */
.shop-ai-tools-container {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 2px 0 -2px 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* Streaming message cursor effect - using a smooth pulsing dot */
.shop-ai-message.streaming::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #667eea;
  margin-left: 4px;
  margin-bottom: 2px;
  animation: pulse 1.2s ease-in-out infinite;
  vertical-align: middle;
}

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

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Mobile devices (< 768px) */
@media (max-width: 767px) {
  /* Container positioning */
  .shop-ai-chat-container {
    bottom: 16px;
    right: 16px;
  }

  .shop-ai-chat-container.position-bottom-left {
    left: 16px;
    right: auto;
  }

  /* Bubble - slightly smaller on mobile */
  .shop-ai-chat-bubble {
    width: calc(var(--bubble-size) * 0.9);
    height: calc(var(--bubble-size) * 0.9);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
  }

  .shop-ai-chat-bubble svg {
    width: calc(var(--bubble-size) * 0.4);
    height: calc(var(--bubble-size) * 0.4);
  }

  /* FULLSCREEN CHAT WINDOW for mobile */
  .shop-ai-chat-window {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh;
    border-radius: 0 !important;
    box-shadow: none;
    z-index: 10000;
    /* GPU acceleration for smooth keyboard transitions */
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Height will be dynamically adjusted by visualViewport API */
  }

  /* Ensure proper positioning context for absolute input */
  .shop-ai-chat-window.open {
    position: fixed;
  }

  .shop-ai-chat-container.position-bottom-left .shop-ai-chat-window {
    left: 0;
  }

  /* Hide bubble when chat is open on mobile */
  .shop-ai-chat-window.open ~ .shop-ai-chat-bubble {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.8);
  }

  /* Greeting card - hide when chat is open */
  .shop-ai-chat-window.open ~ .shop-ai-greeting-card {
    display: none !important;
  }

  /* Greeting card - mobile optimized */
  .shop-ai-greeting-card {
    max-width: calc(100vw - 100px);
    bottom: 24px;
    right: calc(var(--bubble-size) * 0.9 + 26px);
    padding: 12px 14px;
    padding-right: 30px;
  }

  .shop-ai-chat-container.position-bottom-left .shop-ai-greeting-card {
    left: calc(var(--bubble-size) * 0.9 + 26px);
  }

  .shop-ai-greeting-text {
    font-size: 13px;
  }

  .shop-ai-greeting-emoji {
    font-size: 20px;
  }

  .shop-ai-greeting-dismiss {
    width: 18px;
    height: 18px;
    font-size: 16px;
    top: 6px;
    right: 6px;
  }

  /* Header - optimized for mobile */
  .shop-ai-chat-header {
    padding: 14px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .shop-ai-chat-header[data-size="small"] {
    padding: 10px 14px;
  }

  .shop-ai-chat-header[data-size="small"] .shop-ai-header-text {
    font-size: 15px;
  }

  .shop-ai-chat-header[data-size="medium"] {
    padding: 14px 16px;
  }

  .shop-ai-chat-header[data-size="medium"] .shop-ai-header-text {
    font-size: 16px;
  }

  .shop-ai-chat-header[data-size="large"] {
    padding: 16px 18px;
  }

  .shop-ai-chat-header[data-size="large"] .shop-ai-header-text {
    font-size: 17px;
  }

  /* Close button - larger tap target */
  .shop-ai-chat-close,
  .shop-ai-chat-clear {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
  }

  .shop-ai-chat-close {
    font-size: 26px;
  }

  /* Messages - optimized padding */
  .shop-ai-chat-messages {
    padding: 16px 14px;
    padding-bottom: env(safe-area-inset-bottom, 16px);
  }

  .shop-ai-message {
    max-width: 85%;
    font-size: 15px;
    line-height: 1.5;
  }

  /* Product images - smaller on mobile */
  .shop-ai-product-image {
    max-width: 160px;
  }

  /* Input container - absolute positioning on mobile for keyboard handling */
  .shop-ai-chat-input-container {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 14px;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    background: white !important;
    border-top: 1px solid #e5e7eb;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.05);
    z-index: 10;
    /* Force GPU rendering for smoother transitions */
    transform: translateZ(0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: bottom;
    /* Prevent pull-to-refresh and overscroll on input area */
    overscroll-behavior: contain;
    touch-action: pan-x pan-y;
  }

  .shop-ai-chat-input {
    border-radius: 20px;
    align-items: center;
  }

  .shop-ai-chat-input textarea {
    padding: 10px 14px;
    font-size: 16px; /* Prevents zoom on iOS */
    min-height: 40px; /* Single line height for mobile */
    max-height: 120px; /* Smaller max height on mobile */
    background: transparent !important;
    color: #1f2937 !important;
    /* Improve iOS keyboard handling */
    -webkit-appearance: none;
    appearance: none;
    /* Prevent unwanted mobile behaviors */
    -webkit-user-select: text;
    user-select: text;
    touch-action: manipulation;
  }

  /* Messages container - account for absolute input at bottom */
  .shop-ai-chat-messages {
    /* Reserve space for input container at bottom */
    /* Input is 80px above bottom nav + ~60px input height = ~160px total */
    padding-bottom: 160px;
  }

  /* Send button - larger tap target */
  .shop-ai-chat-send {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    flex-shrink: 0;
  }

  .shop-ai-chat-send svg {
    width: 20px;
    height: 20px;
  }

  /* Tool indicators - smaller on mobile */
  .shop-ai-tool-indicator {
    font-size: 11px;
    padding: 4px 8px;
  }

  .shop-ai-tool-indicator svg {
    width: 12px;
    height: 12px;
  }
}

/* Small phones (< 375px) */
@media (max-width: 374px) {
  .shop-ai-chat-header {
    padding: 12px 14px;
  }

  .shop-ai-chat-header[data-size="medium"] .shop-ai-header-text {
    font-size: 15px;
  }

  .shop-ai-chat-messages {
    padding: 14px 12px;
  }

  .shop-ai-message {
    font-size: 14px;
    padding: 7px 11px;
  }

  .shop-ai-product-image {
    max-width: 140px;
  }

  .shop-ai-chat-input textarea {
    font-size: 16px; /* Still 16px to prevent zoom */
    padding: 9px 12px;
  }
}

/* Tablet devices (768px - 1024px) */
@media (min-width: 768px) and (max-width: 1024px) {
  .shop-ai-chat-window {
    width: min(420px, 90vw);
    height: min(650px, 80vh);
  }

  .shop-ai-chat-bubble {
    width: calc(var(--bubble-size) * 0.95);
    height: calc(var(--bubble-size) * 0.95);
  }
}

/* Large screens (> 1024px) - use default styles */
@media (min-width: 1025px) {
  /* Desktop styles already defined above */
}

/* Landscape mode on phones */
@media (max-width: 767px) and (orientation: landscape) {
  .shop-ai-chat-window {
    height: 100vh !important;
  }

  .shop-ai-chat-header {
    padding: 10px 14px;
  }

  .shop-ai-chat-messages {
    padding: 12px 14px;
  }

  .shop-ai-chat-input-container {
    padding: 10px 14px;
  }
}

/* Safe area insets for notched devices (iPhone X+) */
@supports (padding: env(safe-area-inset-bottom)) {
  @media (max-width: 767px) {
    .shop-ai-chat-window {
      padding-top: env(safe-area-inset-top, 0);
    }

    .shop-ai-chat-input-container {
      padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }
  }
}

/* Prevent body scroll when chat is open on mobile */
@media (max-width: 767px) {
  body.shop-ai-chat-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100vh;
  }
}

/* ====================================
   Rating Widget Styles
   ==================================== */

.shop-ai-rating-widget {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 8px 0;
  margin: 6px 0;
  box-shadow: none;
  animation: slideInUp 0.3s ease;
}

.shop-ai-rating-header {
  text-align: center;
  margin-bottom: 10px;
}

.shop-ai-rating-prompt {
  color: #6b7280;
  font-size: 13px;
  font-weight: 500;
  margin: 0;
  line-height: 1.4;
}

.shop-ai-rating-options {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: nowrap;
  overflow-x: auto;
  padding: 2px 0;
}

/* Emoji Rating Options */
.shop-ai-rating-options.emoji {
  gap: 6px;
}

.shop-ai-rating-options.emoji .shop-ai-rating-option.selected {
  opacity: 1 !important;
}

.shop-ai-rating-option {
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 48px;
  flex-shrink: 0;
}

.shop-ai-rating-option .emoji {
  font-size: 32px;
  line-height: 1;
}

.shop-ai-rating-option .label {
  display: none;
}

.shop-ai-rating-option:hover:not(:disabled) {
  transform: scale(1.15);
}

.shop-ai-rating-option:active:not(:disabled) {
  transform: scale(1.1);
}

.shop-ai-rating-option.selected {
  transform: scale(1.2);
  opacity: 1 !important;
}

.shop-ai-rating-option.dimmed,
.shop-ai-rating-star.dimmed {
  opacity: 0.3;
  transform: scale(0.9);
  cursor: default;
}

.shop-ai-rating-option:disabled,
.shop-ai-rating-star:disabled {
  cursor: default;
  pointer-events: none;
}

/* Ensure selected stars have full opacity */
.shop-ai-rating-star.selected {
  opacity: 1 !important;
}

/* Stars Rating Options */
.shop-ai-rating-options.stars {
  gap: 4px;
  justify-content: center;
}

.shop-ai-rating-star {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 4px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.shop-ai-rating-star svg {
  width: 28px;
  height: 28px;
  fill: #e8eaed;
  stroke: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.05));
}

.shop-ai-rating-star.hover:not(:disabled) svg,
.shop-ai-rating-star:hover:not(:disabled) svg {
  fill: #fbbf24;
  transform: scale(1.08);
  filter: drop-shadow(0 2px 4px rgba(251, 191, 36, 0.3));
}

.shop-ai-rating-star.selected svg {
  fill: #f59e0b;
  transform: scale(1.1);
  filter: drop-shadow(0 2px 6px rgba(245, 158, 11, 0.4));
  opacity: 1 !important;
}

.shop-ai-rating-star.dimmed svg {
  opacity: 0.25;
  transform: scale(0.92);
  filter: none;
}

/* Ensure hover state takes precedence over default */
.shop-ai-rating-star.hover svg {
  fill: #fbbf24 !important;
}

/* Thumbs Rating Options */
.shop-ai-rating-options.thumbs {
  gap: 16px;
}

.shop-ai-rating-options.thumbs .shop-ai-rating-option {
  min-width: auto;
  padding: 8px;
  flex: 0;
  max-width: none;
}

.shop-ai-rating-options.thumbs .shop-ai-rating-option svg {
  width: 32px;
  height: 32px;
  stroke: #9ca3af;
}

.shop-ai-rating-options.thumbs .shop-ai-rating-option:hover:not(:disabled) svg {
  stroke: #667eea;
}

.shop-ai-rating-options.thumbs .shop-ai-rating-option.selected {
  opacity: 1 !important;
}

.shop-ai-rating-options.thumbs .shop-ai-rating-option.selected svg {
  stroke: #667eea;
  opacity: 1 !important;
}

.shop-ai-rating-options.thumbs .label {
  display: none;
}

/* Feedback Section */
.shop-ai-rating-feedback {
  margin-top: 12px;
  animation: slideDown 0.3s ease;
}

.shop-ai-feedback-input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  margin-bottom: 8px;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.shop-ai-feedback-input:focus {
  outline: none;
  border-color: #667eea;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.shop-ai-feedback-buttons {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.shop-ai-feedback-submit,
.shop-ai-feedback-skip {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 12px;
  transition: all 0.2s ease;
}

.shop-ai-feedback-submit {
  background: #667eea;
  color: white;
}

.shop-ai-feedback-submit:hover {
  background: #5568d3;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.shop-ai-feedback-skip {
  background: #f3f4f6;
  color: #6b7280;
}

.shop-ai-feedback-skip:hover {
  background: #e5e7eb;
}

/* Animations */
@keyframes slideInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    max-height: 0;
  }
  to {
    opacity: 1;
    max-height: 200px;
  }
}

/* Mobile Responsive */
@media (max-width: 767px) {
  .shop-ai-rating-widget {
    padding: 6px 0;
    margin: 6px 0;
  }

  .shop-ai-rating-prompt {
    font-size: 12px;
  }

  .shop-ai-rating-options.emoji {
    gap: 4px;
  }

  .shop-ai-rating-option {
    min-width: 42px;
    padding: 4px;
  }

  .shop-ai-rating-option .emoji {
    font-size: 28px;
  }

  .shop-ai-rating-star {
    padding: 3px;
  }

  .shop-ai-rating-star svg {
    width: 26px;
    height: 26px;
  }

  .shop-ai-rating-options.thumbs {
    gap: 12px;
  }

  .shop-ai-rating-options.thumbs .shop-ai-rating-option {
    min-width: auto;
    padding: 6px;
  }

  .shop-ai-rating-options.thumbs .shop-ai-rating-option svg {
    width: 28px;
    height: 28px;
  }
}
