:root {
  --color-primary: #0E4A84;
  --color-upload-btn: #D0203C;
  --btn-radius: 999px;
  --header-height: 64px;
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
html, body {
  margin: 0; padding: 0;
  width: 100%; max-width: 100vw;
  height: 100%;
  overflow-x: hidden;
  font-family: 'Pretendard', -apple-system, sans-serif;
  color: #1B1B1B;
}
body {
  display: flex;
  flex-direction: column;
}

/* ===== 헤더 ===== */
#app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: var(--header-height);
  flex: 0 0 auto;
  padding: 0 20px;
  background: var(--color-primary);
  border-bottom: 1px solid rgba(0,0,0,.08);
  position: relative;
  z-index: 100;
}
.header-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.header-left h1 {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  margin: 0;
  white-space: nowrap;
}
.header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  gap: 6px;
  max-width: 420px;
  margin: 0 auto;
  min-width: 0;
}
.header-center input {
  width: 100%;
  padding: 8px 14px;
  border: 1px solid #DADADA;
  border-radius: var(--btn-radius);
  font-family: inherit;
  font-size: 14px;
  min-width: 0;
}
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.user-email {
  font-size: 12px;
  color: rgba(255,255,255,.85);
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.btn-round {
  border: none;
  border-radius: var(--btn-radius);
  padding: 8px 16px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.btn-icon { font-size: 14px; line-height: 1; }
.btn-outline { background: #fff; border: 1px solid #CCC; color: #333; }
.btn-outline:hover { background: #F5F5F5; }
.btn-pending-active { background: #F5B400 !important; border-color: #F5B400 !important; color: #fff !important; }
.btn-accent { background: var(--color-upload-btn); color: #fff; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }

/* ===== 지도 ===== */
main { width: 100%; flex: 1 1 auto; min-height: 0; }
#map {
  width: 100%;
  height: 100%;
}

/* 마커(원) */
.map-dot {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  cursor: pointer;
}

.map-pin-temp {
  width: 20px; height: 20px;
  background: #333;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  border: 2px solid #fff;
}

.pick-popup {
  position: relative;
  background: #fff;
  border-radius: 10px;
  padding: 10px 30px 10px 12px;
  box-shadow: 0 2px 8px rgba(0,0,0,.2);
  font-size: 12px;
  white-space: nowrap;
}
.pick-popup-confirm {
  border: none; background: var(--color-primary); color: #fff;
  border-radius: var(--btn-radius); padding: 7px 14px; font-size: 12px; cursor: pointer; font-weight: 600;
}
.pick-popup-close {
  position: absolute; top: 4px; right: 4px;
  width: 20px; height: 20px; line-height: 20px;
  border: none; background: #EEE; color: #555; border-radius: 50%;
  font-size: 13px; cursor: pointer; padding: 0;
}

/* 말풍선 꼬리 (마커와 팝업을 시각적으로 연결) */
.bubble-tail::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -16px;
  transform: translateX(-50%);
  border-left: 16px solid transparent;
  border-right: 16px solid transparent;
  border-top: 16px solid #fff;
  filter: drop-shadow(0 2px 1px rgba(0,0,0,.08));
}

/* 사진 올리기 중 위치 미리보기("여기" 표시) */
.location-tag-dot {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #E11D2E;
  border: 2px solid #fff;
  box-shadow: 0 1px 5px rgba(0,0,0,.4);
}
.location-tag-bubble {
  position: relative;
  background: #E11D2E;
  color: #fff;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
}
.location-tag-bubble::after {
  content: '';
  position: absolute;
  left: 50%; bottom: -12px;
  transform: translateX(-50%);
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid #E11D2E;
}

/* ===== 폴라로이드 뷰어 ===== */
.polaroid-card {
  position: relative;
  width: 220px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  padding: 10px 10px 12px;
  font-size: 12px;
}
.polaroid-photo { position: relative; margin-top: 6px; }
.polaroid-photo img {
  width: 100%; height: 100%; object-fit: cover;
  border-radius: 6px; cursor: zoom-in;
}
.btn-zoom {
  position: absolute; right: 6px; bottom: 6px;
  width: 26px; height: 26px;
  border: none; border-radius: 50%;
  background: rgba(0,0,0,.55); color: #fff;
  font-size: 14px; cursor: pointer;
}
.polaroid-top-row { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.polaroid-date { color: #999; font-size: 11px; white-space: nowrap; }
.polaroid-desc-top { font-weight: 600; text-align: right; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.polaroid-meta { margin-top: 8px; }
.polaroid-keywords { margin-bottom: 8px; }
.tag { color: var(--color-primary); margin-right: 4px; font-size: 11px; }
.polaroid-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.polaroid-actions button {
  border: 1px solid #DDD; background: #fff; border-radius: var(--btn-radius);
  padding: 4px 10px; font-size: 11px; cursor: pointer;
}
.btn-approve { border-color: var(--color-primary) !important; color: var(--color-primary); }
.btn-reject, .btn-delete { border-color: #D0203C !important; color: #D0203C; }

/* 우측 상단: 닫기. 우측 하단(카드 모서리): 공유(아이콘 전용) */
.polaroid-close, .polaroid-share {
  position: absolute;
  width: 26px; height: 26px; border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.polaroid-close { top: -10px; right: -10px; background: #333; color: #fff; }
.polaroid-share { bottom: -10px; right: -10px; background: #fff; color: #333; box-shadow: 0 1px 4px rgba(0,0,0,.25); }

.copied-hint {
  position: absolute;
  bottom: -8px; right: 42px;
  background: #333; color: #fff;
  font-size: 11px; padding: 4px 10px;
  border-radius: 999px; white-space: nowrap;
  pointer-events: none;
}
.copied-hint-inline { margin-left: 10px; font-size: 12px; color: var(--color-primary); font-weight: 600; }

/* 모바일: 화면 정중앙 고정 표시 (지도 오버레이 위치와 무관하게 전체가 보이도록) */
.polaroid-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 1500;
}
.polaroid-card-mobile {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  z-index: 1501;
  max-width: 90vw;
}

/* ===== 모달 ===== */
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 2000;
}
.modal.hidden { display: none; }
.modal-box {
  background: #fff; border-radius: 14px;
  padding: 24px; max-width: 420px; width: 90%;
  max-height: 85vh; overflow-y: auto;
  position: relative;
}
.modal-box h2 { margin-top: 0; font-size: 18px; }
.modal-close {
  position: absolute; top: 12px; right: 14px;
  border: none; background: none; font-size: 20px; cursor: pointer;
}
.modal-box-full {
  width: 95vw; height: 95vh; max-width: none; max-height: none;
  display: flex; align-items: center; justify-content: center; padding: 10px;
}
.modal-box-full .modal-close {
  top: 16px; right: 16px;
  width: 38px; height: 38px;
  background: rgba(0,0,0,.6);
  color: #fff;
  border-radius: 50%;
  font-size: 20px;
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  pointer-events: auto;
  touch-action: manipulation;
}
.full-image-wrap { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; overflow: hidden; touch-action: none; position: relative; z-index: 1; }
.full-image-wrap img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; touch-action: none; cursor: grab; will-change: transform; }

/* ===== 사이드 드로어(사진 올리기) ===== */
.drawer {
  position: fixed; top: 0; right: 0;
  width: 380px; max-width: 100vw; height: 100vh;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0,0,0,.15);
  transform: translateX(100%);
  transition: transform .3s ease;
  z-index: 900;
  display: flex; flex-direction: column;
}
.drawer.open { transform: translateX(0); }
.drawer.hidden { display: none; }
.drawer.collapsed { transform: translateX(85%); }

.drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid #EEE; font-weight: 700;
}
.drawer-close-btn { border: none; background: none; font-size: 22px; cursor: pointer; }
.drawer-body { padding: 16px 20px; overflow-y: auto; flex: 1; }

.up-section { margin-bottom: 18px; }
.up-section label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.up-section input[type="text"], .up-section input[type="date"] {
  width: 100%; padding: 9px 12px; border: 1px solid #DADADA; border-radius: 8px; font-family: inherit;
}
.up-btn-row { display: flex; gap: 8px; }
.up-btn-row button { flex: 1; }
.up-hint { font-size: 11px; color: #999; margin-top: 6px; }
.up-preview img { width: 100%; border-radius: 8px; }
.up-info div { font-size: 13px; margin-bottom: 4px; color: #444; }
.up-location-set p { font-size: 13px; margin: 0 0 8px; }
.up-agree label { display: flex; align-items: flex-start; gap: 8px; font-size: 12px; font-weight: 400; color: #555; }

/* ===== 모바일 반응형 ===== */
@media (max-width: 720px) {
  #app-header {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 14px;
    row-gap: 8px;
    column-gap: 6px;
  }
  .header-left {
    flex: 1 0 100%;      /* 타이틀 영역이 항상 한 줄 전체를 차지 */
    justify-content: space-between;
  }
  .header-left h1 { font-size: 16px; }
  .user-email { font-size: 11px; max-width: 55%; }

  /* 검색창부터 공유 버튼까지 타이틀 아래 한 줄에 */
  .header-center { order: 2; max-width: none; flex: 1 1 auto; min-width: 0; gap: 4px; }
  .header-right { order: 3; flex-shrink: 0; }

  .header-center input { padding: 5px 8px; font-size: 11px; min-width: 0; }
  .header-center .btn-round { padding: 5px 8px; font-size: 11px; }
  .header-right { gap: 3px; }
  .header-right .btn-round { padding: 5px 7px; }
  .btn-label { display: none; }
  .btn-icon { font-size: 15px; }

  .drawer {
    width: 100%; height: 85vh; top: auto; bottom: 0; right: 0;
    border-radius: 16px 16px 0 0;
    transform: translateY(100%);
  }
  .drawer.open { transform: translateY(0); }
  .drawer.collapsed { transform: translateY(80%); }
}
