/* common.css — ValuePick 공통 스타일 (Figma 디자인 기반) */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --primary: #3182f6;
  --primary-dark: #1b64da;
  --primary-light: #e8f3ff;
  --up: #f04452;
  --down: #3182f6;
  --bg: #f2f4f6;
  --surface: #ffffff;
  --border: #e5e8eb;
  --text-main: #191f28;
  --text-sub: #8b95a1;
  --text-muted: #b0b8c1;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.1);
  --header-h: 64px;
  --max-w: 1200px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Pretendard', 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text-main);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ── Header ── */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 24px;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}

.nav {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-sub);
  transition: color 0.15s, background 0.15s;
}

.nav-link:hover {
  color: var(--text-main);
  background: var(--bg);
}

.nav-link.active {
  color: var(--primary);
  background: var(--primary-light);
}

.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.search-wrap svg {
  position: absolute;
  left: 12px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  width: 240px;
  padding: 9px 12px 9px 36px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 14px;
  outline: none;
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(49, 130, 246, 0.12);
  background: var(--surface);
}

.btn-text {
  padding: 8px 14px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-sub);
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}

.btn-text:hover {
  color: var(--text-main);
  background: var(--bg);
}

.btn-primary {
  padding: 9px 18px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

/* ── Main ── */
.main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 32px 24px 64px;
}

/* ── Section ── */
.section-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 16px;
  letter-spacing: -0.3px;
}

/* ── Stock card (shared) ── */
.stock-card {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  cursor: pointer;
  transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}

/* ── 관심종목 별 버튼 (카드/랭킹/상세 공통) ── */
.favorite-btn {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 28px;
  height: 28px;
  border: none;
  background: transparent;
  color: var(--border);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.favorite-btn:hover {
  color: #f0b429;
}

.favorite-btn.active {
  color: #f0b429;
}

.stock-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: #d1d6db;
  transform: translateY(-1px);
}

.stock-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-top: 24px;
}

.stock-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 2px;
}

.stock-code {
  font-size: 13px;
  color: var(--text-sub);
}

.stock-price-wrap {
  text-align: right;
}

.stock-price {
  font-size: 16px;
  font-weight: 700;
}

.stock-change {
  font-size: 13px;
  font-weight: 600;
}

.stock-change.up { color: var(--up); }
.stock-change.down { color: var(--down); }

.stock-metrics {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.metric-item {
  text-align: center;
}

.metric-label {
  font-size: 11px;
  color: var(--text-sub);
  margin-bottom: 4px;
}

.metric-value {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
}

/* ── Ranking list ── */
.rank-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}

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

.rank-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rank-num {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--bg);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.rank-num.top3 {
  background: var(--primary-light);
  color: var(--primary);
}

.rank-name {
  font-size: 14px;
  font-weight: 600;
}

.rank-code {
  font-size: 12px;
  color: var(--text-sub);
}

.rank-right {
  text-align: right;
}

.rank-value {
  font-size: 14px;
  font-weight: 700;
}

/* ── Utility ── */
.up { color: var(--up); }
.down { color: var(--down); }

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-sub);
}

/* ── Mobile nav toggle ── */
.menu-toggle {
  display: none;
  padding: 8px;
  border: none;
  background: none;
  color: var(--text-main);
}

/* ── Footer ── */
.footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  margin-top: 64px;
}

.footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 40px 24px;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  margin-bottom: 32px;
}

.footer-brand {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.footer-desc {
  font-size: 14px;
  color: var(--text-sub);
  line-height: 1.6;
}

.footer-heading {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 12px;
}

.footer-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.footer-list a {
  font-size: 14px;
  color: var(--text-sub);
  transition: color 0.15s;
}

.footer-list a:hover {
  color: var(--primary);
}

.footer-list--plain li {
  font-size: 14px;
  color: var(--text-sub);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

.footer-disclaimer {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 8px;
}

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

@media (max-width: 768px) {
  .footer-grid {
    grid-template-columns: 1fr;
    gap: 24px;
  }
}

/* ── Responsive ── */
@media (max-width: 1024px) {
  .search-input { width: 180px; }
  .stock-metrics { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 768px) {
  .header-inner { gap: 12px; padding: 0 16px; }
  .nav { display: none; }
  .nav.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 12px 16px;
    gap: 4px;
  }
  .menu-toggle { display: block; }
  .search-wrap { flex: 1; }
  .search-input { width: 100%; }
  .main { padding: 20px 16px 48px; }
  .stock-metrics { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 480px) {
  .header-inner {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--header-h);
    padding: 10px 16px;
    row-gap: 8px;
  }
  .header-right {
    width: 100%;
    justify-content: flex-end;
  }
}
