/* ===== Uniclima Predictive Search — 2026-04-17 ===== */

:root {
  --ups-red: #E30613;
  --ups-red-dark: #b00510;
  --ups-red-soft: #fef1f2;
  --ups-ink: #0f172a;
  --ups-ink-2: #334155;
  --ups-muted: #64748b;
  --ups-line: #e5e7eb;
  --ups-bg: #ffffff;
  --ups-radius: 14px;
  --ups-shadow: 0 20px 60px rgba(15,23,42,.16), 0 4px 14px rgba(15,23,42,.06);
}

/* ---------- Input emphasis (desktop pill) ---------- */
/* Wrapper must be INVISIBLE — no square ring, no transforms */
.ucn-search-pill,
.ucn-search-pill:focus-within,
.ucn-search-pill.ups-focused {
  box-shadow: none !important;
  transform: none !important;
  background: transparent !important;
  border: 0 !important;
  padding: 0 !important;
  width: min(460px, 34vw) !important;
  max-width: 100% !important;
}
/* The actual pill is the inner field */
.ucn-search-pill__field {
  border-radius: 999px !important;
  padding: 8px 14px 8px 18px !important;
  gap: 12px !important;
  transition: border-color 180ms ease, box-shadow 180ms ease, transform 180ms ease;
}
.ucn-search-pill__field:focus-within {
  border-color: var(--ups-red) !important;
  box-shadow: none !important;
  transform: none !important;
}
/* Red search icon, slightly bigger and further from text */
.ucn-search-pill__field > .ucn-icon--search-inner,
.ucn-search-overlay__pill > .ucn-icon--search-inner {
  color: var(--ups-red) !important;
  stroke: var(--ups-red) !important;
  width: 18px !important;
  height: 18px !important;
  flex-shrink: 0 !important;
  margin-right: 4px !important;
}
.ucn-search-pill__input,
.ucn-search-overlay__input {
  flex: 1 1 auto !important;
}
.ucn-search-pill__input::placeholder,
.ucn-search-overlay__input::placeholder {
  color: #94a3b8;
  opacity: 1;
}
/* Keep the green pulse inside the pill (absolute against field) */
.ucn-search-pill__field { position: relative; }
.ucn-search-pill.ups-index-ready::after,
.ucn-search-overlay__pill.ups-index-ready::after {
  right: 12px !important;
}

