/* ==========================================================
   components/search.css — 학교 검색
   .sbox > .sfield(입력창) + .sdrop(자동완성 목록 > .sopt)
   .sheet-search(헤더에서 여는 검색 오버레이, 모바일은 전체 화면)
     제목·닫기 → 학교급 → 입력창 → 결과 순서
   동작은 components/search.js
   ========================================================== */

.sbox { position: relative; }

/* ---------- 입력창 ---------- */
.sfield {
  position: relative; display: flex; align-items: center; gap: 10px;
  height: 58px; padding: 0 7px 0 16px; border-radius: 18px; background: #fff;
  box-shadow: inset 0 0 0 2px var(--navy), 0 16px 34px -18px rgba(22, 33, 62, .45);
  transition: box-shadow .2s;
}
.sfield:focus-within { box-shadow: inset 0 0 0 2px var(--brand), var(--focus-ring), 0 16px 34px -18px rgba(232, 86, 26, .45); }
.sfield > .ico { width: 22px; height: 22px; color: var(--navy); stroke-width: 2.3; }
.sfield input {
  flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none;
  font-size: 16px; font-weight: 700; letter-spacing: -.02em; color: var(--ink);
}
.sfield input::placeholder { color: var(--ink-4); font-weight: 600; }
.sfield input::-webkit-search-cancel-button { display: none; }
.s-clear { width: 36px; height: 36px; flex: none; border-radius: 10px; display: grid; place-items: center; color: var(--ink-4); }
.s-clear:hover { background: var(--surface-2); color: var(--ink-2); }
.s-go { width: 44px; height: 44px; padding: 0; border-radius: 13px; }
.s-go span { display: none; }

@media (min-width: 480px) {
  .s-go { width: auto; padding: 0 18px; }
  .s-go span { display: inline; }
}
@media (min-width: 768px) {
  .sfield { height: 66px; padding-left: 22px; border-radius: 20px; }
  .sfield input { font-size: 18.5px; }
  .s-go { height: 50px; padding: 0 22px; border-radius: 14px; font-size: 16px; }
}

/* ---------- 자동완성 목록 ---------- */
.sdrop {
  position: absolute; left: 0; right: 0; top: calc(100% + 8px); z-index: 40;
  max-height: min(62vh, 470px); overflow-y: auto; padding: 8px;
  background: #fff; border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow-pop);
}
/* 모달·오버레이 안에서는 목록을 펼친 채로 둔다 */
.sbox.is-inline .sdrop { position: static; max-height: none; margin-top: 10px; padding: 0; border: 0; box-shadow: none; }

.sdrop-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 6px; font-size: 12.5px; font-weight: 800; color: var(--ink-4); }
.sdrop-head button { min-height: 28px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); }

.sopt { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; border-radius: 13px; text-align: left; transition: background .12s; }
.sopt:hover, .sopt.is-active { background: var(--surface-2); }
.sopt-ico {
  width: 38px; height: 38px; flex: none; border-radius: 12px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-deep); font-size: 13px; font-weight: 800;
}
.sopt-ico.is-recent { background: var(--surface-2); color: var(--ink-4); }
.sopt-main { min-width: 0; flex: 1; }
.sopt-name { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15.5px; font-weight: 800; letter-spacing: -.03em; color: var(--ink); }
.sopt-name mark { background: none; color: var(--brand-deep); }
.sopt-sub { display: block; margin-top: 1px; font-size: 12.5px; color: var(--ink-3); }
.sopt-rank { flex: none; text-align: right; line-height: 1.25; }
.sopt-rank b { display: block; font-size: 14px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.sopt-rank span { font-size: 11.5px; font-weight: 700; color: var(--ink-4); }

/* 검색 결과 없음 (기획서 7장 문구) */
.sempty { padding: 24px 14px 22px; text-align: center; }
.sempty .ico { width: 34px; height: 34px; margin: 0 auto 8px; color: var(--ink-4); }
.sempty b { display: block; font-size: 15px; font-weight: 800; }
.sempty p { margin-top: 4px; font-size: 13.5px; color: var(--ink-3); }

/* ---------- 헤더 검색 오버레이 ---------- */
.sheet-search {
  position: fixed; inset: 0; z-index: 140; display: flex; justify-content: center; align-items: flex-start;
  padding: 12px; background: rgba(29, 36, 51, .34); opacity: 0; pointer-events: none; transition: opacity .2s;
}
.sheet-search.open { opacity: 1; pointer-events: auto; }
.sheet-search-panel {
  width: 100%; max-width: 640px; margin-top: 6vh; padding: 16px; border-radius: 24px; background: #fff;
  box-shadow: 0 30px 70px -20px rgba(29, 36, 51, .45);
  transform: translateY(-10px); transition: transform .24s var(--ease);
}
.sheet-search.open .sheet-search-panel { transform: none; }
.sheet-search-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: -4px -4px 8px 4px; }
.sheet-search-head strong { font-size: 17px; font-weight: 800; letter-spacing: -.03em; }
.sheet-search .sfield { height: 54px; box-shadow: inset 0 0 0 2px var(--navy); }
.sheet-search .sfield:focus-within { box-shadow: inset 0 0 0 2px var(--brand), var(--focus-ring); }
.sheet-search .sdrop { max-height: 60vh; overflow-y: auto; }
.sheet-scope { margin-bottom: 12px; }
body.search-open { overflow: hidden; }

@media (max-width: 767px) {
  .sheet-search { padding: 0; background: #fff; }
  .sheet-search-panel { max-width: none; min-height: 100%; margin: 0; padding: 12px 12px 24px; border-radius: 0; box-shadow: none; }
  .sheet-search .sdrop { max-height: none; }
}
