/* Gemar webshop FULLTEXT search -- Premium UI/UX */

:root {
  --gemar-search-bg: rgba(255, 255, 255, 0.85);
  --gemar-search-border: rgba(255, 255, 255, 0.3);
  --gemar-search-shadow: 0 12px 32px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  --gemar-search-radius: 12px;
  --gemar-search-item-radius: 8px;
  --gemar-search-hover-bg: rgba(245, 247, 250, 0.9);
  --gemar-brand-color: #2490ef;
  --gemar-stock-green: #10b981;
  --gemar-stock-gray: #6b7280;
  --gemar-transition-fast: 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
  --gemar-transition-spring: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

/* Glassmorphism Container */
#search-results-container {
  background: var(--gemar-search-bg) !important;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--gemar-search-border) !important;
  border-radius: var(--gemar-search-radius) !important;
  box-shadow: var(--gemar-search-shadow) !important;
  overflow: hidden;
  margin-top: 8px;
  padding: 8px;
  transition: opacity var(--gemar-transition-fast), transform var(--gemar-transition-fast);
}

/* Glowing Search Box */
#search-box.gemar-enhanced {
  border-radius: 8px;
  transition: all var(--gemar-transition-fast);
  background-color: #f9fafb;
}

#search-box.gemar-enhanced:focus {
  background-color: #ffffff;
  border-color: var(--gemar-brand-color);
  box-shadow: 0 0 0 4px rgba(36, 144, 239, 0.15);
}

/* Scrollable Area */
#product-scroll {
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 4px;
}

#product-scroll::-webkit-scrollbar {
  width: 6px;
}
#product-scroll::-webkit-scrollbar-track {
  background: transparent;
}
#product-scroll::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.1);
  border-radius: 10px;
}

/* Result Row */
.gemar-ws-result-row {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: var(--gemar-search-item-radius);
  margin-bottom: 4px;
  text-decoration: none !important;
  color: inherit !important;
  background: transparent;
  transition: transform var(--gemar-transition-fast), background var(--gemar-transition-fast), box-shadow var(--gemar-transition-fast);
  /* Staggered animation setup */
  opacity: 0;
  transform: translateY(10px);
  animation: slideUpFade 0.3s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  animation-delay: var(--anim-delay, 0ms);
}

.gemar-ws-result-row:last-child {
  margin-bottom: 0;
}

.gemar-ws-result-row:hover {
  background: var(--gemar-search-hover-bg);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

/* Thumbnail */
.gemar-ws-thumb {
  width: 48px;
  height: 48px;
  object-fit: contain;
  border-radius: 6px;
  background: #ffffff;
  border: 1px solid rgba(0, 0, 0, 0.04);
  padding: 2px;
  flex-shrink: 0;
}

/* Content Area */
.gemar-ws-content {
  flex-grow: 1;
  min-width: 0; /* for text-overflow */
}

/* Product Title */
.gemar-ws-title {
  font-weight: 600;
  font-size: 14px;
  color: #111827;
  line-height: 1.3;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Brand Badge */
.gemar-ws-brand {
  display: inline-block;
  font-size: 11px;
  font-weight: 500;
  color: var(--gemar-brand-color);
  background: rgba(36, 144, 239, 0.08);
  padding: 2px 8px;
  border-radius: 12px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* Footer (Price & Stock) */
.gemar-ws-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}

.gemar-ws-price {
  font-weight: 700;
  font-size: 15px;
  color: #111827;
}

/* Stock Indicators */
.gemar-ws-stock {
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 500;
}

.gemar-ws-stock::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-right: 6px;
}

.gemar-ws-in-stock {
  color: var(--gemar-stock-green);
}
.gemar-ws-in-stock::before {
  background-color: var(--gemar-stock-green);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.gemar-ws-out-stock {
  color: var(--gemar-stock-gray);
}
.gemar-ws-out-stock::before {
  background-color: var(--gemar-stock-gray);
}

/* Empty State / Loader */
.gemar-ws-search-empty {
  font-size: 14px;
  color: #6b7280;
  text-align: center;
  padding: 24px 12px;
  animation: fadeIn var(--gemar-transition-fast);
}

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

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

@media (max-width: 768px) {
  #search-results-container {
    max-width: calc(100% - 32px);
    margin-left: auto;
    margin-right: auto;
  }
  #product-scroll {
    max-height: calc(100dvh - 140px - env(safe-area-inset-bottom, 0px));
  }
  #search-box.gemar-enhanced {
    font-size: 16px; /* evita zoom iOS */
    min-height: 44px;
  }
  .gemar-ws-title {
    font-size: 13px;
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .gemar-ws-thumb {
    width: 40px;
    height: 40px;
  }
  .gemar-ws-result-row {
    min-height: 44px;
    padding: 12px;
  }
}
