/* ── 사이드 메뉴 ── */
.side-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 80px;               /* 닫힌 상태 너비 */
  height: 100%;
  background-color: #F3F5F6;
  border-right: 10px solid #E4EAEE;
  overflow: hidden;
  transition: width 0.3s ease;
  /* 상단 로고 줄(.site-header, logo.css)은 화면 폭 전체를 덮는 투명 층이고 z-index 1000 이다.
     같은 1000 이면 HTML 에서 나중에 나온 쪽이 위에 온다 — 사이드 메뉴를 헤더보다 먼저 넣은 페이지
     (스마트시그널 · 마이페이지 · 오토스텝 등)에선 헤더가 메뉴를 덮어 로그인 · 설정 버튼이 안 눌렸다.
     페이지마다 고치지 않게 여기서 항상 헤더보다 위로 둔다 (2026-11-23) */
  z-index: 1001;
}
.side-menu.expanded {
  width: 280px;              /* 펼친 상태 너비 */
  display: flex;
  flex-direction: column;
}

/* ── 스크롤 영역 (지수 + 경제 일정) ── */
.scroll-area {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 12px 80px;      /* 아래 여백으로 토글 버튼 공간 확보 */
}

/* ── 프로필 영역 ── */
.profile-area {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;   /* 닫힌 상태엔 가운데 */
  height: 80px;
  padding: 10px;
  transition: justify-content 0.3s ease;
}
.side-menu.expanded .profile-area {
  justify-content: flex-start; /* 펼친 상태엔 왼쪽 정렬 */
  padding-left: 16px;
}

/* ── 프로필 플레이스홀더 & 로그인 버튼 ── */
.profile-placeholder,
.login-btn {
  width: 40px;
  height: 40px;
  margin: 0;
  padding: 0;
  background: none;
  border: none;
  cursor: pointer;
}
.profile-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.login-btn img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* ── 비로그인(guest) — 로그인한 사람에게만 뜻이 있는 것들은 숨긴다 ──
   auth.js 가 쿠키를 보고 #sideMenu 에 guest 를 붙인다. 펼침 상태 규칙
   (.side-menu.expanded .profile-my 등)이 display 를 다시 켜므로 !important */
.side-menu.guest .profile-name,
.side-menu.guest .profile-my,
.side-menu.guest .logout-btn,
.side-menu.guest .profile-star,
.side-menu.guest .profile-star-expanded { display: none !important; }

/* ── 프로필 이름 ── */
.profile-name {
  margin-left: 10px;
  font-weight: 500;
  color: #333;
  display: none;             /* 닫힌 상태엔 숨김 */
}
.side-menu.expanded .profile-name {
  display: inline-block;     /* 펼친 상태엔 보임 */
}

