/* ══════════════════════════════════════════════
   풀페이지 종목 분석 탭 (.sa-*)
══════════════════════════════════════════════ */

/* ── 검색바 ── */
.sa-search-bar {
  position: relative;
  margin-bottom: 20px;
}
/* 종목 분석 탭 활성 시 검색바 상단 고정 */
.sa-search-bar.sa-fixed {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  background: var(--bg);
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  margin: 0;
}
.sa-search-bar.sa-fixed + .sa-search-spacer { display: block; }
.sa-search-spacer { display: none; height: 64px; }
@media (min-width: 1024px) {
  .sa-search-bar.sa-fixed {
    left: var(--sidebar-w);
    padding: 10px 32px;
  }
}
@media (min-width: 1280px) {
  .sa-search-bar.sa-fixed {
    right: 184px;
  }
}
.sa-search-input {
  width: 100%;
  padding: 14px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 14px;
  outline: none;
  transition: border-color var(--duration) var(--ease-out), box-shadow var(--duration) var(--ease-out);
}
.sa-search-input::placeholder { color: var(--text3); }
.sa-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim2);
}
.sa-search-bar .search-suggestions {
  top: 100%;
  left: 0;
  right: 0;
  max-height: 280px;
}

/* ── 헤더 ── */
.sa-header {
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  margin-bottom: 16px;
}

/* ── 빈 상태 ── */
.sa-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 60px 20px;
  text-align: center;
}
.sa-empty-icon { font-size: 48px; margin-bottom: 16px; opacity: 0.5; }
.sa-empty-text {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 6px;
}
.sa-empty-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  margin-bottom: 20px;
}
.sa-recent-list { width: 100%; max-width: 420px; }
.sa-recent-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  text-align: left;
  margin-bottom: 6px;
  margin-top: 10px;
}
.sa-recent-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.sa-recent-chip {
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text2);
  font-family: var(--font-mono);
  font-size: 11px;
  cursor: pointer;
  transition: border-color var(--duration), color var(--duration);
}
.sa-recent-chip:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ── 서브탭 (pill 버튼) — 모든 화면 크기에서 표시 ── */
.sa-mobile-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
  -ms-overflow-style: none;
  scrollbar-width: none;
  padding: 2px 0;
}
.sa-mobile-tabs::-webkit-scrollbar { display: none; }
.sa-mobile-tabs::after {
  content: '';
  position: sticky;
  right: 0;
  flex-shrink: 0;
  width: 32px;
  background: linear-gradient(to right, transparent, var(--bg));
  pointer-events: none;
}
.sa-pill {
  flex-shrink: 0;
  padding: 7px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text2);
  font-family: var(--font-mono);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--duration);
  white-space: nowrap;
}
.sa-pill.active {
  background: var(--accent-dim2);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── 탭 레이아웃 (단일 패널 전환) ── */
.sa-grid {
  display: block;
}

/* ── 패널 ── */
.sa-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.sa-panel-title {
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  user-select: none;
}
.sa-panel-title::after {
  content: '▾';
  font-size: 10px;
  color: var(--text4);
  transition: transform var(--duration);
}
.sa-panel.collapsed .sa-panel-title::after { transform: rotate(-90deg); }
.sa-panel.collapsed .sa-panel-body { display: none; }
.sa-panel-title .sa-title-spinner {
  width: 12px; height: 12px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: stock-spin .8s linear infinite;
  margin-left: 6px;
  flex-shrink: 0;
}
.sa-panel-body {
  padding: 14px 16px;
  overflow-y: auto;
  flex: 1;
}
.sa-panel-body::-webkit-scrollbar { width: 4px; transition: width .2s; }
.sa-panel-body:hover::-webkit-scrollbar { width: 6px; }
.sa-panel-body::-webkit-scrollbar-track { background: transparent; }
.sa-panel-body::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 3px; }

/* ── 패널 상태 표시 (로딩/에러/빈 데이터) ── */
.sa-panel-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 16px;
  text-align: center;
  gap: 6px;
}
.sa-panel-state-icon { font-size: 24px; }
.sa-panel-state-title { font-family: var(--font-mono); font-size: 12px; color: var(--text3); }
.sa-panel-state-sub { font-family: var(--font-mono); font-size: 10px; color: var(--text4); }
.sa-panel-state-retry {
  margin-top: 8px;
  padding: 6px 16px;
  background: rgba(62,207,142,0.12);
  border: 1px solid rgba(62,207,142,0.4);
  color: #3ecf8e;
  border-radius: 6px;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: background var(--duration);
}
.sa-panel-state-retry:hover { background: rgba(62,207,142,0.2); }

/* ── 즐겨찾기 버튼 ── */
.sa-fav-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 22px;
  padding: 8px;
  line-height: 1;
  min-width: 44px;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background var(--duration);
}
.sa-fav-btn:hover { background: var(--bg2); }

/* ── 탭 전환: 차트만 기본 표시, 나머지 숨김 ── */
.sa-panel { display: none; }
.sa-panel.sa-panel-active { display: flex; }
.sa-panel-body { max-height: none; }
.sa-panel-title::after { display: none; }
.sa-panel-title { cursor: default; }

/* ── 재무 요약 패널 스타일 ── */
.fin-metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (max-width: 767px) {
  .fin-metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
.fin-metric-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  text-align: center;
}
.fin-metric-label {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  margin-bottom: 4px;
}
.fin-metric-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.2;
}
.fin-metric-change {
  font-family: var(--font-mono);
  font-size: 10px;
  margin-top: 2px;
}
.fin-annual-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 11px;
  margin-top: 16px;
}
.fin-annual-table th {
  text-align: right;
  color: var(--text3);
  font-weight: 500;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.fin-annual-table th:first-child { text-align: left; }
.fin-annual-table td {
  text-align: right;
  color: var(--text2);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}
.fin-annual-table td:first-child {
  text-align: left;
  color: var(--text);
  font-weight: 600;
}
.fin-source {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  margin-top: 14px;
  text-align: right;
}

/* ── 배당 이력 ── */
.div-history {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.div-history-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  font-family: var(--font-mono);
  font-size: 10px;
}
.div-history-date { color: var(--text3); }
.div-history-amt { color: var(--text); font-weight: 600; }
