/* ============================================================
   경기도 일자리맵 — 메인 화면 스타일
   참고 UI 패턴: Indeed(검색바+필터 칩), 잡코리아/원티드(카드형 리스트)
   ============================================================ */

:root {
  /* 색상 팔레트: 채용 서비스 특유의 신뢰감 있는 블루 계열 */
  --primary: #1a73d1;
  --primary-dark: #135ba8;
  --primary-light: #e8f1fb;
  --accent-public: #0f766e;   /* 공공 배지 */
  --accent-public-bg: #e6f4f2;
  --accent-private: #7c3aed;  /* 민간 배지 */
  --accent-private-bg: #f1ebfd;
  --danger: #dc2626;

  --text-strong: #1c2733;
  --text-body: #3d4a58;
  --text-muted: #79879a;
  --line: #e3e8ef;
  --bg-page: #f7f9fb;
  --bg-card: #ffffff;

  --radius: 10px;
  --shadow-card: 0 1px 3px rgba(28, 39, 51, 0.08);
  --shadow-pop: 0 8px 24px rgba(28, 39, 51, 0.16);

  --header-h: 64px;
  --filterbar-h: 52px;
  --list-w: 400px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: "Pretendard", "Noto Sans KR", "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  color: var(--text-body);
  background: var(--bg-page);
  font-size: 14px;
  line-height: 1.5;
  overflow: hidden; /* 페이지 자체 스크롤 방지 — 리스트/지도 내부 스크롤만 사용 */
}

button { font-family: inherit; cursor: pointer; }

/* 키보드 포커스 접근성 (마우스 클릭 시엔 표시 안 됨) */
:focus-visible {
  outline: 2.5px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}
.job-card:focus-visible { outline-offset: -1px; }

/* ===== 헤더 ===== */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
}

.header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 20px;
  max-width: 1600px;
  margin: 0 auto;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-strong);
  flex-shrink: 0;
}

.logo__pin { color: var(--primary); display: inline-flex; }

.logo__text {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.4px;
}

/* 검색바 */
.search {
  flex: 1;
  max-width: 620px;
  display: flex;
  align-items: center;
  height: 42px;
  border: 1.5px solid var(--line);
  border-radius: 8px;
  background: var(--bg-page);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px var(--primary-light);
}

.search__icon { margin: 0 10px 0 14px; color: var(--text-muted); flex-shrink: 0; }

.search__input {
  flex: 1;
  min-width: 0;
  border: none;
  outline: none;
  background: transparent;
  font-size: 14px;
  color: var(--text-strong);
}

.search__input::placeholder { color: var(--text-muted); }

.search__btn {
  height: 100%;
  padding: 0 20px;
  border: none;
  border-radius: 0 6.5px 6.5px 0;
  background: var(--primary);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  flex-shrink: 0;
}

.search__btn:hover { background: var(--primary-dark); }

/* ===== 필터 칩 바 ===== */
.filterbar {
  border-top: 1px solid var(--line);
  background: var(--bg-card);
}

.filterbar__inner {
  height: var(--filterbar-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 20px;
  max-width: 1600px;
  margin: 0 auto;
  overflow-x: auto;
  scrollbar-width: none;
}

.filterbar__inner::-webkit-scrollbar { display: none; }

.filter-chip { position: relative; flex-shrink: 0; }

.filter-chip__btn {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px 0 14px;
  border: 1.5px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-body);
  white-space: nowrap;
  transition: border-color 0.15s, background 0.15s;
}

.filter-chip__btn:hover { border-color: var(--text-muted); }

.filter-chip__btn .caret {
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.55;
  transition: transform 0.15s;
}

/* 값이 선택된 칩 / 드롭다운 열린 칩 */
.filter-chip.is-active .filter-chip__btn {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
}

.filter-chip.is-open .filter-chip__btn .caret { transform: rotate(180deg); }

/* 드롭다운 — filterbar 의 overflow 클리핑을 벗어나기 위해 fixed, 좌표는 JS 가 지정 */
.filter-chip__menu {
  position: fixed;
  top: 0;
  left: 0;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 6px;
  z-index: 200;
  display: none;
  transform-origin: top left;
  animation: chipMenuIn 0.13s ease;
}

@keyframes chipMenuIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.filter-chip.is-open .filter-chip__menu { display: block; }

.filter-chip__option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 7px;
  background: none;
  font-size: 13.5px;
  color: var(--text-body);
  text-align: left;
}

.filter-chip__option:hover { background: var(--bg-page); }

.filter-chip__option.is-selected {
  color: var(--primary-dark);
  font-weight: 700;
  background: var(--primary-light);
}

