/* ========================================= */
/* Popups - Modal & Popup Components        */
/* ========================================= */

/* Popup Base Styles (Slide up from bottom) */
.popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  padding: 0;
  pointer-events: none;
  transition: background 0.3s ease;
  overflow: hidden;
}
.popup.show {
  background: rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}

.popup-content {
  background: var(--bg-default);
  border-radius: 20px 20px 0 0;
  padding: 0 0 16px;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
  box-shadow: none;
  transform: translateY(100%);
  transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}
.popup.show .popup-content {
  transform: translateY(0);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
}

/* Popup Header */
.popup-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg-default);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;                  /* 챗 바텀시트 헤드와 동일 56 (26-08-27: 16/12 패딩+44 버튼 = 72 는 과함) */
  padding: 0 8px 0 16px;         /* 닫기 버튼 44 히트영역이 오른쪽 8 안에 */
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}
.popup-title {
  font-size: 16px;
  line-height: 24px;
  font-weight: 700;
  color: var(--fg-primary);
  margin: 0;
}

/* 바텀시트 본문 (26-09-12 승격, 컨셉 04-login-sheet) — .popup-content 는 좌우 패딩이 없다(헤더만 자체 16).
   본문도 같은 16 에 선다 */
.sheet-body { padding: var(--space-control) var(--gutter); }
.sheet-text { margin: 0; font: var(--t-body); color: var(--fg-secondary); }
.sheet-text + .form-group { margin: var(--space-section) 0 0; }   /* 시트 안 입력 칸(취소 사유 등) — 안내 글과 붙지 않게 */
.sheet-actions { display: flex; flex-direction: column; gap: var(--space-control); margin-top: var(--space-section); }
.sheet-actions.is-row { flex-direction: row; }
.sheet-actions.is-row .btn { flex: 1; min-width: 0; }

/* Country Selection Popup */
.country-popup {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  padding: 0;
  pointer-events: none;
  transition: background 0.3s ease;
  overflow: hidden;
}
.country-popup.show {
  background: rgba(0, 0, 0, 0.3);
  pointer-events: auto;
}
.country-popup-content {
  background: var(--bg-default);
  border-radius: 20px 20px 0 0;
  padding: 0 0 16px;
  width: 100%;
  max-width: 100vw;
  overflow-x: hidden;
  box-sizing: border-box;
  box-shadow: none;
  transform: translateY(100%);
  transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}
.country-popup.show .country-popup-content {
  transform: translateY(0);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.15);
}

.country-item {
  display: flex;
  align-items: center;
  padding: 12px 8px;   /* 좌우 8 + 바깥 여백 8 = 16 — 다른 화면 여백과 같은 자리에 국기가 선다.
                          전엔 16 + 8 = 24 라 이 목록만 안쪽으로 밀려 있었다 (26-09-02 사용자) */
  border-radius: var(--r-8);   /* 6 폐기 → 목록 행 4 (26-09-02) */
  cursor: pointer;
  transition: background-color 0.2s;
  margin: 0 8px;   /* 호버 면이 시트 끝에 붙지 않게 */
}
.country-item:hover { background: var(--bg-muted); }
.country-item.selected { background: transparent; color: var(--fg-primary); }
.country-item.selected .country-name { font-weight: 700; }
/* 선택 표시 = 끝에 체크 (26-08-26). 빨간 면 채움은 목록에서 대면적 레드라 폐기 */
.country-check { margin-left: auto; display: none; font-size: 20px; line-height: 28px; color: var(--fg-primary); }
.country-item.selected .country-check { display: block; }
.country-item .flag { width: 28px; height: 28px; margin-right: 12px; }   /* 목록에서는 28 (헤더 24보다 한 단계 크게, 26-08-26) */
/* 안쪽 리스트 래퍼가 .popup-content 클래스를 같이 써서 translateY(100%) 로 밀려 빈 공간이 생기던 문제 (26-08-26) */
.country-popup-content > .popup-content { transform: none; box-shadow: none; border-radius: 0; padding: 0 0 8px; max-height: none; }
.country-name { font-size: 14px; line-height: 20px; font-weight: 500; }

