/* =====================================================
   INDEX.CSS — 홈 페이지 전용 스타일
   스카이블루 + 화이트 / 고급 인터랙션
===================================================== */

/* ── 홈 전체 레이아웃 ── */
.home-layout {
  display: flex;
  gap: 24px;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px 24px 40px;
  min-height: calc(100vh - var(--nav-h));
  align-items: flex-start;
}

.home-left {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.home-right {
  width: 870px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  position: sticky;
  top: calc(var(--nav-h) + 24px);
}

/* =====================================================
   히어로 검색 섹션
===================================================== */
.search-hero {
  border-radius: 20px;
  background: linear-gradient(135deg, #e8f4ff 0%, #f0f7ff 40%, #e6f0ff 100%);
  border: 1px solid rgba(91, 141, 238, 0.2);
  overflow: hidden;
  position: relative;
  box-shadow: 0 4px 24px rgba(59, 130, 246, 0.08);
}

/* 배경 장식 원형 */
.search-hero::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(96,175,245,0.18) 0%, transparent 70%);
  pointer-events: none;
}

.search-hero::after {
  content: '';
  position: absolute;
  bottom: -40px;
  left: 30%;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(91,141,238,0.1) 0%, transparent 70%);
  pointer-events: none;
}

.search-hero-inner {
  padding: 32px 28px 28px;
  position: relative;
  z-index: 1;
}

.search-hero-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sky-600);
  margin-bottom: 10px;
  background: rgba(91,141,238,0.1);
  padding: 4px 10px;
  border-radius: 20px;
}

/* 라이브 펄스 점 */
.search-pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  position: relative;
  flex-shrink: 0;
}

.search-pulse::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  background: #22c55e;
  opacity: 0.4;
  animation: pulse-ring 1.8s ease infinite;
}

@keyframes pulse-ring {
  0% { transform: scale(1); opacity: 0.4; }
  70% { transform: scale(2.2); opacity: 0; }
  100% { transform: scale(2.2); opacity: 0; }
}

.search-hero-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 18px;
  letter-spacing: -0.4px;
  line-height: 1.25;
}

/* 검색 입력창 */
.search-hero-box {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--bg-card);
  border: 2px solid transparent;
  border-radius: 14px;
  padding: 6px 6px 6px 16px;
  box-shadow: 0 2px 16px rgba(30,80,160,0.1);
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
  position: relative;
}

.search-hero-box:focus-within {
  border-color: var(--sky-500);
  box-shadow: 0 0 0 4px rgba(59,155,239,0.15), 0 4px 20px rgba(30,80,160,0.1);
  transform: translateY(-1px);
}

.search-icon-big {
  font-size: 18px;
  margin-right: 8px;
  flex-shrink: 0;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.search-hero-box:focus-within .search-icon-big {
  opacity: 1;
}

.search-hero-box input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  color: var(--text-primary);
  outline: none;
  padding: 6px 0;
}

.search-hero-box input::placeholder {
  color: var(--text-muted);
}

/* 검색 버튼 — 그라디언트 + 호버 반짝임 */
.search-hero-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 11px 22px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--sky-500) 0%, var(--sky-700) 100%);
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
  letter-spacing: 0.01em;
}

/* 반짝이는 shimmer 레이어 */
.search-hero-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.35), transparent);
  transform: skewX(-15deg);
  transition: left 0.5s ease;
}

.search-hero-btn:hover::before {
  left: 160%;
}

.search-hero-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30,135,232,0.45);
  background: linear-gradient(135deg, var(--sky-400) 0%, var(--sky-600) 100%);
}

.search-hero-btn:active {
  transform: translateY(0);
  box-shadow: none;
}

/* 태그 빠른 검색 */
.search-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.search-tag {
  padding: 5px 12px;
  border-radius: 20px;
  background: rgba(91,141,238,0.1);
  border: 1px solid rgba(91,141,238,0.2);
  color: var(--sky-700);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}

.search-tag:hover {
  background: var(--sky-600);
  border-color: var(--sky-600);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(30,135,232,0.3);
}

/* =====================================================
   게시글 피드 카드
===================================================== */
.feed-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 2px 12px rgba(30,50,110,0.06);
  overflow: hidden;
}

.feed-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
}

.feed-card-title {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

/* 라이브 점 (초록) */
.feed-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,0.25);
  animation: liveDot 2s ease infinite;
  flex-shrink: 0;
}

@keyframes liveDot {
  0%, 100% { box-shadow: 0 0 0 3px rgba(34,197,94,0.25); }
  50% { box-shadow: 0 0 0 6px rgba(34,197,94,0.1); }
}

.feed-refresh-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.feed-refresh-btn:hover {
  background: var(--sky-600);
  border-color: var(--sky-600);
  color: white;
  transform: rotate(90deg);
}

