/* style.css — 폼 전용 CSS (생성 페이지, 목록 페이지) */

:root {
  --bg: #f8f6f3;
  --bg-card: #ffffff;
  --text: #2c2c2c;
  --text-secondary: #666;
  --text-muted: #666;
  --border: #e0ddd8;
  --border-focus: #2c2c2c;
  --primary: #2c2c2c;
  --primary-text: #fff;
  --error: #d32f2f;
  --success: #2e7d32;
  --radius: 12px;
  --radius-sm: 8px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { }
html.font-lg { font-size: 112%; }
html.font-xl { font-size: 125%; }

body {
  font-family: 'Pretendard', -apple-system, 'Malgun Gothic', '맑은 고딕', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  justify-content: center;
}

.page-container {
  max-width: 480px;
  width: 100%;
  padding: 0 20px 40px;
}

/* 네비게이션 */
.top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
}
.top-nav .logo {
  font-size: 18px;
  font-weight: 700;
  text-decoration: none;
  color: var(--text);
}
.top-nav a { text-decoration: none; color: var(--text-secondary); font-size: 14px; }
.top-nav .nav-right { display: flex; align-items: center; gap: 8px; }
.top-nav .btn-font { background: none; border: 1px solid var(--border); border-radius: 8px; padding: 4px 10px; font-size: 14px; font-family: inherit; cursor: pointer; color: var(--text); white-space: nowrap; min-height: 36px; }
.top-nav .btn-font.active { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.top-nav .btn-hamburger { background: none; border: none; font-size: 22px; cursor: pointer; padding: 4px; min-height: 36px; display: flex; align-items: center; color: var(--text); }
.hamburger-overlay { display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,.4); z-index: 1000; }
.hamburger-overlay.open { display: block; }
.hamburger-menu { position: fixed; top: 0; right: -280px; width: 260px; height: 100%; background: #fff; z-index: 1001; transition: right .25s ease; display: flex; flex-direction: column; box-shadow: -2px 0 12px rgba(0,0,0,.1); }
.hamburger-menu.open { right: 0; }
.hamburger-menu .hm-header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.hamburger-menu .hm-header span { font-weight: 700; font-size: 16px; }
.hamburger-menu .hm-close { background: none; border: none; font-size: 24px; cursor: pointer; padding: 4px; color: #666; min-height: 36px; }
.hamburger-menu .hm-links { flex: 1; padding: 12px 0; }
.hamburger-menu .hm-links a { display: block; padding: 14px 20px; text-decoration: none; color: var(--text); font-size: 15px; border-bottom: 1px solid #f0eeeb; }
.hamburger-menu .hm-links a:hover { background: var(--bg); }
.hamburger-menu .hm-bottom { padding: 16px 20px; border-top: 1px solid var(--border); }
.hamburger-menu .hm-install { display: none; width: 100%; padding: 14px; background: var(--primary); color: var(--primary-text); border: none; border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit; min-height: 44px; }
.hamburger-menu .hm-install.show { display: block; }
.hamburger-menu .hm-ios-guide { display: none; font-size: 13px; color: #666; line-height: 1.6; padding: 8px 0; }
.hamburger-menu .hm-ios-guide.show { display: block; }

/* 페이지 타이틀 */
.page-title{font-size:22px;font-weight:700;text-align:center;margin:24px 0 8px;line-height:1.4}

/* 스텝 인디케이터 */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 8px;
}
.step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600;
  background: var(--border);
  color: var(--text-muted);
  transition: all 0.2s;
}
.step-dot.active { background: var(--primary); color: var(--primary-text); }
.step-dot.done { background: var(--success); color: #fff; }
.step-line { width: 32px; height: 2px; background: var(--border); }
.step-line.active { background: var(--primary); }

.progress-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 24px;
  overflow: hidden;
}
.progress-bar .fill {
  height: 100%;
  background: var(--primary);
  transition: width 0.3s ease;
  border-radius: 2px;
}

.step-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}
.step-subtitle {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 24px;
}

/* 폼 */
.form-group {
  margin-bottom: 20px;
}
.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}
.form-group .required::after {
  content: ' *';
  color: var(--error);
}

input[type="text"],
input[type="number"],
input[type="tel"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-family: inherit;
  color: var(--text);
  background: var(--bg-card);
  transition: border-color 0.2s;
  -webkit-appearance: none;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(44, 44, 44, 0.08);
}
input[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--error);
}
input[aria-invalid="true"]:focus, textarea[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.1);
}
textarea {
  resize: vertical;
  min-height: 100px;
}
.char-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* 에러 메시지 */
.field-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 4px;
  display: none;
}
.field-error.show { display: block; }

