/* ═══════════════════════════════════════════════
   거래포털 메인 – deal-main.css
   ═══════════════════════════════════════════════ */

:root {
  --dm-orange: #d35400;
  --dm-re:  #2563eb;
  --dm-car: #d97706;
  --dm-mkt: #059669;
  --dm-onl: #7c3aed;

  /* ── 타이포그래피 스케일 (PROJECT_RULES.md 원칙3 / layout.css --fs-* 공통 참조) ── */
  --dm-fs-xs: var(--fs-xs, 12px);   /* 12px — 배지 전용 */
  --dm-fs-sm: var(--fs-sm, 14px);   /* 14px — 메타·날짜·보조텍스트 최솟값 */
  --dm-fs-base: var(--fs-base, 16px);   /* 16px — 본문 기본 */
  --dm-fs-md: var(--fs-md, 17px);   /* 17px — 강조 본문·버튼·폼 */
  --dm-fs-lg: var(--fs-lg, 18px);   /* 18px — 카드 제목·섹션명 */
  --dm-fs-xl: var(--fs-xl, 20px);   /* 20px — 서브 헤더 */
  --dm-fs-2xl: var(--fs-2xl, 24px);   /* 24px — 페이지 제목 */
  --dm-fs-3xl: var(--fs-3xl, 28px);   /* 28px — 섹션 대제목 */
  --dm-fs-hero: var(--fs-hero, 32px);   /* 32px — 히어로 제목 */
}

/* ── 서브네비 ── */
.dm-subnav {
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
  position: sticky;
  top: 0;
  z-index: 50;
}
.dm-subnav-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 10px 16px;
}
.dm-snav-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 20px;
  background: #f1f5f9;
  color: #475569;
  font-size: var(--dm-fs-sm);
  font-weight: 500;
  text-decoration: none;
  transition: all .15s;
}
.dm-snav-item:hover,
.dm-snav-item.active {
  background: var(--dm-orange);
  color: #fff;
}

/* ── 히어로 ── */
.dm-hero {
  background: linear-gradient(135deg, #d35400 0%, #e67e22 100%);
  color: #fff;
  padding: 36px 24px;
}
.dm-hero-inner {
  max-width: 1000px;
  margin: 0 auto;
}
.dm-hero h1 {
  margin: 0 0 8px;
  font-size: 26px;
  font-weight: 800;
}
.dm-hero p {
  margin: 0;
  opacity: .88;
  font-size: var(--dm-fs-sm);
}

/* ── 래퍼 ── */
.dm-wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 16px 60px;
}

/* ── 카테고리 카드 그리드 ── */
.dm-cat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 36px;
}
.dm-cat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 16px;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  text-decoration: none;
  color: #1e293b;
  border: 1.5px solid #f1f5f9;
  transition: all .2s;
  position: relative;
  overflow: hidden;
}
.dm-cat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.dm-cat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--dm-fs-xl);
  flex-shrink: 0;
  color: #fff;
}
.dm-cat-re  .dm-cat-icon { background: var(--dm-re); }
.dm-cat-car .dm-cat-icon { background: var(--dm-car); }
.dm-cat-mkt .dm-cat-icon { background: var(--dm-mkt); }
.dm-cat-onl .dm-cat-icon { background: var(--dm-onl); }

.dm-cat-re:hover  { border-color: var(--dm-re); }
.dm-cat-car:hover { border-color: var(--dm-car); }
.dm-cat-mkt:hover { border-color: var(--dm-mkt); }
.dm-cat-onl:hover { border-color: var(--dm-onl); }

.dm-cat-body { flex: 1; min-width: 0; }
.dm-cat-name { font-size: var(--dm-fs-base); font-weight: 700; margin-bottom: 3px; }
.dm-cat-desc { font-size: 11.5px; color: #64748b; margin-bottom: 6px; line-height: 1.4; }
.dm-cat-cnt  { font-size: var(--dm-fs-xs); font-weight: 600; color: #94a3b8; }
.dm-cat-arr  { color: #cbd5e1; font-size: var(--dm-fs-sm); flex-shrink: 0; }

/* ── 섹션 ── */
.dm-section {
  margin-bottom: 40px;
}
.dm-sec-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid #f1f5f9;
}
.dm-sec-head h2 {
  margin: 0;
  font-size: var(--dm-fs-base);
  font-weight: 700;
  color: #1e293b;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dm-sec-more {
  font-size: var(--dm-fs-sm);
  color: #64748b;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: color .15s;
}
.dm-sec-more:hover { color: var(--dm-orange); }

/* ── 카드 행 (3열) ── */
.dm-card-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.dm-item-card {
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 12px;
  border: 1.5px solid #f1f5f9;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
  text-decoration: none;
  color: #1e293b;
  transition: all .18s;
}
.dm-item-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 14px rgba(0,0,0,.1);
  transform: translateY(-2px);
}
.dm-item-thumb {
  position: relative;
  width: 100%;
  padding-top: 62%;
  background: #f1f5f9;
  overflow: hidden;
}
.dm-item-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .3s;
}
.dm-item-card:hover .dm-item-thumb img { transform: scale(1.04); }
.dm-thumb-blank {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--dm-fs-hero);
  color: #cbd5e1;
}
.dm-sold-badge {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: var(--dm-fs-sm);
  font-weight: 700;
  z-index: 2;
}
.dm-deal-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  z-index: 3;
}
.dm-badge-re  { background: var(--dm-re); }
.dm-badge-car { background: var(--dm-car); }
.dm-badge-mkt { background: var(--dm-mkt); }
.dm-badge-onl { background: var(--dm-onl); }

.dm-item-body {
  padding: 12px 13px 14px;
}
.dm-item-price {
  font-size: var(--dm-fs-base);
  font-weight: 800;
  color: #1e293b;
  margin-bottom: 4px;
}
.dm-item-title {
  font-size: var(--dm-fs-sm);
  color: #334155;
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dm-item-meta {
  font-size: 11.5px;
  color: #94a3b8;
}

/* ── 빈 상태 ── */
.dm-empty {
  text-align: center;
  padding: 36px 24px;
  background: #f8fafc;
  border-radius: 12px;
  color: #94a3b8;
  font-size: var(--dm-fs-sm);
}
.dm-empty i {
  font-size: 30px;
  display: block;
  margin-bottom: 8px;
}

/* ── 반응형 ── */
@media (max-width: 860px) {
  .dm-cat-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .dm-card-row {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 540px) {
  .dm-cat-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .dm-cat-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 12px;
  }
  .dm-cat-arr { display: none; }
  .dm-card-row {
    grid-template-columns: 1fr;
  }
  .dm-hero h1 { font-size: var(--dm-fs-xl); }
}