/* Toast Notification */
/* Toast — 26-08-26 재설계: 다크 솔리드, 하단 탭바 위 16px, 라운드 8, 아래서 올라옴.
   이전 초록 그라데이션·상단 배치는 앱 톤(플랫·중립)과 어긋났고 Material 글리프 텍스트가 노출됐다 */
.toast-notification {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(56px + env(safe-area-inset-bottom, 0px) + 16px);   /* 꽉 찬 탭바 56 위 16 (26-08-31) */
  margin: 0 auto;
  max-width: 358px;
  min-height: 48px;
  padding: 12px 16px;
  background: rgba(17, 17, 17, 0.94);
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
  z-index: 10000;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  color: var(--fg-inverse);
  animation: toastIn 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.toast-notification .toast-icon { font-size: 20px; line-height: 28px; color: var(--mark-success); flex-shrink: 0; }
.toast-notification .toast-text { flex: 1; min-width: 0; }
.toast-notification.hiding { animation: toastOut 0.2s ease-in forwards; }
/* 하단 고정 바가 있는 화면 — 기본 위치(탭바 56 위)는 바(12+56+12)에 8 겹친다 (26-09-12).
   이 값은 버튼 1줄 바 기준 기본값. 바가 더 높은 화면(요약+버튼)은 toast.js·SP.toast 가 실제 바 윗변 16 위로 다시 잡는다 */
body.has-actionbar .toast-notification { bottom: calc(52px + 2 * var(--space-content) + var(--space-card)); }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(8px); }
}
}

/* 공지 시트 (10-23) — 로그인 직후 한 번. 날짜 · 제목 · 한 줄 요약 · 요점 상자 · 버튼 둘 */
.notice-sheet .popup-content { max-height: 88vh; overflow-y: auto; }
.ns-date { margin: 0 0 4px; font: var(--t-caption); color: var(--fg-secondary); }
.ns-title { margin: 0 0 8px; font: var(--t-title-sm); color: var(--fg-primary); word-break: keep-all; }
.ns-box { display: flex; flex-direction: column; gap: 12px; margin: 16px 0 0; padding: 16px; border-radius: var(--r-12); background: var(--bg-muted); }
.ns-box > div { display: grid; grid-template-columns: 96px 1fr; gap: 8px; }
.ns-box dt { font: var(--t-caption); color: var(--fg-secondary); }
.ns-box dd { margin: 0; font: var(--t-caption); font-weight: 500; color: var(--fg-primary); }
/* 나라 12개(10-25) — 낮은 화면에서도 시트가 화면을 넘지 않게 목록만 스크롤 */
.country-popup .country-list { max-height: calc(85vh - 116px); overflow-y: auto; padding-bottom: 8px; }
/* 목록 아래 = 다른 나라 가입 입구 (10-27) — 국기 칸과 같은 왼쪽 16 */
.country-join { display: flex; align-items: center; gap: 12px; min-height: 52px; margin: 0 16px; border-top: 1px solid var(--border-subtle); font: var(--t-label); font-weight: 600; color: var(--fg-primary); text-decoration: none; }
.country-join .icon:first-child { width: 28px; height: 20px; color: var(--fg-secondary); }   /* 국기 28 자리에 맞춤 */
.country-join span { flex: 1; min-width: 0; }
.country-join .icon:last-child { color: var(--fg-tertiary); }
/* 로그인 창 SNS 버튼의 브랜드 로고 (10-25) — 아이콘 24 와 같은 자리 */
.sns-logo { width: 24px; height: 24px; flex-shrink: 0; }

/* 선택 상자 시트 (10-27, scripts/select-sheet.js) — 국기 창과 같은 모양. 줄은 <button> 이라 기본 테두리·면만 지운다 */
.select-sheet .country-list { max-height: 60vh; overflow-y: auto; }
.select-sheet .country-item { width: calc(100% - 16px); min-height: 48px; border: 0; background: none; font: inherit; color: var(--fg-primary); text-align: left; }
.select-sheet .country-check { width: 20px; height: 20px; flex-shrink: 0; fill: currentColor; }
.select-sheet .country-name { flex: 1; min-width: 0; }
