/**
 * Avo AI Search Widget Styles
 */

:root {
  --avo-accent: #111827;
  --avo-accent-hover: #1f2937;
  --avo-pill-bg: rgba(255, 255, 255, 0.92);
  --avo-text: #1f2937;
  --avo-muted: #6b7280;
  --avo-border: rgba(229, 231, 235, 0.8);
  --avo-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  --avo-radius: 9999px;
  --avo-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* 1. Floating Pill Widget */
.avo-widget-container {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99998;
  width: 90%;
  max-width: 480px;
  pointer-events: auto;
  font-family: var(--avo-font);
}

.avo-search-pill {
  display: flex;
  align-items: center;
  background: var(--avo-pill-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12), 0 4px 6px rgba(0, 0, 0, 0.05);
  border-radius: var(--avo-radius);
  padding: 6px 8px 6px 18px;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  cursor: pointer;
}

.avo-search-pill:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.15), 0 6px 12px rgba(0, 0, 0, 0.08);
}

.avo-pill-icon {
  display: flex;
  align-items: center;
  color: var(--avo-muted);
  margin-right: 12px;
  flex-shrink: 0;
}

.avo-pill-input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  outline: none !important;
  font-size: 15px !important;
  color: var(--avo-text) !important;
  font-family: inherit !important;
  padding: 8px 0 !important;
  box-shadow: none !important;
  line-height: 1.4 !important;
}

.avo-pill-input::placeholder {
  color: #6b7280;
  opacity: 0.9;
}

.avo-pill-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  background: var(--avo-accent, #111827) !important;
  color: #ffffff !important;
  border: none !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
  transition: all 0.2s ease !important;
  padding: 0 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

.avo-pill-btn:hover {
  transform: scale(1.06) !important;
  opacity: 0.95 !important;
}

/* Bulletproof Arrow SVG */
.avo-arrow-svg,
.avo-pill-btn svg,
.avo-modal-submit-btn svg {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  stroke: #ffffff !important;
  stroke-width: 2.5px !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  fill: none !important;
  visibility: visible !important;
  opacity: 1 !important;
  margin: auto !important;
}

.avo-arrow-svg path,
.avo-pill-btn svg path,
.avo-modal-submit-btn svg path {
  stroke: #ffffff !important;
  stroke-width: 2.5px !important;
  stroke-linecap: round !important;
  stroke-linejoin: round !important;
  fill: none !important;
}

/* Inline / Shortcode Pill */
.avo-inline-search-pill {
  display: flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: var(--avo-radius);
  padding: 6px 8px 6px 18px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  cursor: pointer;
  max-width: 500px;
  margin: 16px 0;
}

.avo-inline-placeholder {
  flex: 1;
  color: #6b7280;
  font-size: 15px;
}

/* 2. Results Modal Dialog */
.avo-modal {
  position: fixed;
  inset: 0;
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  font-family: var(--avo-font);
}

.avo-modal.avo-open {
  opacity: 1;
  visibility: visible;
}

.avo-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.5);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.avo-modal-content {
  position: relative;
  background: #ffffff;
  width: 100%;
  max-width: 680px;
  max-height: 85vh;
  border-radius: 20px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transform: scale(0.95) translateY(10px);
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.avo-modal.avo-open .avo-modal-content {
  transform: scale(1) translateY(0);
}

/* Modal Header */
.avo-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid #f3f4f6;
  background: #ffffff;
}

.avo-pill-icon {
  display: flex;
  align-items: center;
  margin-right: 12px;
  flex-shrink: 0;
}

.avo-pill-logo {
  width: 22px !important;
  height: 22px !important;
  object-fit: contain !important;
  display: block !important;
}

.avo-modal-logo {
  width: 28px !important;
  height: 28px !important;
  object-fit: contain !important;
  display: block !important;
}

.avo-sparkle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f3f4f6;
  color: var(--avo-accent);
}

.avo-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
}

.avo-modal-close {
  background: transparent;
  border: none;
  cursor: pointer;
  color: #9ca3af;
  padding: 6px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  transition: all 0.2s;
}

.avo-modal-close:hover {
  background: #f3f4f6;
  color: #111827;
}

/* Modal Search Input */
.avo-modal-search-box {
  display: flex;
  align-items: center;
  padding: 14px 22px;
  border-bottom: 1px solid #f3f4f6;
  background: #fafafa;
  gap: 12px;
}

.avo-modal-input {
  flex: 1;
  border: 1px solid #e5e7eb !important;
  background: #ffffff !important;
  border-radius: 9999px !important;
  padding: 10px 18px !important;
  font-size: 15px !important;
  outline: none !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04) !important;
}

.avo-modal-input:focus {
  border-color: var(--avo-accent) !important;
}

.avo-modal-submit-btn {
  width: 40px !important;
  height: 40px !important;
  border-radius: 50% !important;
  background: var(--avo-accent, #111827) !important;
  color: #ffffff !important;
  border: none !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: transform 0.2s ease !important;
  flex-shrink: 0 !important;
  padding: 0 !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15) !important;
}

.avo-modal-submit-btn:hover {
  transform: scale(1.06) !important;
  opacity: 0.95 !important;
}

