/* ═══════════════════════════════════════════════
   trade-page.css — 매매 서브메인 페이지
   (main.css 변수, card.css 의 .card 재사용)
   ═══════════════════════════════════════════════ */

/* ── 페이지 헤더 ── */
.page-hd { background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
           padding: 36px 20px 28px; border-bottom: 1px solid #bfdbfe; }
.page-hd-inner { max-width: 1200px; margin: 0 auto; }
.page-hd-title { font-size: 26px; font-weight: 800; color: #1e40af;
                 margin-bottom: 6px; letter-spacing: -.5px; }
.page-hd-desc { font-size: 14px; color: #475569; }
.page-breadcrumb { font-size: 12px; color: #64748b; margin-bottom: 10px; }
.page-breadcrumb a { color: #3b82f6; text-decoration: none; }
.page-breadcrumb a:hover { text-decoration: underline; }

/* ── KPI 스트립 (매매 전용) ── */
.strip { background: #0f2744; padding: 10px 20px; position: sticky; top: 61px; z-index: 100; }
.si-wrap { max-width: 1200px; margin: 0 auto; display: flex; align-items: center; flex-wrap: wrap; }
.si { display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
      padding: 2px 20px; border-right: 1px solid rgba(255,255,255,.18); }
.si:first-child { padding-left: 0; }
.si:last-of-type { border-right: none; }
.si-lbl  { font-size: 11px; color: rgba(255,255,255,.65); font-weight: 600; letter-spacing: .2px; }
.si-row  { display: flex; align-items: baseline; gap: 4px; }
.si-val  { font-size: 18px; font-weight: 800; color: #fff; line-height: 1.1; }
.si-unit { font-size: 12px; color: rgba(255,255,255,.6); }
.si-d    { font-size: 11px; font-weight: 700; padding: 1px 5px; border-radius: 3px; }
.sd-bad  { background: rgba(239,68,68,.22); color: #fca5a5; }
.sd-dwn  { background: rgba(59,130,246,.25); color: #93c5fd; }
.sd-neu  { background: rgba(255,255,255,.1);  color: rgba(255,255,255,.65); }

/* 월 네비게이션 */
.mn-nav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.mn-btn { font-size: 13px; color: #fff; padding: 3px 10px; border-radius: 4px;
          background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.25);
          text-decoration: none; line-height: 1.5; cursor: pointer; }
.mn-btn:hover { background: rgba(255,255,255,.32); }
.mn-dis { color: rgba(255,255,255,.22); background: transparent; border-color: rgba(255,255,255,.1); cursor: default; }
.mn-select { font-size: 13px; font-weight: 700; color: #fff; background: rgba(255,255,255,.15);
             border: 1px solid rgba(255,255,255,.25); border-radius: 4px; padding: 3px 8px;
             cursor: pointer; outline: none; letter-spacing: -.2px; }
.mn-select option { color: #0f172a; background: #fff; }

/* ── 레이아웃 ── */
.tp-wrap { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }

/* ── 카드 헤더 ── */
.ch { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.ct { font-size: 15px; font-weight: 800; letter-spacing: -.3px; }
.cs { font-size: 13px; color: var(--text-faint); }

/* ── 그룹 헤더 ── */
.grp-hd { display: flex; align-items: center; gap: 12px; margin: 32px 0 14px; }
.grp-hd:first-child { margin-top: 0; }
.grp-bar   { width: 4px; border-radius: 2px; flex-shrink: 0; align-self: stretch; min-height: 36px; }
.grp-title { font-size: 18px; font-weight: 800; color: var(--text-muted); line-height: 1.2; }
.grp-desc  { font-size: 13px; color: var(--text-faint); margin-top: 3px; }

/* ── 테이블 ── */
.dt { width: 100%; border-collapse: collapse; font-size: 14px; }
.dt th { padding: 9px 8px; background: var(--bg); color: var(--text-faint); font-size: 13px; font-weight: 700;
         border-bottom: 2px solid var(--border); white-space: nowrap; text-align: right; }
.dt th:first-child { text-align: left; padding-left: 14px; }
.dt td { padding: 9px 8px; border-bottom: 1px solid var(--border); white-space: nowrap;
         vertical-align: middle; text-align: right; font-variant-numeric: tabular-nums; }
.dt tr:last-child td { border-bottom: none; }
.dt tr:hover td { background: #f0f9ff; cursor: pointer; }
.dt td:first-child { text-align: left; font-weight: 700; padding-left: 14px; }
.dt td.tl, .dt th.tl { text-align: left; }
.dt td.tc, .dt th.tc { text-align: center; }

.link { color: #2563eb; text-decoration: none; }
.link:hover { color: #1d4ed8; text-decoration: underline; }

/* ── 그리드 ── */
.grid-2col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; align-items: stretch; }
.card-flex { display: flex; flex-direction: column; }

/* 그룹 내 직속 카드 간격 */
.tp-wrap > .card { margin-bottom: 16px; }

/* ── 각주 ── */
.fn { font-size: 12px; color: var(--text-faint); padding: 8px 14px 10px; text-align: right;
      border-top: 1px solid var(--border); line-height: 1.5; }
.fn-notes { font-size: 12px; color: var(--text-faint); padding: 10px 14px;
            border-top: 1px solid var(--border); background: #f8fafc; line-height: 1.7; }
.fn-notes-item { display: flex; gap: 8px; align-items: baseline; }
.fn-notes-item::before { content: '•'; color: #cbd5e1; font-weight: 700; }
.fn-notes-lbl { font-weight: 700; color: #64748b; flex-shrink: 0; }
.fn-notes-desc { color: #94a3b8; }


/* ── 랭킹 CTA ── */
.ranking-cta { background: linear-gradient(135deg, #fef3c7, #fed7aa); border: 1px solid #fbbf24;
               border-radius: 10px; padding: 20px 24px; display: flex; align-items: center;
               justify-content: space-between; margin-bottom: 10px; gap: 16px; }
.ranking-cta-title { font-size: 15px; font-weight: 800; color: #92400e; margin-bottom: 4px; }
.ranking-cta-desc  { font-size: 13px; color: #78350f; }
.ranking-cta-btn   { background: #b45309; color: #fff; padding: 10px 18px; border-radius: 6px;
                     font-size: 13px; font-weight: 700; white-space: nowrap; text-decoration: none; }
.ranking-cta-btn:hover { background: #78350f; }

/* ── 상승/하락 · 면적 배지 ── */
.ud-up { color: #dc2626; font-weight: 700; }
.ud-dn { color: #2563eb; font-weight: 700; }
.ud-sep { color: #cbd5e1; }
.area-chip { display: inline-block; padding: 2px 7px; border-radius: 10px;
             font-size: 11px; font-weight: 700; }
.area-s { background: #dbeafe; color: #1d4ed8; }
.area-m { background: #e0e7ff; color: #4338ca; }
.area-l { background: #ede9fe; color: #6d28d9; }

/* ── TOP 아파트 접힘/펼침 카드 ── */
.apt-list { padding: 0; }
.apt-card { border-bottom: 1px solid var(--border); transition: all .15s; }
.apt-card:last-child { border-bottom: none; }
.apt-card[open] { background: #fff; border-left: 3px solid #1d4ed8;
                  box-shadow: 0 2px 8px rgba(29,78,216,.08); }
.apt-card[open] .apt-summary { background: #eff6ff; border-bottom: 2px solid #bfdbfe; }

.apt-summary { padding: 12px 14px; display: grid; grid-template-columns: 32px 1fr auto 32px;
               gap: 12px; align-items: center; cursor: pointer; list-style: none; user-select: none;
               transition: background .1s; }
.apt-summary::-webkit-details-marker { display: none; }
.apt-summary::marker { display: none; }
.apt-summary:hover { background: #f0f9ff; }

.apt-rank { font-size: 14px; font-weight: 800; color: #64748b; text-align: center;
            font-variant-numeric: tabular-nums; }
.apt-rank.top1 { color: #d97706; font-size: 16px; }
.apt-rank.top2 { color: #94a3b8; font-size: 16px; }
.apt-rank.top3 { color: #b45309; font-size: 16px; }

.apt-main { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; }
.apt-name-link { font-size: 14px; font-weight: 800; color: #2563eb; text-decoration: none;
                 white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
                 max-width: 100%; cursor: pointer;
                 border-bottom: 1px dashed transparent; transition: all .12s; }
.apt-name-link:hover { color: #1d4ed8; border-bottom-color: #1d4ed8; }
.apt-region { font-size: 12px; color: #64748b; font-weight: 500; }

.apt-kpi { display: flex; align-items: baseline; gap: 10px; white-space: nowrap; }
.apt-kpi-vol { font-size: 14px; font-weight: 800; color: #1e40af; font-variant-numeric: tabular-nums; }
.apt-kpi-vol-unit { font-size: 11px; color: #64748b; font-weight: 600; margin-left: 2px; }
.apt-kpi-price { font-size: 14px; font-weight: 700; color: #334155; font-variant-numeric: tabular-nums; }

.apt-toggle { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
              color: #64748b; font-size: 13px; font-weight: 700; border-radius: 50%;
              background: #f1f5f9; border: 1px solid #e2e8f0; transition: all .15s; }
.apt-summary:hover .apt-toggle { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.apt-card[open] .apt-toggle { transform: rotate(180deg); background: #1d4ed8; color: #fff; border-color: #1d4ed8; }

.apt-details { padding: 16px 20px 18px; display: grid; grid-template-columns: repeat(3,1fr); gap: 16px;
               background: #f8fafc; }
.apt-detail-item { display: flex; flex-direction: column; gap: 4px; padding: 10px 14px;
                   background: #fff; border: 1px solid #e2e8f0; border-radius: 6px; }
.apt-detail-lbl { font-size: 11px; color: #64748b; font-weight: 700; text-transform: uppercase;
                  letter-spacing: .5px; }
.apt-detail-val { font-size: 14px; color: #1e293b; font-weight: 700; }

/* 전체 펼치기 컨트롤 */
.apt-list-controls { padding: 10px 14px; display: flex; justify-content: flex-end; gap: 8px;
                     border-bottom: 1px solid var(--border); background: #f8fafc; }
.apt-ctrl-btn { font-size: 12px; font-weight: 700; color: #475569; background: #fff;
                border: 1px solid #cbd5e1; padding: 5px 12px; border-radius: 4px; cursor: pointer; }
.apt-ctrl-btn:hover { background: #eff6ff; border-color: #93c5fd; color: #1d4ed8; }

/* ── 반응형 ── */
@media (max-width: 960px) {
  .grid-2col { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .page-hd { padding: 28px 16px 22px; }
  .page-hd-title { font-size: 22px; }
  .si-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
  .si { padding: 4px 0; border-right: none; }
  .mn-nav { grid-column: 1 / -1; justify-content: center; margin-left: 0; margin-top: 2px; }
  .tp-wrap { padding: 18px 10px 48px; }
  .ranking-cta { flex-direction: column; align-items: stretch; text-align: center; }
  .apt-details { grid-template-columns: 1fr; gap: 8px; }
  .apt-detail-item { flex-direction: row; justify-content: space-between; align-items: center; }
}
@media (max-width: 580px) {
  .page-hd-title { font-size: 18px; }
  .page-hd-desc { font-size: 13px; }
  .dt th, .dt td { font-size: 12px; padding: 7px 6px; }
  .apt-summary { grid-template-columns: 28px 1fr auto 28px; gap: 8px; padding: 10px 12px; }
  .apt-kpi { flex-direction: column; gap: 0; align-items: flex-end; }
  .apt-kpi-vol { font-size: 13px; }
  .apt-kpi-price { font-size: 12px; color: #64748b; font-weight: 600; }
  .apt-toggle { width: 26px; height: 26px; font-size: 11px; }
  .apt-detail-lbl { font-size: 10px; }
  .apt-detail-val { font-size: 13px; text-align: right; }
}
