/* ============================================
   조인 멤버 구하기 - 페이지 전용 스타일
   공용 스타일은 common.css 참조
   ============================================ */

body {
  height: 100vh;
  overflow: hidden;
}

/* ============================================
   메인 레이아웃 (골프장 페이지와 동일)
   ============================================ */
.main {
  display: flex;
  height: calc(100vh - var(--header-height));
}

/* ============================================
   좌측 패널
   ============================================ */
.panel {
  width: var(--panel-width);
  min-width: var(--panel-width);
  border-right: 2px solid var(--color-border-strong);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  background: var(--color-bg);
}

#listView {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ============================================
   날짜 선택 바
   ============================================ */
.date-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-subtle);
  gap: 8px;
  flex-shrink: 0;
}

.date-bar__nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.date-bar__arrow {
  width: 32px;
  height: 32px;
  background: var(--color-bg);
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 20px;
  line-height: 1;
  color: var(--color-text);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  font-family: inherit;
}

.date-bar__arrow:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-pale);
}

.date-bar__display {
  position: relative;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 12px;
  font-family: inherit;
}

.date-bar__text {
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary-dark);
  white-space: nowrap;
}

.date-bar__input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 16px;
  width: 100%;
  height: 100%;
}

.date-bar__range {
  display: flex;
  align-items: center;
}

.date-bar__range-text {
  font-size: 14px;
  font-weight: 700;
  color: var(--color-primary-dark);
  white-space: nowrap;
}

.date-bar__cal-btn {
  padding: 6px 10px;
  background: var(--color-bg);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius);
  font-size: 12px;
  font-weight: 600;
  color: var(--color-primary-dark);
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s;
}

.date-bar__cal-btn:hover {
  background: var(--color-primary-pale);
}

.date-bar__write-btn {
  padding: 8px 16px;
  background: var(--color-primary-dark);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.date-bar__write-btn:hover {
  background: var(--color-primary-deep);
}

/* 설명 버튼 (헤더 subtitle 옆) */
.header__help-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1.5px solid var(--color-primary);
  background: none;
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: 4px;
  flex-shrink: 0;
  vertical-align: baseline;
  padding: 0;
  line-height: 1;
  margin-bottom: 1px;
}

.header__help-btn:hover {
  background: var(--color-primary-pale);
}

/* 설명 팝업 */
.help-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.help-popup {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 400px;
  max-width: 92vw;
  max-height: 85vh;
  overflow-y: auto;
}

.help-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.help-popup__title {
  font-size: 16px;
  font-weight: 700;
}

.help-popup__close {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--color-text-secondary);
}

.help-popup__body {
  padding: 20px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--color-text);
}

.help-popup__body p {
  margin: 0 0 12px;
}

.help-popup__notice {
  background: #fff3e0;
  border: 1px solid #ffe0b2;
  border-radius: 8px;
  padding: 14px 16px;
  margin-top: 8px;
}

.help-popup__notice > strong {
  display: block;
  margin-bottom: 8px;
  color: #e65100;
  font-size: 13px;
}

.help-popup__notice ul {
  margin: 0;
  padding-left: 18px;
}

.help-popup__notice li {
  margin-bottom: 6px;
  font-size: 13px;
  color: #555;
}

/* 달력 팝업 */
.cal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-popup {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 340px;
  max-width: 95vw;
  overflow: hidden;
}

.cal-popup__header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border-bottom: 1px solid var(--color-border);
}

.cal-popup__nav {
  width: 32px;
  height: 32px;
  background: none;
  border: 1.5px solid var(--color-border);
  border-radius: 6px;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text);
  font-family: inherit;
}

.cal-popup__nav:hover {
  background: var(--color-primary-pale);
  border-color: var(--color-primary);
}

.cal-popup__month {
  flex: 1;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-text);
}

.cal-popup__close {
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--color-text-secondary);
  margin-left: 8px;
}

.cal-popup__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 8px 12px;
  gap: 2px;
}

.cal-popup__dow {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: 4px 0;
}

.cal-popup__day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px 2px;
  border-radius: 6px;
  cursor: pointer;
  min-height: 42px;
  transition: background 0.1s;
  border: none;
  background: none;
  font-family: inherit;
}

