/* ============================================================
   구매 요청 — 네이비 히어로 + 흰 본문 (대시보드 스타일)
   ============================================================ */

:root {
  /* 히어로 (상단 네이비) */
  --hero-bg: #1a2c5b;
  --hero-bg-grad: linear-gradient(135deg, #1a2c5b 0%, #2f4a82 100%);
  --hero-text: #ffffff;
  --hero-text-soft: #c5d1eb;

  /* 본문 (연회색 바탕 + 흰 카드) */
  --bg: #f1f3f5;
  --surface: #ffffff;
  --surface-tint: #f7f8fb;

  --ink: #1a2540;
  --ink-soft: #4e5968;
  --ink-mute: #8b95a1;
  --ink-light: #c5c9d0;

  --line: #e8eaef;
  --line-soft: #f3f4f7;

  --accent: #4a6cf7;
  --accent-deep: #2f4a82;
  --accent-soft: #eef2fc;

  /* 신규 품목 — 오렌지 강조 */
  --new: #ff6b35;
  --new-deep: #e85a25;
  --new-soft: #fff5ee;
  --new-bg: #fff1e8;

  --danger: #ef4444;
  --danger-soft: #fee2e2;
  --success: #00b888;

  --radius: 10px;

  --font: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  color: inherit;
  font-size: inherit;
}

input, textarea {
  font-family: inherit;
  font-size: inherit;
  border: none;
  outline: none;
  background: none;
  color: inherit;
  width: 100%;
}

.hidden { display: none !important; }

/* ============================================================
   히어로 섹션 — 풀폭 네이비 배경 (깔끔한 단일 톤)
   ============================================================ */
.app-header {
  background: var(--hero-bg);
  color: var(--hero-text);
  padding: 32px 24px 40px;
  text-align: center;
  position: relative;
}

.app-icon {
  display: inline-grid;
  place-items: center;
  width: 58px;
  height: 58px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  font-size: 28px;
  margin-bottom: 14px;
}

.app-title {
  margin: 0 0 8px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.app-subtitle {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.65);
  letter-spacing: 0.04em;
}

.app-desc {
  margin: 0;
  font-size: 15px;
  color: var(--hero-text-soft);
  line-height: 1.7;
}

/* ============================================================
   본문 레이아웃
   ============================================================ */
.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 0 24px 24px;
}

/* ============================================================
   카드 (구매요청자 카드 + 품목 카드 공통)
   ============================================================ */
.section-divider { display: none; }

.app {
  padding-top: 20px;
}

.form-card,
.item {
  background: var(--surface);
  border-radius: 16px;
  padding: 22px 22px 24px;
  margin-bottom: 12px;
  box-shadow: 0 1px 2px rgba(20, 30, 50, 0.04);
}

.section-heading {
  margin: 0 0 18px;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  position: relative;
  padding-left: 12px;
  line-height: 1.2;
}
.section-heading::before {
  content: '';
  position: absolute;
  left: 0;
  top: 3px;
  bottom: 3px;
  width: 3px;
  background: var(--accent);
  border-radius: 2px;
}

/* ============================================================
   필드 — 박스 X, 깔끔한 인라인
   ============================================================ */
.form-field {
  margin-bottom: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.form-field:last-child { margin-bottom: 0; }

.form-label {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}

.label-hint {
  font-size: 14px;
  font-weight: 400;
  color: var(--ink-mute);
}

.badge-new {
  display: inline-flex;
  align-items: center;
  background: var(--new);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

.badge-required {
  display: inline-flex;
  align-items: center;
  background: var(--danger);
  color: white;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}

/* ============================================================
   입력 — 굵은 밑줄 스타일 (박스 아닌)
   ============================================================ */
.form-input,
.form-textarea {
  width: 100%;
  padding: 14px 0;
  border-bottom: 2px solid var(--line);
  font-size: 18px;
  color: var(--ink);
  background: transparent;
  transition: border-color 0.2s;
}
.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--ink-mute);
  font-size: 17px;
}
.form-input:focus,
.form-textarea:focus {
  border-bottom-color: var(--accent);
}
.form-textarea {
  resize: vertical;
  min-height: 60px;
  line-height: 1.6;
  font-family: inherit;
  padding: 12px 0;
}

