/* =============================================
   DOMINO INVEST — Global Styles
   ============================================= */

:root {
  --blue:        #1565C0;
  --blue-dark:   #1565C0;
  --blue-mid:    #1976D2;
  --blue-bright: #2196F3;
  --blue-pale:   #E3F2FD;
  --green:       #2E7D32;
  --green-light: #43A047;
  --red:         #C62828;
  --red-light:   #EF5350;
  --gold:        #F9A825;
  --bg:          #EEF2F7;
  --card:        #FFFFFF;
  --text:        #1A1A2E;
  --text-muted:  #78909C;
  --border:      #E0E8F0;
  --shadow:      0 2px 12px rgba(21,101,192,0.08);
  --shadow-lg:   0 8px 32px rgba(21,101,192,0.14);
  --radius:      14px;
}

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

body {
  font-family: 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

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

/* ── NAVBAR ── */
.navbar {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 60px;
  background: var(--blue);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 0;
  box-shadow: 0 2px 16px rgba(21,101,192,0.3);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.2rem;
  font-weight: 900;
  color: white;
  margin-right: 32px;
  letter-spacing: -0.5px;
  white-space: nowrap;
}

.logo span { color: #90CAF9; }

.logo-icon {
  width: 34px; height: 34px;
  background: white;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
}

.nav-links {
  display: flex;
  gap: 2px;
  flex: 1;
}

.nav-link {
  color: rgba(255,255,255,0.8);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.15s;
  cursor: pointer;
}

.nav-link:hover, .nav-link.active {
  background: rgba(255,255,255,0.18);
  color: white;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-greeting {
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  white-space: nowrap;
}

.nav-icon-btn {
  width: 34px; height: 34px;
  background: rgba(255,255,255,0.15);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 15px;
  color: white;
  position: relative;
  transition: background 0.15s;
  border: none;
}

.nav-icon-btn:hover { background: rgba(255,255,255,0.28); }

.nav-help {
  width: auto;
  padding: 0 12px;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.badge {
  position: absolute;
  top: 5px; right: 5px;
  width: 7px; height: 7px;
  background: #FF5252;
  border-radius: 50%;
  border: 1.5px solid var(--blue);
}

/* ── LAYOUT ── */
.layout {
  display: flex;
  flex: 1;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 196px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 20px 0;
}

.sidebar-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 0 18px 10px;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  font-size: 0.87rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  position: relative;
  transition: all 0.15s;
}

.sidebar-item:hover {
  background: var(--blue-pale);
  color: var(--blue);
}

.sidebar-item.active {
  background: var(--blue-pale);
  color: var(--blue);
  font-weight: 700;
}

.sidebar-item.active::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--blue);
  border-radius: 0 2px 2px 0;
}

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1;
  min-width: 0;
  padding: 22px;
  display: grid;
  grid-template-columns: 1fr 308px;
  grid-template-rows: auto auto;
  gap: 18px;
  align-content: start;
}

/* ── CARD ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.card:hover { box-shadow: var(--shadow-lg); }

/* ── PORTFOLIO CARD ── */
.portfolio-card {
  grid-column: 1;
  grid-row: 1;
}

.portfolio-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 22px 10px;
  gap: 12px;
  flex-wrap: wrap;
}

.card-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.portfolio-amount {
  font-size: 1.9rem;
  font-weight: 900;
  font-family: 'DM Mono', monospace;
  letter-spacing: -1px;
  color: var(--text);
}

.portfolio-change {
  font-size: 0.95rem;
  font-family: 'Noto Sans KR', sans-serif;
  font-weight: 700;
  margin-left: 8px;
}

.portfolio-change.up   { color: var(--green-light); }
.portfolio-change.down { color: var(--red-light); }

.period-selector {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}

.period-btn {
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-family: 'Noto Sans KR', sans-serif;
  transition: all 0.15s;
}

.period-btn:hover, .period-btn.active {
  background: var(--blue-pale);
  color: var(--blue);
  border-color: var(--blue-bright);
}

.chart-wrap {
  padding: 4px 22px 18px;
  height: 190px;
  position: relative;
}

/* ── MARKET CARD ── */
.market-card {
  grid-column: 1;
  grid-row: 2;
}

.market-header {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--blue);
  padding: 11px 18px;
}

.star { color: #FFD54F; font-size: 18px; }
.market-title { color: white; font-weight: 800; font-size: 0.92rem; flex: 1; }
.market-news { font-size: 18px; }

.market-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
}


