/* @mql5/core-indicators — Sessions timeline popup. dark 고정. */

/* 체크박스 토글 버튼 — 멀티차트 UI 옆에 배치. 페이지 테마(GoldMiner light) 와
   무관하게 항상 dark 톤으로 고정. 체크 상태일 때 글리프가 흰색으로 채워지고
   파란 보더로 강조 — 다시 클릭하면 팝업이 닫히면서 글리프가 비워짐.
   z-index: chart-panel-maximized (z 2500) 위에 떠 있게 유지. */
.btn-sessions-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  background: #161b22;
  color: #c9d1d9;
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  z-index: 2600;
}
.btn-sessions-toggle:hover {
  background: #1f242c;
}
.btn-sessions-toggle[aria-pressed="true"] {
  background: #1f2933;
  border-color: rgba(88, 166, 255, 0.65);
  color: #c9d1d9;
}
.btn-sessions-toggle .sessions-toggle-glyph {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1.5px solid #c9d1d9;
  border-radius: 2px;
  position: relative;
  flex-shrink: 0;
  box-sizing: border-box;
  background: transparent;
  transition: background 100ms ease, border-color 100ms ease;
}
.btn-sessions-toggle[aria-pressed="true"] .sessions-toggle-glyph {
  background: #c9d1d9;
  border-color: #c9d1d9;
}
.btn-sessions-toggle[aria-pressed="true"] .sessions-toggle-glyph::after {
  content: "";
  position: absolute;
  left: 2px;
  top: -1px;
  width: 4px;
  height: 7px;
  border: solid #0d1117;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.btn-sessions-toggle .sessions-toggle-label {
  font-size: inherit;
  line-height: 1;
  color: inherit;
}

/* chart-footer 안에서는 Sessions 가 우측 클러스터(KST/Display 등) 의 좌측 시작점.
   .draw-tool-group 의 margin-right: auto 가 이미 그 뒤 항목을 모두 우측으로
   몰아주므로 별도 auto margin 불필요. 단 FXTester 의 .tz-toggle-btn 이
   자체적으로 margin-left:auto 를 가져 Sessions 와 사이가 벌어지므로, Sessions
   가 형제로 존재할 때만 nullify. */
.chart-footer .btn-sessions-toggle ~ .tz-toggle-btn {
  margin-left: 0;
}

.sessions-timeline-popup {
  position: fixed;
  z-index: 9999;
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 11px;
  user-select: none;
  overflow: hidden;
}

.sessions-timeline-header {
  height: 28px;
  padding: 0 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #161b22;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.sessions-timeline-title {
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #c9d1d9;
}
.sessions-timeline-now-label {
  font-variant-numeric: tabular-nums;
  color: #8b949e;
}

/* 헤더 중앙 — 현재 KST 시간대의 카테고리 (phase · note ⚠ caution) 한 줄.
   data-color 속성으로 좌측 dot 색 분기. flex:1 + 중앙 정렬로 title-now 사이
   여백 차지. */
.sessions-timeline-current {
  flex: 1;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #c9d1d9;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
  padding: 0 12px;
}
.sessions-timeline-current::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(160, 160, 160, 0.4);
  flex-shrink: 0;
}
.sessions-timeline-current[data-color="white"]::before  { background: rgba(220, 220, 220, 0.55); }
.sessions-timeline-current[data-color="yellow"]::before { background: rgba(255, 242, 0, 0.85); }
.sessions-timeline-current[data-color="red"]::before    { background: rgba(255, 18, 12, 0.9); box-shadow: 0 0 6px rgba(255, 18, 12, 0.5); }
.sessions-timeline-current[data-color="gray"]::before   { background: rgba(160, 160, 160, 0.6); }

.sessions-timeline-body {
  position: relative;
  width: 100%;
  overflow: hidden;
}

.sessions-timeline-track {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.sessions-timeline-rows {
  position: absolute;
  left: 0;
  right: 0;
}

.sessions-timeline-row {
  position: absolute;
  left: 0;
  right: 0;
}

.sessions-timeline-row-label {
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.4px;
  pointer-events: none;
  z-index: 2;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.6);
}

.sessions-timeline-bar {
  position: absolute;
  top: 2px;
  bottom: 2px;
  border-radius: 3px;
  border: 1px solid;
  box-sizing: border-box;
  transition: opacity 120ms ease;
  z-index: 1;
}
.sessions-timeline-bar.is-active {
  filter: brightness(1.6) saturate(1.2);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08) inset;
}