.cal-popup__day:hover {
  background: var(--color-primary-pale);
}

.cal-popup__day--empty {
  cursor: default;
}

.cal-popup__day--empty:hover {
  background: none;
}

.cal-popup__day--today .cal-popup__num {
  color: var(--color-primary-dark);
  font-weight: 800;
}

.cal-popup__day--selected {
  background: var(--color-primary) !important;
}

.cal-popup__day--selected .cal-popup__num,
.cal-popup__day--selected .cal-popup__cnt {
  color: #fff !important;
}

.cal-popup__day--inrange {
  background: var(--color-primary-pale);
}

.cal-popup__num {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1;
}

.cal-popup__cnt {
  font-size: 9px;
  color: var(--color-primary-dark);
  font-weight: 600;
  margin-top: 2px;
  line-height: 1;
  min-height: 10px;
}

.cal-popup__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-top: 1px solid var(--color-border);
}

.cal-popup__sel {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.cal-popup__submit {
  padding: 8px 20px;
  background: var(--color-primary-dark);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.cal-popup__submit:disabled {
  opacity: 0.4;
  cursor: default;
}

/* ============================================
   필터 영역 (골프장 페이지와 동일 구조)
   ============================================ */
.filters {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.filters__top-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

.filters__search {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
  font-family: inherit;
}

.filters__search:focus {
  border-color: var(--color-primary-dark);
}

.filters__toggle {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
  padding: 0 4px;
  border: none;
  background: none;
  color: var(--color-text-secondary);
  user-select: none;
}

.filters__toggle-label {
  font-weight: 600;
}

.filters__toggle-icon {
  font-size: 10px;
  transition: transform 0.2s;
}

.filters__toggle-icon.collapsed {
  transform: rotate(-90deg);
}

.filters__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: max-height 0.3s ease;
  max-height: 500px;
}

.filters__body.collapsed {
  max-height: 0;
  gap: 0;
}

.filters__row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filters__select {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  background: var(--color-bg);
  color: var(--color-text);
  outline: none;
  cursor: pointer;
  font-family: inherit;
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-group__label {
  font-size: 12px;
  color: var(--color-text-secondary);
  width: 100%;
  margin-bottom: 2px;
}

.filter-chip {
  padding: 4px 10px;
  border: 1.5px solid var(--color-border);
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  background: var(--color-bg);
  color: var(--color-text-secondary);
  transition: all 0.15s;
  user-select: none;
}

.filter-chip:hover {
  border-color: var(--color-primary);
  background: var(--color-primary-pale);
}

.filter-chip.active {
  border-color: var(--color-primary-dark);
  background: var(--color-primary-pale);
  color: var(--color-primary-dark);
  font-weight: 600;
}

#regionChips {
  display: contents;
}

.filters__bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.filters__count {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.filters__count strong {
  color: var(--color-primary-dark);
}

/* ============================================
   조인 카드 리스트
   ============================================ */
.join-list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  min-height: 0;
}

/* 지역 대분류 그룹 헤더 */
.join-group-header {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  background: #e8f5e9;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  user-select: none;
  position: sticky;
  top: 0;
  z-index: 5;
}

.join-group-header:hover {
  background: #c8e6c9;
}

.join-group-header__label {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-primary, #333);
}

.join-group-header__count {
  font-size: 12px;
  color: var(--color-text-secondary, #888);
  margin-left: 8px;
}

.join-group-header__arrow {
  margin-left: auto;
  font-size: 10px;
  color: var(--color-text-secondary, #888);
}

.join-card {
  padding: 14px 16px;
  margin: 0 12px;
  border: none;
  border-bottom: 1px solid var(--color-border);
  border-radius: 0;
  cursor: pointer;
  transition: background 0.15s;
  background: var(--color-bg);
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.join-card:last-child {
  border-bottom: 1px solid var(--color-border);
}

.join-card:hover {
  background: var(--color-primary-pale);
}

.join-card--highlight {
  background: var(--color-primary-pale);
  transition: background 0.3s;
}

.join-card--highlight.join-card--highlight {
  animation: card-highlight-fade 2s ease-out;
}

@keyframes card-highlight-fade {
  0%, 50% { background: #c8e6c9; }
  100% { background: transparent; }
}

.join-card.active {
  background: var(--color-primary-pale);
}

/* 카드 상단: 골프장명 + 지역 */
.join-card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.join-card__course {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.join-card__course--undecided {
  color: var(--color-text-muted);
  font-weight: 600;
}

.join-card__region {
  font-size: 13px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
  text-align: right;
  display: flex;
  align-items: center;
  gap: 6px;
}

.join-card__route-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #e8f5e9;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s;
}

.join-card__route-btn:hover {
  background: #c8e6c9;
}

/* 별점 */
.join-card__ratings {
  display: flex;
  gap: 10px;
  padding: 2px 0;
  font-size: 12px;
  margin-bottom: 6px;
  min-height: 20px;
}

.card-rating {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--color-star);
  font-weight: 600;
}

.card-rating__src {
  color: var(--color-text-muted);
  font-weight: 400;
  font-size: 11px;
}

.card-rating__count {
  font-weight: 400;
  color: var(--color-text-muted);
  font-size: 11px;
}

/* 카드 정보 행 */
.join-card__info {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  flex: 1;
}

.join-card__tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  background: var(--color-primary-pale);
  color: var(--color-primary-dark);
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
  min-height: 24px;
}

.join-card__tag--empty {
  visibility: hidden;
}

/* 출처 태그 (외부 크롤링) */
.join-card__source {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px 8px;
  background: #e3f2fd;
  color: #1565c0;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  margin-left: auto;
}

.join-card__source-icon {
  font-weight: 900;
}

/* ============================================
   상세 패널
   ============================================ */
.detail-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.detail-panel.visible {
  display: flex;
}

.detail__back {
  padding: 12px;
  background: var(--color-bg-subtle);
  border: none;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
  color: var(--color-primary-dark);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  font-weight: 600;
  flex-shrink: 0;
}

.detail__back:hover {
  background: var(--color-primary-pale);
}

.detail__content {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

/* 상세 섹션 */
.detail__section {
  margin-bottom: 20px;
}

.detail__section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--color-border);
}

.detail__row {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  font-size: 14px;
}

.detail__row-label {
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.detail__row-value {
  color: var(--color-text);
  font-weight: 600;
  text-align: right;
}

.detail__memo {
  font-size: 14px;
  color: var(--color-text);
  line-height: 1.6;
  padding: 10px 12px;
  background: var(--color-bg-subtle);
  border-radius: var(--radius-sm);
}

.detail__contact-btn {
  width: 100%;
  padding: 12px;
  background: var(--color-primary-dark);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}

.detail__contact-btn:hover {
  background: var(--color-primary-deep);
}

.detail__contact-info {
  text-align: center;
  padding: 10px;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-primary-dark);
  background: var(--color-primary-pale);
  border-radius: var(--radius-sm);
}

.detail__source-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #1565c0;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}

.detail__source-link:hover {
  text-decoration: underline;
}

.detail__name {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 4px;
}

.detail__sub {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin-bottom: 16px;
}

.detail__actions {
  display: flex;
  gap: 8px;
}

.detail__edit-btn {
  flex: 1;
  padding: 10px;
  background: var(--color-bg);
  color: var(--color-primary-dark);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.detail__edit-btn:hover {
  background: var(--color-primary-pale);
}

.detail__delete-btn {
  flex: 1;
  padding: 10px;
  background: var(--color-bg);
  color: var(--color-text-muted);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}

.detail__delete-btn:hover {
  border-color: #c62828;
  color: #c62828;
}

/* ============================================
   빈 상태
   ============================================ */
.join-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-text-muted);
}

.join-empty__icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.join-empty__text {
  font-size: 16px;
  margin-bottom: 4px;
  color: var(--color-text-secondary);
}

.join-empty__sub {
  font-size: 14px;
}

/* ============================================
   지도
   ============================================ */
.map-container {
  flex: 1;
  position: relative;
}

.map-toggle {
  display: none;
}

.map-inner {
  width: 100%;
  height: 100%;
  position: relative;
}

#map {
  width: 100%;
  height: 100%;
}

/* ============================================
   로딩
   ============================================ */
.join-loading {
  text-align: center;
  padding: 48px 20px;
}

.join-loading__spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--color-border);
  border-top-color: var(--color-primary-dark);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.join-loading__text {
  font-size: 14px;
  color: var(--color-text-muted);
}

