/* ══════════════════════════════════════════════
   카드 — Supabase Panel Style
══════════════════════════════════════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  transition:
    border-color var(--duration) var(--ease-out),
    box-shadow var(--duration) var(--ease-out),
    transform var(--duration) var(--ease-out);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(62, 207, 142, 0.5) 50%,
    transparent 100%
  );
  opacity: 0;
  transition: opacity var(--duration);
}
.card:hover::before { opacity: 1; }
.card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.card-header {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-header::before {
  content: '';
  width: 3px;
  height: 3px;
  background: var(--accent);
  border-radius: 50%;
  flex-shrink: 0;
}

.card-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  letter-spacing: -0.5px;
}
.card-value-sm {
  font-size: 16px !important;
  line-height: 1.25;
  letter-spacing: 0;
}
.card-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  margin-top: auto;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 18px 20px;
  position: relative;
  overflow: hidden;
  transition: all var(--duration) var(--ease-out);
}
.stat-card:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-sm);
}


/* ══════════════════════════════════════════════
   차트 박스
══════════════════════════════════════════════ */
.chart-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  /* 모바일에서 차트가 부모를 벗어나지 않도록 */
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  transition: border-color var(--duration), box-shadow var(--duration);
}
.chart-box::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(62, 207, 142, 0.35), transparent);
  opacity: 0;
  transition: opacity var(--duration);
}
.chart-box:hover::before { opacity: 1; }
.chart-box:hover {
  border-color: var(--border2);
  box-shadow: var(--shadow-md);
}

.chart-box h3 {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text3);
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-box h3::before {
  content: '';
  width: 2px;
  height: 11px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}

/* canvas 높이 — 모바일에서 비율 고정 해제 */
canvas {
  max-width: 100%;
  display: block;
}

/* 모바일: chart-box 내 canvas 높이 제한 */
@media (max-width: 1023px) {
  .chart-box canvas {
    max-height: 240px;
  }
}

/* 데스크탑: 기존 유지 */
@media (min-width: 1024px) {
  .chart-box canvas {
    max-height: 320px;
  }
}


/* ══════════════════════════════════════════════
   그리드 레이아웃
══════════════════════════════════════════════ */
.grid { display: grid; gap: 14px; }
.grid-5 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: 1fr; }
.grid-2 { grid-template-columns: 1fr; }

/* 백테스트 신호차트 + AI 분석 — 모바일 1열, 데스크탑 2열 */
.grid-bt-analysis {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  /* 자식이 그리드 셀 밖으로 나가지 않도록 */
  min-width: 0;
  overflow: hidden;
}
.grid-bt-analysis > * {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
@media (min-width: 1024px) {
  .grid-bt-analysis {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 640px) {
  .grid-5 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid { gap: 16px; }
}
@media (min-width: 1024px) {
  .grid-5 { grid-template-columns: repeat(5, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
}


/* 구루 차트 */
.guru-chart-wrap {
  height: 160px; position: relative; margin-top: 6px;
}
@media (max-width: 640px) {
  .guru-chart-wrap { height: 140px; }
}

/* ══════════════════════════════════════════════
   버튼 시스템
══════════════════════════════════════════════ */
.period-btn,
.news-src-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--duration) var(--ease-out);
  border: 1px solid var(--border);
  background: var(--surface2);
  color: var(--text3);
  border-radius: var(--r-sm);
  padding: 6px 13px;
  white-space: nowrap;
  /* 터치 친화적 최소 높이 */
  min-height: 34px;
}
.period-btn:hover,
.news-src-btn:hover {
  color: var(--text2);
  border-color: var(--border2);
  background: var(--surface3);
}
.period-btn.active,
.news-src-btn.active {
  background: var(--accent-dim2);
  color: var(--accent);
  border-color: rgba(62, 207, 142, 0.4);
  font-weight: 600;
}

.badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 10px;
  border-radius: 9999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  border: 1px solid transparent;
}


/* ══════════════════════════════════════════════
   테이블
══════════════════════════════════════════════ */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: var(--surface);
  /* 모바일 가로 스크롤 hint */
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
}
th {
  background: var(--bg2);
  padding: 10px 14px;
  text-align: left;
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text3);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  position: sticky;
  top: 0;
}
td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  color: var(--text2);
  transition: color 0.15s, background 0.15s;
}
td:first-child {
  color: var(--text);
  font-weight: 500;
}
tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--duration); }
tbody tr:hover td {
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
}
tbody tr:hover td:first-child { color: var(--accent); }


