/* 산책 — 관리자 화면 (style.css 위에 덧입힘) */

body.admin {
  line-height: 1.65;
}

/* ---------- 로그인 ---------- */

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
}

.login-card {
  width: 100%;
  max-width: 380px;
  padding: 38px 28px 30px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.login-brand {
  display: block;
  text-align: center;
  font-size: 24px;
}

.login-title {
  margin: 10px 0 26px;
  text-align: center;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 16px;
  color: var(--muted);
}

.field {
  display: block;
  margin-bottom: 16px;
}

.field-label {
  display: block;
  margin: 0 0 6px 2px;
  font-size: 13px;
  color: var(--muted);
}

.field-hint {
  font-size: 12px;
  color: var(--muted);
}

.input {
  display: block;
  width: 100%;
  padding: 13px 15px;
  font-family: var(--sans);
  font-size: 16px;
  color: var(--text);
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

input[type='date'].input {
  -webkit-appearance: none;
  appearance: none;
  min-width: 0;
  height: 50px;
  text-align: left;
}

.form-grid > * {
  min-width: 0;
}

.input:focus {
  outline: none;
  border-color: var(--brown);
  box-shadow: 0 0 0 4px rgba(118, 87, 63, 0.12);
}

textarea.input {
  min-height: 150px;
  resize: vertical;
  font-family: var(--serif);
  line-height: 1.85;
}

.back-link {
  display: block;
  margin-top: 20px;
  text-align: center;
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--brown);
}

/* ---------- 상단 ---------- */

.admin-header {
  position: sticky;
  top: 0;
  z-index: 10;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(244, 239, 230, 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.admin-header-inner {
  max-width: 980px;
  margin: 0 auto;
  padding: 8px 12px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 12px;
}

.admin-brand {
  padding: 6px 6px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: 0.16em;
  text-decoration: none;
}

.admin-brand small {
  margin-left: 4px;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.admin-nav {
  order: 3;
  width: 100%;
  display: flex;
  gap: 4px;
}

.admin-nav a {
  padding: 8px 10px 9px;
  font-size: 14.5px;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1.5px solid transparent;
}

.admin-nav a:hover {
  color: var(--text);
}

.admin-nav a.active {
  color: var(--text);
  border-bottom-color: var(--brown);
}

.admin-tools {
  display: flex;
  align-items: center;
}

.tool-link {
  padding: 8px 10px;
  font-size: 13.5px;
  color: var(--muted);
  text-decoration: none;
  background: none;
  border: 0;
  border-radius: 10px;
}

.tool-link:hover {
  color: var(--brown);
  background: rgba(118, 87, 63, 0.07);
}

.admin-main {
  max-width: 980px;
  margin: 0 auto;
  padding: 26px 18px calc(env(safe-area-inset-bottom, 0px) + 80px);
}

@media (min-width: 720px) {
  .admin-header-inner {
    flex-wrap: nowrap;
    padding: 10px 18px;
  }

  .admin-nav {
    order: 0;
    width: auto;
    flex: 1;
    justify-content: center;
    gap: 14px;
  }
}

/* ---------- 공통 조각 ---------- */

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 22px;
}

.page-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 26px;
  line-height: 1.4;
}

.page-sub {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--muted);
}

.section-title {
  margin: 38px 0 14px;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 18px;
}

.btn-sm {
  padding: 10px 20px;
  font-size: 14.5px;
  border-radius: 999px;
}

.btn-danger {
  background: var(--clay);
  color: var(--card);
}

.btn-danger:hover:not(:disabled) {
  background: #87493a;
}

.mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--muted);
  text-decoration: none;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

.mini:hover:not(:disabled) {
  color: var(--brown);
  border-color: var(--brown);
}

.mini:disabled {
  opacity: 0.35;
  cursor: default;
}

.mini .ico {
  width: 15px;
  height: 15px;
}

.mini.danger:hover:not(:disabled) {
  color: var(--clay);
  border-color: var(--clay);
}

.mini.is-public {
  color: var(--olive);
  border-color: rgba(78, 86, 67, 0.35);
  background: rgba(78, 86, 67, 0.08);
}

.mini.is-private {
  background: var(--sand);
}

.crumb {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 18px -4px;
  padding: 4px 8px 4px 2px;
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
}

.crumb:hover {
  color: var(--brown);
}

.crumb .ico {
  width: 18px;
  height: 18px;
}

.empty-note {
  padding: 56px 12px;
  text-align: center;
  font-family: var(--serif);
  font-weight: 300;
  color: var(--muted);
}

/* ---------- 관리자 홈 ---------- */

