/* ═══════════════════════════════════════════════
   lowest.css — 최저가검색 페이지
   ═══════════════════════════════════════════════ */

/* ── 요약 카드 4종 (브리핑 스타일) ──────── */
.lw-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--bg-base);
  border-bottom: 1px solid var(--border-secondary);
}

.lw-summary-card {
  padding: 10px 16px;
  border-right: 1px solid var(--border-secondary);
}

.lw-summary-card:last-child {
  border-right: none;
}

.lw-sc-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  padding-bottom: 6px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-secondary);
}

.lw-sc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
}

.lw-sc-row .name {
  font-size: 12px;
  color: var(--text-tertiary);
}

.lw-sc-row .value {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
}

.lw-sc-row .value.up {
  color: var(--color-up);
}

.lw-sc-row .value.down {
  color: var(--color-down);
}

.lw-sc-row .value.accent {
  color: var(--color-accent);
}

.lw-sc-row .value.muted {
  color: var(--text-muted);
}

/* ── 필터/정렬 바 (GNB 스타일 한줄) ──── */
.lw-filter-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  height: 45px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-secondary);
  position: sticky;
  top: 48px;
  z-index: 50;
}

.lw-filter-bar>.lw-fb-section {
  display: flex;
  align-items: center;
  height: 100%;
}

.lw-fb-right {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  height: 100%;
}

.lw-premium-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 100%;
  border-right: 1px solid var(--border-secondary);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-tertiary);
  transition: color 0.15s ease;
  user-select: none;
}

.lw-premium-toggle:hover {
  color: var(--text-secondary);
}

.lw-premium-toggle input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border: 1px solid var(--border-secondary);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
}

.lw-premium-toggle input[type="checkbox"]:checked {
  background: var(--color-accent);
  border-color: var(--color-accent);
}

.lw-premium-toggle input[type="checkbox"]:checked::after {
  content: "✓";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: #000;
  font-weight: 700;
}

.lw-fb-right .lw-fb-count {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 0 16px;
  height: 100%;
}

.lw-fb-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.lw-fb-title i {
  color: var(--color-accent);
  margin-right: 4px;
}

.lw-fb-count {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.lw-source-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  width: 100%;
  height: 100%;
}

.lw-source-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.5px;
  border: none;
  border-right: 1px solid var(--border-secondary);
  border-radius: 0;
  background: transparent;
  color: var(--text-tertiary);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.lw-source-chip:hover {
  background: var(--bg-hover);
}

.lw-source-chip .chip-check {
  display: none;
  font-size: 10px;
}

.lw-source-chip.active .chip-check {
  display: inline;
}

.lw-source-chip.s1.active {
  color: #00BCD4;
}

.lw-source-chip.s2.active {
  color: #4CAF50;
}

.lw-source-chip.s3.active {
  color: #FFC107;
}

.lw-filter-select {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  padding: 0 14px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: -0.5px;
  background: transparent;
  border: none;
  border-right: 1px solid var(--border-secondary);
  color: var(--text-secondary);
  cursor: pointer;
}

.lw-filter-select:focus {
  border-color: var(--border-primary);
  outline: none;
}

/* ── 테이블 헤더 행 ───────────────────── */
.lw-list-header {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 120px 64px 110px 52px 36px;
  column-gap: 16px;
  align-items: center;
  padding: 0 20px;
  height: 28px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-secondary);
  font-size: 11px;
  color: var(--text-muted);
  position: sticky;
  top: 93px;
  z-index: 49;
}

.lw-th {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.lw-th:hover {
  color: var(--text-secondary);
}

.lw-th.active {
  color: var(--color-accent);
}

.lw-th.active i {
  color: var(--color-accent);
}

.lw-th i {
  font-size: 12px;
  color: var(--text-muted);
  transition: color 0.15s;
}

.lw-th-info {
  cursor: default;
}

.lw-th-right {
  justify-content: flex-end;
  text-align: right;
}

/* ── 1열 카드 리스트 ──────────────────── */
.lw-card-grid {
  display: flex;
  flex-direction: column;
}

.lw-listing-card {
  background: var(--bg-surface);
  border: none;
  border-bottom: 1px solid var(--border-secondary);
  border-radius: 0;
  overflow: hidden;
  transition: background 0.2s ease;
  position: relative;
  cursor: pointer;
}

.lw-listing-card:last-child {
  border-bottom: none;
}

/* 서버리스트 스타일 호버 — 좌측 accent bar */
.lw-listing-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: var(--color-accent);
  transform: scaleY(0);
  transition: transform 0.2s ease;
}

.lw-listing-card:hover {
  background: var(--bg-hover);
}

.lw-listing-card:hover::before {
  transform: scaleY(1);
}


/* 리스트 행 — 6열 그리드 (순위 없음) */
.lc-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 120px 64px 110px 52px 36px;
  align-items: center;
  column-gap: 16px;
  padding: 14px 20px;
}

/* ① 서버 + 거래소 + 제목 */
.lc-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  padding-right: 24px;
}