/* ============================================
   출발지 검색 / 경로 정보 바
   ============================================ */
.origin-bar {
  position: absolute;
  top: 12px;
  left: 12px;
  right: 52px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--color-bg);
  padding: 10px 14px;
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.origin-bar__input-wrap {
  flex: 1;
  min-width: 150px;
  position: relative;
}

.origin-bar__input {
  width: 100%;
  border: 1.5px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
}

.origin-bar__input:focus {
  border-color: var(--color-primary-dark);
}

.origin-autocomplete {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: #fff;
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
}

.origin-autocomplete.visible {
  display: block;
}

.origin-autocomplete li {
  padding: 10px 14px;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
  list-style: none;
  transition: background 0.1s;
}

.origin-autocomplete li:last-child {
  border-bottom: none;
}

.origin-autocomplete li:hover,
.origin-autocomplete li.active {
  background: #e8f5e9;
}

.origin-autocomplete li .ac-name {
  font-weight: 600;
  color: var(--color-text);
}

.origin-autocomplete li .ac-addr {
  color: var(--color-text-muted);
  font-size: 11px;
  margin-top: 3px;
}

.origin-bar__btn {
  padding: 8px 14px;
  border: 1.5px solid var(--color-primary-dark);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-primary-dark);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
  font-family: inherit;
}

