/* ── 관심종목 모달 ── */
.favorites-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.favorites-modal.hidden {
  display: none;
}

.favorites-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  cursor: pointer;
}

.favorites-modal-content {
  position: relative;
  width: 90%;
  max-width: 400px;
  height: 70vh;
  max-height: 600px;
  background: white;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  z-index: 2001;
}

/* ── 탭 ── */
.favorites-tabs {
  display: flex;
  align-items: center;
  border-bottom: 1px solid #e0e0e0;
  padding: 0 20px;
  gap: 0;
}

.favorites-tab-btn {
  padding: 12px 16px;
  background: none;
  border: none;
  font-size: 0.95rem;
  color: #666;
  cursor: pointer;
  font-weight: 500;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

.favorites-tab-btn:hover {
  color: #333;
}

.favorites-tab-btn.active {
  color: #333;
  border-bottom-color: #333;
}

/* ── 닫기 버튼 (탭 우측) ── */
.favorites-close {
  background: none;
  border: none;
  font-size: 1.8rem;
  cursor: pointer;
  color: #999;
  padding: 8px;
  margin-left: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
  line-height: 1;
}

.favorites-close:hover {
  color: #333;
}

/* ── ✅ 정렬 Select ── */
.favorites-sort-container {
  padding: 12px 20px;
  border-bottom: 1px solid #e0e0e0;
}

#favorites-sort-select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  font-size: 0.9rem;
  color: #333;
  background-color: white;
  cursor: pointer;
  transition: border-color 0.2s;
}

#favorites-sort-select:hover {
  border-color: #999;
}

#favorites-sort-select:focus {
  outline: none;
  border-color: #333;
}

/* ── 탭 콘텐츠 ── */
.favorites-tab-content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.favorites-tab-panel {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.favorites-tab-panel.active {
  display: flex;
  flex-direction: column;
}

/* ── 관심종목 리스트 ── */
.favorites-stock-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.favorites-stock-item {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: #f5f5f5;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.favorites-stock-item:hover {
  background: #efefef;
}

.favorites-stock-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.favorites-stock-name {
  font-weight: 700;
  color: #333;
  font-size: 1rem;
}

.favorites-stock-date {
  font-size: 0.8rem;
  color: #999;
}

.favorites-stock-item-middle {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: #999;
  gap: 12px;
}

.stock-price-left {
  flex: 1;
}

.stock-price-right {
  flex: 1;
  text-align: right;
}

.price-value {
  font-weight: 600;
  color: #333;
  font-size: 0.95rem;
  margin-left: 4px;
}

.favorites-stock-item-bottom {
  display: flex;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid #e0e0e0;
  font-size: 0.85rem;
  color: #999;
  gap: 12px;
}

.stock-change-left {
  flex: 1;
}

.stock-change-right {
  flex: 1;
  text-align: right;
}

.change-value {
  font-weight: 700;
  font-size: 0.95rem;
  margin-left: 4px;
}

.change-value.positive {
  color: #f33;
}

.change-value.negative {
  color: #4fabff;
}

.change-value.neutral {
  color: #999;
}

/* ── 빈 상태 ── */
.mypick-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  color: #999;
  font-size: 0.95rem;
}

/* ── 스크롤바 ── */
.favorites-tab-panel::-webkit-scrollbar {
  width: 6px;
}

.favorites-tab-panel::-webkit-scrollbar-track {
  background: #f0f0f0;
}

.favorites-tab-panel::-webkit-scrollbar-thumb {
  background: #ccc;
  border-radius: 3px;
}

.favorites-tab-panel::-webkit-scrollbar-thumb:hover {
  background: #999;
}

/* ── 모바일 ── */
@media (max-width: 480px) {
  .favorites-modal-content {
    width: 95%;
    height: 80vh;
    max-height: 90%;
    max-width: 100%;
  }

  .favorites-tab-btn {
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  .favorites-stock-item {
    padding: 10px 12px;
  }

  #favorites-sort-select {
    font-size: 0.85rem;
    padding: 6px 10px;
  }
}