/* ── 별모양 버튼 (접혀있을때 - 프로필 아래) ── */
.profile-star {
  position: absolute;
  top: 50px;
  left: 50%;
  transform: translateX(-50%);
  background: none;
  border: none;
  font-size: 2em;
  cursor: pointer;
  color: gold;
  padding: 12px 20px;
  transition: color 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.profile-star:hover {
  color: orange;
}
.side-menu.expanded .profile-star {
  display: none;
}

/* ── 톱니바퀴 버튼 (접혀있을때 - 별 아래) ── */
.profile-gear {
  position: absolute;
  top: 100px;
  left: 50%;
  transform: translateX(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  transition: opacity 0.2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
.profile-gear img {
  width: 24px;
  height: 24px;
}
.profile-gear:hover {
  opacity: 0.7;
}
.side-menu.expanded .profile-gear {
  display: none;
}

/* ── MY 링크 ── */
.profile-my {
  position: absolute;
  right: 16px;
  display: none;             /* 닫힌 상태 숨김 */
  font-size: 13px;
  text-decoration: underline;
  color: #333;
}
.side-menu.expanded .profile-my {
  display: inline-block;     /* 펼친 상태엔 보임 */
}

/* ── 별모양 버튼 (펼쳐졌을때) ── */
.profile-star-expanded {
  background: none;
  border: none;
  font-size: 1.2em;
  cursor: pointer;
  color: gold;
  padding: 0;
  margin-left: 12px;
  margin-right: 10px;
  transition: color 0.2s;
}
.profile-star-expanded:hover {
  color: orange;
}
.side-menu:not(.expanded) .profile-star-expanded {
  display: none;
}

/* ── 톱니바퀴 버튼 (펼쳐졌을때 - 별 왼쪽) ── */
.profile-gear-expanded {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-right: 12px;
  transition: opacity 0.2s;
}
.profile-gear-expanded img {
  width: 18px;
  height: 18px;
}
.profile-gear-expanded:hover {
  opacity: 0.7;
}
.side-menu:not(.expanded) .profile-gear-expanded {
  display: none;
}

/* ── 로그아웃 버튼 ── */
.side-menu .logout-btn {
  display: none;             /* 닫힌 상태 숨김 */
  position: relative;
  width: calc(100% - 32px);
  margin: 8px 16px 24px;
  padding: 8px 0;
  background: #E6E6E6;
  border-radius: 4px;
  text-decoration: none;
  color: #333D4B;
  font-weight: 500;
  transition: background 0.2s;
  overflow: hidden;
}
.side-menu.expanded .logout-btn {
  display: block;
}
.logout-btn:hover {
  background: #A2A2A2;
}
.logout-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
}
.logout-btn span {
  display: block;
  width: 100%;
  text-align: center;
  pointer-events: none;
}

/* ── 지수 섹션 ── */
.index-section {
  opacity: 0;
  transition: opacity 0.3s ease 0.1s;
  padding: 0 12px;
}
.side-menu.expanded .index-section {
  opacity: 1;
}
.index-section h4 {
  margin: 0 0 15px;
  font-size: 1.1rem;
  color: #555;
  text-align: left;
}
.index-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.index-item {
  display: flex;
  align-items: center;
  margin-bottom: 12px;
}
.index-flag {
  width: 40px;
  margin-right: 8px;
}
.index-text {
  display: block;
  font-size: 12px;
  line-height: 1.3;
}
.index-name {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
  color: #333;
}
.index-value,
.index-change {
  display: inline-block;
  vertical-align: middle;
}
.index-change {
  margin-left: 6px;
}
.index-change.up {
  color: #e71909;
}
.index-change.down {
  color: #006633;
}

/* ── 경제 일정 섹션 ── */
.econ-section {
  opacity: 0;
  transition: opacity 0.3s ease 0.1s;
  padding: 0 12px;
  margin-top: 40px;
}
.side-menu.expanded .econ-section {
  opacity: 1;
}
.econ-section h4 {
  margin: 0 0 15px;
  font-size: 1.1rem;
  color: #555;
  text-align: left;
}
.econ-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.econ-category {
  margin-bottom: 12px;
}
.category-title {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  color: #333;
  margin-bottom: 6px;
}
.event-list {
  list-style: none;
  padding: 0 0 0 8px;
  margin: 0;
}

/* ── 이벤트 아이템 ── */
.event-item,
.event-no-item {
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 4px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.event-flag,
.event-time,
.event-date {
  flex-shrink: 0;
  white-space: nowrap;
}
.event-flag {
  width: 20px;
  margin-right: 8px;
}
.event-time,
.event-date {
  width: 50px;
  color: #666;
}
.event-title {
  flex: 1;
  white-space: normal;
  word-break: break-word;
}
.event-no-item {
  flex: 1;
  justify-content: center;
  text-align: center;
  padding: 8px 0;
  color: #666;
}

/* ── 토글 핸들 ── */
.menu-handle {
  position: absolute;
  bottom: 20px;
  right: 5px;
  width: 60px;
  z-index: 1001;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}
.menu-handle img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.icon-open {
  display: block;
}
.icon-close {
  display: none;
}
.side-menu.expanded .icon-open {
  display: none;
}
.side-menu.expanded .icon-close {
  display: block;
}

/* ── 스크롤바 숨기기 ── */
.scroll-area {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.scroll-area::-webkit-scrollbar {
  display: none;
}

/* ── 모바일 숨김 ── */
@media (max-width: 480px) {
  .side-menu {
    display: none;
  }
}
/* ── 종목 필터 창 (좌측 메뉴 톱니) — partials/global_filter_modal.html ──
 * side_menu.html 이 직접 포함하므로 사이드 메뉴가 있는 모든 페이지에 뜬다. 그래서 페이지마다 다른
 * .modal / .modal-content / .modal-close 규칙(main.css·issue.css·modal.css)에 기대지 않고 .gf-* 로만 그린다. */
.gf-modal {
  position: fixed; inset: 0; z-index: 4000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.45); padding: 16px;
}
.gf-modal.open { display: flex; }
.gf-box {
  position: relative; width: 100%; max-width: 320px; box-sizing: border-box;
  background: #fff; color: #333; border-radius: 12px; padding: 20px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  display: flex; flex-direction: column; gap: 12px;
  font-family: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, "Noto Sans KR", system-ui, sans-serif;
}
.gf-close {
  position: absolute; top: 8px; right: 10px; width: 32px; height: 32px;
  border: 0; background: none; color: #555; font-size: 24px; line-height: 1; cursor: pointer;
}
.gf-close:hover { color: #111; }
.gf-title { margin: 0 0 4px; font-size: 17px; font-weight: 700; color: #222; }
.gf-field { display: flex; flex-direction: column; gap: 4px; font-size: 14px; color: #555; }
.gf-field input {
  width: 100%; box-sizing: border-box; height: 40px; padding: 0 12px;
  border: 1px solid #d6dae0; border-radius: 8px; font-size: 15px; font-family: inherit; color: #222; background: #fff;
}
.gf-field input:focus { outline: none; border-color: #333d4b; }
.gf-note { margin: 0; font-size: 12px; color: #8b95a1; line-height: 1.5; }
.gf-save {
  height: 42px; border: 0; border-radius: 8px; background: #333d4b; color: #fff;
  font-size: 15px; font-weight: 700; font-family: inherit; cursor: pointer; margin-top: 4px;
}
.gf-save:hover { background: #1f2630; }