/* (removed 2026-05-14) sessions-timeline-hour-strip / -cell / -tooltip — chart-footer
   의 createSessionsFooterStrip 으로 이관, 팝업에서는 중복 제거. */

/* ─── Sessions footer wrap — chart-footer 상시 표시 hour grid + 좌측 라벨.
   wrapper 가 [현재 시간대 라벨] + [strip] 을 inline-flex 로 묶음. 어디 클릭해도
   popup 토글. now marker 는 strip 위아래 5px 씩 튀어나오는 흰 vertical line. */
.sessions-footer-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  user-select: none;
  vertical-align: middle;
}
.sessions-footer-wrap.is-clickable {
  cursor: pointer;
}
.sessions-footer-wrap:focus-visible {
  outline: 1px solid rgba(88, 166, 255, 0.65);
  outline-offset: 2px;
  border-radius: 4px;
}

/* 좌측 라벨 — 현재 KST 시간대 카테고리 1줄 + color dot. data-color 분기. */
.sessions-footer-current-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: #c9d1d9;
  letter-spacing: 0.2px;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.sessions-footer-current-label::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(160, 160, 160, 0.4);
  flex-shrink: 0;
}
.sessions-footer-current-label[data-color="white"]::before  { background: rgba(220, 220, 220, 0.65); }
.sessions-footer-current-label[data-color="yellow"]::before { background: rgba(255, 242, 0, 0.9); }
.sessions-footer-current-label[data-color="red"]::before    { background: rgba(255, 18, 12, 0.95); box-shadow: 0 0 6px rgba(255, 18, 12, 0.5); }
.sessions-footer-current-label[data-color="gray"]::before   { background: rgba(160, 160, 160, 0.7); }

.sessions-footer-strip {
  position: relative;
  display: inline-block;
  /* SESSIONS_TIMELINE_WIDTH (sessions-config.js) 와 일치 — 팝업 본문 트랙과 동기. */
  width: 720px;
  height: 22px;
  background: #161b22;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 4px;
  box-sizing: border-box;
  /* now marker 가 위아래로 튀어나가야 해서 strip 자체는 overflow visible. */
  overflow: visible;
  transition: border-color 100ms ease;
  vertical-align: middle;
}
.sessions-footer-wrap.is-clickable:hover .sessions-footer-strip {
  border-color: rgba(255, 255, 255, 0.6);
}

/* cells 는 strip 안에서만 보이게 — overflow hidden + border-radius 내부 정렬. */
.sessions-footer-cells {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: 3px;
  z-index: 1;
}
.sessions-footer-cell {
  position: absolute;
  top: 0;
  bottom: 0;
  transition: filter 80ms ease;
}
.sessions-footer-wrap.is-clickable .sessions-footer-cell:hover {
  filter: brightness(1.3) saturate(1.15);
}
.sessions-footer-cell.is-caution::after {
  content: '⚠';
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  font-size: 7px;
  line-height: 9px;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
  pointer-events: none;
}
.sessions-footer-cell.is-red {
  box-shadow: inset 0 -1px 0 rgba(255, 18, 12, 0.85);
}

/* now marker — strip 가운데 고정, 위아래 5px 튀어나옴, 흰 vertical line. */
.sessions-footer-now {
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.95);
  pointer-events: none;
  z-index: 3;
}
.sessions-footer-now::before {
  content: '';
  position: absolute;
  top: -3px;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.7);
}

/* footer 의 strip cell hover 시 표시되는 tooltip (body 부착, fixed 위치) */
.sessions-footer-tooltip {
  position: fixed;
  background: #0d1117;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #c9d1d9;
  padding: 6px 9px;
  border-radius: 4px;
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-line;
  pointer-events: none;
  z-index: 10001;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.6);
  max-width: 260px;
}

.sessions-timeline-ticks {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
}