/* ============================================================
   품목 카드 (개별 카드 형태)
   ============================================================ */
.item {
  animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.item-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.item-badge {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: 9px;
  color: white;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(74, 108, 247, 0.3);
}

.item-title {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.remove-item-btn {
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: transparent;
  color: var(--ink-mute);
  font-size: 0;
  display: grid;
  place-items: center;
  transition: background 0.15s, color 0.15s;
  position: relative;
}
.remove-item-btn::before {
  content: '×';
  font-size: 26px;
  line-height: 1;
  font-weight: 300;
}
.remove-item-btn:hover {
  background: var(--danger-soft);
  color: var(--danger);
}

/* ============================================================
   신규 품목 모드
   ============================================================ */
.new-item-only {
  background: var(--new-soft);
  border-left: 3px solid var(--new);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 14px 16px;
  margin-bottom: 14px !important;
}
.new-item-only .form-label {
  color: var(--new-deep);
}
.new-item-only .form-input {
  border-bottom-color: rgba(255, 107, 53, 0.3);
}
.new-item-only .form-input:focus {
  border-bottom-color: var(--new);
}

/* ============================================================
   검색 가능한 드롭다운
   ============================================================ */
.searchable-select { position: relative; }

.select-trigger {
  width: 100%;
  padding: 16px 0;
  border-bottom: 2px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  font-size: 18px;
  font-weight: 500;
  transition: border-color 0.2s;
}
.searchable-select[data-state="open"] .select-trigger {
  border-bottom-color: var(--accent);
}
.select-value { color: var(--ink); }
.select-value.placeholder {
  color: var(--ink-mute);
  font-weight: 400;
}
.select-arrow {
  color: var(--ink-mute);
  font-size: 20px;
  font-weight: 300;
  transform: rotate(90deg);
  transition: transform 0.2s, color 0.15s;
}
.searchable-select[data-state="open"] .select-arrow {
  transform: rotate(-90deg);
  color: var(--accent);
}

.select-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: white;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 12px 32px rgba(20, 30, 50, 0.12);
  z-index: 50;
  max-height: 400px;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.searchable-select[data-state="open"] .select-dropdown { display: flex; }

.select-search-wrap {
  padding: 10px;
  border-bottom: 1px solid var(--line-soft);
}
.select-search {
  width: 100%;
  padding: 14px 16px;
  background: var(--surface-tint);
  border-radius: 8px;
  font-size: 16px;
  transition: background 0.15s;
}
.select-search:focus {
  background: white;
  outline: 1.5px solid var(--accent);
}
.select-search::placeholder { color: var(--ink-mute); }

.select-options {
  list-style: none;
  margin: 0;
  padding: 6px 0;
  overflow-y: auto;
  flex: 1;
}
.select-options li {
  padding: 14px 20px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  transition: background 0.1s;
}
.select-options li:hover,
.select-options li.highlighted {
  background: var(--accent-soft);
  color: var(--accent-deep);
}

.select-empty {
  padding: 28px 20px;
  text-align: center;
  font-size: 15px;
  color: var(--ink-soft);
  line-height: 1.7;
}
.select-empty strong { color: var(--new-deep); }

.new-item-option {
  width: 100%;
  padding: 16px 20px;
  text-align: left;
  background: var(--new-bg);
  border-top: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: background 0.15s;
}
.new-item-option:hover { background: #ffe4d6; }
.new-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--new);
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.new-icon {
  color: white;
  font-size: 18px;
  font-weight: 400;
  line-height: 1;
}
.new-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.new-text strong {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}
.new-text .hint {
  font-size: 13px;
  color: var(--ink-soft);
}

/* ============================================================
   수량 — 단순 inline
   ============================================================ */
.quantity {
  display: inline-flex;
  align-items: center;
  background: var(--surface-tint);
  border-radius: var(--radius);
  padding: 4px;
  gap: 0;
  width: fit-content;
}
.qty-btn {
  width: 44px;
  height: 44px;
  font-size: 22px;
  font-weight: 500;
  color: var(--ink-soft);
  border-radius: 8px;
  transition: background 0.15s, color 0.15s;
}
.qty-btn:hover {
  background: white;
  color: var(--accent);
}
.qty-input {
  width: 56px;
  height: 44px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  background: transparent;
  -moz-appearance: textfield;
}
.qty-input::-webkit-outer-spin-button,
.qty-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* ============================================================
   사진 업로드
   ============================================================ */
.photo-upload {
  display: block;
  background: white;
  border: 1.5px dashed var(--new);
  border-radius: var(--radius);
  padding: 18px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.photo-upload:hover {
  border-color: var(--new-deep);
  background: var(--new-soft);
}
.photo-input { display: none; }
.photo-upload-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.photo-icon { font-size: 22px; }
.photo-text {
  font-size: 16px;
  font-weight: 700;
  color: var(--new-deep);
}
.photo-sub {
  font-size: 13px;
  color: var(--ink-mute);
}

.photo-preview-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.photo-preview-list:empty { margin-top: 0; }
.photo-preview {
  position: relative;
  width: 64px;
  height: 64px;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface-tint);
}
.photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.photo-preview .remove-photo {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  background: rgba(0,0,0,0.7);
  color: white;
  border-radius: 50%;
  font-size: 10px;
  display: grid;
  place-items: center;
}

/* ============================================================
   토글 (상품 링크)
   ============================================================ */
.toggle-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--accent);
  padding: 8px 0;
  transition: color 0.15s;
}
.toggle-link-btn:hover { color: var(--accent-deep); }
.toggle-icon {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 50%;
  font-size: 14px;
  font-weight: 600;
}

