/* ── Itdasy Design System v1 · screens/dm-autoreply-v3.css ──────
   DM 자동응답 v3 — 활성화/페르소나/톤/운영시간/금지어/inbox + 슬라이드 애니메이션
   mockup: ../../mockups/03a-dm-autoreply.html
   tokens: tokens.css */

/* ── 시트 헤더 (모바일) ──────────────────────────────────────── */
.dm-header {
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.5px solid var(--border);
}
.dm-header__back {
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-family: inherit;
}
.dm-header__title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.2px;
  color: var(--text);
}
.dm-header__action {
  font-size: 12px;
  color: var(--text-muted);
  background: none;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: 0;
  cursor: pointer;
  font-weight: 600;
  padding: 6px 8px;
  font-family: inherit;
}

/* ── 본문 ─────────────────────────────────────────────────── */
.dm-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 22px;
  background: var(--bg);
}
.dm-body::-webkit-scrollbar { width: 0; }

/* ── 활성화 카드 ──────────────────────────────────────────── */
.dm-activate {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  margin-bottom: 18px;
}
.dm-activate__top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.dm-activate__info { flex: 1; }
.dm-activate__status {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}
.dm-activate__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ok);
  animation: dm-pulse 2s ease-in-out infinite;
}
.dm-activate__dot--off {
  background: var(--text-subtle);
  animation: none;
}
.dm-activate__dot--off + .dm-activate__status-text { color: var(--text-subtle); }
@keyframes dm-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}
.dm-activate__status-text {
  font-size: 11px;
  font-weight: 700;
  color: var(--ok);
  letter-spacing: 0.2px;
}
.dm-activate__title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  letter-spacing: -0.3px;
}
.dm-activate__meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
  line-height: 1.5;
  font-weight: 500;
}
.dm-activate__meta b { font-weight: 700; }
.dm-activate__pause {
  margin-left: auto;
  font-size: 11px;
  color: var(--brand-strong);
  background: var(--brand-bg);
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: 0;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.dm-activate__stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
  padding-top: 12px;
  border-top: 0.5px solid var(--border);
}
.dm-activate__stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.dm-activate__stat-value {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.3px;
}
.dm-activate__stat-label {
  font-size: 10.5px;
  color: var(--text-subtle);
  font-weight: 500;
}

