/* issue.css – 데일리 이슈 페이지 전용 스타일 */

/* ── 전체 레이아웃 ── */
.grid-container {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 20px;
  width: 70%;
  margin: 20px auto 0;
  padding: 10px;
  box-sizing: border-box;
  margin-bottom: 30px;
}

/* ── 헤더 ── */
.header__container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #1e1e2f;
  border-bottom: 1px solid #333;
}
.header__left {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── 섹션 헤더 (이슈/테마 공통) ── */
.section-header {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  padding: 0 10px;
  height: 48px;
  box-sizing: border-box;
}
.section-header .section-title {
  grid-column: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1.1rem;
  font-weight: 600;
  color: #f5f5f5;
}
.section-header .toggle-buttons {
  grid-column: 2;
  display: inline-flex;
  background: #2b2b3c;
  padding: 4px;
  border-radius: 20px;
}
.section-header .toggle-button {
  flex: 1;
  width: 80px;
  padding: 3px 0;
  text-align: center;
  font-size: 0.9rem;
  color: #bbb;
  background: transparent;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.2s;
}
.section-header .toggle-button.active {
  background: #e71909;
  color: #fff;
}
.section-header .date {
  grid-column: 3;
  justify-self: end;
  display: flex;
  align-items: center;
  font-size: 0.9rem;
  font-weight: bold;
  color: #f5f5f5;
}
.section-header .weekday {
  margin-left: 6px;
  color: #e71909;
}
.section-header .calendar-icon {
  margin-left: 6px;
  font-size: 1rem;
  cursor: pointer;
  filter: grayscale(100%);
}

/* ── 이슈 테이블 ── */
/* tbody를 flex column으로 만들어 행 간격 확보 */
#issue-table {
  width: 100%;
  table-layout: fixed;
  background: transparent;
}
#issue-table tbody {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#issue-table tbody tr {
  display: flex;
  background: #2b2b3c;
  border-radius: 8px;
}
#issue-table td {
  flex-shrink: 0;
  padding: 8px 10px;
  color: #f5f5f5;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
#issue-table td:nth-child(1) { flex-basis: 5%;  text-align: center; }
#issue-table td:nth-child(2) { flex-basis: 20%; }
#issue-table td:nth-child(3) { flex-basis: 15%; }
#issue-table td:nth-child(4) { flex-basis: 10%; text-align: center; }
#issue-table td:nth-child(5) { flex-basis: 50%; padding-left: 12px; color: #bbb; }
#issue-table .top-line {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}
#issue-table .bottom-line {
  font-size: 0.8rem;
  color: #888;
}

/* ── 주도 테마 섹션 ── */
#theme-sections {
  overflow-y: auto;
  padding: 0 10px;
}
.theme-section {
  background: #2b2b3c;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 16px;
}
.theme-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #444;
  padding-bottom: 8px;
  margin-bottom: 8px;
}
.theme-header h3 {
  font-size: 1rem;
  color: #f5f5f5;
  margin: 0;
}
.theme-header .total-volume {
  font-size: 0.85rem;
  color: #bbb;
}
.theme-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.theme-table td {
  padding: 6px;
  color: #f5f5f5;
  vertical-align: middle;
}
.theme-table tbody tr {
  border-bottom: 1px solid #333;
}
.theme-table tbody tr:last-child {
  border-bottom: none;
}
.theme-table .stock-name {
  font-weight: 500;
}
.theme-table td:nth-child(1) .bottom-line {
  color: #888;
}
.theme-table td:nth-child(2) .bottom-line {
  color: #bbb;
}
.stock-rate.up {
  color: #e71909;
  font-weight: bold;
}
.stock-rate.down {
  color:  #4fabff;
  font-weight: bold;
}