.origin-bar__btn:hover {
  background: var(--color-primary-dark);
  color: white;
}

.origin-bar__btn--clear {
  border-color: var(--color-border);
  color: var(--color-text-secondary);
}

.origin-bar__btn--clear:hover {
  background: var(--color-border);
  color: var(--color-text);
}

.origin-bar__form {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  justify-content: flex-end;
}

.origin-bar__edit-btn {
  padding: 6px 12px;
  border: 1.5px solid var(--color-primary-dark);
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.9);
  color: var(--color-primary-dark);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  white-space: nowrap;
  transition: all 0.15s;
}

.origin-bar__edit-btn:hover {
  background: var(--color-primary-dark);
  color: white;
}

.origin-bar.compact {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
}

.origin-bar.compact .origin-bar__edit-btn {
  box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.origin-bar.compact + .route-info-bar {
  top: 48px;
}

.route-info-bar {
  position: absolute;
  top: 64px;
  left: 12px;
  right: 52px;
  z-index: 9;
  display: none;
  flex-direction: column;
  background: var(--color-bg);
  border: 2px solid var(--color-border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.route-info-bar.visible {
  display: flex;
}

.route-info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--color-border);
}

.route-info-item:last-child {
  border-bottom: none;
}

.route-info-item__name {
  font-weight: 600;
  color: var(--color-text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1;
}

.route-info-item__time {
  margin-left: auto;
  font-weight: 700;
  color: var(--color-primary-dark);
  white-space: nowrap;
}

.route-info-item__dist {
  color: var(--color-text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.route-info-item__remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-border);
  color: var(--color-text-secondary);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  line-height: 1;
  transition: all 0.15s;
}

.route-info-item__remove:hover {
  background: #c62828;
  color: white;
}

/* ============================================
   글쓰기 팝업
   ============================================ */
.join-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.join-popup {
  background: var(--color-bg);
  border-radius: var(--radius);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
}

.join-popup__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-shrink: 0;
}

.join-popup__title {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text);
}

.join-popup__close {
  width: 32px;
  height: 32px;
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}

.join-popup__close:hover {
  background: var(--color-primary-pale);
}

.join-popup__body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.join-popup__section {
  margin-bottom: 16px;
}

.join-popup__section:last-child {
  margin-bottom: 0;
}

.join-popup__label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}

.join-popup__input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color 0.15s;
}

.join-popup__input:focus {
  outline: none;
  border-color: var(--color-primary-dark);
}