/* ── 큰 토글 (활성화용 44x26) ────────────────────────────────── */
.dm-toggle {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: 0;
  padding: 0;
  background: transparent;
  font-family: inherit;
}
.dm-toggle__track {
  width: 100%;
  height: 100%;
  background: #d1d5db;  /* 명확한 회색 = OFF */
  border-radius: var(--r-pill);
  transition: background 0.2s;
}
.dm-toggle__knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  background: var(--surface);
  border-radius: 50%;
  box-shadow: 0 1px 3px var(--border-strong);
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.dm-toggle.is-on .dm-toggle__track { background: #22c55e; }  /* vivid green = ON */
.dm-toggle.is-on .dm-toggle__knob { transform: translateX(18px); }
.dm-toggle.is-disabled { opacity: 0.4; cursor: not-allowed; }
.dm-toggle.is-disabled .dm-toggle__track { background: #D1D6DB; }

/* 작은 토글 (운영시간 외 응답 등 36x22) */
.dm-toggle--small {
  width: 36px;
  height: 22px;
}
.dm-toggle--small .dm-toggle__knob {
  width: 18px;
  height: 18px;
}
.dm-toggle--small.is-on .dm-toggle__knob { transform: translateX(14px); }

/* ── 페르소나 카드 ────────────────────────────────────────── */
.dm-persona {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.dm-persona__icon {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--brand-bg);
  color: var(--brand-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dm-persona__info { flex: 1; min-width: 0; }
.dm-persona__title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dm-persona__title b { color: var(--brand-strong); }
.dm-persona__meta {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 3px;
  font-weight: 500;
}
.dm-persona__progress {
  margin-top: 7px;
  height: 4px;
  width: 100%;
  background: var(--border);
  border-radius: var(--r-pill);
  overflow: hidden;
}
.dm-persona__bar {
  height: 100%;
  width: 92%;
  background: var(--brand-strong);
  border-radius: var(--r-pill);
}
.dm-persona__pct {
  font-size: 11.5px;
  font-weight: 700;
  color: var(--brand-strong);
  flex-shrink: 0;
}

/* ── 섹션 ─────────────────────────────────────────────────── */
.dm-section { margin-bottom: 22px; }
.dm-section__title {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  margin: 0 4px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.dm-section__help {
  font-size: 11px;
  color: var(--text-subtle);
  font-weight: 500;
  text-transform: none;
  letter-spacing: 0;
}

/* ── 톤 카드 3개 ──────────────────────────────────────────── */
.dm-tone {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 6px;
}
.dm-tone__card {
  padding: 12px 10px 11px;
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  cursor: pointer;
  text-align: center;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  appearance: none;
  -webkit-appearance: none;
  outline: 0;
  font-family: inherit;
  color: var(--text);
}
.dm-tone__card:hover { transform: translateY(-1px); }
.dm-tone__card.is-on {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.dm-tone__icon {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 6px;
  color: var(--text-muted);
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: 0;
  cursor: pointer;
  font-family: inherit;
}
.dm-tone__card.is-on .dm-tone__icon {
  background: var(--border-strong);
  color: var(--surface);
}
.dm-tone__name {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}
.dm-tone__card.is-on .dm-tone__name { color: var(--surface); }
.dm-tone__sample {
  font-size: 11px;
  color: var(--text-subtle);
  margin-top: 3px;
  line-height: 1.4;
}
.dm-tone__card.is-on .dm-tone__sample { color: var(--border-strong); }

/* ── 일반 행 리스트 ──────────────────────────────────────── */
.dm-rows {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.dm-rows__item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 0.5px solid var(--border);
}
.dm-rows__item:last-child { border-bottom: none; }
.dm-rows__label {
  flex: 1;
  font-size: 13.5px;
  color: var(--text);
  font-weight: 600;
  letter-spacing: -0.2px;
}
.dm-rows__value {
  font-size: 12.5px;
  color: var(--text-muted);
  font-weight: 500;
}
.dm-rows__value b { color: var(--text); font-weight: 700; }
.dm-rows__chev { color: var(--text-subtle); }

/* ── 시간 input ─────────────────────────────────────────── */
.dm-time {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dm-time__input {
  flex: 1;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--r-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: inherit;
  outline: 0;
}
.dm-time__sep {
  color: var(--text-subtle);
  font-weight: 700;
}

/* ── 금지어 textarea ────────────────────────────────────── */
.dm-ban {
  width: 100%;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  font-family: inherit;
  resize: none;
  min-height: 60px;
  outline: 0;
}
.dm-ban:focus { border-color: var(--border-strong); }
/* 예약 양식 textarea + 예약금 인풋 = 완전히 같은 타입 램프(크기·줄간격·색) */
.dm-ban::placeholder,
.dm-field__input::placeholder {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-subtle);
}

/* ── 예약 양식: 세로 스택 입력 필드 ─────────────────────── */
.dm-field {
  margin-top: 12px;
}
.dm-field__label {
  display: block;
  margin: 0 4px 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}
.dm-field__input {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
  text-align: left;
  font-family: inherit;
  outline: 0;
}
.dm-field__input:focus { border-color: var(--border-strong); }
.dm-field__suffix {
  position: relative;
}
.dm-field__input--unit { padding-right: 34px; }
.dm-field__unit {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--text-subtle);
  pointer-events: none;
}

/* ── DM inbox ───────────────────────────────────────────── */
.dm-inbox {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dm-card {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  max-height: 600px;
  overflow: hidden;
  transition:
    transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
    opacity 0.35s ease,
    margin 0.35s ease,
    max-height 0.45s ease;
}
.dm-card.is-pending {
  background: var(--surface-2);
  border-color: var(--border);
}
.dm-card.is-sending {
  transform: translateX(120%);
  opacity: 0;
  max-height: 0;
  margin-bottom: -10px !important;
  padding-top: 0 !important;
  padding-bottom: 0 !important;
}
.dm-card__top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.dm-card__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
}
.dm-card__name {
  flex: 1;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.2px;
}
.dm-card__time {
  font-size: 10.5px;
  color: var(--text-subtle);
  font-weight: 500;
}
.dm-card__cat {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-muted);
  margin-right: 4px;
  display: inline-block;
}
.dm-card__pending-badge {
  font-size: 9.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  background: var(--text);
  color: var(--surface);
  margin-left: auto;
  letter-spacing: 0.2px;
}

/* ── DM 말풍선 thread ─────────────────────────────────── */
.dm-thread {
  padding: 12px 4px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 6px;
  border-top: 0.5px solid var(--border);
}
.dm-thread__row {
  display: flex;
  gap: 7px;
  align-items: flex-end;
  padding: 0 8px;
}
.dm-thread__row--received { justify-content: flex-start; }
.dm-thread__row--sent { justify-content: flex-end; }
.dm-thread__avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface);
  border: 0.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9.5px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-bottom: 2px;
}
.dm-thread__avatar--shop {
  background: var(--brand-strong);
  color: var(--surface);
  border: none;
}
.dm-bubble {
  max-width: 78%;
  padding: 8px 12px;
  font-size: 12.5px;
  line-height: 1.5;
  word-break: break-word;
}
.dm-bubble--received {
  background: var(--surface);
  color: var(--text);
  border: 0.5px solid var(--border);
  border-radius: 16px 16px 16px 4px;
}
.dm-card.is-pending .dm-bubble--received {
  background: var(--surface);
  border-color: var(--border-strong);
}
.dm-bubble--sent {
  background: var(--brand-strong);
  color: var(--surface);
  border-radius: 16px 16px 4px 16px;
  font-weight: 500;
}
.dm-bubble--sent.is-draft {
  position: relative;
  cursor: text;
  min-width: 120px;
  min-height: 1em;
}
/* 2026-05-01 ── 빈 초안일 때 placeholder 표시. 사용자 보고: '여기에 초안등록 안되어있어. 빈칸이야' */
.dm-bubble--sent.is-draft:empty::before {
  content: attr(data-placeholder);
  color: rgba(255,255,255,0.65);
  font-style: italic;
  pointer-events: none;
}
.dm-bubble--sent.is-draft::after {
  content: '✎';
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  background: var(--surface);
  color: var(--brand-strong);
  border: 0.5px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 2px 6px var(--border-strong);
}
.dm-bubble--sent.is-draft:focus {
  outline: 2px solid var(--brand-strong);
  outline-offset: 2px;
}
.dm-bubble--sent.is-draft:hover {
  filter: brightness(1.05);
}
.dm-thread__time-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  margin-top: -2px;
}
.dm-thread__time-row--received { margin-left: 29px; }
.dm-thread__time-row--sent {
  justify-content: flex-end;
  margin-right: 29px;
}
.dm-thread__time {
  font-size: 9.5px;
  color: var(--text-subtle);
  font-weight: 500;
}
.dm-thread__time.is-draft {
  color: var(--brand-strong);
  font-weight: 700;
}

/* ── 톤 미세 조정 (이 답장만) ─────────────────────────── */
.dm-mini-tone {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 0.5px solid var(--border);
}
.dm-mini-tone__label {
  font-size: 10.5px;
  color: var(--text-subtle);
  font-weight: 600;
}
.dm-mini-tone__chips {
  display: flex;
  gap: 4px;
  flex: 1;
}
.dm-mini-tone__chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  background: var(--surface-2);
  border: 0.5px solid var(--border);
  border-radius: var(--r-pill);
  color: var(--text-muted);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: 0;
  font-family: inherit;
}
.dm-mini-tone__chip.is-on {
  background: var(--text);
  color: var(--surface);
  border-color: var(--text);
}
.dm-mini-tone__regen {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text);
  background: var(--surface);
  border: 0.5px solid var(--border-strong);
  padding: 4px 9px;
  border-radius: var(--r-pill);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  outline: 0;
  font-family: inherit;
}

