/* issue.css – 데일리 이슈 페이지 전용 스타일 */

/* ── 전체 레이아웃 ── */
.grid-container {
  display: grid;
  grid-template-columns: 7fr 3fr;
  gap: 20px;
  width: 70%;
  margin: 40px 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: #333D4B;
}
.section-header .toggle-buttons {
  grid-column: 2;
  display: inline-flex;
  background: #E6E6E6;
  padding: 4px;
  border-radius: 20px;
}
.section-header .toggle-button {
  flex: 1;
  width: 80px;
  padding: 3px 0;
  text-align: center;
  font-size: 0.9rem;
  color: #979797;
  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.8rem;
  font-weight: bold;
  color: #979797;
}
.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 thead tr {
  display: flex;
  padding: 4px 10px;
  border-bottom: 1px solid #eee;
  margin-bottom: 8px;
}
#issue-table th {
  font-size: 0.9rem;
  font-weight: 500;
  color: #888;
  text-align: left;
}
#issue-table th:nth-child(1) { flex-basis: 5%; }
#issue-table th:nth-child(2) { flex-basis: 20%; }
#issue-table th:nth-child(3) { flex-basis: 15%; }
#issue-table th:nth-child(4) { flex-basis: 10%; text-align: center; }
#issue-table th:nth-child(5) { flex-basis: 50%; padding-left: 12px; text-align: center;}
#issue-table tbody {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
#issue-table tbody tr {
  display: flex;
  background: #f5f5f5;
  border-radius: 8px;
}
#issue-table td {
  flex-shrink: 0;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  font-size: 0.8rem;
}
#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; font-weight: bold}
#issue-table td:nth-child(5) { flex-basis: 50%; padding-left: 12px; color: #333D4B; }
#issue-table .top-line {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
  font-size: 0.9rem;
}
#issue-table .bottom-line {
  font-size: 0.8rem;
  color: #888;
}

/* ── 주도 테마 섹션 ── */
#theme-sections {
  overflow-y: auto;
  padding: 0 10px;
}
.theme-section {
  background:#f5f5f5;
  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: #333D4B;
  margin: 0;
}
.theme-header .total-volume {
  font-size: 0.85rem;
  color: #333D4B;
}
.theme-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 0.8rem;
}
.theme-table td {
  padding: 6px;
  vertical-align: middle;
}
.theme-table tbody tr {
  border-bottom: 1px solid #333;
}
.theme-table tbody tr:last-child {
  border-bottom: none;
}
.stock-name {
  font-weight: bold;
}
.theme-table td:nth-child(1) .bottom-line {
  color: #888;
}
.theme-table td:nth-child(2) .bottom-line {
  color: #888;
}
.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: #333D4B;
}
.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;
    padding-right: 0;
    padding-left: 0;
    margin: 20px auto 0;
  }
  .right-column {
    display: none;
  }
  #issue-table thead {
    display: none;
  }
}
/* 토글 버튼 기본 숨김 */
.mobile-section-toggle {
  display: none;
}

/* 모바일에서만 토글 보이기, 좌/우 섹션은 초기화 */
@media (max-width: 767px) {
  .mobile-section-toggle {
    display: flex;
    width: 100%;
    margin: 10px 0;
  }
  .section-header .date {
    font-size: 0.6rem;
  }
  .section-header .toggle-button {
    font-size: 0.7rem;
  }
  .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;           /* 필요 시 재지정 */
    font-weight: bold;
    font-size: 0.8rem;
  }
}

@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: #e3f2f9 !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: #e3f2f9 !important;
  }
}

@media (max-width: 767px) {
  /* section-title 텍스트 숨기기(토글 버튼 글꼴 크기는 .toggle-button 규칙이 우선) */
  .section-header .section-title {
    font-size: 0 !important;
    gap: 0px;
  }
  .section-header {
    padding: 0;
  }
}
/* ═══════════════════════════════════════════════════════════
   모바일 카드 피드 (≤1023px) — 5열 표 대체
   앞면: 이니셜 · 종목명 · 테마/코드 · 등락률/거래대금
   펼침: 상승이슈 본문 + 차트/테마 보기
   ═══════════════════════════════════════════════════════════ */
.im-wrap { display: none; }