/* Modal Body */
.avo-modal-body {
  padding: 22px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Prompt Suggestions */
.avo-prompt-suggestions {
  background: #f9fafb;
  border-radius: 12px;
  padding: 16px;
}

.avo-suggestion-label {
  font-size: 13px;
  font-weight: 500;
  color: #6b7280;
  margin: 0 0 10px 0;
}

.avo-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.avo-tag-pill {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 13px;
  color: #374151;
  cursor: pointer;
  transition: all 0.2s;
}

.avo-tag-pill:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
  color: #111827;
}

/* AI Speech Bubble */
.avo-ai-response-box {
  display: flex;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  padding: 14px 18px;
}

.avo-ai-avatar {
  width: 32px;
  height: 32px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 4px;
}

.avo-avatar-logo {
  width: 22px !important;
  height: 22px !important;
  object-fit: contain !important;
  display: block !important;
}

.avo-ai-speech {
  font-size: 14px;
  line-height: 1.5;
  color: #334155;
}

/* Category Link Banner */
.avo-category-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #f0fdf4 0%, #e0f2fe 100%);
  border: 1px solid #bbf7d0;
  border-radius: 12px;
  padding: 14px 18px;
  gap: 12px;
}

.avo-category-info {
  display: flex;
  flex-direction: column;
}

.avo-cat-subtext {
  font-size: 12px;
  color: #4b5563;
}

.avo-cat-name {
  font-size: 15px;
  color: #111827;
}

.avo-category-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--avo-accent);
  color: #ffffff !important;
  text-decoration: none !important;
  padding: 8px 16px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.2s;
  white-space: nowrap;
}

.avo-category-btn:hover {
  opacity: 0.9;
}

/* Product Cards Grid */
.avo-products-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.avo-product-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.avo-product-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.06);
}

.avo-card-image-wrap {
  position: relative;
  width: 100%;
  padding-top: 80%;
  background: #f9fafb;
  overflow: hidden;
}

.avo-card-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.avo-product-card:hover .avo-card-img {
  transform: scale(1.04);
}

.avo-sale-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: #ef4444;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.avo-card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.avo-card-title {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  text-decoration: none !important;
  line-height: 1.35;
  margin-bottom: 8px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.avo-card-title:hover {
  color: var(--avo-accent);
}

.avo-card-price {
  font-size: 15px;
  font-weight: 700;
  color: #111827;
  margin-bottom: 12px;
}

.avo-card-price del {
  color: #9ca3af;
  font-weight: 400;
  font-size: 13px;
  margin-right: 6px;
}

.avo-card-price ins {
  text-decoration: none;
  color: #059669;
}

.avo-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.avo-view-cart-link {
  width: 100%;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  color: #059669;
  text-decoration: underline;
  margin-top: 4px;
}

.avo-view-cart-link:hover {
  color: #047857;
}

.avo-btn-cart {
  flex: 1;
  background: var(--avo-accent);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  text-align: center;
}

.avo-btn-cart:hover {
  opacity: 0.9;
}

.avo-btn-cart.added {
  background: #10b981;
}

.avo-btn-view {
  background: #f3f4f6;
  color: #374151 !important;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  text-decoration: none !important;
  display: flex;
  align-items: center;
  justify-content: center;
}

.avo-btn-view:hover {
  background: #e5e7eb;
}

/* Loading State */
.avo-loading-state {
  text-align: center;
  padding: 40px 20px;
}

.avo-spinner-dots {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 14px;
}

.avo-spinner-dots span {
  width: 10px;
  height: 10px;
  background: var(--avo-accent);
  border-radius: 50%;
  animation: avoBounce 1.4s infinite ease-in-out both;
}

.avo-spinner-dots span:nth-child(1) { animation-delay: -0.32s; }
.avo-spinner-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes avoBounce {
  0%, 80%, 100% { transform: scale(0); opacity: 0.3; }
  40% { transform: scale(1); opacity: 1; }
}

.avo-loading-text {
  font-size: 14px;
  color: #6b7280;
  margin: 0;
}

/* Empty State */
.avo-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
  font-size: 14px;
}

/* Sleek Modal Footer - Powered by Corpela Inc. */
.avo-modal-footer {
  padding: 12px 20px !important;
  background: #f9fafb !important;
  border-top: 1px solid #f3f4f6 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 5px !important;
  width: 100% !important;
  box-sizing: border-box !important;
  border-bottom-left-radius: 20px !important;
  border-bottom-right-radius: 20px !important;
  margin: 0 !important;
  flex-shrink: 0 !important;
}

.avo-powered-text {
  font-size: 11px !important;
  color: #9ca3af !important;
  letter-spacing: 0.25px !important;
  line-height: 1 !important;
  margin: 0 !important;
}

.avo-powered-link {
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #4b5563 !important;
  text-decoration: none !important;
  letter-spacing: 0.25px !important;
  line-height: 1 !important;
  transition: color 0.2s ease !important;
}

.avo-powered-link:hover {
  color: var(--avo-accent, #111827) !important;
  text-decoration: underline !important;
}

/* Responsive */
@media (max-width: 640px) {
  .avo-widget-container {
    width: 94%;
    bottom: calc(16px + var(--avo-mobile-bottom-offset, 0px) + env(safe-area-inset-bottom, 0px));
    transition: bottom 0.3s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s ease;
  }
  .avo-modal-content {
    max-height: 92vh;
    border-radius: 16px;
  }
  .avo-products-grid {
    grid-template-columns: 1fr;
  }
}
