/* ========================================
main.css
메인 페이지 전용 스타일
히어로 섹션, 검색, 상품 그리드, 상품 카드,
대체상품, 가격 비교, 평가 버튼, 폼 섹션(상품등록),
중복 검증 모달, 더보기 섹션 포함
   ======================================== */

/* ========================================
메인 레이아웃
   ======================================== */
/* 폭·좌우 패딩은 헤더와 같은 토큰을 쓴다 (페이지 전환 시 좌측 라인이 안 튀도록) */
.main-container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--spacing-xl) var(--container-pad);
}

/* ========================================
   콘텐츠 섹션
   ======================================== */
/* 🔴 상자를 없앤다 (2026-09-04).
   옛 구조는 [흰 섹션 상자] 안에 [흰 상품 카드] 가 들어가는 **이중 중첩**이었다.
   흰색 위 흰색이라 정작 봐야 할 상품 카드가 묻혔다 — 바탕을 아무리 어둡게 해도
   바깥 상자만 도드라질 뿐이었다. 웹픽·픽셀링은 회색 바탕 위에 카드가 **직접** 놓인다.

   ⚠️ 클래스는 남긴다 — js/main.js 가 `.content-section:last-child` 로 찾아
   display 를 토글한다 (hideRecentProductsSection). 지우면 검색 전환이 깨진다. */
.content-section {
  background: none;
  border: 0;
  padding: 0;
  margin-bottom: var(--spacing-2xl);
}

.section-title {
  font-size: var(--font-xl);
  font-weight: 700;
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--spacing-md);
  color: var(--ink-900);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ========================================
   섹션 헤더 및 필터 버튼
   ======================================== */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.filter-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* 웹픽 밀도 기준: 12px · 얇은 테두리 · 들리지 않는다.
   🔴 활성 pill 이 화면에서 오렌지를 쓰는 거의 유일한 자리다 (액센트 원칙). */
.filter-btn {
  padding: 5px 12px;
  border: 1px solid var(--ink-300);
  background: var(--bg-surface);
  color: var(--ink-600);
  border-radius: var(--radius-full);
  font-size: var(--font-xs);
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.filter-btn:hover {
  border-color: var(--brand-500);
  color: var(--brand-600);
}

.filter-btn.active {
  background: var(--brand-500);
  color: var(--text-inverse);
  border-color: var(--brand-500);
}

.filter-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--gray-200);
  color: var(--gray-500);
  border-color: var(--gray-300);
}

/* ========================================
   더보기 섹션
   ======================================== */
.load-more-section {
  text-align: center;
  margin-top: var(--spacing-xl);
  padding-top: var(--spacing-lg);
  border-top: 1px solid var(--gray-200);
}

.load-more-btn {
  min-width: 200px;
  font-weight: 500;
}

.load-more-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.load-more-btn .loading-sm {
  width: 16px;
  height: 16px;
  border-width: 2px;
  margin-right: 8px;
}

/* ========================================
   내 닉네임 강조
   ======================================== */
.my-nickname {
  color: var(--primary-color) !important;
  font-weight: 700 !important;
}

/* 새 상품 추가 애니메이션 */
@keyframes slideInFromTop {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.new-product-animation {
  animation: slideInFromTop 0.5s ease-out;
}

/* ========================================
   히어로 섹션
   ======================================== */
.hero-section {
  text-align: center;
  margin-bottom: var(--spacing-2xl);
  padding: var(--spacing-2xl) 0;
  user-select: none;
  caret-color: transparent;
}

/* 🔴 옛 보라 그라데 위 흰 글씨였다. 배경이 밝아졌으므로 잉크색으로 뒤집는다
   (text-shadow 도 함께 제거 — 밝은 바탕에선 때가 낀 것처럼 보인다). */
.hero-title {
  font-size: var(--font-4xl);
  font-weight: 800;
  color: var(--ink-900);
  margin-bottom: var(--spacing-md);
  line-height: var(--line-tight);
  letter-spacing: var(--tracking-tighter);
}

.hero-subtitle {
  font-size: var(--font-md);
  color: var(--ink-500);
  margin: 0;
  font-weight: 400;
  line-height: var(--line-base);
}

/* 히어로 통계 및 버튼 영역 */
.hero-stats {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: var(--spacing-xl);
  flex-wrap: wrap;
}

.hero-product-btn {
  font-size: 14px;
  padding: 7px 14px;
  white-space: nowrap;
  line-height: 1;
  margin: 0;
}

/* 메인 검색 */
.main-search {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
}

.main-search-input {
  width: 100%;
  padding: 16px 58px 16px 22px;
  font-size: var(--font-lg);
  border: 1px solid var(--ink-300);
  border-radius: var(--radius-full);
  outline: none;
  box-shadow: var(--shadow-sm);
  background: var(--bg-surface);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
  user-select: text;
  caret-color: auto;
}

/* 포커스 링은 옛 보라(102,126,234)였다 — 브랜드 오렌지로 */
.main-search-input:focus {
  border-color: var(--brand-400);
  box-shadow: 0 0 0 3px rgba(217, 119, 87, 0.15);
}

.search-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--ink-900);
  border: none;
  width: 50px;
  height: 50px;
  border-radius: var(--radius-full);
  color: var(--text-inverse);
  font-size: 20px;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-btn:hover {
  transform: translateY(-50%) scale(1.1);
  box-shadow: var(--shadow-lg);
}