/* ---------- Dropdown: desktop positioned under pill ---------- */
.ups-dropdown {
  position: fixed;
  z-index: 99998;
  background: var(--ups-bg);
  border: 1px solid var(--ups-line);
  border-radius: var(--ups-radius);
  box-shadow: var(--ups-shadow);
  overflow: hidden;
  display: none;
  flex-direction: column;
  max-height: min(70vh, 560px);
  min-width: 420px;
  max-width: 640px;
  animation: upsFadeIn 160ms ease both;
}
.ups-dropdown.is-open { display: flex; }
@keyframes upsFadeIn {
  from { opacity: 0; transform: translateY(-6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Dropdown head ---------- */
.ups-dropdown__head {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  font-size: 12px;
  color: var(--ups-muted);
  border-bottom: 1px solid var(--ups-line);
  background: #f8fafc;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.ups-dropdown__head .ups-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ups-red);
  background: var(--ups-red-soft);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
}

/* ---------- Body ---------- */
.ups-dropdown__body {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
.ups-dropdown__body::-webkit-scrollbar { width: 8px; }
.ups-dropdown__body::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.ups-dropdown__body::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ---------- Result row ---------- */
.ups-row {
  display: grid;
  grid-template-columns: 88px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid #f1f5f9;
  color: inherit;
  cursor: pointer;
  transition: background 140ms ease;
}
.ups-row:last-child { border-bottom: 0; }
.ups-row:hover,
.ups-row.is-active {
  background: #fef1f2;
}

.ups-row__thumb,
.ups-row__thumb-link {
  width: 88px; height: 88px;
  border-radius: 12px;
  background: #f8fafc center / contain no-repeat;
  border: 1px solid #edf0f4;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
  display: block;
  text-decoration: none;
  transition: border-color 160ms ease, transform 160ms ease;
}
.ups-row__thumb-link:hover { border-color: #cbd5e1; transform: translateY(-1px); }
.ups-row__thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: none;
  pointer-events: none;
}
.ups-row__thumb--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #cbd5e1;
  font-size: 28px;
  font-weight: 700;
}

.ups-row__main { min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ups-row__title-link { text-decoration: none; color: inherit; }
.ups-row__title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ups-ink);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin: 0;
}
.ups-row__title-link:hover .ups-row__title { color: var(--ups-ink-2); }
.ups-row__title mark {
  background: transparent;
  color: var(--ups-red);
  font-weight: 700;
  padding: 0;
}
.ups-row__sub {
  font-size: 11.5px;
  color: var(--ups-muted);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.ups-row__sku {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: #f1f5f9;
  color: var(--ups-ink-2);
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 10.5px;
  letter-spacing: .02em;
}

/* Stock badge */
.ups-row__stock {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: .01em;
  line-height: 1;
}
.ups-row__stock svg { display: block; }
.ups-row__stock--in {
  background: #ecfdf5;
  color: #047857;
  border: 1px solid #a7f3d0;
}
.ups-row__stock--out {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fecaca;
}

/* Right column: price + add-to-cart button */
.ups-row__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  min-width: 96px;
}
.ups-row__price {
  font-size: 15px;
  font-weight: 800;
  color: var(--ups-ink);
  white-space: nowrap;
  text-align: right;
  line-height: 1.1;
}
.ups-row__price small {
  display: block;
  font-size: 10px;
  color: var(--ups-muted);
  font-weight: 500;
  letter-spacing: .02em;
  margin-top: 2px;
}

.ups-row__atc {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--ups-red);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.ups-row__atc:hover { background: var(--ups-red-dark); }
.ups-row__atc:active { transform: scale(.96); }
.ups-row__atc.is-loading { opacity: .7; pointer-events: none; }
.ups-row__atc.is-loading svg { animation: ups-atc-spin .8s linear infinite; }
.ups-row__atc.is-success { background: #047857; }
.ups-row__atc.is-disabled,
.ups-row__atc[disabled] {
  background: #e5e7eb;
  color: #6b7280;
  cursor: not-allowed;
}
@keyframes ups-atc-spin { to { transform: rotate(360deg); } }

/* ---------- Empty / loading / initial states ---------- */
.ups-empty,
.ups-loading,
.ups-intro {
  padding: 28px 20px;
  text-align: center;
  color: var(--ups-muted);
  font-size: 13px;
  line-height: 1.5;
}
.ups-empty strong,
.ups-intro strong { color: var(--ups-ink); }
.ups-empty__icon,
.ups-intro__icon {
  display: block;
  margin: 0 auto 10px;
  width: 44px; height: 44px;
  color: var(--ups-muted);
  opacity: .5;
}

/* Intro / hint state: quick categories as chips */
.ups-intro__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-top: 10px;
}
.ups-intro__chip {
  padding: 6px 12px;
  border: 1px solid var(--ups-line);
  background: #fff;
  color: var(--ups-ink-2);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background 140ms ease;
}
.ups-intro__chip:hover {
  border-color: var(--ups-red);
  color: var(--ups-red);
  background: var(--ups-red-soft);
}

/* ---------- Footer: see all ---------- */
.ups-dropdown__foot {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-top: 1px solid var(--ups-line);
  background: #f8fafc;
  gap: 10px;
}
.ups-dropdown__foot__hint {
  font-size: 11.5px;
  color: var(--ups-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.ups-dropdown__foot__hint kbd {
  background: #fff;
  border: 1px solid var(--ups-line);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 1px 5px;
  font-size: 10.5px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  color: var(--ups-ink-2);
}
.ups-see-all {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--ups-red);
  color: #fff !important;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 700;
  text-decoration: none;
  transition: background 140ms ease, transform 140ms ease;
}
.ups-see-all:hover {
  background: var(--ups-red-dark);
  transform: translateX(2px);
}

/* Loading spinner */
.ups-spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid #e2e8f0;
  border-top-color: var(--ups-red);
  border-radius: 50%;
  animation: upsSpin 700ms linear infinite;
  vertical-align: -2px;
  margin-right: 6px;
}
@keyframes upsSpin { to { transform: rotate(360deg); } }

/* Index-ready pulse animation on the pill */
.ucn-search-pill.ups-index-ready::after,
.ucn-search-overlay__pill.ups-index-ready::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 50%;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #22c55e;
  transform: translateY(-50%);
  box-shadow: 0 0 0 0 rgba(34,197,94,.4);
  animation: upsPulse 1600ms ease-out infinite;
  pointer-events: none;
}
@keyframes upsPulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.4); }
  70% { box-shadow: 0 0 0 10px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

/* ---------- Mobile: use overlay, dropdown fills bottom ---------- */
@media (max-width: 768px) {
  .ups-dropdown {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    min-width: 0 !important;
    max-width: none !important;
    width: 100vw !important;
    max-height: calc(100vh - 70px) !important;
    border-radius: 18px 18px 0 0 !important;
  }
  .ups-dropdown--for-overlay {
    top: 64px !important;
    bottom: 0 !important;
    max-height: calc(100vh - 64px) !important;
    border-radius: 0 !important;
    border: 0 !important;
  }
  .ups-row { grid-template-columns: 72px 1fr auto; padding: 12px 14px; gap: 12px; }
  .ups-row__thumb,
.ups-row__thumb-link { width: 72px; height: 72px; }
  .ups-row__title { font-size: 13px; }
  .ups-row__right { min-width: 84px; gap: 6px; }
  .ups-row__price { font-size: 14px; }
  .ups-row__atc { padding: 7px 10px; font-size: 11.5px; }
  .ups-row__atc-label { display: none; }
  .ups-dropdown__head,
.ups-dropdown__foot {
    padding: 10px 14px;
  }
  .ups-see-all { padding: 10px 16px; }
}

/* Body lock only used for mobile overlay, not dropdown */
body.ups-input-open .ucn-search-overlay { pointer-events: auto; }

/* Backdrop for dropdown on desktop */
.ups-backdrop {
  position: fixed;
  inset: 0;
  background: transparent;
  z-index: 99997;
  display: none;
}
.ups-backdrop.is-open { display: block; }

/* Visually hide default autocomplete suggestions */
.ucn-search-pill__input::-webkit-search-cancel-button,
.ucn-search-overlay__input::-webkit-search-cancel-button { display: none; }