.filter-chip__option.is-selected::after {
  content: "✓";
  font-size: 12px;
}

.filter-reset {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 12px;
  border: none;
  border-radius: 999px;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  flex-shrink: 0;
}

.filter-reset:hover { color: var(--danger); }

.filter-reset[hidden] { display: none; }

/* ===== 본문 레이아웃 ===== */
.content {
  display: flex;
  height: 100vh;
  padding-top: calc(var(--header-h) + var(--filterbar-h));
}

/* ----- 좌측 리스트 패널 ----- */
.panel-list {
  width: var(--list-w);
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg-page);
  border-right: 1px solid var(--line);
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
}

.list-head__count { font-size: 14px; color: var(--text-body); }

.list-head__count strong { color: var(--primary); font-weight: 800; }

.list-head__sort {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  padding: 6px 10px;
  font-size: 12.5px;
  color: var(--text-body);
  font-family: inherit;
}

.job-list {
  list-style: none;
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain; /* 리스트 끝에서 페이지가 같이 스크롤되지 않게 */
  padding: 2px 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: #c6d0dc transparent;
}

/* 슬림 스크롤바 (webkit) */
.job-list::-webkit-scrollbar { width: 8px; }
.job-list::-webkit-scrollbar-thumb {
  background: #c6d0dc;
  border-radius: 4px;
  border: 2px solid var(--bg-page);
}
.job-list::-webkit-scrollbar-thumb:hover { background: #aab7c6; }

/* ----- 채용공고 카드 ----- */
.job-card {
  background: var(--bg-card);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.job-card:hover {
  border-color: #b9c6d6;
  box-shadow: 0 3px 10px rgba(28, 39, 51, 0.12);
}

.job-card.is-selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light), var(--shadow-card);
}

.job-card__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.badge--public  { color: var(--accent-public);  background: var(--accent-public-bg); }
.badge--private { color: var(--accent-private); background: var(--accent-private-bg); }

.job-card__dday { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.job-card__dday.is-urgent { color: var(--danger); }

.job-card__title {
  font-size: 15.5px;
  font-weight: 700;
  color: var(--text-strong);
  letter-spacing: -0.3px;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.job-card__company { font-size: 13.5px; color: var(--text-body); margin-bottom: 10px; }

.job-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  font-size: 12.5px;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.job-card__meta span:not(:last-child)::after {
  content: "·";
  margin: 0 6px;
  color: var(--line);
}

.job-card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.job-card__salary {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-strong);
}

.job-card__link {
  flex-shrink: 0;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
}

.job-card__link:hover { background: var(--primary-light); text-decoration: underline; }

/* 로딩/에러 상태 (리스트 영역) */
.list-state {
  list-style: none;
  padding: 48px 20px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

.list-state--error { color: var(--danger); line-height: 1.8; }
.list-state--error small { color: var(--text-muted); }

/* 빈 결과 */
.list-empty {
  padding: 60px 20px;
  text-align: center;
}

.list-empty__title { font-size: 15px; font-weight: 700; color: var(--text-strong); margin-bottom: 6px; }
.list-empty__desc { font-size: 13px; color: var(--text-muted); }

/* ----- 우측 지도 패널 ----- */
.panel-map {
  flex: 1;
  position: relative;
  min-width: 0;
}

/* 지도 컨테이너 자체의 크기/위치 (플레이스홀더 여부와 무관하게 유지) */
#map {
  position: absolute;
  inset: 0;
}

.map-placeholder {
  background:
    linear-gradient(rgba(190, 205, 220, 0.25) 1px, transparent 1px),
    linear-gradient(90deg, rgba(190, 205, 220, 0.25) 1px, transparent 1px),
    linear-gradient(160deg, #eef3f8 0%, #e4ecf4 60%, #dbe6f0 100%);
  background-size: 48px 48px, 48px 48px, 100% 100%;
  overflow: hidden;
}

.map-placeholder__notice {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--text-muted);
  user-select: none;
  pointer-events: none;
}

.map-placeholder__notice p { margin-top: 6px; font-size: 15px; }
.map-placeholder__notice strong { color: var(--text-body); }
.map-placeholder__sub { font-size: 12.5px !important; }

/* ----- 지도 컨트롤 (현재 위치 · 정책정보) ----- */
.map-ctrls {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 40;
  display: flex;
  gap: 8px;
}

.map-ctrl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--text-body);
  font-size: 13px;
  font-weight: 700;
  box-shadow: var(--shadow-card);
}
.map-ctrl:hover { border-color: var(--primary); color: var(--primary-dark); }
.map-ctrl.is-busy { opacity: .6; pointer-events: none; }
.map-ctrl-wrap { position: relative; }

