/* ── 리스트 헤더 ── */
.stock-list-header {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: 12px;
}

/* 첫 번째 줄: 테마명 + 등락률 */
.header-line-1 {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-line-1 > h3 {
  margin: 0;
  font-size: 1.2em;
  font-weight: 500;
}

/* 상승/하락 뱃지 */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75em;
  font-weight: 600;
  min-width: 20px;
}

.badge-up {
  background-color: #f33;
  color: white;
}

.badge-down {
  background-color: #4fabff;
  color: white;
}

.header-line-1 .header-stats {
  display: flex;
  align-items: center;
}

.header-stats .change {
  font-size: 1.2em;
  font-weight: 600;
}

/* 두 번째 줄: 버튼 + 거래대금 */
.header-line-2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 36px;
}

.sort-buttons {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sort-btn {
  padding: 1px 12px;
  font-size: 0.85rem;
  border: none;
  border-radius: 6px;
  background-color: #e6e6e6;
  color: #333D4B;
  cursor: pointer;
  transition: background-color 0.2s ease;
  font-weight: 500;
  display: flex;
  align-items: center;
}

.sort-btn:hover {
  background-color: #f0f0f0;
}

.sort-btn.active {
  background-color: #e71909;
  color: #fff;
}

.volume-stat {
  display: flex;
  align-items: center;
}

.volume-stat .volume {
  color: #6a6a6a;
  font-size: 1.1em;
}

/* ── 리스트 아이템 래퍼 ── */
.stock-list-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
}

/* ── 카드 ── */
.stock-card {
  display: flex;
  flex-direction: column;
  padding: 12px;
  background: #f5f5f5;
  border-radius: 10px;
  margin-bottom: 8px;
  border: 1px solid #e0e0e0;
}

/* 상단 영역 */
.stock-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
}

.stock-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.stock-card .rank {
  font-size: 0.95rem;
  font-weight: 700;
  color: #333;
  min-width: 18px;
}

.stock-card-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background-color: #e0e0e0;
  background-size: cover;
  background-position: center;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 600;
  color: #666;
}

.stock-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stock-card .stock-name {
  font-weight: 600;
  font-size: 0.85rem;
  color: #333D4B;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.stock-card .stock-code {
  font-size: 0.7rem;
  color: #888;
}

.stock-card .change {
  font-size: 0.95rem;
  font-weight: 700;
  text-align: right;
}

/* 하단 박스 영역 */
.stock-card-bottom {
  display: flex;
  gap: 8px;
}

.stock-card-box {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 4px;
  padding: 8px 12px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #e6e6e6;
}

.stock-card-box .box-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
}

.stock-card-box .box-label {
  font-size: 0.7rem;
  color: #888;
}

/* ── 펼치기/접기 버튼 ── */
#stock-list-toggle-btn {
  background-color: #e6e6e6;
  color: #333D4B;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 0.9rem;
  font-family: Pretendard Variable, Pretendard, -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  cursor: pointer;
}

/* ───────────── Pagination ───────────── */
#stock-list-pagination {
  text-align: center;
}

/* ── PC 전용 (≥1024px) ── */
@media (min-width: 1024px) {
  .stock-list-items {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .stock-card {
    margin-bottom: 0;
    padding: 10px;
  }

  .stock-card-top {
    margin-bottom: 6px;
  }

  .stock-card-left {
    gap: 8px;
  }

  .stock-info {
    gap: 0;
    line-height: 1.2;
  }

  .stock-card .rank {
    font-size: 0.95rem;
    min-width: 18px;
  }

  .stock-card-icon {
    width: 26px;
    height: 26px;
  }

  .stock-card .stock-name {
    font-size: 0.85rem;
  }

  .stock-card .stock-code {
    font-size: 0.7rem;
  }

  .stock-card .change {
    font-size: 0.95rem;
  }

  .stock-card-bottom {
    gap: 6px;
  }

  .stock-card-box {
    padding: 6px 10px;
  }

  .stock-card-box .box-value {
    font-size: 0.85rem;
  }

  .stock-card-box .box-label {
    font-size: 0.7rem;
  }
}