/* 미니멀 강조 카운터 */
/* 옛 보라 배경 위에서 금색이었다. 흰 바탕에선 노랑이 바래 보인다 → 브랜드 오렌지로. */
.stats-counter {
  color: var(--brand-600);
  font-weight: 800;
  font-size: 1.2em;
  font-family: 'Pretendard Variable', sans-serif;
  transition: all var(--transition-base);
}

/* ========================================
   상품 그리드 레이아웃
   ======================================== */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}

/* ========================================
   상품 세트 카드 컴포넌트
   ======================================== */
/* 🔴 바탕이 순백이라 카드도 흰색 — 경계는 전적으로 **테두리** 몫이다.
   그림자는 거의 빼고(순백 위에서는 얼룩처럼 보인다) 테두리로 또렷하게 세운다. */
.product-set-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: none;
  transition: box-shadow var(--transition-fast), border-color var(--transition-fast);
  border: 1px solid var(--ink-300);
  margin-bottom: 16px;
}

.product-set-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--ink-400);
}

/* ========================================
   상품 태그 영역
   ======================================== */
.product-tags {
  background: var(--ink-50);
  padding: 7px 14px;
  border-bottom: 1px solid var(--ink-200);
  font-size: var(--font-xs);
  color: var(--ink-500);
  font-weight: 500;
}

/* ========================================
   메인 상품 영역
   ======================================== */
.main-product-section {
  padding: 12px 14px;
  border-bottom: 1px solid var(--ink-200);
  transition: background var(--transition-fast);
}

/* 카드 안 메타 줄("2개 상품·도매매·가격순") — 정보가 아니라 라벨이다.
   가장 연한 단계로 눌러야 제목·가격이 살아난다. */
.main-product-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: var(--font-xs);
  color: var(--ink-400);
}

.main-product-info {
  display: flex;
  gap: 15px;
  align-items: flex-start;
  padding: 10px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.main-product-info:hover {
  background: var(--gray-100);
}

/* 메인 상품 이미지 */
.main-product-image {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.main-product-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--bg-alt);
}

.main-product-image.no-image {
  background: var(--ink-100);
  color: var(--ink-400);
  font-size: 24px;
  font-weight: 600;
}

/* 메인 상품 콘텐츠 */
.main-product-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.main-product-title {
  font-size: var(--font-md);
  font-weight: 600;
  color: var(--ink-900);
  line-height: var(--line-tight);
  letter-spacing: var(--tracking-tight);
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  flex-wrap: wrap;
}

.main-product-title .title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  flex: 1;
  min-width: 0;
}

/* 가격은 카드에서 눈이 두 번째로 가야 할 정보다 — 제목 다음.
   본문과 같은 크기·농도면 카드가 통째로 회색으로 읽힌다. */
.main-product-price {
  font-size: var(--font-md);
  font-weight: 700;
  color: var(--ink-900);
  letter-spacing: var(--tracking-tight);
}