/* 라디오 그룹 */
.radio-group {
  display: flex;
  gap: 12px;
}
.radio-group label {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 400;
  transition: all 0.2s;
}
.radio-group input[type="radio"] { display: none; }
.radio-group input:checked + span {
  font-weight: 600;
}
.radio-group label:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-text);
}
.radio-group label:active { transform: scale(0.97); }

/* 동적 행 (유족, 계좌) */
.dynamic-rows { display: flex; flex-direction: column; gap: 8px; }
.dynamic-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.dynamic-row input, .dynamic-row select { flex: 1; }
.btn-remove-row {
  width: 36px; height: 36px;
  border: none; background: none;
  color: var(--error);
  font-size: 20px;
  cursor: pointer;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}
.btn-add-row {
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--text-secondary);
  font-size: 14px;
  cursor: pointer;
  width: 100%;
  margin-top: 8px;
}

/* 버튼 */
.btn {
  display: block;
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.2s;
  min-height: 44px;
}
.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
.btn:not(:disabled):hover { opacity: 0.85; }
.btn:not(:disabled):active { transform: scale(0.98); opacity: 0.8; }
.btn-primary { background: var(--primary); color: var(--primary-text); }
.btn-secondary { background: var(--bg-card); color: var(--text); border: 1px solid var(--border); }
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }

.btn-group {
  display: flex;
  gap: 12px;
  margin-top: 32px;
}
.btn-group .btn { flex: 1; }

/* 히든 */
.hidden { display: none !important; }

/* 스텝 전환 애니메이션 */
@keyframes stepFadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.form-step:not(.hidden), .success-screen:not(.hidden) {
  animation: stepFadeIn 0.3s ease-out;
}

/* 카드 */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

/* 자동완성 드롭다운 */
.autocomplete-wrapper { position: relative; }
.autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0; right: 0;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  display: none;
}
.autocomplete-list.show { display: block; }
.autocomplete-item {
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.highlighted {
  background: var(--bg);
}
.autocomplete-item .region {
  font-size: 12px;
  color: var(--text-muted);
}

/* 테마 선택 */
.theme-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.theme-option {
  padding: 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s;
}
.theme-option.selected { border-color: var(--primary); }
.theme-option:active { transform: scale(0.97); }
.theme-option .preview {
  height: 40px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.theme-option .name { font-size: 13px; font-weight: 600; }

/* 이모지 선택 */
.emoji-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.emoji-option {
  width: 48px; height: 48px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  cursor: pointer;
  transition: border-color 0.2s;
}
.emoji-option.selected { border-color: var(--primary); background: var(--bg); }
.emoji-option:active { transform: scale(0.93); }

/* PIN 입력 */
.pin-group {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.pin-digit {
  width: 56px;
  height: 56px;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--bg-card);
  color: var(--text);
  -webkit-text-security: disc;
  transition: border-color 0.2s, box-shadow 0.2s;
  padding: 0 !important;
}
.pin-digit:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(44, 44, 44, 0.08);
}

/* 모달 (바닥 시트) */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1000;
  display: none;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.modal-overlay.show {
  display: flex;
  opacity: 1;
}
.modal-sheet {
  background: var(--bg-card);
  border-radius: 16px 16px 0 0;
  max-width: 480px;
  width: 100%;
  max-height: 70vh;
  overflow-y: auto;
  padding: 20px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}
.modal-overlay.show .modal-sheet { transform: translateY(0); }
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-header h3 { font-size: 18px; font-weight: 700; }
.modal-close {
  width: 36px; height: 36px;
  border: none; background: none;
  font-size: 24px; color: var(--text-muted);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.modal-option {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  font-size: 15px;
}
.modal-option:last-child { border-bottom: none; }
.modal-option:hover { background: var(--bg); }

/* 관계 선택 그리드 */
.rel-group-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  margin: 12px 0 6px;
  padding-left: 2px;
}
.rel-group-label:first-of-type { margin-top: 0; }
.rel-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 4px;
}
.rel-chip {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  background: var(--bg-card);
  transition: background 0.15s, border-color 0.15s;
}
.rel-chip:hover {
  background: var(--bg);
  border-color: var(--primary);
}
.rel-chip:active { transform: scale(0.95); }

/* 미리보기 */
.preview-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}
.preview-card .emoji { font-size: 32px; margin-bottom: 12px; }
.preview-card .title { font-size: 20px; letter-spacing: 8px; font-weight: 700; margin-bottom: 8px; }
.preview-card .name { font-size: 22px; font-weight: 700; letter-spacing: 4px; margin-bottom: 8px; }
.preview-card .info { color: var(--text-secondary); font-size: 14px; margin-bottom: 4px; }

