/**
 * 공통 검색 오버레이 (체크인/체크아웃 + 인원)
 *
 * PC : 화면 중앙 카드형 모달 (max-width 560)
 * MO : 하단 고정 시트 (bottom sheet · 상단 라운드)
 */

/* ==== 오버레이 ==== */
.tp-sm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    z-index: 500;
    align-items: center;
    justify-content: center;
}
.tp-sm-overlay.open { display: flex; }

/* ==== 모달 (PC 중앙) ==== */
.tp-sm-modal {
    background: #fff;
    border-radius: 16px;
    width: min(560px, 92vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

/* 헤더 */
.tp-sm-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px 12px;
    border-bottom: 1px solid #f1f3f5;
}
.tp-sm-head h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 800;
    color: #1f2937;
}
.tp-sm-close {
    width: 32px;
    height: 32px;
    border: 1px solid #e5e7eb;
    background: #fff;
    border-radius: 8px;
    font-size: 18px;
    color: #6b7280;
    cursor: pointer;
    line-height: 1;
}
.tp-sm-close:hover { background: #f3f4f6; }

/* 바디 — flex column. 달력만 세로 스크롤, 인원 영역은 항상 노출 */
.tp-sm-body {
    padding: 16px 20px 20px;
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;                /* 자식 tp-sm-cal 만 스크롤 */
}
.tp-sm-section + .tp-sm-section { margin-top: 20px; }
/* 여행일정 섹션 — 달력 영역이 남은 높이를 채우도록 */
.tp-sm-section:first-child {
    display: flex;
    flex-direction: column;
    min-height: 0;                   /* flex 자식 overflow 발동 조건 */
}
.tp-sm-label {
    font-size: 13px;
    font-weight: 700;
    color: #374151;
    margin-bottom: 10px;
}

/* 상단 한줄 요약: "여행 일정  2027.10.12(화) → 2027.10.16(토) · 4박" */
.tp-sm-summary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 14px;
    color: #111827;
}
.tp-sm-summary .tp-sm-label {
    margin-bottom: 0;                /* 인원 라벨과 공용이라 여기서 초기화 */
    color: #6b7280;
    font-size: 12px;
    font-weight: 700;
}
.tp-sm-summary-val {
    display: inline-flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}
.tp-sm-date-val {
    font-weight: 700;
    color: #111827;
}
.tp-sm-arrow {
    color: #9ca3af;
}
.tp-sm-dot {
    color: #d1d5db;
    margin: 0 2px;
}
.tp-sm-nights {
    color: #1a5fd6;
    font-weight: 700;
}

/* Lightpick 캘린더 컨테이너 — 세로로 월별 이어지도록 (numberOfMonths=12 + 1열) */
.tp-sm-cal {
    margin-top: 12px;
    flex: 1;                         /* 여행일정 섹션 안에서 남은 높이 차지 */
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    border: 1px solid #f1f3f5;
    border-radius: 8px;
    padding: 0;
}
/* Lightpick 기본 팝업 스타일 무력화 — 인라인 배치 + 폭 100% */
.tp-sm-cal .lightpick {
    position: static !important;
    box-shadow: none;
    border: none;
    padding: 0;
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
}
/* 상단 네비게이션(< 월 년 >) 과 닫기 버튼 숨김 — 스크롤로만 이동하도록 */
.tp-sm-cal .lightpick__toolbar,
.tp-sm-cal .lightpick__previous-action,
.tp-sm-cal .lightpick__next-action,
.tp-sm-cal .lightpick__close-action {
    display: none !important;
}
/* 각 월 캘린더 가로 전체 사용 */
.tp-sm-cal .lightpick__months {
    display: block !important;
    width: 100% !important;
}
.tp-sm-cal .lightpick__month {
    width: 100% !important;
    max-width: 100% !important;
    padding: 12px 8px;
    border-bottom: 1px solid #f1f3f5;
}
.tp-sm-cal .lightpick__month:last-child { border-bottom: none; }
.tp-sm-cal .lightpick__month-title-bar { padding: 0 0 8px; }
.tp-sm-cal .lightpick__days { width: 100% !important; }

/* 인원 섹션 — flex-shrink:0 로 캘린더 스크롤에 밀리지 않게. 라벨("인원") 없음 */
.tp-sm-section:nth-child(2) { flex: 0 0 auto; }

/* 인원 스테퍼 — 라벨 제거 대신 텍스트/컨트롤 살짝 확대 */
.tp-sm-occ-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f1f3f5;
}
.tp-sm-occ-row:last-child { border-bottom: none; }
.tp-sm-occ-t {
    font-size: 15px;
    font-weight: 700;
    color: #1f2937;
    line-height: 1.25;
}
.tp-sm-occ-d {
    font-size: 11px;
    color: #6b7280;
    margin-top: 2px;
    line-height: 1.2;
}
.tp-sm-stepper {
    display: flex;
    align-items: center;
    gap: 12px;
}
.tp-sm-step {
    width: 30px;
    height: 30px;
    border: 1px solid #d1d5db;
    background: #fff;
    border-radius: 50%;
    color: #374151;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
}
.tp-sm-step:hover { background: #f3f4f6; }
.tp-sm-step:disabled {
    opacity: 0.35;
    cursor: default;
}
.tp-sm-count {
    min-width: 22px;
    text-align: center;
    font-size: 15px;
    font-weight: 700;
    color: #111827;
}

/* 푸터 */
.tp-sm-foot {
    padding: 14px 20px;
    border-top: 1px solid #f1f3f5;
}
.tp-sm-confirm {
    width: 100%;
    padding: 14px 16px;
    border: none;
    border-radius: 10px;
    background: #1a5fd6;
    color: #fff;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
}
.tp-sm-confirm:hover { background: #124a9a; }
.tp-sm-confirm:disabled {
    background: #9ca3af;
    cursor: default;
}

/* ==== 모바일 (bottom sheet) ==== */
@media (max-width: 760px) {
    .tp-sm-overlay { align-items: flex-end; justify-content: center; }
    .tp-sm-modal {
        width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 0 0;
    }
    .tp-sm-head { padding: 14px 16px 10px; }
    .tp-sm-body { padding: 12px 16px 16px; }
    .tp-sm-foot {
        padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    }
}