@media (max-width: 1023px) {
    /* 기존 표·섹션 토글은 모바일에서 카드 피드로 대체 */
    .mobile-section-toggle,
    .left-column,
    .right-column { display: none !important; }

    .im-wrap {
        display: block;
        padding: 0 8px 132px;    /* 하단: 플로팅 탭 + 바텀 네비 */
    }

    /* ── 상단 툴바: 날짜 + 정렬 ── */
    .im-toolbar { display: flex; gap: 6px; padding: 10px 0; }

    .im-date-btn {
        flex: 1.7; min-width: 0; height: 36px;
        display: flex; align-items: center; justify-content: center; gap: 7px;
        padding: 0 12px; border: none; border-radius: 11px;
        background: #fff; box-shadow: 0 1px 3px rgba(27, 35, 48, .08);
        font-family: inherit; font-size: 13px; font-weight: 700; color: #1b2330;
        cursor: pointer; white-space: nowrap;
    }
    .im-date-btn .im-cal {
        width: 15px; height: 15px; flex: none;
        border: 1.6px solid #1b2330; border-top-width: 4px; border-radius: 4px;
    }

    .im-sort {
        flex: 2; min-width: 0; display: flex; gap: 3px; padding: 3px;
        background: #fff; box-shadow: 0 1px 3px rgba(27, 35, 48, .08);
        border-radius: 11px;
    }
    .im-sort button {
        flex: 1; min-width: 0; height: 30px; border: none; border-radius: 8px;
        background: transparent; color: #8a94a0;
        font-family: inherit; font-size: 12px; font-weight: 700;
        cursor: pointer; transition: background-color .18s, color .18s;
    }
    .im-sort button.on { background: #e71909; color: #fff; }

    /* ── 카드 ── */
    .im-feed { display: flex; flex-direction: column; gap: 8px; }
    .im-feed.hidden { display: none; }

    .im-card {
        background: #fff; border: 1px solid #eef0f3; border-radius: 14px;
        overflow: hidden;
    }
    .im-card.open { background: #fff8f7; border-color: #f6cdc8; }

    .im-head {
        width: 100%; display: flex; align-items: center; gap: 9px;
        padding: 12px; border: none; background: transparent;
        font-family: inherit; text-align: left; cursor: pointer;
    }
    /* 종목/테마 로고. 이미지가 없으면 이니셜 + 배경색으로 대체된다 */
    .im-ini {
        width: 28px; height: 28px; flex: none; border-radius: 50%;
        display: flex; align-items: center; justify-content: center;
        color: #4a5460; font-size: 11px; font-weight: 700; overflow: hidden;
        background-size: cover; background-position: center; background-repeat: no-repeat;
    }
    .im-ini.img { background-color: #f0f1f4; }

    .im-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
    .im-name {
        font-size: 14px; font-weight: 700; color: #1b2330;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .im-sub { display: flex; align-items: center; gap: 5px; min-width: 0; }
    .im-theme {
        font-size: 10.5px; font-weight: 600; color: #5b6672;
        background: #f4f5f7; border-radius: 5px; padding: 2px 6px;
        max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .im-code { font-size: 10.5px; color: #a8b0ba; font-variant-numeric: tabular-nums; }

    .im-nums {
        flex: none; display: flex; flex-direction: column; align-items: flex-end;
        line-height: 1.3;
    }
    .im-pct { font-size: 14.5px; font-weight: 800; font-variant-numeric: tabular-nums; }
    .im-pct.up { color: #e71909; }
    .im-pct.down { color: #115bcb; }
    .im-amt {
        font-size: 11px; font-weight: 600; color: #8a94a0;
        font-variant-numeric: tabular-nums;
    }

    .im-star {
        flex: none; border: none; background: none; cursor: pointer;
        font-size: 15px; line-height: 1; padding: 0 2px; color: #c9cfd6;
    }
    .im-star.on { color: #FFB800; }
    .im-caret { flex: none; width: 14px; text-align: center; font-size: 11px; color: #a8b0ba; }

    /* ── 펼침 영역 ── */
    .im-body { display: none; padding: 0 12px 12px; }
    .im-card.open .im-body { display: block; }

    .im-issue {
        padding: 11px 12px; background: #fff;
        border: 1px solid #f0e4e2; border-radius: 11px;
    }
    .im-issue-t {
        display: block; font-size: 11px; font-weight: 700; letter-spacing: .04em;
        color: #e71909; margin-bottom: 6px;
    }
    .im-issue-b {
        display: block; font-size: 13px; line-height: 1.65; color: #3f4a58;
        white-space: pre-wrap; word-break: break-word;
    }
    .im-acts { display: flex; gap: 6px; margin-top: 10px; }
    .im-acts button {
        flex: 1; padding: 8px 0; border: none; border-radius: 8px;
        background: #f7f8fa; color: #1b2330;
        font-family: inherit; font-size: 11.5px; font-weight: 700; cursor: pointer;
    }
    .im-acts button:active { background: #eceef1; }

    /* ── 주도 테마 카드 ── */
    .im-tcard {
        padding: 13px; background: #fff; border: 1px solid #eef0f3;
        border-radius: 14px; display: flex; flex-direction: column; gap: 9px;
    }
    .im-thead { display: flex; align-items: center; gap: 9px; }
    .im-tname {
        font-size: 15px; font-weight: 800; letter-spacing: -.02em; color: #1b2330;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    }
    .im-tpct {
        margin-left: auto; flex: none; font-size: 14.5px; font-weight: 800;
        font-variant-numeric: tabular-nums;
    }
    .im-tpct.up { color: #e71909; }
    .im-tpct.down { color: #115bcb; }
    .im-tsum { font-size: 12.5px; line-height: 1.6; color: #5b6672; }
    .im-tags { display: flex; flex-wrap: wrap; gap: 6px; }
    .im-tag {
        font-size: 11.5px; font-weight: 700; color: #1b2330;
        background: #f4f5f7; border-radius: 99px; padding: 5px 10px;
        cursor: pointer;
    }
    .im-tag b { font-weight: 700; }
    .im-tag b.up { color: #e71909; }
    .im-tag b.down { color: #115bcb; }

    /* ── 플로팅 탭 ── */
    .im-tabs {
        position: fixed; left: 12px; right: 12px; bottom: 80px; z-index: 30;
        display: flex; gap: 4px; padding: 4px;
        background: rgba(255, 255, 255, .92);
        -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
        border: 1px solid #e6e8ec; border-radius: 999px;
        box-shadow: 0 6px 20px rgba(27, 35, 48, .12);
    }
    .im-tabs button {
        flex: 1; height: 38px; border: none; border-radius: 999px;
        background: transparent; color: #8a94a0;
        font-family: inherit; font-size: 13px; font-weight: 700;
        cursor: pointer; transition: background-color .18s, color .18s;
    }
    .im-tabs button.on { background: #1b2330; color: #fff; }

    .im-empty {
        padding: 40px 0; text-align: center; color: #a8b0ba; font-size: 13px;
    }
}