.feed-viewall-btn {
  font-size: 13px;
  font-weight: 600;
  color: var(--sky-600);
  text-decoration: none;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(91,141,238,0.08);
  border: 1px solid rgba(91,141,238,0.2);
  transition: all 0.18s;
}

.feed-viewall-btn:hover {
  background: var(--sky-600);
  color: white;
  border-color: var(--sky-600);
  transform: translateX(2px);
}

/* 게시글 아이템 */
.posts-feed {
  display: flex;
  flex-direction: column;
  max-height: 420px;
  overflow-y: auto;
}

.posts-feed::-webkit-scrollbar { width: 4px; }
.posts-feed::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }

.post-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 20px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.18s;
  animation: fadeSlideIn 0.35s ease both;
  position: relative;
  overflow: hidden;
}

.post-item:last-child { border-bottom: none; }

/* 호버시 스카이블루 shimmer */
.post-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(180deg, var(--sky-400), var(--sky-600));
  transform: scaleY(0);
  transform-origin: center;
  transition: transform 0.2s;
  border-radius: 0 2px 2px 0;
}

.post-item:hover::before {
  transform: scaleY(1);
}

.post-item:hover {
  background: linear-gradient(90deg, rgba(91,141,238,0.05) 0%, transparent 100%);
  padding-left: 24px;
}

.pi-rank {
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--bg-secondary);
  border: 1px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  flex-shrink: 0;
  font-family: 'DM Mono', monospace;
  transition: all 0.18s;
}

.post-item:hover .pi-rank {
  background: var(--sky-600);
  border-color: var(--sky-600);
  color: white;
}

.pi-body { flex: 1; min-width: 0; }

.pi-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.18s;
}

.post-item:hover .pi-title {
  color: var(--sky-600);
}

.pi-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.pi-dot-sep { opacity: 0.4; }

.pi-arrow {
  font-size: 20px;
  color: var(--text-muted);
  transition: all 0.18s;
  flex-shrink: 0;
  line-height: 1;
}

.post-item:hover .pi-arrow {
  color: var(--sky-600);
  transform: translateX(3px);
}

/* 로딩 dots */
.feed-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 40px;
}

.feed-loading span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--sky-400);
  animation: dotBounce 0.8s ease infinite;
}

.feed-loading span:nth-child(2) { animation-delay: 0.15s; }
.feed-loading span:nth-child(3) { animation-delay: 0.3s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.6); opacity: 0.4; }
  40% { transform: scale(1.1); opacity: 1; }
}

.feed-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 48px;
  color: var(--text-muted);
  font-size: 13.5px;
}

.feed-empty-icon { font-size: 36px; margin-bottom: 4px; }
.feed-write-link {
  color: var(--sky-600);
  font-weight: 600;
  text-decoration: none;
  margin-top: 4px;
  transition: color 0.15s;
}
.feed-write-link:hover { color: var(--sky-700); text-decoration: underline; }
.feed-error { padding: 40px; text-align: center; color: #dc2626; font-size: 13px; }

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

/* =====================================================
   공지사항 카드
===================================================== */
.notice-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(30,50,110,0.06);
}

.notice-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-secondary);
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
}

.notice-badge {
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  background: rgba(251,191,36,0.15);
  color: #b45309;
  border: 1px solid rgba(251,191,36,0.3);
  border-radius: 20px;
  letter-spacing: 0.04em;
}

.notice-list { padding: 6px 0; }

.notice-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 20px;
  transition: background 0.15s;
  cursor: default;
}

.notice-item:hover { background: var(--bg-secondary); }

.notice-item.coming-soon { opacity: 0.55; }

.notice-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--border-strong);
  margin-top: 5px;
  flex-shrink: 0;
}

.notice-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.notice-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.notice-date {
  font-size: 12px;
  color: var(--text-muted);
}

.notice-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  border-radius: 6px;
  flex-shrink: 0;
}

/* =====================================================
   종목 검색 카드 (오른쪽)
===================================================== */
.ticker-search-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(30,50,110,0.06);
}

.ticker-search-inner {
  display: flex;
  gap: 0;
  padding: 16px 20px 14px;
  gap: 20px;
  align-items: flex-start;
}

.ticker-left { flex-shrink: 0; }

.ticker-label {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.ticker-current {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.ticker-symbol {
  font-size: 22px;
  font-weight: 800;
  color: var(--sky-600);
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.5px;
}

.ticker-name {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.ticker-right { flex: 1; }

.ticker-input-wrap {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}

.ticker-input-wrap input {
  flex: 1;
  padding: 9px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: 10px;
  background: var(--bg-secondary);
  color: var(--text-primary);
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  outline: none;
  transition: all 0.18s;
}

.ticker-input-wrap input:focus {
  border-color: var(--sky-500);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px rgba(59,155,239,0.12);
}

.ticker-input-wrap input::placeholder { color: var(--text-muted); }

/* 차트 변경 버튼 — 그라디언트 shimmer */
.ticker-search-btn {
  padding: 9px 18px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--sky-500), var(--sky-700));
  color: white;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition: all 0.2s;
}

.ticker-search-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 60%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent);
  transform: skewX(-15deg);
  transition: left 0.45s ease;
}

