/* Stock Dashboard Styles */

/* page-content와 wrapper 스타일 오버라이드 */
.page-content .wrapper {
  max-width: 100%;
  padding: 0;
}

.stock-dashboard-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 1.5rem;
  max-width: 1600px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  min-height: calc(100vh - 200px);
  align-items: start;
}

/* 메인 차트 영역 */
.stock-chart-main {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.chart-title h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.25rem 0;
}

.chart-subtitle {
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ticker-select {
  padding: 0.5rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: border-color 0.2s ease;
}

.ticker-select:hover {
  border-color: var(--accent-color);
}

.chart-refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  background: var(--bg-primary);
  color: var(--text-primary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.chart-refresh-btn:hover {
  background: var(--accent-light);
  border-color: var(--accent-color);
  color: var(--accent-color);
}

.chart-refresh-btn i {
  width: 1rem;
  height: 1rem;
}

.chart-wrapper {
  flex: 1;
  min-height: 800px;
  position: relative;
  width: 100%;
}

.tradingview-widget-container {
  width: 100%;
  height: 100%;
  min-height: 800px;
  position: relative;
}

.tradingview-widget-container__widget {
  width: 100% !important;
  height: 100% !important;
  min-height: 800px !important;
}

.tradingview-widget-container__widget iframe {
  width: 100% !important;
  height: 100% !important;
  min-height: 800px !important;
}

/* 사이드바 */
.stock-sidebar {
  display: flex;
  flex-direction: column;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  height: fit-content;
  max-height: calc(100vh - 200px);
}

/* VSCode 스타일 탭 */
.sidebar-tabs {
  display: flex;
  flex-direction: row;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-secondary);
  padding: 0;
  margin: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.sidebar-tabs::-webkit-scrollbar {
  height: 4px;
}

.sidebar-tabs::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar-tabs::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 2px;
}

.sidebar-tab {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 1rem;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: left;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  position: relative;
  margin-bottom: -1px;
}

.sidebar-tab:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text-primary);
}

.sidebar-tab.active {
  background: var(--bg-primary);
  color: var(--text-primary);
  border-bottom-color: var(--accent-color);
  font-weight: 500;
}

.sidebar-tab.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent-color);
}

.tab-icon {
  width: 1.125rem;
  height: 1.125rem;
  stroke-width: 2;
  flex-shrink: 0;
}

.tab-label {
  flex: 1;
}

.sidebar-content {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 400px;
  background: var(--bg-primary);
}

.tab-panel {
  display: none;
  padding: 1.25rem;
}

.tab-panel.active {
  display: block;
}

.panel-header {
  margin-bottom: 1rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-color);
}

.panel-header h3 {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0 0 0.25rem 0;
}

.panel-subtitle {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

/* 다이제스트 리스트 */
.digest-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.digest-item {
  display: block;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  text-decoration: none;
  transition: all 0.2s ease;
  text-align: center;
}

.digest-item:hover {
  background: var(--accent-light);
  border-color: var(--accent-color);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.digest-item-date-only {
  font-size: 0.875rem;
  color: var(--text-primary);
  font-weight: 500;
}

/* 실시간 피드 리스트 */
.realtime-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.realtime-item {
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.realtime-item:hover {
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
}

.realtime-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.realtime-source {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.realtime-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.realtime-content {
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.realtime-link {
  font-size: 0.75rem;
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.realtime-link:hover {
  color: var(--accent-color-dark);
  text-decoration: underline;
}

/* 관심종목 리스트 */
.watchlist-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.watchlist-item {
  padding: 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.watchlist-item:hover {
  background: var(--bg-primary);
  box-shadow: var(--shadow-sm);
}

.watchlist-item-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.watchlist-source {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
}

.watchlist-time {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-left: auto;
}

.watchlist-content {
  font-size: 0.875rem;
  color: var(--text-primary);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.watchlist-link {
  font-size: 0.75rem;
  color: var(--accent-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

.watchlist-link:hover {
  color: var(--accent-color-dark);
  text-decoration: underline;
}

/* 공통 스타일 */
.sentiment-badge {
  font-size: 0.75rem;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  font-weight: 500;
}

.sentiment-badge.positive {
  background: #d1fae5;
  color: #065f46;
}

.sentiment-badge.negative {
  background: #fee2e2;
  color: #991b1b;
}

.loading-message,
.empty-message,
.error-message {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.error-message {
  color: #ef4444;
}

/* 반응형 */
@media (max-width: 1200px) {
  .stock-dashboard-container {
    grid-template-columns: 1fr;
  }

  .stock-sidebar {
    order: -1;
    max-height: none;
  }

  .chart-wrapper {
    min-height: 500px;
  }
}

@media (max-width: 768px) {
  .stock-dashboard-container {
    padding: 0 1rem;
    margin: 1rem auto;
  }

  .chart-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .sidebar-tabs {
    flex-direction: row;
    overflow-x: auto;
  }

  .sidebar-tab {
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    border-right: none;
  }

  .sidebar-tab.active {
    border-right: none;
    border-bottom-color: var(--accent-color);
  }

  .chart-wrapper {
    min-height: 400px;
  }
  
  .sidebar-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }
}
