/* ═══════════════════════════════════════════════════════════
   SoulsGuides — Búsqueda Global (overlay navbar)
   Usa variables globales del tema (--bg2, --gold, etc.)
   ═══════════════════════════════════════════════════════════ */

/* Enlace "Buscar" del menú móvil */
.mmenu-search{
  gap: 10px;
  color: var(--gold) !important;
}
.mmenu-search svg{
  flex-shrink: 0;
}

.sg-search{
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: min(12vh, 96px) 16px 16px;
  visibility: hidden;
  opacity: 0;
  transition: opacity .25s ease, visibility .25s ease;
}
.sg-search.is-open{
  visibility: visible;
  opacity: 1;
}

.sg-search-backdrop{
  position: absolute;
  inset: 0;
  background: rgba(6, 7, 10, 0.72);
  -webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.sg-search-panel{
  position: relative;
  width: min(680px, 100%);
  max-height: min(72vh, 620px);
  display: flex;
  flex-direction: column;
  background: color-mix(in srgb, var(--bg2, #101318) 92%, transparent);
  border: 1px solid rgba(196, 163, 90, 0.22);
  border-radius: 14px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(196, 163, 90, 0.06) inset;
  overflow: hidden;
  transform: translateY(-12px) scale(0.985);
  transition: transform .28s cubic-bezier(.22, .9, .3, 1);
}
.sg-search.is-open .sg-search-panel{
  transform: translateY(0) scale(1);
}

/* ── Cabecera (input) ── */
.sg-search-head{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(196, 163, 90, 0.14);
}
.sg-search-icon{
  color: var(--gold, #c4a35a);
  flex-shrink: 0;
}
.sg-search-head input{
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--txt, #e8e4da);
  font-size: 16px;
  font-family: inherit;
}
.sg-search-head input::placeholder{
  color: rgba(232, 228, 218, 0.4);
}
.sg-search-clear{
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(196, 163, 90, 0.25);
  background: transparent;
  color: rgba(232, 228, 218, 0.7);
  cursor: pointer;
  flex-shrink: 0;
  transition: border-color .2s, color .2s;
}
.sg-search-clear:hover{
  border-color: var(--gold, #c4a35a);
  color: var(--gold, #c4a35a);
}
.sg-search-esc{
  font: 11px/1.4 ui-monospace, monospace;
  padding: 3px 7px;
  border: 1px solid rgba(196, 163, 90, 0.3);
  border-radius: 5px;
  color: rgba(232, 228, 218, 0.55);
  flex-shrink: 0;
}

/* ── Cuerpo (resultados) ── */
.sg-search-body{
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--sb-b, var(--gold, #c4a35a)) transparent;
}
.sg-search-body::-webkit-scrollbar{
  width: 8px;
}
.sg-search-body::-webkit-scrollbar-track{
  background: transparent;
}
.sg-search-body::-webkit-scrollbar-thumb{
  border-radius: 99px;
  border: 2px solid transparent;
  background-clip: padding-box;
  background-image: linear-gradient(180deg,
    var(--sb-a, var(--gold-d, #8b7340)) 0%,
    var(--sb-b, var(--gold, #c4a35a)) 40%,
    var(--sb-c, var(--gold-l, #e8c96a)) 80%
  );
  box-shadow: 0 0 6px color-mix(in srgb, var(--sb-b, var(--gold, #c4a35a)) 40%, transparent);
}
.sg-search-body::-webkit-scrollbar-thumb:hover{
  background-image: linear-gradient(180deg,
    var(--sb-b, var(--gold, #c4a35a)) 0%,
    var(--sb-c, var(--gold-l, #e8c96a)) 50%,
    var(--sb-b, var(--gold, #c4a35a)) 100%
  );
  box-shadow: 0 0 10px color-mix(in srgb, var(--sb-c, var(--gold-l, #e8c96a)) 55%, transparent);
}

.sg-search-group + .sg-search-group{
  border-top: 1px solid rgba(196, 163, 90, 0.1);
}
.sg-search-group-name{
  padding: 10px 18px 4px;
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(196, 163, 90, 0.85);
}

.sg-search-row{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
  text-decoration: none;
  color: inherit;
  transition: background .15s;
}
.sg-search-row:hover,
.sg-search-row.is-active{
  background: rgba(196, 163, 90, 0.08);
}
.sg-search-thumb{
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(196, 163, 90, 0.14);
  overflow: hidden;
}
.sg-search-thumb img{
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}
.sg-search-thumb.is-broken img,
.sg-search-thumb--none{
  display: none;
}
.sg-search-row-info{
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sg-search-row-name{
  font-size: 14.5px;
  color: var(--txt, #e8e4da);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-search-row-meta{
  font-size: 11.5px;
  color: rgba(232, 228, 218, 0.45);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sg-search-row-arrow{
  color: var(--gold, #c4a35a);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .15s, transform .15s;
  flex-shrink: 0;
}
.sg-search-row:hover .sg-search-row-arrow,
.sg-search-row.is-active .sg-search-row-arrow{
  opacity: 1;
  transform: translateX(0);
}

/* ── Estados vacíos / carga ── */
.sg-search-empty,
.sg-search-loading{
  padding: 46px 24px;
  text-align: center;
  color: rgba(232, 228, 218, 0.55);
  font-size: 14px;
}
.sg-search-empty-ico{
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 1px solid rgba(196, 163, 90, 0.25);
  color: rgba(196, 163, 90, 0.7);
  margin-bottom: 14px;
}
.sg-search-empty strong{
  color: var(--txt, #e8e4da);
}
.sg-search-empty-sub{
  margin-top: 6px;
  font-size: 12.5px;
  color: rgba(232, 228, 218, 0.35);
}
.sg-spin{
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(196, 163, 90, 0.25);
  border-top-color: var(--gold, #c4a35a);
  border-radius: 50%;
  vertical-align: -4px;
  margin-right: 8px;
  animation: sg-spin-rot .7s linear infinite;
}
@keyframes sg-spin-rot{
  to{ transform: rotate(360deg); }
}

/* ── Pie (atajos) ── */
.sg-search-foot{
  display: flex;
  gap: 16px;
  padding: 9px 18px;
  border-top: 1px solid rgba(196, 163, 90, 0.12);
  font-size: 11px;
  color: rgba(232, 228, 218, 0.4);
}
.sg-search-foot kbd{
  font: 11px/1.5 ui-monospace, monospace;
  padding: 1px 5px;
  border: 1px solid rgba(196, 163, 90, 0.25);
  border-radius: 4px;
  color: rgba(232, 228, 218, 0.6);
  margin-right: 2px;
}
.sg-search-foot-note{
  margin-left: auto;
}

/* ── Móvil ── */
@media (max-width: 640px){
  .sg-search{
    padding: 10px 10px 10px;
    align-items: flex-start;
  }
  .sg-search-panel{
    width: 100%;
    max-height: min(86vh, 640px);
    border-radius: 12px;
  }
  .sg-search-head{
    padding: 12px 14px;
  }
  .sg-search-row{
    padding: 10px 14px;
  }
  .sg-search-foot-note{
    display: none;
  }
}