.glance {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.glance > div {
  padding: 18px 8px 16px;
  text-align: center;
}

.glance > div + div {
  border-left: 1px solid var(--line);
}

.glance dt {
  font-size: 12.5px;
  color: var(--muted);
}

@media (max-width: 520px) {
  .glance dt {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    min-height: 2.8em;
    line-height: 1.4;
  }
}

.glance dd {
  margin: 2px 0 0;
  font-family: var(--serif);
  font-size: 25px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

.glance dd small {
  margin-left: 2px;
  font-size: 13px;
  color: var(--muted);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
}

@media (min-width: 640px) {
  .gallery-grid {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 20px;
  }
}

.art-card {
  position: relative;
  display: block;
  overflow: hidden;
  color: inherit;
  text-decoration: none;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  transition: border-color 0.25s;
}

.art-card:hover {
  border-color: #cdbfae;
}

.art-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  background: var(--sand);
}

.art-body {
  padding: 11px 14px 14px;
}

.art-no {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

.art-title {
  margin: 1px 0 4px;
  font-family: var(--serif);
  font-size: 15.5px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.art-count {
  margin: 0;
  font-size: 13px;
  color: var(--olive);
}

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  padding: 2px 10px;
  font-size: 12px;
  color: var(--muted);
  background: rgba(251, 248, 242, 0.92);
  border: 1px solid var(--line);
  border-radius: 999px;
}

/* ---------- 사진 관리 ---------- */

.rows {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.row {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 12px 16px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.row-thumb {
  width: 84px;
  height: 84px;
  object-fit: cover;
  background: var(--sand);
  border-radius: 14px;
}

.row-info {
  min-width: 0;
}

.row-title {
  margin: 0;
  font-family: var(--serif);
  font-size: 16px;
  line-height: 1.5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-meta {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.row-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

@media (min-width: 720px) {
  .row {
    grid-template-columns: 84px 1fr auto;
    align-items: center;
  }

  .row-actions {
    grid-column: auto;
    justify-content: flex-end;
  }
}

/* ---------- 받은 이야기 ---------- */

.photo-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

.photo-head img {
  width: 96px;
  height: 96px;
  flex: none;
  object-fit: cover;
  background: var(--sand);
  border-radius: 16px;
}

.photo-head h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 22px;
  line-height: 1.45;
}

.photo-head p {
  margin: 2px 0 0;
  font-size: 13.5px;
  color: var(--muted);
}

.photo-head .count {
  margin-top: 6px;
  font-size: 14px;
  color: var(--olive);
}

.comments {
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  border-bottom: 1px solid var(--line);
}

.comment {
  padding: 22px 4px 18px;
  border-top: 1px solid var(--line);
}

.comment-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.comment-who {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 15px;
}

.comment-time {
  font-size: 12.5px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.comment-body {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 16px;
  line-height: 1.95;
  white-space: pre-wrap;
}

.comment-foot {
  display: flex;
  justify-content: flex-end;
  margin-top: 8px;
}

/* ---------- 창 (올리기 / 수정 / 확인) ---------- */

/* 창이 화면보다 길어도 안쪽에서 또 스크롤되지 않고, 바깥 층 하나만 스크롤돼요 */
#modalRoot .modal {
  align-items: flex-start;
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-anchor: none;
  -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top, 0px) + 14px) 14px calc(env(safe-area-inset-bottom, 0px) + 14px);
}

#modalRoot .modal-backdrop {
  position: fixed;
}

#modalRoot .sheet {
  margin: auto;
  max-height: none;
  overflow: visible;
  transform: translateY(12px);
}

#modalRoot .modal.open .sheet {
  transform: none;
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 520px;
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 28px 22px 22px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 30px 60px -28px rgba(53, 44, 37, 0.5);
  opacity: 0;
  transform: translateY(18px) scale(0.98);
  transition: opacity 0.35s ease, transform 0.45s cubic-bezier(0.2, 0.75, 0.2, 1);
}

.sheet:focus {
  outline: none;
}

.modal.open .sheet {
  opacity: 1;
  transform: none;
}

.sheet-title {
  margin: 0 0 18px;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
}

.sheet-text {
  margin: -6px 0 6px;
  font-size: 14.5px;
  color: var(--muted);
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.sheet-actions .btn {
  min-width: 108px;
}

.btn.is-busy {
  opacity: 0.55;
  pointer-events: none;
}

.form-grid {
  display: grid;
  gap: 0 14px;
}

@media (min-width: 520px) {
  .form-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.file-drop {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 212px;
  margin-bottom: 18px;
  padding: 14px;
  text-align: center;
  font-size: 14px;
  color: var(--muted);
  background: var(--field);
  border: 1.5px dashed var(--line);
  border-radius: 18px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.file-drop:hover,
.file-drop:focus-within {
  border-color: var(--brown);
}

.file-drop input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop-slot {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 116px;
  flex: none;
}

.drop-slot .ico {
  width: 30px;
  height: 30px;
}

.drop-slot img {
  position: absolute;
  inset: 0;
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 12px;
}

.drop-slot.has-image img {
  display: block;
}

.drop-slot.has-image .ico {
  display: none;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 0;
  font-size: 14.5px;
}

.check input {
  width: 20px;
  height: 20px;
  accent-color: var(--olive);
}

.progress {
  height: 4px;
  margin-top: 6px;
  opacity: 0;
  transition: opacity 0.25s;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.progress.on {
  opacity: 1;
}

.progress span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--brown);
  transition: width 0.2s;
}

/* ---------- 알림 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 26px);
  z-index: 80;
  max-width: calc(100vw - 36px);
  padding: 10px 20px;
  font-size: 14px;
  color: var(--card);
  background: var(--olive);
  border-radius: 999px;
  opacity: 0;
  transform: translate(-50%, 8px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: var(--clay);
}