.lc-info-top {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lc-server {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  line-height: 1;
}

.lc-title {
  font-size: 15px;
  font-weight: 300;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  line-height: 1.2;
}

/* 뱃지 */
.lw-badge-premium {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 15px;
  height: 15px;
  font-size: 8px;
  font-weight: 800;
  background: var(--color-accent);
  color: #000;
  border-radius: 2px;
  flex-shrink: 0;
}

.lw-badge-new {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  font-size: 9px;
  font-weight: 700;
  height: 15px;
  background: rgba(234, 57, 67, 0.12);
  color: #EA3943;
  border-radius: 2px;
  flex-shrink: 0;
  line-height: 15px;
}

/* ② 단가 */
.lc-unit-price {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  text-align: right;
  white-space: nowrap;
  line-height: 1;
}

/* 수량 인라인: 데스크탑에서 숨김 (모바일 전용) */
.lc-qty-inline {
  display: none;
}

.lc-unit-price strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ③ 수량 */
.lc-qty {
  font-size: 12px;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  text-align: right;
  white-space: nowrap;
  line-height: 1;
}

.lc-qty strong {
  color: var(--text-secondary);
  font-weight: 600;
}

/* ④ 총금액 */
.lc-total {
  font-size: 14px;
  color: #EA3943;
  font-family: var(--font-mono);
  text-align: right;
  white-space: nowrap;
  line-height: 1;
  letter-spacing: -0.2px;
  transition: color 0.25s ease;
}

.lw-listing-card:hover .lc-total {
  color: var(--color-up);
}

.lc-total strong {
  font-weight: 600;
}

/* 단위 (원/만) 공통 */
.lc-unit-price .unit,
.lc-qty .unit,
.lc-total .unit {
  margin-left: 2px;
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 400;
}

/* ⑤ 시간 */
.lc-time {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-align: center;
  white-space: nowrap;
  line-height: 1;
}

/* ⑥ 바로가기 — 아이콘만 */
.lc-link {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  margin-left: auto;
  color: var(--text-muted);
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.lc-link i {
  font-size: 16px;
}

.lc-link:hover {
  color: var(--color-accent);
  background: rgba(240, 185, 11, 0.08);
}

/* ── 거래소 뱃지 ──────────────────────── */
.source-badge {
  display: inline-flex;
  align-items: center;
  padding: 0 5px;
  font-size: 10px;
  font-weight: 600;
  height: 16px;
  border-radius: 2px;
  border: 1px solid;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 14px;
}

.source-badge.barotem {
  color: #4FC3F7;
  border-color: rgba(79, 195, 247, 0.25);
  background: rgba(79, 195, 247, 0.06);
}

.source-badge.itemmania {
  color: #AED581;
  border-color: rgba(174, 213, 129, 0.25);
  background: rgba(174, 213, 129, 0.06);
}

.source-badge.itembay {
  color: #FFB74D;
  border-color: rgba(255, 183, 77, 0.25);
  background: rgba(255, 183, 77, 0.06);
}

/* ── 로딩/종료/더보기 ─────────────────── */
.lw-loading,
.lw-end {
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
  font-size: 12px;
}

.lw-load-more-wrap {
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-secondary);
}

.lw-load-more-btn {
  background: none;
  border: none;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  cursor: pointer;
  transition: color var(--transition-fast);
  padding: 0;
}

.lw-load-more-btn:hover {
  color: var(--text-primary);
}

.lw-load-more-btn.loading i {
  animation: lw-spin 1s linear infinite;
}

@keyframes lw-spin {
  to {
    transform: rotate(360deg);
  }
}

.lw-empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
  font-size: 13px;
  grid-column: 1 / -1;
}