/* ══════════════════════════════════════════════
   상태 & 컬러 유틸리티
══════════════════════════════════════════════ */
.positive { color: var(--green); }
.negative { color: var(--red); }
.neutral  { color: var(--yellow); }

.status-open               { color: var(--blue); }
.status-take_profit        { color: var(--green); }
.status-stop_loss          { color: var(--red); }
.status-expired            { color: var(--yellow); }
.status-sell_signal        { color: var(--blue); }
.status-strategy_rebalance { color: var(--purple); }
.status-trailing_stop      { color: #63e6be; }
.status-time_decay_tp      { color: #a3e635; }

.glow-green { text-shadow: 0 0 14px rgba(62, 207, 142, 0.55); }
.glow-red   { text-shadow: 0 0 14px rgba(245, 101, 101, 0.55); }
.glow-blue  { text-shadow: 0 0 14px rgba(99, 179, 237, 0.55); }


/* ══════════════════════════════════════════════
   뉴스 아이템
══════════════════════════════════════════════ */
.news-item {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  transition: background var(--duration), padding-left var(--duration);
  cursor: pointer;
  position: relative;
}
.news-item::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: var(--accent);
  opacity: 0;
  transition: opacity var(--duration);
}
.news-item:hover {
  background: rgba(255, 255, 255, 0.02);
  padding-left: 20px;
}
.news-item:hover::before { opacity: 1; }
.news-item:last-child { border-bottom: none; }


/* ══════════════════════════════════════════════
   가중치 바
══════════════════════════════════════════════ */
.weight-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.weight-bar .label {
  width: 140px;
  color: var(--text2);
  text-align: right;
  flex-shrink: 0;
  font-size: 11px;
}
.weight-bar .bar {
  flex: 1;
  height: 18px;
  background: var(--surface3);
  border-radius: var(--r-xs);
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  min-width: 60px;
}
.weight-bar .fill {
  height: 100%;
  border-radius: var(--r-xs);
  transition: width 0.8s var(--ease-out);
  background: linear-gradient(90deg, var(--accent3) 0%, var(--accent) 100%);
  position: relative;
}
.weight-bar .fill::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 45%;
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--r-xs) var(--r-xs) 0 0;
}
.weight-bar .val {
  width: 48px;
  text-align: right;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}


/* ══════════════════════════════════════════════
   파라미터 그리드
══════════════════════════════════════════════ */
.param-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (min-width: 640px) {
  .param-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
}

.param-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 14px;
  text-align: center;
  transition: all var(--duration) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.param-item::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(62,207,142,0.4), transparent);
  opacity: 0;
  transition: opacity var(--duration);
}
.param-item:hover {
  background: var(--surface2);
  border-color: var(--border2);
  box-shadow: var(--shadow-sm);
}
.param-item:hover::before { opacity: 1; }

.param-item .label {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 1.6px;
}
.param-item .value {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 8px;
  line-height: 1;
  letter-spacing: -0.5px;
}
@media (min-width: 640px) {
  .param-item .value { font-size: 28px; }
}


