/**
 * Theme Inquiry Flow Page Styles
 * Redesigned with Surge Monitoring Style
 * 2026-01-08
 */

/* ========================================
   1. 기본 레이아웃
   ======================================== */

.theme-flow-page {
  background: #F9FAFB;
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
}

/* ========================================
   2. 페이지 헤더
   ======================================== */

.page-header {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 24px;
  margin-bottom: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header__title-area {
  flex: 1;
}

.page-header__title {
  font-size: 24px;
  font-weight: 700;
  color: #111827;
  margin: 0 0 8px 0;
}

.page-header__subtitle {
  font-size: 14px;
  color: #6B7280;
  margin: 0;
}

.page-header__status {
  display: flex;
  align-items: center;
  gap: 16px;
}

.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #22c55e;
  font-weight: 600;
}

.live-dot {
  width: 8px;
  height: 8px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.6; transform: scale(1.1); }
}

.page-header__update-time {
  font-size: 13px;
  color: #6B7280;
  font-family: 'Courier New', monospace;
}

.page-header__refresh-btn {
  background: #F3F4F6;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  color: #374151;
}

.page-header__refresh-btn:hover {
  background: #E5E7EB;
  border-color: #9CA3AF;
}

.page-header__refresh-btn--loading i {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================
   3. 세션 배지 바
   ======================================== */

.session-badge-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.session-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-radius: 20px;
  font-weight: 600;
  font-size: 14px;
}

.session-badge.market_hours {
  background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
}

.session-time {
  font-size: 13px;
  color: #6B7280;
  font-family: 'Courier New', monospace;
}

/* ========================================
   4. TOP 3 테마 카드
   ======================================== */

.theme-top3 {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 24px;
  margin-bottom: 24px;
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.theme-top3__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid #E5E7EB;
  padding-bottom: 12px;
}

.theme-top3__title {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.theme-top3__title-icon {
  font-size: 24px;
}

.theme-top3__update-time {
  font-size: 13px;
  color: #6B7280;
}

.theme-top3__cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}

.theme-top3__card {
  background: #FAFAFA;
  border: 2px solid #E5E7EB;
  border-radius: 12px;
  padding: 20px;
  transition: all 0.3s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.theme-top3__card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: transparent;
  transition: all 0.3s ease;
}

.theme-top3__card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