.join-popup__textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: inherit;
  color: var(--color-text);
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s;
}

.join-popup__textarea:focus {
  outline: none;
  border-color: var(--color-primary-dark);
}

/* 골프장 자동완성 */
.join-popup__ac-wrap {
  position: relative;
}

.join-popup__ac-list {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  list-style: none;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.join-popup__ac-list.visible {
  display: block;
}

.join-popup__ac-list li {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 1px solid var(--color-border);
  transition: background 0.1s;
}

.join-popup__ac-list li:last-child {
  border-bottom: none;
}

.join-popup__ac-list li:hover,
.join-popup__ac-list li.active {
  background: var(--color-primary-pale);
}

.join-popup__ac-list li .ac-region {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-left: 6px;
}

/* 그린피 + 변동가능 */
.join-popup__fee-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.join-popup__input--fee {
  flex: 1;
}

.join-popup__checkbox-label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  color: var(--color-text-secondary);
  white-space: nowrap;
  cursor: pointer;
}

.join-popup__checkbox-label input[type="checkbox"] {
  accent-color: var(--color-primary-dark);
  width: 16px;
  height: 16px;
  cursor: pointer;
}

.join-popup__submit {
  margin: 16px 20px 20px;
  padding: 14px;
  background: var(--color-primary-dark);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
  flex-shrink: 0;
}

.join-popup__submit:hover {
  background: var(--color-primary-deep);
}

/* ============================================
   모바일 반응형 (768px 이하)
   ============================================ */
@media (max-width: 768px) {
  body {
    height: auto;
    overflow: auto;
  }

  .main {
    flex-direction: column;
    height: auto;
  }

  .panel {
    width: 100%;
    min-width: 0;
    border-right: none;
    height: auto;
    overflow: visible;
  }

  #listView {
    height: auto;
    overflow: visible;
  }

  .date-bar {
    position: sticky;
    top: 0;
    z-index: 51;
    gap: 4px;
    padding: 8px 8px;
    flex-wrap: nowrap;
  }

  .date-bar__arrow {
    width: 26px;
    height: 26px;
    font-size: 16px;
  }

  .date-bar__text {
    font-size: 13px;
  }

  .date-bar__cal-btn {
    padding: 5px 8px;
    font-size: 11px;
  }

  .date-bar__write-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  .date-bar__range-text {
    font-size: 12px;
  }

  .filters {
    position: sticky;
    top: 43px;
    z-index: 50;
    background: var(--color-bg);
  }

  .join-list {
    flex: none;
    overflow-y: visible;
    padding: 0;
    max-height: none;
    min-height: auto;
  }

  .join-card {
    padding: 12px 16px;
  }

  /* 지도 */
  .map-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: var(--color-bg);
  }

  .map-toggle {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-top: 2px solid var(--color-border-strong);
    background: var(--color-primary-pale);
    color: var(--color-primary-dark);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
  }

  /* 지도 토글 버튼 높이만큼 하단 여백 */
  .join-card:last-child {
    margin-bottom: 56px;
  }

  .detail__content {
    padding-bottom: 72px;
  }

  .map-inner {
    display: none;
    width: 100%;
    height: 85vw;
    position: relative;
  }

  .map-inner.open {
    display: block;
  }

  /* 팝업 */
  .join-popup {
    max-width: 100%;
    max-height: 95vh;
    border-radius: var(--radius) var(--radius) 0 0;
    align-self: flex-end;
  }

  .join-popup__header {
    padding-top: 32px;
  }

  /* 출발지 바 모바일 */
  .origin-bar {
    left: 8px;
    right: 8px;
    top: 8px;
    padding: 8px 10px;
    gap: 6px;
  }

  .origin-bar__input {
    font-size: 14px;
    min-width: 0;
    flex: 1;
  }

  .route-info-bar {
    left: 8px;
    right: 8px;
  }

  .route-info-item {
    padding: 6px 10px;
    gap: 8px;
    font-size: 12px;
  }

  .route-info-item__name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
  }

  /* 상세 패널 모바일 */
  .detail__name {
    font-size: 18px;
  }
}
