/* purchase-mobile.css — 소모품 신청 모바일 전용 */

/* 메인 컨텐츠 (하단 네비 여유) */
.pm-content {
  padding-bottom: calc(140px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

/* 상태 탭 */
.pm-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 8px 16px;
  background: white;
  border-bottom: 1px solid #e5e7eb;
}
.pm-tabs::-webkit-scrollbar { display: none; }
.pm-tab {
  flex-shrink: 0;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  background: #f3f4f6;
  color: #6b7280;
  border: none;
  cursor: pointer;
  white-space: nowrap;
}
.pm-tab.active {
  background: #ea580c;
  color: white;
}
.pm-tab .tab-count {
  margin-left: 4px;
  font-size: 11px;
  opacity: 0.8;
}

/* 카드 리스트 */
.pm-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 16px;
}
.pm-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 14px;
  cursor: pointer;
  transition: box-shadow 0.15s;
}
.pm-card:active { box-shadow: 0 0 0 2px rgba(234,88,12,0.2); }
.pm-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}
.pm-card-name {
  font-size: 15px;
  font-weight: 600;
  color: #1f2937;
  line-height: 1.3;
}
.pm-card-custom { font-size: 11px; color: #ea580c; margin-left: 4px; }
.pm-card-meta {
  display: flex;
  gap: 10px;
  margin-top: 8px;
  font-size: 12px;
  color: #9ca3af;
}
.pm-card-qty { color: #374151; font-weight: 600; }

/* FAB */
.pm-fab {
  position: fixed;
  bottom: calc(84px + env(safe-area-inset-bottom));
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #ea580c;
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(234,88,12,0.35);
  font-size: 24px;
  cursor: pointer;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s;
}
.pm-fab:active { transform: scale(0.92); }

/* 바텀시트 */
.pm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 1005;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s;
}
.pm-overlay.open { opacity: 1; pointer-events: auto; }

.pm-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: white;
  border-radius: 16px 16px 0 0;
  z-index: 1010;
  max-height: 92vh;
  overflow-y: auto;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  padding-bottom: calc(20px + env(safe-area-inset-bottom));
}
.pm-sheet.open { transform: translateY(0); }
.pm-sheet-handle {
  width: 36px;
  height: 4px;
  background: #d1d5db;
  border-radius: 2px;
  margin: 8px auto;
}
.pm-sheet-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px 8px;
}
.pm-sheet-title { font-size: 17px; font-weight: 700; color: #1f2937; }
.pm-sheet-close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f3f4f6;
  border-radius: 50%;
  font-size: 16px;
  color: #6b7280;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.pm-sheet-body { padding: 0 20px 20px; }

/* 검색 */
.pm-search-wrap { position: relative; margin-bottom: 12px; }
.pm-search-input {
  width: 100%;
  padding: 12px 40px 12px 14px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
}
.pm-search-input:focus { border-color: #ea580c; }
.pm-search-spinner {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
}
.pm-search-spinner.show { display: block; }
.pm-search-results {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  display: none;
}
.pm-search-results.open { display: block; }
.pm-search-thumb {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f3f4f6;
}
.pm-search-thumb-empty {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  background: #f3f4f6;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d1d5db;
  font-size: 14px;
  flex-shrink: 0;
}
.pm-search-item {
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  border-bottom: 1px solid #f3f4f6;
}
.pm-search-item:last-child { border-bottom: none; }
.pm-search-item:active { background: #fff7ed; }
.pm-search-item .match-type {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: #f3f4f6;
  color: #9ca3af;
  flex-shrink: 0;
}
.pm-search-register {
  padding: 10px 12px;
  font-size: 14px;
  cursor: pointer;
  color: #ea580c;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.pm-search-register:active { background: #fff7ed; }

/* 장바구니 */
.pm-cart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.pm-cart-title { font-size: 14px; font-weight: 600; color: #374151; }
.pm-cart-count { font-size: 12px; color: #ea580c; font-weight: 600; }
.pm-cart-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  margin-bottom: 6px;
}
.pm-cart-item-info { flex: 1; min-width: 0; }
.pm-cart-item-name { font-size: 13px; font-weight: 600; color: #1f2937; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pm-cart-item-meta { font-size: 11px; color: #9ca3af; margin-top: 2px; }
.pm-cart-item-new { font-size: 10px; color: #ea580c; }
.pm-cart-qty {
  width: 48px;
  padding: 4px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 14px;
  text-align: center;
  flex-shrink: 0;
}
.pm-cart-memo {
  width: 80px;
  padding: 4px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 12px;
  flex-shrink: 0;
}
.pm-cart-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: #f3f4f6;
}
.pm-cart-photo-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border: 1px dashed #d1d5db;
  border-radius: 4px;
  font-size: 11px;
  color: #6b7280;
  cursor: pointer;
}
.pm-cart-remove {
  width: 24px;
  height: 24px;
  border: none;
  background: #fecaca;
  color: #dc2626;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
/* 신규 품목 인라인 필드 */
.pm-cart-new-fields {
  display: flex;
  gap: 4px;
  margin-top: 4px;
}
.pm-cart-new-fields input, .pm-cart-new-fields select {
  padding: 3px 6px;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  font-size: 11px;
  width: 100%;
}

/* 폼 필드 */
.pm-field { margin-bottom: 12px; }
.pm-label { display: block; font-size: 12px; font-weight: 600; color: #6b7280; margin-bottom: 4px; }
.pm-input {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 16px;
  outline: none;
  box-sizing: border-box;
}
.pm-input:focus { border-color: #ea580c; }
.pm-select {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid #e5e7eb;
  border-radius: 8px;
  font-size: 16px;
  background: white;
  outline: none;
  box-sizing: border-box;
}

/* 사진 */
.pm-photo-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1.5px dashed #d1d5db;
  border-radius: 8px;
  background: #fafafa;
  cursor: pointer;
  font-size: 14px;
  color: #6b7280;
  min-height: 44px;
}
.pm-photo-preview {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
  margin-top: 8px;
}

/* 제출 */
.pm-submit {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 10px;
  background: #ea580c;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 16px;
  min-height: 48px;
}
.pm-submit:active { background: #c2410c; }
.pm-submit:disabled { background: #d1d5db; cursor: not-allowed; }

/* 상세 시트 */
.pm-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
  border-bottom: 1px solid #f3f4f6;
}
.pm-detail-label { color: #9ca3af; }
.pm-detail-value { color: #1f2937; font-weight: 500; }
.pm-received-photo {
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: 10px;
  margin-top: 12px;
}

/* 빈 상태 */
.pm-empty {
  text-align: center;
  padding: 48px 16px;
  color: #9ca3af;
}
.pm-empty i { font-size: 32px; margin-bottom: 8px; display: block; }

/* 로딩 */
.pm-loading {
  text-align: center;
  padding: 24px;
  color: #9ca3af;
  font-size: 14px;
}

/* 스피너 애니메이션 */
@keyframes pm-spin { to { transform: translateY(-50%) rotate(360deg); } }
.pm-search-spinner.show i { animation: pm-spin 0.8s linear infinite; }
