/* ───────────── Global Reset & Base ───────────── */
*, *::before, *::after {
  box-sizing: border-box;
}
body {
  background: #1e1e2f;
  color: #f5f5f5;
  font-family: 'Inter', 'Noto Sans KR', sans-serif;
  padding: 20px;
  display: flex;
  justify-content: center;
  font-size: 14px;
}
.container {
  width: 100%;
  max-width: 1400px;
  margin-bottom: 30px;
}

/* ───────────── Layout ───────────── */
.panel {
  display: flex;
  flex-direction: column;
  padding: 0 10px;
}
.combo-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.combo-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.combo-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
}
.combo-group {
  display: flex;
  gap: 10px;
}
.combo-group select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-color: #fff;
  color: #000;
  font-size: 0.85rem;
  padding: 8px 36px 8px 12px;
  border: none;
  border-radius: 6px;
  font-family: 'Inter';
  background-image: url("data:image/svg+xml;charset=UTF-8,%3Csvg viewBox='0 0 140 140' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M20 50 L70 100 L120 50' stroke='%23333' stroke-width='15' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px 12px;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.combo-group select:hover {
  background-color: #f0f0f0;
}

.combo-group select:focus {
  outline: none;
  box-shadow: 0 0 0 2px #4fabff;
}

/* ───────────── View Toggle Buttons ───────────── */
.view-toggle {
  display: none;
  gap: 6px;
}
.view-toggle button {
  height: 36px;
  padding: 0 12px;
  font-size: 0.85rem;
  border-radius: 6px;
  background: #333;
  color: #fff;
  border: none;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}
.view-toggle button.active {
  background: linear-gradient(90deg, #e71909, #e71909);
}

/* ───────────── Chart Bars ───────────── */
#bar-container,
#stock-bar-container {
  position: relative;
  height: 500px;
  margin-bottom: 20px;
  padding-left: 10px;
}
.bar-item {
  position: absolute;
  width: calc(100% - 10px);
  height: 40px;
  display: flex;
  align-items: center;
  transition: top 0.5s ease;
  padding-left: 10px;
}
.panel.right-panel .chart-label {
  white-space: pre-line;   /* \n을 실제 줄바꿈으로 인식 */
}
.stock-code {
  display: inline-block;    /* 필요에 따라 block or inline-block */
  color: #888;              /* 원하는 색으로 변경 */
  font-size: 0.9em;         /* 필요하면 크기도 조절 */
  margin-top: 2px;          /* 줄 간격 조정 */
}
.chart-theme-label {
  width: 120px;
  text-align: center;
  border-left: 1px solid white;
}
.chart-label {
  width: 130px;
  font-weight: 500;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar {
  flex: 1;
  height: 100%;
  background: #2b2b3c;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}
.bar-fill {
  height: 100%;
  border-radius: 20px;
  transition: width 0.5s ease;
}
.right-panel .chart-value {
  left: 280px;
}
.left-panel .chart-value {
  left: 160px;
}
.chart-value {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.85rem;
  font-weight: 500;
}

/* ───────────── Pagination ───────────── */
#stock-pagination {
  margin-top: 12px;
  text-align: center;
}
.stock-toggle-btn {
  background-color: #333;
  color: white;
  padding: 6px 14px;
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}
.stock-toggle-btn:hover {
  background-color: #555;
}

/* ───────────── Modal ───────────── */
.modal {
  display: none;
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  padding: 20px;
}
.modal.show {
  display: flex;
}
.modal-content {
  background: #2b2b3c;
  border-radius: 8px;
  width: 100%;
  max-width: 400px;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.5rem;
  color: white;
  cursor: pointer;
}

/* ───────────── Filter Bar ───────────── */
.filter-bar {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 14px;
  background: #2b2b3c;
  padding: 20px;
  border-radius: 8px;
}
.modal .filter-bar {
  display: flex;
}
.filter-bar input.filter-input {
  width: 90px;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 6px;
  background: #fafafa;
  color: #000;
}
.filter-bar button.filter-save-btn {
  padding: 7px 14px;
  background: #4fabff;
  color: #fff;
  border: none;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}
.filter-bar button.filter-save-btn:hover {
  background: #3486d1;
}

/* ───────────── Responsive ───────────── */
@media (min-width: 1024px) {
  .container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;

  }
}
@media (max-width: 1023px) {
  .container {
    display: block;
    padding-bottom: 60px; /* 내비 높이가 50px이라면 50px, 60px으로 약간 여유를 줘도 좋습니다 */
  }
  .right-panel {
    display: none;
  }
  .combo-title {
    display: none;
  }
  .combo-bar {
    justify-content: space-between;
    flex-wrap: nowrap;
  }
  .view-toggle {
    display: flex;
  }
  .combo-group {
    flex: 1;
    justify-content: flex-end;
  }
}
@media (max-width: 390px) {
  body {
    font-size: 13px;
  }
  .combo-title {
    font-size: 0.95rem;
  }
  .view-toggle button {
    font-size: 0.7rem;
    height: 34px;
    padding: 0 12px;
  }
  .combo-group select {
    font-size: 0.7rem;
    height: 34px;
    padding: 4px 25px;
  }
  .chart-value,
  .chart-label {
    font-size: 0.75rem;
  }
  .filter-bar {
    font-size: 12px;
  }
  .filter-bar input.filter-input {
    width: 80px;
    font-size: 0.8rem;
  }
  .filter-bar button.filter-save-btn {
    font-size: 0.8rem;
    padding: 6px 12px;
  }
  .chart-label {
  width: 120px;
  }
  .chart-value {
    left: 150px;
  }
}

@media (max-width: 350px) {
  body {
    font-size: 13px;
  }
  .combo-title {
    font-size: 0.95rem;
  }
  .view-toggle button {
    font-size: 0.6rem;
    height: 34px;
    padding: 0 12px;
  }
  .combo-group select {
    font-size: 0.6rem;
    height: 34px;
    padding: 4px 25px;
  }
  .chart-value,
  .chart-label {
    font-size: 0.65rem;
  }
  .filter-bar {
    font-size: 12px;
  }
  .filter-bar input.filter-input {
    width: 80px;
    font-size: 0.8rem;
  }
  .filter-bar button.filter-save-btn {
    font-size: 0.8rem;
    padding: 6px 12px;
  }
  .chart-label {
  width: 120px;
  }
  .chart-value {
    left: 150px;
  }
}
