/* =============================================================
   Zoyero Typesense Search — Overlay CSS
   Accent colour is injected as CSS custom property by PHP:
   :root { --zoyero-ts-accent: #000000; }
   ============================================================= */

/* ── Overlay fullscreen ───────────────────────────────────── */
.zoyero-ts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99999;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.zoyero-ts-overlay.is-open {
  opacity: 1;
  pointer-events: all;
}

/* ── Box interno ──────────────────────────────────────────── */
.zoyero-ts-overlay-inner {
  background: #fff;
  border-radius: 12px;
  width: 90%;
  max-width: 760px;
  max-height: 80vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

/* ── Header overlay ──────────────────────────────────────── */
.zoyero-ts-overlay-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

/* Input editabile dentro l'overlay */
.zoyero-ts-overlay-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 16px;
  font-family: inherit;
  background: transparent;
  color: #333;
  padding: 0;
  min-width: 0;
}
.zoyero-ts-overlay-input::placeholder {
  color: #bbb;
}

.zoyero-ts-overlay-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #aaa;
  line-height: 1;
  padding: 0;
  flex-shrink: 0;
}
.zoyero-ts-overlay-close:hover {
  color: #333;
}

/* ── Griglia prodotti ────────────────────────────────────── */
.zoyero-ts-overlay-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 16px;
  padding: 20px 24px;
  flex: 1;
}

/* ── Card prodotto ───────────────────────────────────────── */
.zoyero-ts-product-card {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #f0f0f0;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.zoyero-ts-product-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
  transform: translateY(-2px);
  border-color: var(--zoyero-ts-accent, #000);
}
.zoyero-ts-product-card img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: #f8f8f8;
  display: block;
}
.zoyero-ts-card-info {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  flex: 1;
}
.zoyero-ts-card-name {
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.zoyero-ts-card-sku {
  font-size: 11px;
  color: #aaa;
  margin-bottom: 6px;
  font-family: monospace;
}

/* ── Prezzo ──────────────────────────────────────────────── */
.zoyero-ts-card-price {
  font-size: 13px;
  margin-top: auto;
}
.zoyero-ts-regular-price {
  text-decoration: line-through;
  color: #999;
  font-size: 12px;
  margin-right: 4px;
}
.zoyero-ts-sale-price {
  color: #e53935;
  font-weight: 700;
  font-size: 14px;
}
.zoyero-ts-card-price:not(:has(.zoyero-ts-sale-price)) {
  font-weight: 700;
  color: var(--zoyero-ts-accent, #000);
}

/* ── Badge varianti colore ───────────────────────────────── */
.zoyero-ts-variants {
  display: inline-block;
  background: #e0f2f1;
  color: #00897b;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 500;
  margin-top: 6px;
  align-self: flex-start;
}

/* ── Footer overlay ──────────────────────────────────────── */
.zoyero-ts-overlay-footer {
  padding: 16px 24px;
  border-top: 1px solid #f0f0f0;
  text-align: center;
  flex-shrink: 0;
}
.zoyero-ts-view-all {
  font-size: 14px;
  font-weight: 600;
  color: var(--zoyero-ts-accent, #000);
  text-decoration: none;
}
.zoyero-ts-view-all:hover {
  text-decoration: underline;
}

/* ── Skeleton loading ────────────────────────────────────── */
.zoyero-ts-skeleton {
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  animation: zoyero-ts-shimmer 1.2s infinite;
  border-radius: 8px;
  aspect-ratio: 1;
}
@keyframes zoyero-ts-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ── Input + pulsante ────────────────────────────────────── */
.zoyero-ts-wrap {
  position: relative;
}
.zoyero-ts-input-row {
  display: flex;
  gap: 8px;
}
.zoyero-ts-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--zoyero-ts-accent, #000);
  border-radius: 8px;
  font-size: 15px;
  outline: none;
  transition: box-shadow 0.15s ease;
}
.zoyero-ts-input:focus {
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.08);
}
.zoyero-ts-btn {
  padding: 12px 24px;
  background: var(--zoyero-ts-accent, #000);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s ease;
  white-space: nowrap;
}
.zoyero-ts-btn:hover {
  opacity: 0.85;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
  .zoyero-ts-overlay {
    padding-top: 0;
    align-items: flex-end;
  }
  .zoyero-ts-overlay-inner {
    width: 100%;
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 90vh;
  }
  .zoyero-ts-overlay-results {
    grid-template-columns: repeat(2, 1fr);
  }
}
