/* ── 사이트 네비게이션 ── */
.site-nav {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.site-nav a {
  padding: 5px 16px;
  border: 1px solid rgba(180,150,220,0.4);
  border-radius: 20px;
  font-size: 0.75rem;
  color: #a090c0;
  text-decoration: none;
  transition: all 0.2s;
  letter-spacing: 0.06em;
}
.site-nav a:hover { border-color: #c9a0dc; color: #7b6fa0; }
.site-nav a.active {
  background: rgba(201,160,220,0.18);
  border-color: #c9a0dc;
  color: #7b6fa0;
  font-weight: 600;
}

/* ── 검색 페이지 레이아웃 ── */
.search-main {
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ── 검색 패널 ── */
.search-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* 태그 입력 */
.tag-input-area { position: relative; }
.tag-input-label {
  font-size: 0.72rem;
  color: #a090c0;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.tag-input-label small {
  color: #c0b0d8;
  margin-left: 6px;
  font-size: 0.65rem;
}

.tag-pill-wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid rgba(180,150,220,0.4);
  border-radius: 14px;
  background: rgba(255,255,255,0.6);
  cursor: text;
  transition: border-color 0.2s;
}
.tag-pill-wrap:focus-within { border-color: #c9a0dc; }

.pills { display: flex; flex-wrap: wrap; gap: 5px; }

.tag-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 10px;
  background: linear-gradient(135deg, rgba(201,160,220,0.25), rgba(160,184,240,0.25));
  border: 1px solid rgba(180,150,220,0.5);
  border-radius: 20px;
  font-size: 0.75rem;
  color: #5a4880;
  white-space: nowrap;
}
.pill-del {
  background: none;
  border: none;
  cursor: pointer;
  color: #c9a0dc;
  font-size: 0.65rem;
  padding: 0;
  line-height: 1;
}
.pill-del:hover { color: #8b5e9e; }

#tag-input {
  flex: 1;
  min-width: 140px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 0.83rem;
  color: #4a4060;
}
#tag-input::placeholder { color: #c0b0d8; }

/* 자동완성 */
.autocomplete-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(180,150,220,0.4);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(140,120,200,0.15);
  z-index: 100;
  overflow: hidden;
}
.autocomplete-list.hidden { display: none; }
.ac-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.8rem;
  transition: background 0.15s;
}
.ac-item:hover, .ac-item.selected { background: rgba(201,160,220,0.12); }
.ac-tag { color: #4a4060; }
.ac-count { color: #b0a0c8; font-size: 0.68rem; }

/* 필터 행 */
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  align-items: flex-start;
}
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-label {
  font-size: 0.7rem;
  color: #a090c0;
  letter-spacing: 0.08em;
}

.rating-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}
.rating-checks label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.77rem;
  color: #6a5888;
  cursor: pointer;
}
.rating-checks input[type=checkbox] { accent-color: #c9a0dc; }

#sort-select, #min-score {
  padding: 6px 10px;
  border: 1px solid rgba(180,150,220,0.4);
  border-radius: 10px;
  background: rgba(255,255,255,0.6);
  font-size: 0.79rem;
  color: #4a4060;
  outline: none;
  transition: border-color 0.2s;
}
#sort-select:focus, #min-score:focus { border-color: #c9a0dc; }

/* 검색 버튼 */
#search-btn {
  align-self: flex-end;
  background: linear-gradient(135deg, #c9a0dc, #a0b8f0);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 10px 28px;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
}
#search-btn:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
#search-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* 검색 상태 */
.search-status {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 40px 0;
}
.search-status.hidden { display: none; }
.search-status .spinner { font-size: 2rem; animation: spin 1.8s linear infinite; }
.search-status p { font-size: 0.82rem; color: #a090c0; }
@keyframes spin { to { transform: rotate(360deg); } }

/* 결과 정보 */
.result-info {
  font-size: 0.75rem;
  color: #b0a0c8;
  text-align: right;
}
.result-info.hidden { display: none; }

/* 결과 없음 */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px;
  color: #b0a0c8;
  font-size: 0.85rem;
}

/* ── 결과 그리드 ── */
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}

