/* dramas.icu — header search (v3.7.x) — colors inherit site CSS variables (pink-purple system) */

/* ---------- Search box placement ---------- */
.nav-search { position: static; display: flex; align-items: center; }
.search-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; padding: 0;
  background: none; border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); cursor: pointer; transition: border-color .15s ease, color .15s ease;
}
.search-icon:hover { border-color: var(--accent); color: var(--accent); }
.search-box { display: none; position: relative; }

/* Desktop: inline search between logo and nav */
@media (min-width: 768px) {
  .nav-search { position: relative; }
  .search-box { display: block; }
  .search-icon { display: none; }
}

/* ---------- Input ---------- */
.search-box input[type="search"] {
  width: min(260px, 26vw);
  padding: 9px 16px 9px 38px;
  border: 1px solid var(--border); border-radius: 999px;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23D946EF' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cline x1='16.5' y1='16.5' x2='21' y2='21'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 13px center;
  background-size: 16px 16px;
  color: var(--text);
  font-size: .88rem; font-family: inherit; line-height: 1.2;
  outline: none; -webkit-appearance: none; appearance: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.search-box input[type="search"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
  background-color: var(--surface);
}
.search-box input[type="search"]::-webkit-search-cancel-button { cursor: pointer; }

/* ---------- Mobile expanded row (below header, full width) ---------- */
@media (max-width: 767px) {
  .nav-search.open .search-box {
    display: block; position: absolute;
    top: var(--nav-h); left: 0; right: 0;
    padding: 10px 20px 12px;
    background: var(--surface); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
  }
  .nav-search.open .search-box input[type="search"] { width: 100%; }
  .nav-search.open .search-dropdown { left: 0; right: 0; width: auto; max-width: none; }
}

/* ---------- Dropdown results ---------- */
.search-dropdown {
  display: none;
  position: absolute; top: calc(100% + 6px); left: 0;
  width: 330px; max-width: calc(100vw - 40px);
  max-height: min(420px, 60vh); overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 6px 22px rgba(0,0,0,.12); z-index: 60;
}
.search-dropdown.show { display: block; }
.search-result {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.search-result:last-child { border-bottom: 0; }
.search-result img {
  width: 34px; height: 50px; object-fit: cover; border-radius: 4px;
  background: #f0f0f2; flex: 0 0 auto;
}
.sr-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sr-noimg { width: 34px; height: 50px; border-radius: 4px; background: var(--accent-soft); flex: 0 0 auto; }
.sr-title {
  font-weight: 600; font-size: .88rem; line-height: 1.3; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sr-tags { color: var(--text-2); font-size: .74rem; }
.search-result:hover, .search-result.is-active { background: var(--accent-soft); }
.search-empty { padding: 14px 16px; color: var(--text-2); font-size: .86rem; }