/* ============================================================
   품목 추가 버튼 — 차분한 텍스트 버튼
   ============================================================ */
.add-item-btn {
  width: 100%;
  padding: 20px;
  margin: 8px 0 32px;
  background: var(--surface-tint);
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background 0.15s, color 0.15s;
}
.add-item-btn:hover {
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.plus {
  font-size: 18px;
  font-weight: 500;
}

/* ============================================================
   제출 영역 — sticky 아님, 그냥 큰 버튼
   ============================================================ */
.submit-area {
  margin-top: 16px;
}

.item-count {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 15px;
  color: var(--ink-soft);
}
.count-label { font-weight: 500; }
.count-value {
  font-weight: 700;
  color: var(--accent);
}

.submit-btn {
  width: 100%;
  padding: 22px;
  background: var(--hero-bg);
  color: white;
  border-radius: var(--radius);
  font-size: 18px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.submit-btn:hover {
  background: var(--accent-deep);
  box-shadow: 0 8px 20px rgba(26, 44, 91, 0.25);
  transform: translateY(-1px);
}
.submit-btn:active {
  transform: translateY(0);
}
.submit-btn:disabled {
  background: var(--ink-light);
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}
.submit-arrow {
  font-size: 20px;
  font-weight: 400;
  transition: transform 0.2s;
}
.submit-btn:hover .submit-arrow {
  transform: translateX(4px);
}

.submit-hint {
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--ink-mute);
  text-align: center;
}

/* ============================================================
   푸터
   ============================================================ */
.app-footer {
  text-align: center;
  padding: 32px 20px 28px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-mute);
  letter-spacing: 0.05em;
}
.app-footer p { margin: 0; }

/* ============================================================
   토스트
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--hero-bg);
  color: white;
  padding: 16px 24px;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 500;
  box-shadow: 0 12px 32px rgba(20, 30, 50, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
  z-index: 200;
  max-width: 88%;
  text-align: center;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* ============================================================
   모바일
   ============================================================ */
@media (max-width: 480px) {
  .app { padding: 0 20px 16px; }
  .app-header { padding: 44px 24px 52px; }
  .app-title { font-size: 24px; }
  .app-icon { width: 52px; height: 52px; font-size: 24px; }
}