/* 순위별 스타일 */
.theme-top3__card--rank-1 {
  border-color: #FFD700;
  background: linear-gradient(135deg, #FFFBEB 0%, #FEFCE8 100%);
}

.theme-top3__card--rank-1::before {
  background: linear-gradient(90deg, #FFD700, #FFA500);
}

.theme-top3__card--rank-2 {
  border-color: #C0C0C0;
  background: linear-gradient(135deg, #F9FAFB 0%, #F3F4F6 100%);
}

.theme-top3__card--rank-2::before {
  background: linear-gradient(90deg, #C0C0C0, #A8A8A8);
}

.theme-top3__card--rank-3 {
  border-color: #CD7F32;
  background: linear-gradient(135deg, #FEF3C7 0%, #FDE68A 100%);
}

.theme-top3__card--rank-3::before {
  background: linear-gradient(90deg, #CD7F32, #B8691A);
}

.theme-top3__medal {
  font-size: 32px;
  text-align: center;
  margin-bottom: 8px;
}

.theme-top3__theme-name {
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  color: #111827;
  margin-bottom: 12px;
}

.theme-top3__leader {
  font-size: 13px;
  color: #6B7280;
  text-align: center;
  margin-bottom: 8px;
}

.theme-top3__leader-name {
  font-weight: 600;
  color: #2563EB;
}

.theme-top3__stats {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid #E5E7EB;
  border-bottom: 1px solid #E5E7EB;
  margin-bottom: 12px;
}

.theme-top3__change-rate {
  font-size: 16px;
  font-weight: 700;
}

.theme-top3__change-rate--positive {
  color: #EF4444;
}

.theme-top3__change-rate--negative {
  color: #3B82F6;
}

.theme-top3__inq-count {
  font-size: 13px;
  color: #F59E0B;
  font-weight: 600;
}

.theme-top3__duration {
  font-size: 12px;
  color: #6B7280;
  text-align: center;
}

.theme-top3__duration-value {
  font-weight: 700;
  color: #111827;
}

/* 로딩 상태 */
.theme-top3__card--loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  grid-column: 1 / -1;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #E5E7EB;
  border-top-color: #667eea;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 12px;
}

/* 대기 슬롯 */
.theme-top3__card--waiting {
  background: #F9FAFB !important;
  border: 2px dashed #D1D5DB !important;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.theme-top3__waiting-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.theme-top3__waiting-text {
  font-size: 16px;
  font-weight: 600;
  color: #6B7280;
}

.theme-top3__waiting-subtext {
  font-size: 12px;
  color: #9CA3AF;
}

/* ========================================
   5. 차트 섹션
   ======================================== */

.charts-section {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 24px;
  margin-bottom: 24px;
}

.charts-section__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid #E5E7EB;
  padding-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.charts-section__title {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.charts-section__controls {
  display: flex;
  gap: 8px;
}

.range-btn {
  padding: 8px 16px;
  border: 2px solid #D1D5DB;
  background: white;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  color: #374151;
}

.range-btn:hover {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.range-btn.active {
  background: #667eea;
  color: white;
  border-color: #667eea;
}

.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.chart-card {
  background: #FAFAFA;
  border-radius: 12px;
  padding: 20px;
  border: 1px solid #E5E7EB;
}

.chart-card__header {
  margin-bottom: 16px;
  text-align: center;
}

.chart-card__header h3 {
  font-size: 16px;
  font-weight: 600;
  color: #111827;
  margin: 0 0 4px 0;
}

.chart-card__subtitle {
  font-size: 12px;
  color: #6B7280;
}

.chart-card__body {
  position: relative;
  height: 280px;
}

.chart-card__body canvas {
  max-height: 100%;
}

/* ========================================
   6. 테마 타임라인
   ======================================== */

.theme-timeline {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 24px;
  margin-bottom: 24px;
}

.theme-timeline__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid #E5E7EB;
  padding-bottom: 12px;
  flex-wrap: wrap;
  gap: 12px;
}

.theme-timeline__title {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.theme-timeline__controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.timeline-search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.timeline-search-wrap i {
  position: absolute;
  left: 12px;
  color: #9CA3AF;
}

.timeline-search {
  padding: 8px 12px 8px 36px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  font-size: 13px;
  width: 200px;
  transition: all 0.3s ease;
}

.timeline-search:focus {
  outline: none;
  border-color: #667eea;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.theme-timeline__filter {
  padding: 8px 12px;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  font-size: 13px;
  background: white;
  cursor: pointer;
}

.theme-timeline__list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 500px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #D1D5DB #F3F4F6;
}

.theme-timeline__list::-webkit-scrollbar {
  width: 8px;
}

.theme-timeline__list::-webkit-scrollbar-track {
  background: #F3F4F6;
  border-radius: 4px;
}

.theme-timeline__list::-webkit-scrollbar-thumb {
  background: #D1D5DB;
  border-radius: 4px;
}

.theme-timeline__item {
  padding: 16px;
  background: #FAFAFA;
  border-radius: 8px;
  margin-bottom: 12px;
  border-left: 4px solid #667eea;
  transition: all 0.3s ease;
}

.theme-timeline__item:hover {
  background: #F3F4F6;
}

.theme-timeline__item--rank-1 {
  border-left-color: #FFD700;
  background: linear-gradient(135deg, #FFFBEB 0%, #FAFAFA 100%);
}

.theme-timeline__item--rank-2 {
  border-left-color: #C0C0C0;
}

.theme-timeline__item--rank-3 {
  border-left-color: #CD7F32;
}

.theme-timeline__item--rising {
  border-left-color: #EF4444;
}

.theme-timeline__item--falling {
  border-left-color: #3B82F6;
}

.theme-timeline__item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.theme-timeline__item-time {
  font-size: 12px;
  color: #6B7280;
  font-family: 'Courier New', monospace;
}

.theme-timeline__item-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.theme-timeline__item-badge--top1 {
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #333;
}

.theme-timeline__item-badge--top5 {
  background: #E5E7EB;
  color: #374151;
}

.theme-timeline__item-badge--new {
  background: #D1FAE5;
  color: #065F46;
}

.theme-timeline__item-badge--up {
  background: #FEE2E2;
  color: #991B1B;
}

.theme-timeline__item-badge--down {
  background: #DBEAFE;
  color: #1E40AF;
}

.theme-timeline__item-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.theme-timeline__item-theme {
  font-size: 15px;
  font-weight: 600;
  color: #111827;
}

.theme-timeline__item-leader {
  font-size: 13px;
  color: #6B7280;
  margin-top: 4px;
}

.theme-timeline__item-leader-name {
  font-weight: 600;
  color: #2563EB;
}

.theme-timeline__item-stats {
  text-align: right;
}

.theme-timeline__item-change {
  font-size: 16px;
  font-weight: 700;
}

.theme-timeline__item-change--positive {
  color: #EF4444;
}

.theme-timeline__item-change--negative {
  color: #3B82F6;
}

.theme-timeline__item-rank {
  font-size: 12px;
  color: #6B7280;
}

.theme-timeline__empty {
  text-align: center;
  padding: 60px 20px;
  color: #9CA3AF;
}

.theme-timeline__empty i {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

/* ========================================
   7. 테마 강도 게이지
   ======================================== */

.theme-strength {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 24px;
  margin-bottom: 24px;
}

.theme-strength__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  border-bottom: 2px solid #E5E7EB;
  padding-bottom: 12px;
}

.theme-strength__title {
  font-size: 20px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.theme-strength__subtitle {
  font-size: 13px;
  color: #6B7280;
}

.theme-strength__list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.theme-strength__item {
  display: flex;
  align-items: center;
  gap: 16px;
}

.theme-strength__rank {
  font-size: 18px;
  font-weight: 700;
  color: #6B7280;
  min-width: 32px;
  text-align: center;
}

.theme-strength__rank--1 { color: #FFD700; }
.theme-strength__rank--2 { color: #C0C0C0; }
.theme-strength__rank--3 { color: #CD7F32; }

.theme-strength__name {
  font-size: 14px;
  font-weight: 600;
  color: #111827;
  min-width: 120px;
}

.theme-strength__bar-container {
  flex: 1;
  background: #F3F4F6;
  border-radius: 8px;
  height: 24px;
  position: relative;
  overflow: hidden;
}

.theme-strength__bar-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.5s ease;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
}

.theme-strength__bar-fill--high {
  background: linear-gradient(90deg, #EF4444, #F87171);
}

.theme-strength__bar-fill--medium {
  background: linear-gradient(90deg, #F59E0B, #FBBF24);
}

.theme-strength__bar-fill--low {
  background: linear-gradient(90deg, #3B82F6, #60A5FA);
}

.theme-strength__bar-value {
  font-size: 12px;
  font-weight: 700;
  color: white;
}

.theme-strength__duration {
  font-size: 13px;
  color: #6B7280;
  min-width: 80px;
  text-align: right;
}

/* ========================================
   8. 시스템 상태
   ======================================== */

.system-status {
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  padding: 24px;
  margin-bottom: 24px;
}

.system-status__header {
  margin-bottom: 16px;
  border-bottom: 2px solid #E5E7EB;
  padding-bottom: 12px;
}

.system-status__title {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  margin: 0;
}

.system-status__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.status-card {
  background: #FAFAFA;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.status-card__icon {
  font-size: 24px;
  margin-bottom: 8px;
}

.status-card__label {
  font-size: 12px;
  color: #6B7280;
  margin-bottom: 4px;
}

.status-card__value {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  font-family: 'Courier New', monospace;
}

/* ========================================
   9. 반응형 디자인
   ======================================== */

@media (max-width: 1024px) {
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .system-status__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .theme-flow-page {
    padding: 12px;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-header__status {
    width: 100%;
    justify-content: space-between;
  }

  .theme-top3__cards {
    grid-template-columns: 1fr;
  }

  .charts-section__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .charts-section__controls {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 8px;
  }

  .theme-timeline__header {
    flex-direction: column;
    align-items: flex-start;
  }

  .theme-timeline__controls {
    width: 100%;
    flex-direction: column;
  }

  .timeline-search {
    width: 100%;
  }

  .theme-timeline__filter {
    width: 100%;
  }

  .theme-strength__item {
    flex-wrap: wrap;
  }

  .theme-strength__bar-container {
    order: 3;
    width: 100%;
    flex: none;
    margin-top: 8px;
  }

  .system-status__grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .page-header__title {
    font-size: 20px;
  }

  .system-status__grid {
    grid-template-columns: 1fr;
  }

  .range-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
}

/* ========================================
   10. 유틸리티
   ======================================== */

.hidden {
  display: none !important;
}

.loading {
  opacity: 0.6;
  pointer-events: none;
}
