/* 어복 웹앱 - 모바일 우선 반응형 */
:root {
  --primary: #0B6E99;
  --primary-dark: #085a7e;
  --accent: #E8862D;
  --bg: #f2f5f8;
  --card: #ffffff;
  --text: #223344;
  --sub: #667788;
  --danger: #c0392b;
  --ok: #2E7D32;
  --radius: 12px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: 'Malgun Gothic', 'Apple SD Gothic Neo', sans-serif;
  background: var(--bg); color: var(--text); font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea {
  font-family: inherit; font-size: 15px;
  padding: 10px 12px; border: 1px solid #ccd5dd; border-radius: 8px;
  width: 100%; background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: transparent; }
a { color: var(--primary); }
.hidden { display: none !important; }

/* ---------- 인증 화면 ---------- */
#auth-view {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(160deg, #0B6E99 0%, #085a7e 60%, #063f58 100%);
  padding: 20px;
}
.auth-card {
  background: #fff; border-radius: 16px; padding: 32px 24px;
  width: 100%; max-width: 400px; box-shadow: 0 12px 40px rgba(0,0,0,.25);
}
.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo .fish { font-size: 44px; }
.auth-logo h1 { font-size: 26px; color: var(--primary); letter-spacing: 2px; }
.auth-logo p { font-size: 13px; color: var(--sub); margin-top: 4px; }
.auth-card .field { margin-bottom: 12px; }
.auth-card label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 4px; }
.btn {
  display: inline-block; width: 100%; padding: 12px; border: none; border-radius: 8px;
  background: var(--primary); color: #fff; font-size: 16px; font-weight: bold;
}
.btn:disabled { background: #9db6c4; }
.btn.outline { background: #fff; color: var(--primary); border: 1.5px solid var(--primary); }
.btn.sm { width: auto; padding: 7px 14px; font-size: 13px; }
.btn.danger { background: var(--danger); }
.btn.ghost { background: transparent; color: var(--primary); border: none; font-weight: normal; }
.auth-switch { text-align: center; margin-top: 14px; font-size: 14px; }
.auth-msg { font-size: 13px; margin-top: 10px; padding: 10px; border-radius: 8px; display: none; }
.auth-msg.err { display: block; background: #fdecea; color: var(--danger); }
.auth-msg.ok { display: block; background: #e8f5e9; color: var(--ok); }

/* ---------- 앱 셸 ---------- */
#app-view { padding-bottom: 70px; min-height: 100vh; }
header.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--primary); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
}
header.topbar .brand { font-size: 19px; font-weight: bold; letter-spacing: 1px; }
header.topbar .brand small { font-weight: normal; font-size: 12px; opacity: .8; margin-left: 6px; }
.bell { position: relative; background: none; border: none; color: #fff; font-size: 21px; }
.bell .badge {
  position: absolute; top: -4px; right: -6px; background: var(--accent); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; line-height: 16px;
  border-radius: 8px; text-align: center; padding: 0 3px;
}
main { max-width: 760px; margin: 0 auto; padding: 12px; }

/* 하단 탭 (모바일) / 상단 탭 (데스크톱) */
nav.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: #fff; border-top: 1px solid #dde5ec;
  display: flex; justify-content: space-around;
}
nav.tabbar button {
  flex: 1; background: none; border: none; padding: 8px 0 10px;
  font-size: 11px; color: var(--sub); display: flex; flex-direction: column; align-items: center; gap: 2px;
}
nav.tabbar button .ico { font-size: 21px; }
nav.tabbar button.active { color: var(--primary); font-weight: bold; }

/* ---------- 카드 공통 ---------- */
.card {
  background: var(--card); border-radius: var(--radius);
  padding: 16px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(20,40,60,.06);
}
.card h2 { font-size: 16px; margin-bottom: 8px; display: flex; align-items: center; gap: 6px; }
.card .desc { font-size: 12px; color: var(--sub); margin-bottom: 10px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.muted { color: var(--sub); font-size: 12px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(11,110,153,.08); color: var(--primary);
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 12px; margin: 2px 4px 2px 0;
}
.banner-warn {
  background: #fdecea; color: var(--danger); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 10px; font-size: 14px;
}
.banner-info {
  background: #fff8e1; color: #8a6d1a; border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 10px; font-size: 13px;
}
.banner-notice {
  background: #e5f0f7; color: #144a66; border-radius: var(--radius);
  padding: 10px 14px; margin-bottom: 10px; font-size: 13px;
}
.list-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 0;
  border-bottom: 1px solid #f0f3f6; cursor: pointer;
}
.list-row:last-child { border-bottom: none; }
.spin { text-align: center; color: var(--sub); padding: 30px 0; }

/* 물때 카드 */
.multtae-big { font-size: 30px; font-weight: bold; }
.weekly-scroll { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.weekly-day {
  min-width: 92px; background: #f0f4f7; border-radius: 10px; padding: 10px; font-size: 12px;
}
.weekly-day.today { background: var(--primary); color: #fff; }
.weekly-day .m { font-size: 16px; font-weight: bold; margin: 3px 0; }
.weekly-day.today .sub, .weekly-day.today .muted { color: rgba(255,255,255,.75); }
.weekly-day .sub { color: var(--sub); }
.tide-row { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 15px; }
.tide-row .lvl { margin-left: auto; color: var(--sub); font-size: 13px; }
.weather-grid { display: flex; justify-content: space-around; text-align: center; }
.weather-grid .v { font-weight: bold; margin-top: 2px; }
.idx-badge {
  display: inline-block; font-size: 12px; font-weight: bold;
  padding: 3px 10px; border-radius: 12px; margin-right: 6px;
}

/* 피드 */
.feed-card img.photo {
  width: 100%; max-height: 320px; object-fit: cover; border-radius: 10px; margin-top: 8px;
}
.feed-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--sub); }
.feed-species { font-size: 17px; font-weight: bold; margin-top: 4px; }
#map-nearby, #map-picker { width: 100%; height: 320px; border-radius: var(--radius); background: #dde7ee; }
#map-picker { height: 380px; position: relative; }

/* 모달 */
.modal-back {
  position: fixed; inset: 0; background: rgba(10,20,30,.55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 14px;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 520px;
  max-height: 92vh; overflow-y: auto; padding: 18px;
}
.modal h3 { font-size: 17px; margin-bottom: 12px; }
.modal .field { margin-bottom: 10px; }
.modal .field label { display: block; font-size: 13px; color: var(--sub); margin-bottom: 3px; }
.modal-actions { display: flex; gap: 8px; margin-top: 14px; }
.modal.video { max-width: 860px; background: #111; color: #fff; }
.modal.video video { width: 100%; border-radius: 8px; background: #000; }

/* 픽커 중앙 핀 */
.pin-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -100%);
  font-size: 38px; z-index: 10; pointer-events: none;
  text-shadow: 0 2px 5px rgba(0,0,0,.4);
}

/* 지도 현위치 버튼 - 좌측 하단, 파란색으로 눈에 띄게 */
.map-locate {
  position: absolute; left: 10px; bottom: 24px; z-index: 20;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 52px; height: 52px; padding: 0 6px; border-radius: 26px;
  border: 2px solid #fff; background: var(--primary); color: #fff;
  font-size: 19px; line-height: 1; box-shadow: 0 3px 10px rgba(0,0,0,.35); cursor: pointer;
}
.map-locate .ml-label { font-size: 10px; font-weight: 700; margin-top: 2px; }
.map-locate:active { transform: scale(.93); }
/* 위치 선택 버튼 - 현위치 위에 쌓임 (흰 배경) */
.map-pick { bottom: 84px; background: #fff; color: var(--primary); border-color: var(--primary); }

/* 토글 스위치 */
.switch-wrap { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--sub); cursor: pointer; user-select: none; }
.switch-wrap input { display: none; }
.switch-wrap .sw { width: 38px; height: 22px; border-radius: 11px; background: #cfd8e0; position: relative; transition: .2s; flex-shrink: 0; }
.switch-wrap .sw::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 9px; background: #fff; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch-wrap input:checked + .sw { background: var(--primary); }
.switch-wrap input:checked + .sw::after { left: 18px; }

/* 토스트 */
#toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: rgba(20,35,50,.92); color: #fff; padding: 10px 18px;
  border-radius: 20px; font-size: 14px; z-index: 200; display: none; max-width: 90vw;
}

/* 배지 */
.badge-s { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: bold; }
.badge-s.ok { background: #e8f5e9; color: var(--ok); }
.badge-s.warn { background: #fff3e0; color: #e65100; }
.badge-s.danger { background: #fdecea; color: var(--danger); }
.badge-s.gray { background: #eceff1; color: var(--sub); }

/* 데스크톱 */
@media (min-width: 800px) {
  #app-view { padding-bottom: 20px; }
  nav.tabbar {
    position: sticky; top: 49px; bottom: auto; border-top: none; border-bottom: 1px solid #dde5ec;
    justify-content: center; gap: 10px;
  }
  nav.tabbar button { flex: none; flex-direction: row; gap: 6px; padding: 12px 20px; font-size: 14px; }
  nav.tabbar button .ico { font-size: 18px; }
  #map-nearby { height: 420px; }
}