/* 메인 상품 가격 비교 스타일 */
.main-product-price .price-comparison {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.main-product-price .price-diff {
  font-size: var(--font-xs);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 500;
  white-space: nowrap;
}

.main-product-price .price-diff.lowest {
  background: #dcf0e4;
  color: #1c6b40;
}

.main-product-price .price-diff.low {
  background: #fdf0d5;
  color: #8a6416;
}

.main-product-price .price-diff.medium {
  background: #fae8dd;
  color: #a8542c;
}

.main-product-price .price-diff.high {
  background: #fadfdd;
  color: #a33a33;
}

.main-product-price .price-diff.no-price {
  background: var(--gray-200);
  color: var(--text-secondary);
}

.main-product-details {
  font-size: var(--font-xs);
  color: var(--text-secondary);
}

/* 변환된 URL 표시 스타일 */
.converted-url {
  font-size: var(--font-xs);
  color: var(--primary-color);
  font-weight: 500;
  background: rgba(217, 119, 87, 0.1);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  display: inline-block;
  margin-top: 2px;
  word-break: break-all;
  line-height: 1.2;
}

/* 대체상품에서의 변환된 URL */
.alternative-price .converted-url {
  display: block;
  margin-top: 4px;
  margin-left: 0;
}

/* 상품 링크 스타일 */
.main-product-link,
.alternative-link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

.main-product-link:hover,
.main-product-link:focus,
.alternative-link:hover,
.alternative-link:focus {
  text-decoration: none;
  color: inherit;
}

/* 링크 내부의 호버 효과 */
.main-product-link:hover .main-product-info,
.alternative-link:hover .alternative-info {
  background: var(--gray-100);
}

/* 버튼 영역 예외처리 - 링크 효과 차단 */
.alternative-actions {
  position: relative;
  z-index: 10;
  background: var(--bg-surface);
  margin-top: var(--spacing-sm);
  padding: var(--spacing-sm) 0;
}

/* 버튼들이 링크 효과를 받지 않도록 */
.rating-btn,
.delete-btn {
  position: relative;
  z-index: 11;
  pointer-events: auto;
}

/* 링크된 상품 정보 영역의 패딩 조정 */
.main-product-link .main-product-info,
.alternative-link .alternative-info {
  margin: 0;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

/* 포커스 상태 개선 */
.main-product-link:focus-visible,
.alternative-link:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
  border-radius: var(--radius-md);
}

/* ========================================
   대체상품 영역
   ======================================== */
.alternatives-section {
  background: var(--bg-alt);
}

.alternatives-header {
  padding: 15px;
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  transition: background-color var(--transition-fast);
}

.group-header-label {
  cursor: pointer;
  flex: 1;
  min-width: 0;
}

.group-header-label:hover {
  color: var(--primary-color);
}

.group-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.alternatives-toggle {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 0;
  color: var(--primary-color);
  transition: transform var(--transition-base);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alternatives-toggle.collapsed {
  transform: rotate(-90deg);
}

.alternatives-list {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-base);
}

.alternatives-list.expanded {
  max-height: 1000px;
}

/* ========================================
   대체상품 아이템
   ======================================== */
.alternative-item {
  padding: 15px;
  border-bottom: 1px solid var(--gray-200);
  background: var(--bg-surface);
  transition: background-color var(--transition-fast);
}

.alternative-item:last-child {
  border-bottom: none;
}

.alternative-info {
  display: flex;
  gap: 15px;
  margin-bottom: 10px;
  padding: 10px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.alternative-info:hover {
  background: var(--gray-100);
}

/* 대체상품 이미지 */
.alternative-image {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.alternative-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.alternative-image.no-image {
  background: var(--ink-100);
  color: var(--ink-400);
  font-size: 18px;
  font-weight: 600;
}

/* 대체상품 콘텐츠 */
.alternative-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.alternative-title {
  font-size: var(--font-sm);
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 4px;
  flex-wrap: wrap;
}

.alternative-title .title-text {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  flex: 1;
  min-width: 0;
}

/* 대체상품 가격 */
.alternative-price {
  font-size: var(--font-sm);
  font-weight: 600;
  margin-bottom: 5px;
}

/* 대체상품 설명 */
.alternative-description {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  margin-bottom: 8px;
  font-style: italic;
  line-height: 1.4;
}

.alternative-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: var(--spacing-sm);
  position: relative;
  z-index: 10;
  background: var(--bg-surface);
  padding: var(--spacing-sm) 0;
}

.alternative-ratings {
  display: flex;
  gap: 15px;
  align-items: center;
  flex: 1;
}

.alternative-author {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  white-space: nowrap;
  margin-left: auto;
}

/* ========================================
   가격 비교 컴포넌트
   ======================================== */
.price-comparison {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.price-diff {
  font-size: var(--font-xs);
  padding: 2px 6px;
  border-radius: var(--radius-full);
  font-weight: 500;
  white-space: nowrap;
}

.price-diff.lowest {
  background: #dcf0e4;
  color: #1c6b40;
}

.price-diff.low {
  background: #fdf0d5;
  color: #8a6416;
}

.price-diff.medium {
  background: #fae8dd;
  color: #a8542c;
}

.price-diff.high {
  background: #fadfdd;
  color: #a33a33;
}

.price-diff.no-price {
  background: var(--gray-200);
  color: var(--text-secondary);
}

/* 최저가 상품 가격 강조 */
.main-product-price:has(.price-diff.lowest) span:first-child,
.alternative-price:has(.price-diff.lowest) .price-comparison span:first-child {
  color: var(--primary-color);
  font-weight: 700;
}

/* has() 미지원 브라우저 대응 */
.lowest-price-highlight {
  color: var(--primary-color) !important;
  font-weight: 700 !important;
}

/* 가격 요약 */
.price-summary {
  font-size: var(--font-xs);
  color: var(--primary-color);
  font-weight: 500;
  background: rgba(217, 119, 87, 0.1);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

/* ========================================
   평가 버튼 컴포넌트
   ======================================== */
.rating-btn {
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: var(--font-xs);
  color: var(--text-secondary);
  transition: all var(--transition-fast);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  font-weight: 500;
}

.rating-btn:hover {
  background: var(--gray-100);
  transform: translateY(-1px);
}

.rating-btn.liked {
  color: var(--success-color);
  background: rgba(16, 185, 129, 0.1);
}

.rating-btn.disliked {
  color: var(--error-color);
  background: rgba(239, 68, 68, 0.1);
}

/* ========================================
   액션 버튼들
   ======================================== */
.delete-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: var(--font-sm);
  color: var(--error-color);
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  margin-left: 8px;
}

.delete-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  transform: translateY(-1px);
}

/* ========================================
   상품 세트 하단 통계
   ======================================== */
.product-set-stats {
  padding: 10px 15px;
  background: var(--bg-alt);
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-top: 1px solid var(--gray-200);
}

.stats-row1 {
  display: flex;
  gap: 4px;
  align-items: center;
  flex-wrap: wrap;
}

.stats-row2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 28px;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: var(--font-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: color var(--transition-fast);
  padding: 4px 8px;
  border-radius: var(--radius-md);
}

.stat-item:hover {
  color: var(--text-primary);
  background: var(--gray-100);
}

/* 관리자 삭제 버튼 (sync-btn 빨간색 버전) */
.admin-delete-btn {
  background: none;
  border: 1px solid #dc3545;
  color: #dc3545;
  padding: 4px 8px;
  border-radius: var(--radius-md);
  font-size: var(--font-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.admin-delete-btn:hover {
  background: #dc3545;
  color: #fff;
  transform: translateY(-1px);
}

/* 동기화 버튼 스타일 */
.sync-btn {
  background: none;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  padding: 4px 8px;
  border-radius: var(--radius-md);
  font-size: var(--font-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.sync-btn:hover:not(:disabled) {
  background: var(--primary-color);
  color: var(--text-inverse);
  transform: translateY(-1px);
}

.sync-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--gray-200);
  color: var(--gray-500);
  border-color: var(--gray-300);
}

.sync-btn .loading-sm {
  width: 12px;
  height: 12px;
  border-width: 1px;
}


/* ========================================
   URL 미리보기 컴포넌트
   ======================================== */
.url-preview {
  margin-top: 10px;
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: none;
  background: var(--bg-surface);
}

.url-preview.show {
  display: block;
}

.url-preview .link-preview {
  padding: 10px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.url-preview .link-image {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  background: var(--gray-100);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.url-preview .link-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.url-preview .link-image.no-image {
  background: var(--ink-100);
  color: var(--ink-400);
  font-size: 18px;
  font-weight: 600;
}

.url-preview .link-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.url-preview .link-title {
  font-size: var(--font-sm);
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  margin: 0;
}

.url-preview .link-description {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  line-height: 1.3;
}

.url-preview .link-site {
  font-size: var(--font-xs);
  color: var(--text-muted);
}

/* 🔴 옛 보라(#667eea)가 js/main.js 의 인라인 스타일에 박혀 있었다 —
   CSS 만 grep 하면 안 잡힌다. 클래스로 빼서 색을 한 곳에서 고친다. */
.url-preview .link-price {
  font-weight: 600;
  color: var(--brand-600);
  margin-top: 3px;
}

.url-preview .link-price-auto {
  font-size: var(--font-2xs);
  color: var(--ink-400);
}

.preview-error {
  color: var(--error-color);
  font-size: var(--font-xs);
  padding: 8px;
  background: rgba(239, 68, 68, 0.1);
  border-radius: var(--radius-sm);
  margin-top: 8px;
}

/* ========================================
   폼 섹션 (상품등록 전용)
   ======================================== */
.form-section {
  margin-bottom: 25px;
  padding: 20px;
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  border: 1px solid var(--gray-200);
}

.form-section h4 {
  margin: 0 0 15px 0;
  color: var(--text-primary);
  font-size: var(--font-lg);
  font-weight: 600;
}

/* 입력 그룹
   🔴 `.esm-input-group` 은 **로그인 모달**(includes/header.php)이 쓴다 —
      전 페이지 공용이므로 common.css 로 옮겼다. 여기 다시 만들지 말 것. */
.market-input-group {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.market-select {
  min-width: 120px;
  padding: 12px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  background: var(--bg-surface);
}

.price-input-group {
  display: flex;
  gap: 10px;
  margin-top: 10px;
  align-items: center;
}

.price-input-group input {
  flex: 1;
}

.price-input-group label {
  font-size: var(--font-xs);
  color: var(--text-secondary);
  white-space: nowrap;
  margin: 0;
}

/* ========================================
   검증 상태 표시
   ======================================== */
.validation-status {
  margin-top: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: var(--font-sm);
  display: none;
  animation: fadeIn var(--transition-base) ease;
}

.validation-status.success {
  background: #dcf0e4;
  color: #1c6b40;
  border: 1px solid #c3e6cb;
}

.validation-status.error {
  background: #fadfdd;
  color: #a33a33;
  border: 1px solid #f5c6cb;
}

/* ESM 상태 표시 */
/* ========================================
   대체상품 폼 컴포넌트
   ======================================== */
.alternative-form-item {
  background: var(--bg-surface);
  border: 1px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  margin-bottom: 8px;
  transition: border-color var(--transition-fast);
}

.alternative-form-item:hover {
  border-color: var(--gray-300);
}

.alternative-form-item .form-group {
  margin-bottom: 6px;
}

.alternative-form-item .form-group:last-child {
  margin-bottom: 0;
}

.alternative-form-item .form-group label {
  font-size: 11px;
  margin-bottom: 2px;
  display: block;
  color: var(--text-secondary);
}

.alternative-form-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 12px;
}

.alternative-form-header span {
  font-weight: 600;
  color: var(--text-primary);
}

.remove-alternative-btn {
  background: var(--error-color);
  color: var(--text-inverse);
  border: none;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: var(--font-xs);
  cursor: pointer;
  transition: all var(--transition-fast);
  font-weight: 500;
}

.remove-alternative-btn:hover {
  background: #dc2626;
  transform: translateY(-1px);
}

/* ========================================
   중복 검증 모달
   ======================================== */
.duplicate-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px;
  background: #fdf0d5;
  border: 1px solid #ffeaa7;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.warning-icon {
  font-size: 24px;
  flex-shrink: 0;
}

.duplicate-warning p {
  margin: 0;
  color: #8a6416;
  font-weight: 500;
  line-height: 1.4;
}

.duplicate-list {
  margin-bottom: 20px;
  max-height: 300px;
  overflow-y: auto;
}

.duplicate-item {
  background: var(--bg-alt);
  border: 1px solid var(--gray-300);
  border-radius: var(--radius-md);
  padding: 15px;
  margin-bottom: 10px;
}

.duplicate-item:last-child {
  margin-bottom: 0;
}

.duplicate-code {
  font-size: var(--font-lg);
  font-weight: 600;
  color: var(--error-color);
  margin-bottom: 8px;
}

.duplicate-location {
  font-size: var(--font-sm);
  color: var(--text-secondary);
  margin-bottom: 5px;
}

.duplicate-existing {
  font-size: var(--font-sm);
  color: var(--text-primary);
  background: var(--gray-200);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border-left: 4px solid var(--primary-color);
}

.duplicate-note {
  padding: 15px;
  background: #e7f3ff;
  border: 1px solid #b8daff;
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

.duplicate-note p {
  margin: 0;
  color: #004085;
  font-size: var(--font-sm);
  line-height: 1.5;
}

.duplicate-actions {
  text-align: center;
}