/* =====================================================================
 * 제자리 — 울산대 캠퍼스 분실물 지도
 * (울산대 그린 테마 — ulsan-contests와 동일한 디자인 언어)
 * ===================================================================== */

:root {
  --navy: #0e4d2e;       /* 울산대 그린 (브랜드·헤더) */
  --navy-dark: #093a22;
  --accent: #14a058;     /* 인터랙션 그린 (링크·활성·숫자) */
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2733;
  --muted: #6b7686;
  --line: #e2e6ee;
  --found: #128a4c;   /* 주웠어요 */
  --lost: #d6363b;    /* 잃어버렸어요 */
  --radius: 12px;
  --shadow: 0 2px 10px rgba(20, 40, 80, 0.06);
}

* { box-sizing: border-box; }

html { scrollbar-gutter: stable; }

body {
  margin: 0;
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "맑은 고딕",
    system-ui, -apple-system, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--accent); text-decoration: none; }

.container { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* ── 헤더 ── */
header.site { background: var(--navy); color: #fff; }
header.site .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 14px;
  padding-bottom: 14px;
}
.brand { font-size: 1.25rem; font-weight: 800; letter-spacing: -0.02em; color: #fff; }
.brand small { display: block; font-size: 0.72rem; font-weight: 400; opacity: 0.8; }
.navBtn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #fff;
  font: inherit;
  font-size: 0.9rem;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
}
.navBtn:hover { background: rgba(255, 255, 255, 0.18); }

/* ── 히어로 ── */
.hero {
  background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%);
  color: #e9f4ee;
  padding: 22px 0 26px;
}
.hero h1 { margin: 0 0 6px; font-size: 1.5rem; }
.hero p { margin: 0; opacity: 0.9; font-size: 0.95rem; }
.hero b { color: #fff; }

/* ── 라이브 통계 바: 내용 너비만큼만, 항목 간 여유 있게 ── */
.statBar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px 18px;
  width: fit-content;          /* 내용 너비만큼만 (block이라 인라인 베이스라인 틈 없음) */
  background: var(--card); border: 1px solid var(--line);
  border-radius: 999px; padding: 8px 20px; margin: 14px 0;  /* 위·아래 간격 = .layout gap(14px) */
  font-size: 0.9rem; color: var(--text); box-shadow: var(--shadow);
}
.statBar b { color: var(--accent); font-weight: 700; }
.statResolved b { color: var(--found); }
.statDot { display: none; }   /* 점 구분 대신 간격으로 구분 */
.statToday {
  background: #eafaf0; color: var(--found);
  border-radius: 999px; padding: 3px 11px; font-weight: 600; font-size: 0.85rem;
}
.statToday b { color: var(--found); }

/* ── 지도 카드 ── */
.mapCard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px;
  margin: 18px 0 14px;
}
#map {
  height: 430px;
  border-radius: 8px;
}
.mapHint {
  margin: 9px 4px 2px;
  font-size: 0.84rem;
  color: var(--muted);
}
.dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
  vertical-align: middle; margin: -2px 2px 0 6px;
}
.dot.found { background: var(--found); }
.dot.lost { background: var(--lost); }