/* ══════════════════════════════════════════════
   전략 행
══════════════════════════════════════════════ */
.strat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 12.5px;
  transition: background var(--duration);
}
.strat-row:last-child { border-bottom: none; }
.strat-row:hover { background: rgba(255, 255, 255, 0.015); }
.strat-row .label { color: var(--text2); }
.strat-row .val { font-weight: 600; color: var(--text); }
.strat-row .val.accent { color: var(--accent); }
.strat-row .val.green  { color: var(--green); }
.strat-row .val.yellow { color: var(--yellow); }


/* ══════════════════════════════════════════════
   섹션 타이틀
══════════════════════════════════════════════ */
.section-title {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text3);
  margin: 20px 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::before {
  content: '';
  width: 2px;
  height: 11px;
  background: var(--accent);
  border-radius: 2px;
  flex-shrink: 0;
}


/* ══════════════════════════════════════════════
   탭 설명 박스
══════════════════════════════════════════════ */
.tab-desc {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text2);
  margin: 0 0 20px;
  padding: 10px 16px;
  border: 1px solid rgba(62, 207, 142, 0.15);
  border-left: 2px solid var(--accent);
  border-radius: 0 var(--r-sm) var(--r-sm) 0;
  background: var(--accent-dim);
}


/* ══════════════════════════════════════════════
   빈 상태
══════════════════════════════════════════════ */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text3);
  font-family: var(--font-mono);
  font-size: 12px;
}
.empty-state .icon {
  font-size: 44px;
  margin-bottom: 14px;
  opacity: 0.35;
  display: block;
}


/* ══════════════════════════════════════════════
   스크롤바 숨기기
══════════════════════════════════════════════ */
.scrollbar-none { scrollbar-width: none; }
.scrollbar-none::-webkit-scrollbar { display: none; }


/* ══════════════════════════════════════════════
   푸터 — 사이드바 레이아웃에서는 콘텐츠 하단
══════════════════════════════════════════════ */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 20px 24px 32px;
  margin-top: 48px;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.footer-brand {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 8px;
}
.footer-brand a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  transition: opacity var(--duration);
}
.footer-brand a:hover { opacity: 0.7; }

.footer-disclaimer {
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--text4);
  text-align: center;
  letter-spacing: 0.3px;
  line-height: 1.6;
}
.footer-disclaimer strong { color: var(--text3); }

.footer-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
}
.footer-nav-link {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  text-decoration: none;
  transition: color var(--duration);
}
.footer-nav-link:hover { color: var(--accent); }
.footer-nav-sep {
  font-size: 10px;
  color: var(--border);
}

.footer-links {
  display: flex;
  justify-content: flex-end;
  gap: 18px;
}
.footer-links a {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  text-decoration: none;
  transition: color var(--duration);
}
.footer-links a:hover { color: var(--text); }

.footer-copy {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--text4);
  letter-spacing: 1.2px;
  text-transform: uppercase;
}


/* ══════════════════════════════════════════════
   애니메이션
══════════════════════════════════════════════ */
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes floatIcon {
  0%, 100% { transform: translateY(0px) rotate(0deg); }
  33%       { transform: translateY(-7px) rotate(-2deg); }
  66%       { transform: translateY(-3px) rotate(1deg); }
}
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.35; transform: scale(0.8); }
}
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* 로딩 스켈레톤 */
.skeleton {
  background: linear-gradient(
    90deg,
    var(--surface2) 0%,
    var(--surface3) 40%,
    var(--surface4) 60%,
    var(--surface2) 100%
  );
  background-size: 200% 100%;
  animation: shimmer 1.8s ease-in-out infinite;
  border-radius: var(--r-sm);
}


/* ══════════════════════════════════════════════
   뱃지
══════════════════════════════════════════════ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
}
.badge-green  { background: var(--green-bg);  color: var(--green);  border: 1px solid rgba(62,207,142,0.2); }
.badge-red    { background: var(--red-bg);    color: var(--red);    border: 1px solid rgba(245,101,101,0.2); }
.badge-yellow { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(246,201,14,0.2); }
.badge-blue   { background: var(--blue-bg);   color: var(--blue);   border: 1px solid rgba(99,179,237,0.2); }


/* ══════════════════════════════════════════════
   Divider
══════════════════════════════════════════════ */
.divider {
  height: 1px;
  background: var(--border);
  margin: 16px 0;
  border: none;
}


