/* =========================================================
   학교 안전 지도 - 기본 스타일 (디자인 토큰, 글꼴, 공통 요소)
   톤: 안전·신뢰(청록/초록), 위험·긴급(빨강/주황)
   화면별 스타일은 같은 폴더의 다른 파일에 있다. 불러오는 순서는 templates/_styles.html
   ========================================================= */

:root {
  /* 브랜드 (Figma 'School Paddi' 테마) */
  --blue: #00737b;
  --blue-dark: #005c63;
  --blue-soft: #dcf0f2;

  /* 의미 색 */
  --safe: #17753f;          /* 안전·도착·등교 */
  --safe-soft: #e4f6ea;
  --danger: #c62828;        /* 긴급·미확인 */
  --danger-soft: #fdeaea;
  --warn: #e8820c;          /* 주의·공사 */
  --warn-soft: #fff4e3;

  /* 중립 */
  --bg: #f5f9fa;
  --card: #ffffff;
  --ink: #2f2d45;
  --muted: #5f5d75;
  --line: #d3d8dc;

  /* 위험 유형 색 (지도 핀·배지와 통일) */
  --t-walkway: #1e8e4e;
  --t-vehicle: #e23b3b;
  --t-lighting: #7b3ff2;
  --t-construction: #e8820c;
  --t-etc: #51606e;

  /* 형태 */
  --r-sm: 8px;
  --r-md: 8px;
  --r-lg: 12px;
  --shadow-sm: 0 1px 4px rgba(0, 60, 66, 0.10);
  --shadow-md: 0 4px 14px rgba(0, 60, 66, 0.12);
  --shadow-lg: 0 8px 28px rgba(0, 60, 66, 0.16);

  /* 앱 틀 */
  --tab-h: 62px;
  --head-h: 53px;
}

/* 글꼴: 춤추는사람들 (DancingPeoples-Dance-VF, Copyright 2026 Hada Type Foundry, SIL Open Font License 1.1)
   출처: https://noonnu.cc/font_page/1974 */
@font-face {
  font-family: 'DancingPeople';
  src: url('/static/fonts/DancingPeoples-Dance-VF.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  line-height: 1.5;
}

body, button, input, textarea, select, .leaflet-container {
  font-family: 'DancingPeople', system-ui, -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 13px; }
.center { text-align: center; }

button { cursor: pointer; font: inherit; transition: transform .06s ease, opacity .15s ease, background .15s ease; }
button:active { transform: scale(0.97); }

/* ---------- 공통 버튼 ---------- */
.primary {
  width: 100%; padding: 15px; border: 0; border-radius: var(--r-md);
  background: var(--blue); color: #fff; font-size: 17px; font-weight: 600;
  margin-top: 6px; box-shadow: none;
}
.primary:active { background: var(--blue-dark); }
.primary:disabled { opacity: 0.55; }

.ghost {
  padding: 9px 13px; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: #fff; color: var(--ink); font-size: 14px; font-weight: 700;
}
.ghost:active { background: var(--bg); }
.ghost.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.ghost.small { padding: 7px 11px; font-size: 13px; }

.chip {
  white-space: nowrap; padding: 8px 15px; border: 1px solid var(--line);
  border-radius: 999px; background: #fff; font-size: 14px; font-weight: 700;
  color: var(--muted); box-shadow: var(--shadow-sm);
}
.chip.active { background: var(--blue); color: #fff; border-color: var(--blue); }

.error { color: var(--danger); font-size: 14px; min-height: 18px; margin: 4px 0; font-weight: 600; }
.hint { margin-top: 18px; font-size: 12px; color: var(--muted); line-height: 1.6; text-align: center; }

.badge { padding: 2px 8px; font-size: 12px; font-weight: 700; color: var(--blue-dark); background: var(--blue-soft); border-radius: 999px; }
.badge.ok { color: #14663a; background: #dff3e7; }
.badge.warn { color: #8a5200; background: #fdebd0; }

.count-badge { display: inline-block; min-width: 20px; margin-left: 8px; padding: 1px 6px; font-size: 12px; font-weight: 800; line-height: 18px; color: #fff; text-align: center; background: var(--danger); border-radius: 999px; }

/* ---------- 여러 화면이 같이 쓰는 움직임 ---------- */
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes shake { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg); } }
@keyframes pulse { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
@keyframes sosPulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(226, 59, 59, 0.5); }
  50% { box-shadow: 0 6px 26px rgba(226, 59, 59, 0.85); }
}

/* 화면 전환: 들어올 때 페이드 인, 링크를 누르면 페이드 아웃 뒤 이동 (ui.js가 html.ui-leave를 붙인다).
   브라우저의 문서 간 View Transition은 빠르게 이동하면 콘솔 오류를 남겨서 쓰지 않는다.
   transform을 쓰면 body 안의 position: fixed 요소 기준이 바뀌므로 opacity만 쓴다. */
@keyframes ui-page-in { from { opacity: 0; } }
body { animation: ui-page-in .22s ease both; }
html.ui-leave body { opacity: 0; transition: opacity .16s ease; }