/* ── 검토 액션 ──────────────────────────────────────── */
.dm-actions {
  display: flex;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 0.5px solid var(--border);
}
.dm-action {
  flex: 1;
  padding: 10px 0;
  font-size: 12.5px;
  font-weight: 700;
  border-radius: var(--r-sm);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  font-family: inherit;
}
.dm-action.is-send {
  background: var(--text);
  color: var(--surface);
  flex: 2;
}
.dm-action.is-reject {
  background: var(--surface-2);
  color: var(--text-muted);
  border: 0.5px solid var(--border);
}

/* ── PC 레이아웃 ─────────────────────────────────────── */
.dm-pc-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  align-items: start;
}
.dm-pc-header {
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 0.5px solid var(--border);
  background: var(--surface);
}
.dm-pc-header__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}
.dm-pc-header__back {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface-2);
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  outline: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  font-family: inherit;
}
.dm-pc-header__actions {
  display: flex;
  gap: 8px;
}

@media (min-width: 1100px) {
  .dm-pc-grid {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── prefers-reduced-motion ─────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .dm-activate__dot { animation: none; }
  .dm-tone__card:hover { transform: none; }
  .dm-tone__card { transition: none; }
  .dm-toggle__knob { transition: none; }
  .dm-card {
    transition: opacity 0.2s ease;
  }
  .dm-card.is-sending {
    transform: none;
    max-height: 0;
  }
}
