* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif; }

/* ===== 공통 flash 메시지 ===== */
.flash-container { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 2000; width: 90%; max-width: 480px; }
.flash { padding: 10px 16px; border-radius: 8px; margin-bottom: 8px; font-size: 14px; box-shadow: 0 2px 8px rgba(0,0,0,.15); }
.flash-success { background: #e6f7ea; color: #1a7f37; }
.flash-error { background: #fdeaea; color: #c0392b; }
.flash-warning { background: #fff8e1; color: #8a6d00; }

/* ===== 지도 페이지 레이아웃 ===== */
#app { position: relative; height: 100vh; height: 100dvh; width: 100vw; overflow: hidden; }
#map { position: absolute; inset: 0; z-index: 1; }

.topbar {
    position: absolute; top: 0; left: 0; right: 0; z-index: 500;
    background: rgba(255,255,255,.95); padding: 10px 16px; box-shadow: 0 1px 6px rgba(0,0,0,.08);
}
.topbar h1 { margin: 0; font-size: 18px; }
.topbar .disclaimer { margin: 4px 0 0; font-size: 12px; color: #666; }
.topbar-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.topbar-brand { display: flex; align-items: center; gap: 8px; }
.topbar-logo { width: 30px; height: 30px; flex-shrink: 0; }
.topbar-submit-btn { font-size: 13px; padding: 7px 12px; white-space: nowrap; }
.topbar-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }

.status-panel {
    background: #f8f8f8; border: 1px solid #eee; border-radius: 8px;
    padding: 6px 10px; text-align: right; white-space: nowrap;
}
.status-panel-date { font-size: 10px; color: #999; }
.status-panel-total { font-size: 13px; color: #222; }
.status-panel-total strong { font-size: 15px; color: #e63946; }
.status-panel-row { font-size: 11px; color: #666; margin-top: 2px; }

@media (max-width: 640px) {
    .status-panel { white-space: normal; }
}

/* ===== 사이드바 (마커 클릭 시 좌측에서 슬라이드) ===== */
.sidebar {
    position: absolute; top: 0; left: 0; bottom: 0; width: 360px; max-width: 90vw;
    background: #fff; box-shadow: 2px 0 12px rgba(0,0,0,.15);
    transform: translateX(-105%); transition: transform .25s ease-out;
    z-index: 1000; overflow-y: auto; padding-top: 8px;
}
.sidebar.open { transform: translateX(0); }
.sidebar-close {
    position: absolute; top: 8px; right: 8px; border: none; background: none;
    font-size: 22px; cursor: pointer; line-height: 1; padding: 4px 8px;
}
.sidebar-content { padding: 48px 20px 24px; }
.sidebar-placeholder { color: #999; font-size: 14px; }

.sidebar-photo { width: 100%; max-width: 220px; border-radius: 8px; display: block; margin-bottom: 12px; }
.sidebar-photo-placeholder {
    width: 100%; max-width: 220px; aspect-ratio: 3/4; border-radius: 8px; margin-bottom: 12px;
    background: #f0f0f0; display: flex; align-items: center; justify-content: center; color: #999; font-size: 13px;
}
.sidebar h2 { margin: 0 0 4px; font-size: 20px; }
.sidebar .meta { color: #555; font-size: 14px; margin-bottom: 12px; }
.sidebar .field { margin-bottom: 10px; }
.sidebar .field-label { font-size: 12px; color: #888; margin-bottom: 2px; }
.sidebar .field-value { font-size: 14px; }
.sidebar .status-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: #ffe8cc; color: #a6540b; }
.status-badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; background: #ffe8cc; color: #a6540b; }

.report-actions { margin-top: 20px; display: flex; flex-direction: column; gap: 8px; }
.report-actions a { text-align: center; padding: 10px; border-radius: 8px; text-decoration: none; font-weight: bold; }
.report-emergency { background: #e63946; color: #fff; }
.report-official { background: #f1f3f5; color: #222; border: 1px solid #ddd; }

.sidebar-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,.35);
    z-index: 900; display: none;
}
.sidebar-overlay.open { display: block; }

/* ===== 반응형 커스텀 마커 ===== */
/* ===== 반응형 커스텀 마커 ===== */
.cluster-badge {
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-weight: bold; font-size: 15px;
    border: 3px solid #fff; box-shadow: 0 1px 8px rgba(0,0,0,.4);
}
.marker-dot {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; line-height: 1;
    filter: drop-shadow(0 1px 3px rgba(0,0,0,.6));
}
.marker-detail {
    display: flex; align-items: center; gap: 6px;
    background: #fff; border-radius: 20px; padding: 3px 10px 3px 3px;
    box-shadow: 0 2px 8px rgba(0,0,0,.35); white-space: nowrap; font-size: 12px;
    border: 3px solid transparent;
}
.marker-detail img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.marker-detail .marker-thumb-placeholder {
    width: 28px; height: 28px;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,.35));
}
.marker-detail .marker-name { font-weight: 800; font-size: 13px; color: #111; }
.marker-detail .marker-age { color: #333; font-weight: 600; font-size: 11px; }
.marker-text-group {
    display: flex; align-items: baseline; gap: 5px;
    padding: 2px 8px; border-radius: 10px;
}

/* ===== 모바일 반응형 ===== */
@media (max-width: 640px) {
    .sidebar { width: 100vw; max-width: 100vw; }
    .topbar h1 { font-size: 16px; }
}

/* ===== 관리자 화면 ===== */
.admin-auth-wrap { display: flex; align-items: center; justify-content: center; height: 100vh; background: #f6f7f9; }
.admin-auth-form { background: #fff; padding: 32px; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,.08); width: 320px; }
.admin-auth-form h1 { font-size: 18px; margin: 0 0 20px; }
.admin-auth-form label { display: block; font-size: 13px; margin: 12px 0 4px; color: #555; }
.admin-auth-form input { width: 100%; padding: 10px; border: 1px solid #ddd; border-radius: 6px; }
.admin-auth-form button { margin-top: 20px; width: 100%; padding: 10px; border: none; border-radius: 6px; background: #222; color: #fff; cursor: pointer; }

.admin-wrap { max-width: 960px; margin: 0 auto; padding: 24px 16px 60px; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.admin-header-actions { display: flex; gap: 8px; }
.btn { padding: 8px 14px; border-radius: 6px; text-decoration: none; font-size: 14px; display: inline-block; border: none; cursor: pointer; }
.btn-primary { background: #222; color: #fff; }
.btn-ghost { background: #f1f3f5; color: #222; }

.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.admin-table th, .admin-table td { padding: 10px; border-bottom: 1px solid #eee; text-align: left; }
.inline-form { display: inline; }

.case-form { display: flex; flex-direction: column; max-width: 520px; }
.case-form label { font-size: 13px; color: #555; margin: 14px 0 4px; }
.case-form input, .case-form select, .case-form textarea { padding: 9px; border: 1px solid #ddd; border-radius: 6px; font: inherit; }
.case-form .form-row { display: flex; gap: 12px; }
.case-form .form-row > div { flex: 1; }
.case-form .checkbox-label { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #333; }
.field-hint { font-size: 12px; color: #888; margin: 4px 0 0; }
.back-link { font-size: 13px; color: #555; text-decoration: none; }

/* ===== 삭제 버튼 ===== */
.link-danger {
    background: none; border: none; color: #c0392b; text-decoration: underline;
    cursor: pointer; font-size: inherit; padding: 0; margin-left: 8px;
}

.donation-footer {
    position: absolute; bottom: 0; left: 0; right: 0; z-index: 1200;
    background: rgba(255,255,255,.95); text-align: center;
    padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); font-size: 12px; color: #555;
    box-shadow: 0 -1px 6px rgba(0,0,0,.08);
}
.donation-footer a { color: #457b9d; text-decoration: none; position: relative; z-index: 1; }
.donation-footer a:hover { text-decoration: underline; }

/* ===== 상태별 색상 ===== */
.status-dot {
    display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle;
}
.status-dot-in_progress { background: #e63946; }
.status-dot-found { background: #2a9d8f; }
.status-dot-deceased { background: #6c757d; }
.status-dot-closed { background: #457b9d; }

.marker-status-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0;
}

/* ===== 필터 패널 ===== */
.filter-toggle {
    margin-top: 8px; padding: 6px 14px; border: 1px solid #ddd; border-radius: 20px;
    background: #fff; font-size: 13px; cursor: pointer;
}
.filter-panel {
    display: none; margin-top: 10px; padding: 12px; background: #fafafa;
    border: 1px solid #eee; border-radius: 10px; max-width: 320px;
}
.filter-panel.open { display: block; }
.filter-group { margin-bottom: 12px; }
.filter-group-title { font-size: 12px; color: #888; margin-bottom: 6px; }
.filter-checkbox { display: flex; align-items: center; font-size: 13px; margin-bottom: 6px; cursor: pointer; }
.filter-checkbox input { margin-right: 6px; }
#filter-since { width: 100%; padding: 6px; border: 1px solid #ddd; border-radius: 6px; }
.filter-apply-btn { width: 100%; }

/* ===== 클러스터 목록 사이드바 ===== */
.sidebar-zoom-btn {
    display: block; width: 100%; margin: 8px 0 16px; padding: 8px;
    border: 1px solid #ddd; border-radius: 6px; background: #f8f8f8;
    font-size: 13px; cursor: pointer;
}
.sidebar-list { list-style: none; margin: 0; padding: 0; }
.sidebar-list-item {
    display: flex; align-items: center; gap: 10px; padding: 10px 4px;
    border-bottom: 1px solid #f0f0f0; cursor: pointer;
}
.sidebar-list-item:hover { background: #f8f8f8; }
.sidebar-list-item img {
    width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex-shrink: 0;
}
.list-thumb-placeholder {
    width: 40px; height: 40px; border-radius: 50%; background: #f0f0f0; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center; font-size: 20px;
}
.sidebar-list-item-name { font-weight: bold; font-size: 14px; }
.sidebar-list-item-meta { font-size: 12px; color: #777; }
/* ===== 사진 제보 ===== */
.report-photo-link {
    display: block; margin-bottom: 16px; font-size: 13px; color: #457b9d; text-decoration: underline;
}
.report-photo-wrap { max-width: 560px; margin: 0 auto; padding: 24px 16px 60px; }
.report-photo-wrap h1 { font-size: 20px; margin: 12px 0 4px; }
.report-photo-target { color: #555; margin-bottom: 16px; }
.report-photo-warning {
    background: #fff8e1; border: 1px solid #f0d98c; border-radius: 8px;
    padding: 14px 16px; margin-bottom: 20px; font-size: 13px; color: #6b5a00;
}
.report-photo-warning ul { margin: 8px 0 0; padding-left: 18px; }
.report-photo-warning li { margin-bottom: 4px; }

/* ===== 관리자 - 사진 제보 검토 ===== */
.submission-card {
    display: flex; gap: 16px; align-items: flex-start; padding: 16px;
    border: 1px solid #eee; border-radius: 8px; margin-bottom: 12px;
}
.submission-card img { width: 100px; height: 100px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.submission-card-info { flex: 1; }
.submission-actions { display: flex; gap: 8px; margin-top: 10px; }
.btn-approve { background: #2a9d8f; color: #fff; }
.btn-reject { background: #e63946; color: #fff; }

/* ===== 관리자 - 통계 ===== */
.stats-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px;
    margin: 16px 0 32px;
}
.stats-card {
    background: #f8f8f8; border-radius: 10px; padding: 16px; text-align: center;
}
.stats-card-value { font-size: 26px; font-weight: 800; color: #222; }
.stats-card-label { font-size: 12px; color: #777; margin-top: 4px; }

.stats-section-title { font-size: 16px; margin: 32px 0 12px; }

.visit-chart {
    display: flex; align-items: flex-end; gap: 6px; height: 140px;
    border-bottom: 1px solid #eee; padding-bottom: 4px; margin-bottom: 8px;
}
.visit-bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.visit-bar-count { font-size: 11px; color: #457b9d; font-weight: 700; margin-bottom: 2px; }
.visit-bar { width: 100%; max-width: 24px; background: #457b9d; border-radius: 3px 3px 0 0; min-height: 2px; }
.visit-bar-label { font-size: 10px; color: #999; margin-top: 4px; white-space: nowrap; }