/* ── 반응형 (모바일) ──────────────────── */
@media (max-width: 600px) {
  .lw-summary-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .lw-summary-card:nth-child(2) {
    border-right: none;
  }

  .lw-summary-card:nth-child(3) {
    border-right: 1px solid var(--border-secondary);
  }

  .lw-filter-bar {
    grid-template-columns: 1fr;
    height: auto;
    top: var(--gnb-height);
  }

  .lw-filter-bar > .lw-fb-section {
    border-bottom: 1px solid var(--border-secondary);
    height: 40px;
  }

  .lw-filter-bar > .lw-fb-section:last-child {
    border-bottom: none;
  }

  .lw-source-chips {
    width: 100%;
  }

  .lw-source-chip {
    font-size: 11px;
    letter-spacing: -0.3px;
  }

  .lw-filter-select {
    font-size: 11px;
  }

  .lw-premium-toggle {
    font-size: 11px;
  }

  .lw-fb-right {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    padding: 0 14px;
    height: 40px;
  }

  .lw-fb-right .lw-premium-toggle {
    flex: 1;
    justify-content: flex-start;
  }

  .lw-fb-right .lw-fb-count {
    flex-shrink: 0;
    text-align: right;
  }

  .lw-sort-group {
    width: 100%;
    flex-wrap: wrap;
  }

  /* 리스트 헤더: 모바일 — 3컬럼 (매물정보 + 단가 + 총금액) */
  .lw-list-header {
    grid-template-columns: 1fr auto 100px;
    column-gap: 8px;
    padding: 0 14px;
    top: calc(var(--gnb-height) + 80px);
  }

  /* 수량·시간·링크 헤더 숨김 */
  .lw-list-header > :nth-child(3),
  .lw-list-header > :nth-child(5),
  .lw-list-header > :nth-child(6) {
    display: none;
  }

  /* 총금액 헤더 → 중앙 정렬 */
  .lw-list-header > :nth-child(4) {
    text-align: center;
    padding-right: 0;
  }

  /* ═══════════════════════════════════════════ */
  /* 매물 카드 — "가격 히어로 + 우측 총금액"       */
  /* ─────────────────────────────────────────── */
  /* │ 1행: 서버명  거래소  뱃지               │ 총금액 │ */
  /* │ 2행: ₩단가/만 · 수량                   │  원    │ */
  /* │ 3행: 제목 말줄임...                     │        │ */
  /* ═══════════════════════════════════════════ */

  .lc-row {
    display: grid;
    grid-template-columns: 1fr 100px;
    grid-template-rows: auto auto auto;
    padding: 0;
    column-gap: 0;
    row-gap: 0;
    cursor: pointer;
    transition: background 0.12s ease;
  }

  .lc-row:active {
    background: rgba(255, 255, 255, 0.03);
  }

  /* lc-info 해체 → 자식이 그리드에 직접 참여 */
  .lc-info {
    display: contents;
  }

  /* ── 1행: 서버 + 거래소 ──────────────── */
  .lc-info-top {
    grid-column: 1;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 10px 10px 2px 14px;
  }

  .lc-server {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
  }

  .source-badge {
    font-size: 9px;
    padding: 0 5px;
    height: 15px;
    line-height: 15px;
  }

  .lw-badge-premium,
  .lw-badge-new {
    height: 15px;
    font-size: 8px;
    line-height: 15px;
  }

  /* ── 2행: 단가 히어로 ──────────────── */
  .lc-unit-price {
    grid-column: 1;
    grid-row: 2;
    padding: 4px 10px 2px 14px;
    font-size: 11px;
    font-weight: 400;
    line-height: 1.4;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    text-align: left;
  }

  /* "1만당" 라벨 — 작고 흐리게 */
  .lc-price-label {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
  }

  /* 숫자 — 히어로 */
  .lc-unit-price strong {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.3px;
  }

  .lc-unit-price .unit {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-muted);
  }

  /* 수량 인라인: 모바일에서 표시 */
  .lc-qty-inline {
    display: inline;
    font-size: 13px;
    font-weight: 400;
    color: var(--text-muted);
    margin-left: 2px;
  }

  .lc-qty {
    display: none;
  }

  /* ── 3행: 제목 ─────────────────────── */
  .lc-title {
    grid-column: 1;
    grid-row: 3;
    padding: 2px 10px 10px 14px;
    font-size: 12px;
    font-weight: 400;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
  }

  /* ── 우측: 총금액 (3행 합침) ─────────── */
  .lc-total {
    grid-column: 2;
    grid-row: 1 / 4;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    border-left: 1px solid var(--border-secondary);
    padding: 8px 10px 8px 8px;
    font-variant-numeric: tabular-nums;
    cursor: pointer;
    transition: background 0.15s ease;
  }

  .lc-total:active {
    background: rgba(240, 185, 11, 0.06);
  }

  .lc-total strong {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.2;
    text-align: right;
    letter-spacing: -0.5px;
  }

  .lc-total .unit {
    font-size: 11px;
    margin-top: 3px;
    color: var(--text-muted);
    text-align: right;
  }

  /* 시간 숨김 */
  .lc-time {
    display: none;
  }

  /* 링크 숨김 (총금액이 링크 역할 대체) */
  .lc-link {
    display: none;
  }
}

/* ── 로딩 오버레이 ─────────────────────── */
.lw-loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(10, 12, 16, 0.8);
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

.lw-loading-overlay.active {
  display: flex;
}

.lw-loading-overlay .loader {
  display: inline-grid;
}

.lw-loading-overlay .loader:before,
.lw-loading-overlay .loader:after {
  content: "";
  grid-area: 1/1;
  height: 14px;
  aspect-ratio: 6;
  --c: #0000 64%, #f0b90b 66% 98%, #0000 101%;
  background:
    radial-gradient(35% 146% at 50% 159%, var(--c)) 0 0,
    radial-gradient(35% 146% at 50% -59%, var(--c)) 25% 100%;
  background-size: calc(100%/3) 50%;
  background-repeat: repeat-x;
  clip-path: inset(0 100% 0 0);
  animation: lw-loader-wave 1.5s infinite linear;
}

.lw-loading-overlay .loader:after {
  scale: -1;
}

@keyframes lw-loader-wave {
  50% { clip-path: inset(0); }
  to  { clip-path: inset(0 0 0 100%); }
}

.lw-loading-overlay .loader-text {
  font-size: 0.8rem;
  color: var(--text-muted, #8b949e);
  letter-spacing: 0.02em;
}