.policy-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 210px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 8px;
  z-index: 50;
}
.policy-menu[hidden] { display: none; }
.policy-menu__head { font-size: 12px; font-weight: 700; color: var(--text-muted); padding: 4px 8px 8px; }
.policy-menu a {
  display: block;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 13.5px;
  color: var(--text-body);
  text-decoration: none;
}
.policy-menu a:hover { background: var(--primary-light); color: var(--primary-dark); }

/* 위치 동의 안내 */
.geo-consent {
  position: absolute;
  left: 50%;
  top: 68px;
  transform: translateX(-50%);
  z-index: 60;
  width: min(360px, calc(100% - 32px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 16px 18px;
}
.geo-consent[hidden] { display: none; }
.geo-consent__text { font-size: 13px; color: var(--text-body); margin-bottom: 12px; }
.geo-consent__btns { display: flex; gap: 8px; justify-content: flex-end; }
.geo-consent__ok, .geo-consent__no {
  height: 34px; padding: 0 16px; border-radius: 8px; font-size: 13px; font-weight: 700; border: none;
}
.geo-consent__ok { background: var(--primary); color: #fff; }
.geo-consent__ok:hover { background: var(--primary-dark); }
.geo-consent__no { background: var(--bg-page); color: var(--text-body); }

/* 내 위치 마커(폴백/카카오 공통 표시용 클래스) */
.job-card__dist { color: var(--primary-dark); font-weight: 700; }

/* 임시 마커 (카카오맵 연동 전 목데이터 미리보기) */
.map-markers { position: absolute; inset: 0; }

.map-marker {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  border: none;
  background: none;
  padding: 0;
  z-index: 10;
}

.map-marker__pin {
  width: 34px;
  height: 34px;
  border-radius: 50% 50% 50% 4px;
  transform: rotate(-45deg);
  background: var(--primary);
  border: 2.5px solid #fff;
  box-shadow: 0 2px 6px rgba(28, 39, 51, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, background 0.15s;
}

.map-marker__pin span {
  transform: rotate(45deg);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.map-marker--public .map-marker__pin { background: var(--accent-public); }

.map-marker:hover .map-marker__pin { transform: rotate(-45deg) scale(1.12); }

.map-marker.is-selected { z-index: 20; }

.map-marker.is-selected .map-marker__pin {
  background: var(--danger);
  transform: rotate(-45deg) scale(1.25);
}

/* 지도 위 선택 공고 미니 카드 */
.map-selected {
  position: absolute;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: min(420px, calc(100% - 32px));
  background: #fff;
  border-radius: var(--radius);
  box-shadow: var(--shadow-pop);
  padding: 14px 16px;
  z-index: 30;
}

.map-selected__title { font-size: 14.5px; font-weight: 700; color: var(--text-strong); margin-bottom: 2px; }
.map-selected__info  { font-size: 12.5px; color: var(--text-muted); }

.map-selected__link {
  display: inline-block;
  margin-top: 8px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--primary);
  text-decoration: none;
}

.map-selected__link:hover { text-decoration: underline; }

.map-selected__close {
  position: absolute;
  top: 8px; right: 10px;
  border: none;
  background: none;
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1;
  padding: 4px;
}

/* ===== 모바일 리스트/지도 전환 버튼 ===== */
.view-toggle {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 110;
  height: 44px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: var(--text-strong);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  box-shadow: var(--shadow-pop);
}

/* ============================================================
   반응형
   ============================================================ */

/* 태블릿: 리스트 폭 축소 */
@media (max-width: 1199px) {
  :root { --list-w: 340px; }
}

/* 모바일: 리스트/지도 겹쳐 놓고 토글 전환 */
@media (max-width: 767px) {
  .header__inner {
    height: auto;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 16px;
  }

  .logo__text { font-size: 17px; }

  .search { width: 100%; max-width: none; order: 2; }

  .content {
    /* 헤더 높이가 가변이므로 JS 없이 대략 고정값 대신 sticky 흐름 사용 */
    padding-top: 0;
    height: auto;
    min-height: 100vh;
    display: block;
  }

  body { overflow: auto; }

  .header { position: sticky; }

  .panel-list {
    width: 100%;
    border-right: none;
    min-height: calc(100vh - 160px);
  }

  .job-list { padding-bottom: 90px; }

  .panel-map {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: 50;
  }

  /* 지도 뷰 활성화 시 */
  body.mobile-map-view .panel-map { display: block; }
  body.mobile-map-view .panel-list { display: none; }
  body.mobile-map-view .map-selected { bottom: 84px; }

  .view-toggle { display: block; }
}
