/* ─────────────────────────────────────────────────────────────
   GLOBAL SEARCH — MINIMAL POWER EDITION
   ───────────────────────────────────────────────────────────── */

[hidden] { display: none !important; }

.search-section {
  width: 100%;
  padding: 1rem;
  box-sizing: border-box;
  display: flex;
  justify-content: center;
  position: relative;
  z-index: 100;
  margin-bottom: 1rem;
}

.adv-search-wrapper {
  position: relative;
  width: 100%;
  max-width: 620px;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  margin: 0 auto;
}

/* ── Input Box ── */
.adv-search-box {
  display: flex;
  align-items: center;
  position: relative;
  width: 100%;
  height: 3.4rem;
  border-radius: 1.1rem;
  background: #ffffff;
  border: 1.5px solid #e8e8ed;
  box-shadow:
    0 1px 2px rgba(0,0,0,0.04),
    0 4px 16px rgba(0,0,0,0.04);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
  overflow: hidden;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='620' height='54'%3E%3Cpolygon points='0,0 60,0 0,54' fill='%236c63ff' fill-opacity='0.04'/%3E%3Cpolygon points='620,0 560,0 620,54' fill='%23ff6b9d' fill-opacity='0.04'/%3E%3Cline x1='0' y1='54' x2='54' y2='0' stroke='%236c63ff' stroke-opacity='0.03' stroke-width='1'/%3E%3C/svg%3E");
  background-size: cover;
  background-repeat: no-repeat;
}

.adv-search-box:focus-within {
  border-color: var(--tool-color, #6c63ff);
  box-shadow:
    0 0 0 3.5px color-mix(in srgb, var(--tool-color, #6c63ff) 12%, transparent),
    0 8px 24px rgba(0,0,0,0.07);
}

.adv-search-icon {
  width: 1.2rem;
  height: 1.2rem;
  margin-left: 1.15rem;
  color: color-mix(in srgb, var(--tool-color, #6c63ff) 60%, #aaa);
  flex-shrink: 0;
  transition: color 0.2s ease;
}

.adv-search-box:focus-within .adv-search-icon {
  color: var(--tool-color, #6c63ff);
}

.adv-search-input {
  flex: 1;
  height: 100%;
  border: none !important;
  outline: none !important;
  background: transparent !important;
  padding: 0 0.85rem;
  font-size: 1rem;
  font-weight: 450;
  color: #111;
  box-shadow: none !important;
  min-width: 0;
  letter-spacing: -0.01em;
}

.adv-search-input::placeholder {
  color: #b0b0bb;
  font-weight: 400;
}

.adv-search-clear {
  background: transparent;
  border: none;
  outline: none !important;
  cursor: pointer;
  padding: 0 1rem 0 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #c0c0cc;
  transition: color 0.18s ease;
}

.adv-search-clear:hover {
  color: var(--tool-color, #6c63ff);
}

/* ── Spinner ── */
.adv-search-spinner {
  width: 1.1rem;
  height: 1.1rem;
  margin-right: 1.1rem;
  border: 2px solid #eee;
  border-top-color: var(--tool-color, #6c63ff);
  border-radius: 50%;
  animation: adv-spin 0.7s linear infinite;
  flex-shrink: 0;
}

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

/* ── Dropdown ── */
.adv-search-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  width: 100%;
  background: #ffffff;
  border-radius: 1.25rem;
  border: 1.5px solid #ebebf0;
  box-shadow:
    0 4px 6px rgba(0,0,0,0.02),
    0 12px 40px rgba(0,0,0,0.09);
  max-height: 420px;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 200;
  padding: 0.5rem;
  box-sizing: border-box;
}

.adv-search-dropdown::-webkit-scrollbar { width: 4px; }
.adv-search-dropdown::-webkit-scrollbar-track { background: transparent; }
.adv-search-dropdown::-webkit-scrollbar-thumb {
  background: #e0e0e8;
  border-radius: 99px;
}

.adv-search-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ── Result Item ── */
.adv-search-item {
  display: flex;
  align-items: center;
  padding: 0.7rem 0.75rem;
  text-decoration: none;
  border-radius: 0.8rem;
  gap: 0.85rem;
  transition:
    background 0.15s ease,
    transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
  background: transparent;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
}

.adv-search-item::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='60'%3E%3Cpolygon points='0,0 18,0 0,18' fill='%236c63ff' fill-opacity='0.05'/%3E%3Cpolygon points='100,60 82,60 100,42' fill='%23ff6b9d' fill-opacity='0.04'/%3E%3C/svg%3E");
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.adv-search-item:hover {
  background: color-mix(in srgb, var(--tool-color, #6c63ff) 5%, #f8f8fc);
  transform: translateX(2px);
}

.adv-search-item:hover::before {
  opacity: 1;
}

/* ── Media: IconSVG ── */
/* ── Media: IconSVG ── */
.adv-search-media {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--tool-color, #6c63ff) 6%, transparent);
  border: 1px solid color-mix(in srgb, var(--tool-color, #6c63ff) 8%, transparent);
  position: relative;
  overflow: hidden;
}

/* kill the fake shine overlay */
.adv-search-media::after {
  display: none;
}

.adv-search-media svg {
  width: 1.3rem;
  height: 1.3rem;
  position: relative;
  z-index: 1;
}

/* ── Media: ImageURL — thumbnail ── */
.adv-search-media--image {
  background: transparent;
  border: none;
  border-radius: 0.65rem;
  overflow: hidden;
  padding: 0;
}

.adv-search-media--image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}


/* ── Text ── */
.adv-search-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.adv-search-title {
  font-weight: 600;
  color: #111;
  font-size: 0.92rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}

.adv-search-desc {
  font-size: 0.81rem;
  color: #888;
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Chevron hint ── */
.adv-search-item-arrow {
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
  color: #d0d0d8;
  transition: color 0.15s ease, transform 0.15s ease;
}

.adv-search-item:hover .adv-search-item-arrow {
  color: var(--tool-color, #6c63ff);
  transform: translateX(2px);
}

/* ── Section label ── */
.adv-search-section-label {
  padding: 0.6rem 0.75rem 0.3rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: color-mix(in srgb, var(--tool-color, #6c63ff) 55%, #aaa);
}

/* ── Empty state ── */
.adv-search-empty {
  padding: 2.8rem 1rem;
  text-align: center;
  color: #aaa;
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.adv-search-empty-icon {
  width: 2rem;
  height: 2rem;
  color: #ddd;
  margin-bottom: 0.25rem;
}

.adv-search-query-text {
  font-weight: 600;
  color: var(--tool-color, #6c63ff);
}

/* ── Keyboard highlight ── */
.adv-search-item--active {
  background: color-mix(in srgb, var(--tool-color, #6c63ff) 7%, #f6f6fc);
}

.adv-search-item--active::before {
  opacity: 1;
}

/* ── Mobile ── */
@media (max-width: 480px) {
  .adv-search-box {
    height: 3rem;
    border-radius: 0.9rem;
  }
  .adv-search-dropdown {
    border-radius: 1rem;
  }
  .adv-search-item {
    padding: 0.65rem 0.65rem;
  }
  .adv-search-media {
    width: 2rem;
    height: 2rem;
    border-radius: 0.5rem;
  }
  .adv-search-title { font-size: 0.88rem; }
  .adv-search-desc  { font-size: 0.78rem; }
}