.ticker-search-btn:hover::before { left: 160%; }
.ticker-search-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 18px rgba(30,135,232,0.4);
}

/* 퀵 종목 버튼들 */
.ticker-quick-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tq-btn {
  padding: 4px 11px;
  border-radius: 8px;
  border: 1.5px solid var(--border-strong);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s;
}

.tq-btn:hover {
  border-color: var(--sky-500);
  color: var(--sky-600);
  background: rgba(91,141,238,0.08);
  transform: translateY(-2px);
  box-shadow: 0 3px 10px rgba(59,155,239,0.2);
}

/* =====================================================
   차트 카드 (PC 기준: 공지사항 하단에 딱 맞춤)
===================================================== */
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(30,50,110,0.08);
  /* 왼쪽 공지사항 카드 끝선에 맞춘 높이 */
  height: 680px; 
  min-height: 680px;
  position: relative;
  transition: box-shadow 0.3s;
}

.chart-card:hover {
  box-shadow: 0 8px 32px rgba(59,130,246,0.12);
}

.chart-card #tradingview_chart {
  width: 100%;
  height: 100%; /* JS의 height: 100%와 연동되어 꽉 찹니다 */
}

/* 차트 로딩 오버레이 */
.chart-card.loading-chart::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(242,245,252,0.6);
  z-index: 10;
  backdrop-filter: blur(2px);
}

/* =====================================================
   반응형 (화면 크기에 따른 유연한 조절)
===================================================== */
@media (max-width: 1300px) {
  .home-right { width: 600px; }
  .chart-card { height: 600px; min-height: 600px; } 
}

@media (max-width: 1100px) {
  .home-layout { flex-direction: column; }
  /* 1100% -> 100%로 수정 */
  .home-right { width: 100%; position: static; } 
  /* 50px -> 500px로 수정 (차트 가독성 확보) */
  .chart-card { height: 500px; min-height: 500px; } 
}

@media (max-width: 600px) {
  .home-layout { padding: 12px; gap: 12px; }
  .search-hero-inner { padding: 20px 16px 18px; }
  .search-hero-title { font-size: 17px; }
  /* 850px -> 400px로 수정 (모바일에서는 한 화면에 들어오는게 중요) */
  .chart-card { height: 400px; min-height: 400px; } 
  .ticker-search-inner { flex-direction: column; gap: 12px; }
}


/* =====================================================
   🏆 최고의 게시글 카드
===================================================== */
.top-post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(30,50,110,0.06);
}

.top-post-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(135deg, #fff9e6 0%, #fff3cd 100%);
  font-size: 14px;
  font-weight: 700;
  color: #92400e;
}

.top-post-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: #b45309;
  background: rgba(251,191,36,0.2);
  padding: 2px 8px;
  border-radius: 10px;
}

.top-post-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* 1위 카드 */
.top-post-winner {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: linear-gradient(135deg, rgba(251,191,36,0.08) 0%, rgba(255,255,255,0) 100%);
  border: 1.5px solid rgba(251,191,36,0.35);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.18s;
  position: relative;
  overflow: hidden;
}

.top-post-winner::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(251,191,36,0.06), transparent);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.top-post-winner:hover::before { transform: translateX(100%); }
.top-post-winner:hover {
  border-color: rgba(251,191,36,0.6);
  box-shadow: 0 4px 16px rgba(251,191,36,0.2);
  transform: translateY(-1px);
}

.top-post-crown {
  font-size: 28px;
  flex-shrink: 0;
  line-height: 1;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.top-post-content { flex: 1; min-width: 0; }

.top-post-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
}

.top-post-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
  flex-wrap: wrap;
}

.top-like-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  background: rgba(239,68,68,0.1);
  border: 1px solid rgba(239,68,68,0.2);
  border-radius: 10px;
  color: #dc2626;
  font-weight: 700;
  font-size: 12px;
}

.top-post-preview {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* 2~4위 */
.top-post-runners {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.top-runner-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}

.top-runner-item:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  transform: translateX(3px);
}

.runner-rank { font-size: 18px; flex-shrink: 0; line-height: 1; }

.runner-body { flex: 1; min-width: 0; }

.runner-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 2px;
}

.runner-meta {
  font-size: 11.5px;
  color: var(--text-muted);
}

.top-post-empty {
  padding: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13.5px;
}

/* =====================================================
   푸터
===================================================== */
.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  margin-top: 0;
}

.footer-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 20px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-logo {
  font-size: 15px;
  font-weight: 800;
  color: var(--sky-600);
  letter-spacing: -0.3px;
}

.footer-links {
  display: flex;
  gap: 16px;
}

.footer-link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s;
}

.footer-link:hover { color: var(--sky-600); }

.footer-copy {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted);
}