.sessions-timeline-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  transform: translateX(-50%);
}
.sessions-timeline-tick-line {
  width: 1px;
  height: 8px;
  background: rgba(255, 255, 255, 0.18);
  margin: 0 auto;
}
.sessions-timeline-tick-label {
  margin-top: 2px;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: #8b949e;
  white-space: nowrap;
  text-align: center;
  transform: translateX(-50%);
  position: relative;
  left: 50%;
}
.sessions-timeline-tick.is-midnight .sessions-timeline-tick-line {
  background: rgba(255, 255, 255, 0.32);
  height: 12px;
}
.sessions-timeline-tick.is-midnight .sessions-timeline-tick-label {
  color: #c9d1d9;
  font-weight: 600;
}
.sessions-timeline-tick.is-noon .sessions-timeline-tick-line {
  background: rgba(255, 255, 255, 0.24);
}

.sessions-timeline-now {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: 2px;
  margin-left: -1px;
  background: linear-gradient(
    to bottom,
    rgba(248, 81, 73, 0.0) 0%,
    rgba(248, 81, 73, 0.85) 12%,
    rgba(248, 81, 73, 0.85) 88%,
    rgba(248, 81, 73, 0.0) 100%
  );
  pointer-events: none;
  z-index: 3;
}
.sessions-timeline-now::before {
  content: "";
  position: absolute;
  top: -4px;
  left: 50%;
  transform: translateX(-50%);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f85149;
  box-shadow: 0 0 6px rgba(248, 81, 73, 0.8);
}

/* Footer — "Show on charts" 체크박스 (Display 메뉴의 Sessions 토글 대체). */
.sessions-timeline-footer {
  display: flex;
  align-items: center;
  padding: 0 12px;
  background: #161b22;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sessions-timeline-show-charts {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 11px;
  color: #c9d1d9;
}
.sessions-timeline-show-charts input[type="checkbox"] {
  cursor: pointer;
  accent-color: #58a6ff;
}

/* ─── Economic events overlay (createEconomicEventsOverlay) ─────────────────
 * chartWrapEl 의 absolute overlay. 시간축 바로 위에 🇺🇸 국기 마커. */
.economic-events-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 7; /* sessions box (lower) 보다 위, drawing-engine (higher) 보다 아래 */
}
.economic-event-marker {
  position: absolute;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 4px;
  background: rgba(17, 24, 31, 0.85);
  color: #fff;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45);
  transition: transform 0.08s ease, background 0.08s ease, border-color 0.08s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.economic-event-marker:hover,
.economic-event-marker:focus-visible {
  transform: translateY(-1px) scale(1.12);
  border-color: rgba(255, 255, 255, 0.95);
  background: rgba(35, 45, 55, 0.95);
  outline: none;
  z-index: 1;
}
.economic-event-marker.is-high {
  border-color: rgba(248, 113, 113, 0.85);
}
.economic-event-marker.is-past {
  opacity: 0.55;
}
.economic-event-marker.is-past:hover,
.economic-event-marker.is-past:focus-visible {
  opacity: 0.95;
}
.economic-event-marker::after {
  /* 아래쪽 끝을 가리키는 작은 삼각형 — 어느 시각의 이벤트인지 명확히. */
  content: '';
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid rgba(255, 255, 255, 0.55);
  pointer-events: none;
}
.economic-event-marker.is-high::after {
  border-top-color: rgba(248, 113, 113, 0.85);
}

.economic-event-tooltip {
  position: fixed;
  z-index: 10000;
  min-width: 200px;
  max-width: 320px;
  background: rgba(13, 17, 23, 0.96);
  color: #c9d1d9;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.45;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55);
  pointer-events: none;
  white-space: normal;
}
.economic-event-tooltip-title {
  font-size: 12px;
  font-weight: 600;
  color: #f0f6fc;
  margin-bottom: 3px;
}
.economic-event-tooltip-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  font-size: 11px;
  color: #8b949e;
  margin-bottom: 4px;
}
.economic-event-tooltip-meta .ev-stars {
  color: #f0883e;
  letter-spacing: 1px;
}
.economic-event-tooltip-time {
  font-size: 11px;
  color: #c9d1d9;
}
.economic-event-tooltip-time-utc {
  font-size: 10px;
  color: #6e7681;
  margin-bottom: 6px;
}
.economic-event-tooltip-values {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 5px;
  margin-top: 2px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.economic-event-tooltip-values .ev-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 11px;
}
.economic-event-tooltip-values .ev-row .k {
  color: #8b949e;
}
.economic-event-tooltip-values .ev-row .v {
  color: #e6edf3;
  font-variant-numeric: tabular-nums;
}