/* ══════════════════════════════════════════════
   Tooltip
══════════════════════════════════════════════ */
[data-tooltip] { position: relative; cursor: help; }
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface3);
  border: 1px solid var(--border2);
  color: var(--text2);
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--duration);
  z-index: var(--z-tooltip);
  box-shadow: var(--shadow-md);
}
[data-tooltip]:hover::after { opacity: 1; }


/* ══════════════════════════════════════════════
   터미널 박스
══════════════════════════════════════════════ */
.terminal-box {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 18px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text2);
  line-height: 1.85;
  position: relative;
  overflow: hidden;
}
.terminal-box::before {
  content: '● ● ●';
  position: absolute;
  top: 10px;
  left: 14px;
  font-size: 8px;
  color: var(--text4);
  letter-spacing: 4px;
}
.terminal-box.has-dots { padding-top: 28px; }


/* ══════════════════════════════════════════════
   모바일 전용 유틸
══════════════════════════════════════════════ */
/* 터치 피드백 */
@media (max-width: 1023px) {
  .card:active  { transform: scale(0.98); }
  .feature-card:active { transform: scale(0.97); }
}

/* 모바일에서 카드 더 촘촘하게 */
@media (max-width: 480px) {
  .card      { padding: 14px; border-radius: var(--r-md); }
  .chart-box { padding: 14px; border-radius: var(--r-md); }
  .card-value { font-size: 22px; }
  .guide-hero-icon  { font-size: 42px; }
  .guide-hero-title { font-size: 22px; }
  .guide-hero-sub   { font-size: 13px; }
  /* letter-spacing 대폭 감소 — uppercase 텍스트 오버플로우 방지 */
  .guide-hero-badge { letter-spacing: 1px; }
  .section-title    { letter-spacing: 1px; }
  .card-header      { letter-spacing: 1px; }
}


/* ══════════════════════════════════════════════
   인쇄
══════════════════════════════════════════════ */
/* ══════════════════════════════════════════════
   투자 경고 — 공용 텍스트·점 스타일
══════════════════════════════════════════════ */
.disclaimer-bar-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--yellow);
  flex-shrink: 0;
  opacity: 0.75;
}

.disclaimer-bar-text {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text4);
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.disclaimer-bar-text strong {
  color: var(--text3);
  font-weight: 600;
}

/* ── 데스크탑 전용 고정 하단 배너 ──
   모바일에서는 .bottom-nav 내 .disclaimer-bar-inline 사용
   HTML에서 .disclaimer-bar div는 데스크탑에서만 표시
── */
.disclaimer-bar {
  display: none;
}

@media (min-width: 1024px) {
  .disclaimer-bar {
    display: flex;
    position: fixed;
    bottom: 0;
    left: var(--sidebar-w);
    right: 0;
    z-index: calc(var(--z-topbar) - 1);
    background: rgba(15, 15, 15, 0.94);
    border-top: 1px solid var(--border);
    backdrop-filter: blur(16px) saturate(180%);
    -webkit-backdrop-filter: blur(16px) saturate(180%);
    padding: 7px 32px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    /* GPU 레이어 — fixed 스크롤 깜빡임 방지 */
    transform: translateZ(0);
    will-change: transform;
  }
  /* 데스크탑: 콘텐츠 하단 여백 (배너 높이 확보) */
  .content-wrap {
    padding-bottom: calc(36px + 28px);
  }
}

@media print {
  .sidebar, .mobile-topbar, .bottom-nav, .page-header { display: none; }
  .main-content { margin-left: 0; }
  body { background: white; color: black; padding-bottom: 0; }
}