.grid-card {
  background: rgba(255,255,255,0.45);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: 14px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  animation: fadeUp 0.3s ease both;
}
.grid-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(160,140,200,0.25);
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* 등급별 왼쪽 테두리 */
.grid-card.rating-g { border-left: 3px solid #6aba6a; }
.grid-card.rating-s { border-left: 3px solid #d4a840; }
.grid-card.rating-q { border-left: 3px solid #d46060; }
.grid-card.rating-e { border-left: 3px solid #c060c0; }

.grid-thumb-wrap {
  position: relative;
  background: #f0eaff;
  aspect-ratio: 1;
  overflow: hidden;
}
.grid-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s;
}
.grid-card:hover .grid-thumb { transform: scale(1.04); }

.thumb-error .grid-thumb { display: none; }
.thumb-error::after {
  content: '이미지 없음';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: #c0b0d8;
}

.grid-score {
  position: absolute;
  bottom: 4px;
  right: 6px;
  font-size: 0.65rem;
  color: white;
  background: rgba(0,0,0,0.45);
  border-radius: 8px;
  padding: 1px 5px;
}
.grid-rating-badge {
  position: absolute;
  top: 5px;
  left: 6px;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1px 5px;
  border-radius: 6px;
  background: rgba(0,0,0,0.35);
  color: white;
}

.grid-info {
  padding: 6px 8px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-height: 36px;
}
.grid-char {
  font-size: 0.68rem;
  color: #7060a0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.grid-artist {
  font-size: 0.64rem;
  color: #9080b0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 페이지네이션 ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}
.pagination.hidden { display: none; }
.pagination button {
  padding: 7px 18px;
  border: 1px solid rgba(180,150,220,0.4);
  border-radius: 10px;
  background: rgba(255,255,255,0.5);
  color: #7b6fa0;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
}
.pagination button:hover:not(:disabled) {
  background: rgba(201,160,220,0.18);
  border-color: #c9a0dc;
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
#page-info { font-size: 0.78rem; color: #a090c0; }

/* ── 라이트박스 ── */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lightbox.hidden { display: none; }

.lb-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(30,20,50,0.7);
  backdrop-filter: blur(4px);
}

.lb-panel {
  position: relative;
  z-index: 1;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 20px;
  max-width: 640px;
  width: calc(100% - 32px);
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 20px 60px rgba(100,80,160,0.35);
}

.lb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.1rem;
  color: #9080b0;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}
.lb-close:hover { background: rgba(180,150,220,0.15); }

#lb-img-link { display: block; }
#lb-img {
  width: 100%;
  max-height: 400px;
  object-fit: contain;
  border-radius: 12px;
  background: #f0eaff;
  display: block;
}

.lb-meta { display: flex; flex-direction: column; gap: 8px; }

.lb-tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}
.lb-cat {
  font-size: 0.65rem;
  color: #b0a0c8;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  width: 44px;
  flex-shrink: 0;
}
.lb-tag {
  padding: 3px 9px;
  border-radius: 14px;
  font-size: 0.72rem;
  text-decoration: none;
  transition: opacity 0.15s;
}
.lb-tag:hover { opacity: 0.75; }
.lb-tag-artist    { background: rgba(160,184,240,0.25); color: #4060a0; border: 1px solid rgba(160,184,240,0.5); }
.lb-tag-character { background: rgba(201,160,220,0.20); color: #6040a0; border: 1px solid rgba(201,160,220,0.5); }

.lb-meta-row {
  display: flex;
  gap: 12px;
  font-size: 0.72rem;
  color: #9080b0;
  padding-top: 4px;
}

.lb-actions { display: flex; gap: 8px; }
.lb-btn {
  padding: 6px 14px;
  background: rgba(201,160,220,0.15);
  border: 1px solid rgba(180,150,220,0.4);
  border-radius: 10px;
  font-size: 0.75rem;
  color: #7060a0;
  text-decoration: none;
  transition: background 0.2s;
}
.lb-btn:hover { background: rgba(201,160,220,0.3); }

/* ── 반응형 ── */
@media (max-width: 600px) {
  .result-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .filter-row { gap: 12px; }
  #search-btn { align-self: stretch; }
}
