/* ============================================================
   여러 화면이 같이 쓰는 조각들.
   버튼, 칩, 카드, 입력, 바텀시트, 토스트.
   ============================================================ */

/* ---------- 버튼 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  min-height: var(--tap);
  padding: 0 var(--sp-5);
  border-radius: var(--r-pill);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform 0.12s var(--ease), background-color 0.15s var(--ease);
}

.btn:active {
  transform: translateY(1px);
}

.btn--primary {
  background: var(--ink);
  color: var(--paper);
}

.btn--primary:hover {
  background: #000;
}

.btn--accent {
  background: var(--accent);
  color: var(--paper);
}

.btn--accent:hover {
  background: var(--accent-deep);
}

.btn--soft {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn--ghost {
  background: transparent;
  color: var(--sub);
}

.btn--danger {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-soft);
}

.btn--block {
  width: 100%;
}

.btn:disabled {
  background: var(--cream);
  color: var(--muted);
  cursor: default;
  transform: none;
}

/* 동그란 아이콘 버튼. 손가락 크기를 지키려고 44px 을 강제한다. */
.icon-btn {
  width: var(--tap);
  height: var(--tap);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  color: var(--ink);
  background: var(--paper);
}

.icon-btn:hover {
  background: var(--cream);
}

.icon-btn svg {
  width: 22px;
  height: 22px;
}

/* ---------- 칩 ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-1);
  padding: 5px 10px;
  border-radius: var(--r-pill);
  background: var(--cream);
  color: var(--sub);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}

.chip--now {
  background: var(--accent);
  color: var(--paper);
}

.chip--soon {
  background: var(--butter);
  color: #7a5200;
}

.chip--later {
  background: var(--cream);
  color: var(--sub);
}

.chip--done {
  background: var(--mint);
  color: var(--ok);
}

.chip--tag {
  background: var(--sky);
  color: #2b5c99;
}

.chip--warn {
  background: var(--accent-soft);
  color: var(--warn);
}

/* ---------- 구역 제목 ---------- */

.section {
  margin-top: var(--sp-6);
}

.section__head {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin: 0 var(--sp-1) var(--sp-2);
}

.section__head h2 {
  font-size: var(--fs-md);
  font-weight: 700;
}

.section__count {
  padding: 1px 8px;
  border-radius: var(--r-pill);
  background: var(--cream);
  color: var(--sub);
  font-size: var(--fs-xs);
  font-weight: 700;
}

.section__hint {
  margin: 0 var(--sp-1) var(--sp-2);
  font-size: var(--fs-sm);
  color: var(--sub);
}

/* ---------- 카드 ---------- */

.card {
  display: block;
  width: 100%;
  text-align: left;
  padding: var(--sp-4);
  border-radius: var(--r-md);
  background: var(--paper);
  box-shadow: var(--shadow-card);
}

.card + .card {
  margin-top: var(--sp-2);
}

/* ---------- 입력 ---------- */

.field {
  display: block;
  margin-top: var(--sp-4);
}

.field__label {
  display: block;
  margin-bottom: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 700;
  color: var(--ink);
}

.field__hint {
  margin-top: var(--sp-2);
  font-size: var(--fs-xs);
  line-height: var(--lh-normal);
  color: var(--sub);
}

.input,
.textarea,
select.input {
  width: 100%;
  min-height: var(--tap);
  padding: var(--sp-3) var(--sp-4);
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--paper);
  font-size: var(--fs-md);
}

.input:focus,
.textarea:focus {
  border-color: var(--accent);
  outline: none;
}

.textarea {
  min-height: 168px;
  line-height: var(--lh-normal);
  resize: vertical;
}

/* 체크 상자. 글자까지 누를 수 있게 label 전체를 키운다. */
.check {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  min-height: var(--tap);
  padding: var(--sp-2) 0;
  cursor: pointer;
}

.check input {
  width: 22px;
  height: 22px;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.check span {
  font-size: var(--fs-md);
}

.field__error {
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--accent);
}

/* ---------- 바텀시트 ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(21, 24, 30, 0.38);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.18s var(--ease);
}

.sheet {
  width: 100%;
  max-width: var(--page-max);
  max-height: 88vh;
  overflow-y: auto;
  padding: var(--sp-3) var(--sp-5) calc(var(--sp-6) + env(safe-area-inset-bottom));
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  background: var(--bg);
  box-shadow: var(--shadow-sheet);
  animation: sheet-up 0.24s var(--ease);
}

.sheet__grip {
  width: 44px;
  height: 4px;
  margin: 0 auto var(--sp-4);
  border-radius: var(--r-pill);
  background: var(--line);
}

.sheet__title {
  font-size: var(--fs-title);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: var(--lh-tight);
}

.sheet__desc {
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  color: var(--sub);
}

.sheet__actions {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  margin-top: var(--sp-6);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes sheet-up {
  from { transform: translateY(24px); opacity: 0.6; }
  to { transform: none; opacity: 1; }
}

@media (min-width: 1024px) {
  .sheet-backdrop {
    align-items: center;
  }

  .sheet {
    max-width: 440px;
    border-radius: var(--r-lg);
    padding-bottom: var(--sp-6);
  }
}

/* ---------- 토스트 ---------- */

.toast-host {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + var(--sp-4) + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  width: calc(100% - var(--sp-8));
  max-width: 420px;
  pointer-events: none;
}

/* 노트북에서는 우측 하단. 윈도우 시스템 알림이 뜨는 자리와 같아서,
   앱 안 알림과 브라우저 푸시 알림이 같은 곳에서 나온다(맥은 시스템 알림이 우측 상단).
   아래 가운데에 두면 폰에서 탭바 위였던 자리라, 사이드바로 바뀐 뒤에는 기댈 곳 없이 떠 있다. */
@media (min-width: 1024px) {
  .toast-host {
    left: auto;
    right: var(--sp-6);
    bottom: var(--sp-6);
    transform: none;
    width: 360px;
  }
}

.toast {
  padding: var(--sp-3) var(--sp-4);
  border-radius: var(--r-sm);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--fs-sm);
  line-height: var(--lh-normal);
  box-shadow: var(--shadow-float);
  animation: toast-in 0.2s var(--ease);
}

.toast--warn {
  background: var(--accent);
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ---------- 빈 화면 ---------- */

.empty {
  padding: var(--sp-8) var(--sp-4);
  text-align: center;
}

.empty__art {
  display: flex;
  justify-content: center;
  margin-bottom: var(--sp-4);
}

.empty__title {
  font-size: var(--fs-lg);
  font-weight: 700;
}

.empty__desc {
  margin-top: var(--sp-2);
  font-size: var(--fs-sm);
  line-height: var(--lh-loose);
  color: var(--sub);
  white-space: pre-line;   /* 문구 안의 줄바꿈 문자를 살린다 */
}

.empty .btn {
  margin-top: var(--sp-5);
}