/* ── 모달 공통 ── */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  color: black;
}
.modal-content {
  position: relative;
  width: 90%;
  max-width: 400px;
  margin: auto;
  padding: 16px;
  background: #fff;
  border-radius: 6px;
  box-sizing: border-box;
}
.modal-content .close {
  position: absolute;
  top: 8px; right: 12px;
  font-size: 1.5rem;
  cursor: pointer;
}
.calendar-header {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.calendar-header .arrow-btn {
  background: transparent;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
}
#issue-calendar-table,
#theme-calendar-table {
  width: 100%;
  border-collapse: collapse;
}
#issue-calendar-table th,
#issue-calendar-table td,
#theme-calendar-table th,
#theme-calendar-table td {
  border: 1px solid #ddd;
  padding: 8px;
  text-align: center;
}
.calendar-day.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ── 반응형 ── */
@media (max-width: 1023px) {
  .grid-container {
    display: block;
    width: 100%;
    padding-bottom: 60px;
  }
  .right-column {
    display: none;
  }
}
/* 토글 버튼 기본 숨김 */
.mobile-section-toggle {
  display: none;
}

/* 모바일에서만 토글 보이기, 좌/우 섹션은 초기화 */
@media (max-width: 767px) {
  .mobile-section-toggle {
    display: flex;
    width: 100%;
    margin: 10px 0;
  }
  .mobile-section-toggle button {
    flex: 1;
    padding: 8px 0;
    background: #2b2b3c;
    color: #f5f5f5;
    border: none;
    font-weight: 600;
    cursor: pointer;
  }
  .mobile-section-toggle button.active {
    background: #e71909;
    color: #fff;
  }
  /* 모바일일 때 둘 중 하나만 보이도록 기본 설정 */
  .left-column,
  .right-column {
    display: none;
  }
  /* active 클래스 붙인 쪽만 보이도록 */
  .left-column.active,
  .right-column.active {
    display: block;
  }
}
@media (max-width: 767px) {
  /* ① 마지막 열 감추기 */
  #issue-table th:last-child,
  #issue-table td:last-child {
    display: none;
  }
  /* ② 아코디언 트리거용 row 스타일 */
  .accordion-row td {
    padding: 0;
    background: #f5f5f5;
  }
  .accordion-content {
    padding: 10px;
    font-size: 0.9rem;
    color: #333;
  }
}

@media (max-width: 767px) {
  /* 1) 5번째 컬럼 숨기기 */
  #issue-table th:nth-child(5),
  #issue-table td:nth-child(5) {
    display: none !important;
  }

  /* 2) 나머지 4개 컬럼 비율 재분배 */
  #issue-table td:nth-child(1) {
    flex-basis: 10% !important;   /* 원래 5% → 10% */
  }
  #issue-table td:nth-child(2) {
    flex-basis: 40% !important;   /* 원래 20% → 40% */
  }
  #issue-table td:nth-child(3) {
    flex-basis: 30% !important;   /* 원래 15% → 30% */
  }
  #issue-table td:nth-child(4) {
    flex-basis: 20% !important;   /* 원래 10% → 20% */
    text-align: center;           /* 필요 시 재지정 */
  }
}

@media (max-width: 767px) {
  /* 아코디언 행 td 전용 오버라이드 */
  #issue-table tbody .accordion-row td {
    /* 1) 전체 너비 차지 */
    flex-basis: 100% !important;
    /* 2) 숨겨진 컬럼 display:none 규칙 무시 */
    display: flex !important;
    /* 3) 기본 padding/정렬 */
    padding: 12px !important;
    flex-direction: column;
    justify-content: center;
    /* 4) 일반 행과 동일한 배경·글자색 */
    background: #2b2b3c !important;
    color: #f5f5f5 !important;
    /* 5) 둥근 모서리 유지 */
    border-radius: 8px;
    /* 6) gap 주고 싶으면 이렇게 */
    gap: 4px;
  }

  /* 아코디언 콘텐츠는 기본 컨테이너 안에 들어 있으니 별도 배경 제거 */
  #issue-table .accordion-content {
    background: none !important;
    color: inherit !important;
    padding: 0 !important;
    font-size: 0.9rem;
    line-height: 1.4;
  }
}

@media (max-width: 767px) {
  /* 선택된(열린) 행 배경 강조 */
  #issue-table tbody tr.selected-row {
    background: #3a3a4f !important;
  }
}

@media (max-width: 767px) {
  /* section-title 텍스트 숨기기(토글 버튼 글꼴 크기는 .toggle-button 규칙이 우선) */
  .section-header .section-title {
    font-size: 0 !important;
    gap: 0px;
  }
  .section-header {
    padding: 0;
  }
}