/* ── 툴바 / 칩 ── */
.toolbar { display: flex; align-items: center; justify-content: space-between; margin: 0 0 12px; }
/* 법적 경고 */
.legalWarn {
  font-size: 0.74rem;
  color: #8a4b4b;
  background: #fbf3f3;
  border: 1px solid #f0d8d8;
  border-radius: 8px;
  padding: 9px 11px;
  margin-top: 14px;
  line-height: 1.55;
}
.legalWarn b { color: #b5454f; }

/* 검색창 */
.searchBar { margin-bottom: 12px; }
.searchBar input {
  width: 100%;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.searchBar input::placeholder { color: var(--muted); }
.searchBar input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px #cfeadd;
}
/* 기본 search 클리어 버튼 정리 */
.searchBar input::-webkit-search-cancel-button { cursor: pointer; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.catChips { margin-top: 8px; margin-bottom: 18px; }
.catChips .chip { font-size: 0.82rem; padding: 5px 11px; }
.catChips .chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip {
  font: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  cursor: pointer;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
.chip.active { background: var(--navy); border-color: var(--navy); color: #fff; }

/* ── 카드 목록 ── */
#list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 30px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  display: flex;
  gap: 12px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--accent); }
.card img {
  width: 64px; height: 64px;
  object-fit: cover;
  border-radius: 8px;
  background: #eef1f6;
  flex-shrink: 0;
}
.lostIcon {
  width: 64px; height: 64px; border-radius: 8px;
  background: #fdf0f0;
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; flex-shrink: 0;
}
.card .info { flex: 1; min-width: 0; }
.card .cat { margin-bottom: 2px; }
.card .desc {
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card .meta { font-size: 0.8rem; color: var(--muted); }

/* 상태 배지 (D-day 필 스타일) */
.pill {
  display: inline-block;
  font-size: 0.74rem; font-weight: 800;
  padding: 2px 9px; border-radius: 999px;
}
.pill.inplace { background: #e4f5ec; color: var(--found); }
.pill.taken { background: #e6f4ec; color: var(--navy); }
.pill.lostP { background: #fde8e8; color: var(--lost); }

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 40px 16px;
  background: var(--card);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ── 버튼 ── */
button {
  font: inherit;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  padding: 9px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}
button.primary { background: var(--found); border-color: var(--found); color: #fff; font-weight: 700; }
button.primary:hover { filter: brightness(0.93); }
button.warn { background: var(--lost); border-color: var(--lost); color: #fff; font-weight: 700; }
button.warn:hover { filter: brightness(0.93); }
button.ghost { background: transparent; color: var(--muted); }
button.ghost:hover { background: #e8f6ee; color: var(--accent); }

/* ── 모달 ── */
.modal {
  position: fixed; inset: 0;
  background: rgba(15, 30, 50, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal.hidden, .hidden { display: none !important; }
.modal-box {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 10px 36px rgba(20, 40, 80, 0.18);
  padding: 22px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-box h3 { margin: 0 0 4px; color: var(--navy); font-size: 1.15rem; }
.hint { font-size: 0.8rem; color: var(--muted); margin: 6px 0; }
.req { color: var(--lost); }
.nudge {
  background: #fff7e6;
  border: 1px solid #ffe3a3;
  color: #875c10;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.82rem;
  margin: 12px 0 0;
}

form label { display: block; font-size: 0.83rem; color: var(--muted); font-weight: 600; margin: 13px 0 0; }
form input[type="text"] {
  width: 100%;
  margin-top: 5px;
  padding: 10px 11px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font: inherit;
  font-size: 0.95rem;
}
form input[type="text"]:focus { outline: 2px solid #cfeadd; border-color: var(--accent); }
/* 사진 업로드 드롭존 */
.fieldLabel { display: block; font-size: 0.83rem; color: var(--muted); font-weight: 600; margin: 13px 0 0; }
.dropzone {
  display: block;
  margin-top: 6px;
  border: 1.5px dashed var(--line);
  border-radius: 10px;
  background: #f7f9fc;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  overflow: hidden;
}
.dropzone:hover { border-color: var(--accent); background: #f0f6ff; }
.dropzoneInner {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 20px 12px;
  text-align: center;
}
.dropIcon { font-size: 26px; }
.dropText { font-size: 0.9rem; font-weight: 700; color: var(--text); }
.dropSub { font-size: 0.76rem; color: var(--muted); }
.dropThumbs { display: none; flex-wrap: wrap; gap: 8px; padding: 10px; }
.dropThumbs.show { display: flex; }
.dropThumb {
  position: relative;
  width: 70px; height: 70px;
  border-radius: 8px;
  background-size: cover; background-position: center;
  border: 1px solid var(--line);
}
.dropThumb .rep {
  position: absolute; left: 3px; bottom: 3px;
  font-size: 0.62rem; font-weight: 700;
  background: var(--accent); color: #fff;
  padding: 1px 5px; border-radius: 5px;
}
.dropAdd {
  width: 70px; height: 70px;
  border: 1.5px dashed var(--line); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: var(--muted);
}
.radioRow { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 7px; }
.radio { display: flex; gap: 6px; align-items: center; font-size: 0.88rem; color: var(--text); margin: 0; font-weight: 400; }

/* 종류 칩 */
.catRow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.catChip {
  display: flex; align-items: center;
  padding: 6px 12px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  font-size: 0.84rem;
  cursor: pointer;
  margin: 0;
  font-weight: 400;
  color: var(--text);
  transition: border-color 0.12s, background 0.12s;
}
.catChip input { display: none; }
.catChip:hover { border-color: #b9c8dd; }
.catChip:has(input:checked) { border-color: var(--accent); background: #f0f6ff; font-weight: 700; }

/* 선택지 카드 목록 */
.optList { display: flex; flex-direction: column; gap: 8px; margin-top: 7px; }
.opt {
  display: flex; align-items: center; gap: 10px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  cursor: pointer;
  margin: 0;
  font-weight: 400;
  transition: border-color 0.12s, background 0.12s;
}
.opt:hover { border-color: #b9c8dd; }
.opt:has(input:checked) { border-color: var(--accent); background: #f0f6ff; }
.opt input[type="radio"] { accent-color: var(--accent); width: 17px; height: 17px; flex-shrink: 0; }
.optTitle { font-size: 0.92rem; font-weight: 700; color: var(--text); }
.optDesc { font-size: 0.78rem; color: var(--muted); }
.actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* 보조/파괴적 동작(수정·삭제·내리기)은 왼쪽에 작은 텍스트 링크로 묶어 주요 버튼과 분리 */
.actLeft { margin-right: auto; display: flex; align-items: center; gap: 8px; }
.actions .adminLink,
.actions button.danger-link {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  padding: 6px 4px;
  white-space: nowrap;         /* 좁아도 글자 세로로 깨지지 않게 */
}
.actions .adminLink:hover,
.actions button.danger-link:hover { background: transparent; color: var(--lost); text-decoration: underline; }
.actions .adminLink { color: var(--lost); }              /* 운영자 삭제 = 빨강 */
.actions .adminLink.edit { color: var(--accent); }       /* 운영자 수정 = 파랑 */
.actions .adminLink.edit:hover { color: var(--accent); }

.dphoto { width: 100%; max-height: 280px; object-fit: contain; background: #f0f2f7; border-radius: 10px; margin: 10px 0 6px; }
.thumbs { display: flex; gap: 6px; margin: 2px 0 6px; }
.thumbs img {
  width: 54px; height: 54px;
  object-fit: cover;
  border-radius: 8px;
  border: 2px solid var(--line);
  cursor: pointer;
}
.thumbs img.active { border-color: var(--accent); }

/* ── 지도 핀 ── */
.pinWrap { background: none; border: none; }
.pin {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(20, 40, 80, 0.35);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: transform 0.12s;
}
.pin:hover { transform: scale(1.12); }
/* 사진은 img 태그 대신 div 배경으로 — Leaflet의 img 강제 스타일 회피 */
.pinFound {
  background-color: #e4f5ec;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  outline: 2px solid var(--found);
}
.pinLost {
  background: #fde8e8;
  outline: 2px solid var(--lost);
  font-size: 21px;
}

/* ── 클러스터 배지 ── */
.clusterWrap { background: none; border: none; }
.clusterIcon {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  display: flex; align-items: center; justify-content: center;
  border: 3px solid #fff;
  box-shadow: 0 2px 8px rgba(20, 40, 80, 0.35);
  cursor: pointer;
  transition: transform 0.12s;
}
.clusterIcon:hover { transform: scale(1.1); }

/* ── 지도 클릭 팝업 ── */
.pickPop .leaflet-popup-content-wrapper {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: 0 6px 24px rgba(20, 40, 80, 0.2);
}
.pickPop .leaflet-popup-tip { background: var(--card); }
.pickPop .leaflet-popup-content { margin: 10px; }
.pickButtons { display: flex; gap: 8px; }
.pp {
  font-size: 0.9rem; font-weight: 700; padding: 10px 13px; border-radius: 9px;
  border: none; cursor: pointer; white-space: nowrap;
}
.pp.found { background: var(--found); color: #fff; }
.pp.lost { background: var(--lost); color: #fff; }

/* ── 카톡 버튼 ── */
.kakaoBtn {
  display: block; text-align: center; margin: 12px 0 4px; cursor: pointer;
  background: #fee500; color: #191919; font-weight: 800; text-decoration: none;
  padding: 13px; border-radius: 10px; font-size: 0.95rem;
}
.kakaoBtn:hover { filter: brightness(0.96); }

/* ── 내 신고 ── */
.matchCard {
  padding: 11px 13px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 7px;
  font-size: 0.9rem;
  cursor: pointer;
}
.matchCard:hover { border-color: var(--accent); }
.matchCard .meta { color: var(--muted); font-size: 0.78rem; }

/* ── 푸터 ── */
footer.site {
  background: #fff;
  border-top: 1px solid var(--line);
  margin-top: 10px;
  padding: 22px 0;
  color: var(--muted);
  font-size: 0.84rem;
}

/* ── 헤더 내비 ── */
.sitenav { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; }
.sitenav a { color: #fff; opacity: 0.9; font-size: 0.92rem; text-decoration: none; }
.sitenav a:hover { opacity: 1; }
.sitenav a.cross-link {
  background: rgba(255, 255, 255, 0.16);
  padding: 5px 12px;
  border-radius: 999px;
  opacity: 1;
}
.sitenav a.cross-link:hover { background: rgba(255, 255, 255, 0.28); }

/* ── 콘텐츠 페이지 (이용안내·문의·방침) ── */
.prose {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  margin: 20px 0;
}
.prose h1 { font-size: 1.4rem; color: var(--navy); margin: 0 0 10px; }
.prose h2 { font-size: 1.08rem; color: var(--navy); margin: 1.6em 0 0.5em; }
.prose ul { padding-left: 1.2em; margin: 0.4em 0; }
.prose li { margin: 5px 0; }
.prose p { margin: 0.6em 0; }
.back-link { font-size: 0.9rem; margin-top: 20px; }
.form-grid { display: grid; gap: 12px; max-width: 560px; margin-top: 16px; }
.form-grid label { display: block; font-size: 0.85rem; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.form-grid input, .form-grid textarea, .form-grid select {
  width: 100%; padding: 10px 11px; border: 1px solid var(--line);
  border-radius: 8px; font-size: 0.95rem; font-family: inherit; background: #fff; color: var(--text);
}
.form-grid textarea { min-height: 110px; resize: vertical; }

/* ── 푸터 링크 ── */
footer.site a { color: var(--muted); margin-right: 14px; text-decoration: none; font-size: 0.86rem; }
footer.site a:hover { color: var(--accent); }
footer.site .copyright { margin-top: 10px; }

/* ── 페이지네이션 ── */
.pagination { display: flex; justify-content: center; gap: 6px; margin: 18px 0 24px; flex-wrap: wrap; }
.pageBtn {
  min-width: 38px; padding: 8px 12px;
  border: 1px solid var(--line); background: var(--card);
  border-radius: 8px; cursor: pointer;
  font: inherit; font-size: 0.9rem; color: var(--text);
}
.pageBtn:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pageBtn.active { background: var(--navy); border-color: var(--navy); color: #fff; font-weight: 700; }
.pageBtn:disabled { opacity: 0.4; cursor: default; }

/* ── 토스트 ── */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: var(--navy); color: #fff; font-weight: 600; font-size: 0.9rem;
  padding: 11px 20px; border-radius: 10px; z-index: 2000;
  box-shadow: 0 6px 20px rgba(20, 40, 80, 0.25);
}

/* ── PC 와이드: 지도 위 + 카드 그리드 아래 (글이 한눈에) ── */
@media (min-width: 1100px) {
  .container { max-width: 1160px; }
  #map { height: 460px; }
  .listPane .toolbar { margin: 4px 0 14px; }
  #list { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .card { min-width: 0; }
}

/* ── 반응형 ── */
@media (max-width: 760px) {
  #list { grid-template-columns: 1fr; }
  #map { height: 46vh; }

  /* 히어로 압축 — 지도까지 빨리 닿게 */
  .hero { padding: 12px 0 14px; }
  .hero h1 { font-size: 1.15rem; margin-bottom: 3px; }
  .hero p { font-size: 0.84rem; line-height: 1.5; }

  /* 범례 한 줄 정리 */
  .mapHint { font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* 카테고리 칩: 8개라 wrap 대신 가로 스크롤 한 줄(스와이프) */
  .catChipsWrap { position: relative; margin: 8px 0 14px; }
  .catChips {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;            /* Firefox */
    margin: 0;
  }
  .catChips::-webkit-scrollbar { display: none; }   /* Chrome/Safari */
  .catChips .chip { flex: 0 0 auto; white-space: nowrap; }
  /* 오른쪽 페이드 = "더 있어요" 힌트, 끝까지 스크롤하면 사라짐 */
  .catChipsWrap::after {
    content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 36px;
    background: linear-gradient(to right, rgba(244, 246, 250, 0), var(--bg));
    pointer-events: none; opacity: 1; transition: opacity 0.18s;
  }
  .catChipsWrap.atEnd::after { opacity: 0; }

  /* 통계바: 모바일에서도 한 줄 유지 — 줄바꿈 막고 폰트·간격·여백 압축 */
  .statBar {
    width: auto; justify-content: center; flex-wrap: nowrap;
    gap: 0 8px; padding: 7px 10px; font-size: 0.72rem;
  }
  .statBar > span { flex-shrink: 0; white-space: nowrap; }  /* 항목·숫자 절대 안 쪼개짐 */
  .statToday { padding: 2px 8px; font-size: 0.72rem; }

  /* 카드 제목 두 줄까지 허용 */
  .card .desc {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
}
@media (max-width: 480px) {
  /* 헤더 중앙정렬 — 한눈에와 통일 */
  header.site .container { justify-content: center; text-align: center; padding-top: 12px; padding-bottom: 12px; }
  .sitenav { width: 100%; display: flex; flex-wrap: wrap; justify-content: center; }
  .sitenav a { margin: 0 6px; }
  .hero { text-align: center; }   /* 헤더와 같은 가운데 정렬 (따로 노는 느낌 제거) */

  form input[type="text"] { min-height: 44px; font-size: 16px; } /* iOS 자동확대 방지 */
  .actions > button { min-height: 44px; flex: 1; }          /* 오른쪽 주요 버튼(닫기·해결)만 넓게 */
  .actLeft button { flex: 0 0 auto; min-height: 0; }        /* 왼쪽 텍스트 링크는 작게 유지 */
  .radio { min-height: 36px; }
  .pp { min-height: 44px; font-size: 0.95rem; }

  /* 모달 → 바텀시트 */
  .modal { align-items: flex-end; padding: 0; }
  .modal-box {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 88vh;
    padding: 18px 18px 26px;
    animation: sheetUp 0.18s ease-out;
  }
  @keyframes sheetUp {
    from { transform: translateY(40px); opacity: 0.6; }
    to { transform: translateY(0); opacity: 1; }
  }
}
