/* ============================================================
   NXS - Popup căutare produse
   Design inspirat din modalul de search al aplicației evergreen-nextjs
   (overlay + panou poziționat sus, listă de rezultate cu thumbnail),
   reskinat cu paleta RO CEREAL (#2d7d46 verde, #0f2a4a navy pt text,
   #ff8400 portocaliu pt preț - aceleași culori folosite deja pe site).
   ============================================================ */

html.nxs-search-open{
  overflow: hidden;
}

.nxs-search-overlay{
  position: fixed;
  inset: 0;
  background: rgba(15, 42, 74, .45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 99980;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease;
}

html.nxs-search-open .nxs-search-overlay{
  opacity: 1;
  pointer-events: auto;
}

.nxs-search-modal{
  position: fixed;
  left: 50%;
  top: 12%;
  transform: translate(-50%, -8px) scale(.97);
  width: min(640px, calc(100vw - 32px));
  max-height: 76vh;
  display: flex;
  flex-direction: column;

  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(15, 42, 74, .18);
  overflow: hidden;

  z-index: 99981;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s cubic-bezier(.22,1,.36,1), transform .2s cubic-bezier(.22,1,.36,1);
}

html.nxs-search-open .nxs-search-modal{
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, 0) scale(1);
}

/* ---------- Header (icon + input + spinner + close) ---------- */
.nxs-search-modal__head{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid #e2e2e2;
  flex: 0 0 auto;
}

.nxs-search-modal__icon{
  flex: 0 0 auto;
  color: #767676;
}

.nxs-search-modal__input{
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  font-family: var(--wp--preset--font-family--roboto, inherit), sans-serif;
  font-size: 16px;
  font-weight: 400;
  color: #0f2a4a;
}

.nxs-search-modal__input::placeholder{
  color: #9a9a9a;
}

.nxs-search-modal__spinner{
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  border: 2px solid #e2e2e2;
  border-top-color: #2d7d46;
  border-radius: 50%;
  animation: nxs-search-spin .7s linear infinite;
}

@keyframes nxs-search-spin{
  to{ transform: rotate(360deg); }
}

.nxs-search-modal__close{
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #767676;
  cursor: pointer;
  transition: background .12s ease, color .12s ease;
}

.nxs-search-modal__close:hover{
  background: rgba(45,125,70,.08);
  color: #2d7d46;
}

/* ---------- Body ---------- */
.nxs-search-modal__body{
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
}

.nxs-search-modal__hint,
.nxs-search-modal__empty{
  padding: 32px 20px;
  text-align: center;
  font-size: 14px;
  color: #767676;
}

.nxs-search-modal__empty a{
  color: #2d7d46;
  font-weight: 600;
  text-decoration: underline;
}

.nxs-search-modal__results{
  list-style: none;
  margin: 0;
  padding: 8px;
}

.nxs-search-modal__item{
  margin: 0;
}

.nxs-search-modal__itemLink{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
}

.nxs-search-modal__itemLink:hover,
.nxs-search-modal__item.is-active .nxs-search-modal__itemLink{
  background: rgba(45,125,70,.08);
}

.nxs-search-modal__thumb{
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  overflow: hidden;
  background: #f3f4f2;
}

.nxs-search-modal__thumb img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.nxs-search-modal__meta{
  flex: 1 1 auto;
  min-width: 0;
}

.nxs-search-modal__title{
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #0f2a4a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nxs-search-modal__price{
  display: block;
  font-size: 13px;
  font-weight: 700;
  color: #ff8400;
  margin-top: 2px;
}

/* ---------- Footer: view all ---------- */
.nxs-search-modal__viewall{
  flex: 0 0 auto;
  display: block;
  text-align: center;
  padding: 14px 18px;
  border-top: 1px solid #e2e2e2;
  color: #2d7d46;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
}

.nxs-search-modal__viewall:hover{
  background: rgba(45,125,70,.06);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px){
  .nxs-search-modal{
    top: 6%;
    width: calc(100vw - 20px);
    max-height: 85vh;
  }
}