/* 성공 화면 */
.success-screen { text-align: center; padding: 40px 0; }
.success-icon { font-size: 48px; margin-bottom: 16px; }
.success-title { font-size: 22px; font-weight: 700; margin-bottom: 16px; }
.success-comfort {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 20px;
  padding: 16px;
  background: rgba(44, 44, 44, 0.03);
  border-radius: 12px;
}
.success-subtitle { color: var(--text-secondary); margin-bottom: 32px; }
.success-url {
  background: var(--bg);
  padding: 12px;
  border-radius: var(--radius-sm);
  word-break: break-all;
  font-size: 14px;
  margin-bottom: 24px;
  color: var(--text-secondary);
}

.share-section { margin-top: 24px; }
.share-main-btn {
  display: block;
  width: 100%;
  padding: 18px;
  background: #fee500;
  color: #3c1e1e;
  border: none;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 12px;
  min-height: 44px;
}
.share-sub-btns {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.share-sub-btn {
  padding: 12px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-height: 44px;
}
.share-sub-btn .icon { font-size: 20px; }

/* 체크박스 */
.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
.checkbox-group input[type="checkbox"] {
  width: 20px; height: 20px;
  margin-top: 2px;
  accent-color: var(--primary);
}
.checkbox-group label { font-size: 14px; line-height: 1.4; font-weight: 400; }
.checkbox-group a { color: var(--primary); }

/* 토스트 */
.toast-msg {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 12px 24px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 9999;
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  white-space: nowrap;
}
.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* 접근성 */
.skip-nav {
  position: absolute; left: -9999px; top: 0; z-index: 9999;
  background: var(--primary); color: #fff; padding: 12px 24px;
  font-size: 14px; text-decoration: none; border-radius: 0 0 8px 0;
}
.skip-nav:focus { left: 0; }
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}
:focus:not(:focus-visible) { outline: none; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

button, a, [role="button"] {
  min-height: 44px;
}

/* 직함 예시 토글 */
.examples-toggle {
  background: none; border: none;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 0;
  font-family: inherit;
}
.examples-panel { display: none; margin-top: 8px; }
.examples-panel.show { display: block; }
.examples-category { margin-bottom: 8px; }
.examples-category .category-name {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.examples-category .tags {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.example-tag {
  padding: 6px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

/* 장례 형식 세그먼트 */
.ft-seg {
  display: flex;
  position: relative;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-card);
}
.ft-seg-indicator {
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 0;
  width: 33.333%;
  background: var(--primary);
  border-radius: calc(var(--radius) - 4px);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 0;
}
.ft-seg-indicator[data-pos="0"] { transform: translateX(0); }
.ft-seg-indicator[data-pos="1"] { transform: translateX(100%); }
.ft-seg-indicator[data-pos="2"] { transform: translateX(200%); }
.ft-seg-item {
  flex: 1;
  padding: 16px 6px;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-muted);
  background: transparent;
  cursor: pointer;
  transition: color 0.2s;
  border-right: 1px solid var(--border);
  user-select: none;
  -webkit-user-select: none;
  position: relative;
  z-index: 1;
}
.ft-seg-item:last-child { border-right: none; }
.ft-seg-item:hover { background: rgba(0,0,0,0.03); }
.ft-seg-item:active { opacity: 0.8; }
.ft-seg-item.selected {
  color: #fff;
}
.ft-desc {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.6;
  padding: 10px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
}
.ft-desc.warn {
  background: #fff8f0;
  color: #8b5e00;
}
.ft-warn-text {
  color: #c62828;
  font-weight: 500;
}

/* 장례식장 토글 */
.hall-toggle {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 14px 16px;
  margin-top: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--text);
}
.hall-toggle .arrow {
  font-size: 12px;
  transition: transform 0.2s;
  color: var(--text-muted);
}
.hall-toggle.open .arrow { transform: rotate(180deg); }
.hall-toggle-hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  padding: 0 4px;
}

/* 계좌 토글 */
.bank-toggle {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  width: 100%;
  text-align: left;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.bank-toggle .arrow { transition: transform 0.2s; }
.bank-toggle.open .arrow { transform: rotate(180deg); }
.bank-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.bank-detail.open { max-height: 500px; }

/* 스켈레톤 */
@keyframes pulse { 0%,100% { opacity: 0.4; } 50% { opacity: 0.8; } }
.skeleton {
  animation: pulse 1.5s ease-in-out infinite;
  background: var(--border);
  border-radius: 8px;
}

/* 인쇄 스타일 */
@media print {
  .top-nav, .step-indicator, .progress-bar, .btn-group,
  .share-section, .success-screen { display: none; }
}