.market-loading {
  padding: 30px;
  color: var(--text-muted);
  text-align: center;
  font-size: 0.85rem;
  grid-column: span 3;
}

.market-item {
  padding: 14px 18px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  position: relative;
  min-width: 0;
}

.market-item:hover { background: var(--blue-pale); }

.market-tag {
  position: absolute;
  top: 10px; right: 10px;
  background: var(--blue-pale);
  color: var(--blue);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.04em;
}

.market-name { font-size: 0.85rem; font-weight: 700; }
.market-value {
  font-size: 1.3rem;
  font-weight: 900;
  font-family: 'DM Mono', monospace;
  letter-spacing: -0.5px;
  margin: 3px 0;
}
.market-change { font-size: 0.82rem; font-weight: 700; }
.market-change.up   { color: var(--green-light); }
.market-change.down { color: var(--red-light); }

.sparkline { display: block; margin-top: 6px; }

/* ── RIGHT PANEL ── */
.right-panel {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s;
}

.search-box:focus-within { border-color: var(--blue-bright); }
.search-icon { color: var(--text-muted); font-size: 14px; }

.search-box input {
  border: none; outline: none;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.87rem;
  color: var(--text);
  background: transparent;
  flex: 1;
}

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

/* ASSET CARD */
.asset-card { flex: 1; display: flex; flex-direction: column; }

.asset-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--border);
}

.asset-title { font-weight: 800; font-size: 0.92rem; }
.asset-arrow { color: var(--text-muted); font-size: 22px; cursor: pointer; }

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

.asset-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 18px;
  cursor: pointer;
  transition: background 0.15s;
}

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

.asset-dot {
  width: 36px; height: 36px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.asset-name { font-size: 0.86rem; font-weight: 700; }
.asset-info .asset-change { font-size: 0.78rem; font-weight: 600; margin-top: 2px; }
.asset-info .asset-change.up   { color: var(--green-light); }
.asset-info .asset-change.down { color: var(--red-light); }

.asset-bar-wrap {
  padding: 12px 18px 16px;
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.asset-bar-label {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-muted);
  text-align: right;
  margin-bottom: 8px;
}

.stacked-bar {
  display: flex;
  gap: 6px;
  height: 130px;
  align-items: flex-end;
}

.bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  position: relative;
  justify-content: flex-end;
  height: 100%;
}

.bar-seg {
  width: 100%;
  border-radius: 3px;
  transition: height 0.5s ease;
}

.bar-col-label {
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 4px;
}

/* ── PAGE HEADER (inner pages) ── */
.page-header {
  grid-column: 1 / -1;
  padding-bottom: 4px;
}

.page-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: var(--text);
}

.page-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card     { animation: fadeUp 0.35s ease both; }
.right-panel { animation: fadeUp 0.4s ease both; }

/* ── NAV SEARCH ── */
.nav-search-wrap {
  flex: 1;
  display: flex;
  justify-content: center;
  padding: 0 20px;
}

.nav-search-box {
  position: relative;
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.15);
  border: 1.5px solid rgba(255,255,255,0.2);
  border-radius: 10px;
  padding: 7px 14px;
  gap: 8px;
  width: 100%;
  max-width: 320px;
  transition: all 0.15s;
}

.nav-search-box:focus-within {
  background: rgba(255,255,255,0.22);
  border-color: rgba(255,255,255,0.5);
}

.nav-search-icon { font-size: 13px; color: rgba(255,255,255,0.7); }

.nav-search-box input {
  border: none;
  outline: none;
  background: transparent;
  font-family: 'Noto Sans KR', sans-serif;
  font-size: 0.85rem;
  color: white;
  width: 100%;
}

.nav-search-box input::placeholder { color: rgba(255,255,255,0.55); }

.nav-search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0; right: 0;
  background: white;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  z-index: 999;
  overflow: hidden;
}

.nav-search-hint {
  padding: 14px 16px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.nav-search-result {
  padding: 10px 16px;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  transition: background 0.1s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.nav-search-result:hover { background: var(--blue-pale); color: var(--blue); }

/* ── 검색 결과 드롭다운 ── */
.nav-search-result {
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}

.nav-search-result:last-child { border-bottom: none; }
.nav-search-result:hover { background: var(--blue-pale); }

.nav-search-badge {
  font-size: 0.65rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.nav-search-info { min-width: 0; }

.nav-search-code {
  font-size: 0.82rem;
  font-weight: 700;
  font-family: 'DM Mono', monospace;
  color: var(--text);
}

.nav-search-name {
  font-size: 0.82rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-search-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
