@import url("../real-market/shared.css");

/* ==========================================================================
   Real Market - Students UI/UX (Modernized)
   ========================================================================== */

/* 1. 환율/정책 안내 배너 (Glassmorphism & Gradient) */
.exchange-rate-banner {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary-soft) 40%, var(--glass-bg) 60%), color-mix(in srgb, var(--success-soft) 30%, var(--glass-bg) 70%));
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 18px;
  font-size: 0.9rem;
  color: var(--text-main);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  box-shadow: var(--glass-shadow);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.exchange-rate-banner:hover {
  transform: translateY(-2px);
}

.exchange-rate-banner .rate-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.exchange-guide-text {
  margin: 4px 0 12px;
}

.exchange-step-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.exchange-step-card {
  background: color-mix(in srgb, var(--card-bg) 84%, var(--primary-soft) 16%);
  border: 1px solid color-mix(in srgb, var(--border) 70%, #fff 30%);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.exchange-step-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.exchange-step-head strong {
  font-size: 0.9rem;
  font-weight: 900;
}

.exchange-field-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-sub);
  font-weight: 800;
}

.exchange-field-label input[type="number"] {
  max-width: 180px;
}

.exchange-action-btn {
  width: 100%;
  border-radius: 12px;
  min-height: 40px;
}

.exchange-preview-text {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
}

/* 2. 시장 현황 필터 및 검색 영역 */
.filter-row,
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
  background: var(--glass-bg);
  padding: 12px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.filter-bar select,
.filter-row select {
  min-width: 150px;
  flex: 0 0 auto;
  border-radius: 10px;
  padding: 8px 12px;
}

.stock-search,
.filter-bar input[type="text"] {
  flex: 1;
  min-width: 200px;
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 0.95rem;
}

/* 3. 계좌 KPI 요약 박스 (Grid Layout & Hover Lift) */
.portfolio-summary,
.portfolio-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.kpi-box {
  background: var(--card-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  transition: all 0.2s ease-out;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.kpi-box:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-color: var(--primary-soft);
}

.kpi-box .kpi-label {
  font-size: 0.8rem;
  color: var(--text-sub);
  font-weight: 700;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.kpi-box .kpi-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
}

.kpi-box .kpi-sub {
  font-size: 0.75rem;
  color: var(--text-sub);
  margin-top: 4px;
}

/* 4. 포트폴리오(보유 주식) 테이블 개선 */
.portfolio-table,
.holdings-table {
  overflow-x: auto;
  background: var(--card-bg);
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  margin-bottom: 16px;
}

.holdings-table table {
  width: 100%;
  border-collapse: collapse;
}

.holdings-table th {
  background: color-mix(in srgb, var(--primary-soft) 30%, transparent 70%);
  color: var(--text-main);
  font-weight: 700;
  padding: 12px 16px;
  text-align: right;
  font-size: 0.85rem;
  border-bottom: 2px solid var(--border);
}

.holdings-table th:first-child,
.holdings-table td:first-child {
  text-align: left;
  /* 종목명은 좌측 정렬 */
}

.holdings-table td {
  padding: 14px 16px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent 50%);
  font-size: 0.9rem;
  text-align: right;
  vertical-align: middle;
  transition: background 0.15s;
}

.holdings-table tbody tr:hover td {
  background: var(--primary-soft);
}

.holdings-table tbody tr:last-child td {
  border-bottom: none;
}

.holdings-table input[type="number"] {
  width: 70px;
  padding: 6px;
  border-radius: 8px;
  text-align: center;
  font-size: 0.9rem;
}

/* 5. 매수 모달 주 수 입력기 (Stepper) */
.share-stepper {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--input-bg);
  padding: 6px;
  border-radius: 24px;
  border: 1px solid var(--border);
}

.share-stepper button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.4rem;
  padding: 0;
  border: none;
  background: var(--glass-bg);
  color: var(--text-main);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.share-stepper button:hover {
  background: var(--primary);
  color: #fff;
  transform: scale(1.05);
}

.share-stepper input {
  width: 90px;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 800;
  background: transparent;
  border: none;
  box-shadow: none;
}

.share-stepper input:focus {
  outline: none;
  box-shadow: none;
}

/* 6. 거래 기록 (Log Items) */
.trade-log-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.trade-log-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--glass-bg) 60%, transparent 40%);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.9rem;
  transition: transform 0.2s, background 0.2s;
}

.trade-log-item:hover {
  transform: translateX(4px);
  background: var(--glass-bg);
}

.trade-log-item .trade-type {
  font-weight: 800;
  font-size: 0.8rem;
  padding: 4px 10px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

.trade-type.buy {
  background: var(--danger);
  /* 주식시장 통상 매수 Red 계열, 혹은 success 매핑 가능 */
  color: #fff;
}

.trade-type.sell {
  background: var(--primary);
  /* 주식시장 통상 매도 Blue 계열 */
  color: #fff;
}

/* 7. 가격 점핑/비공개 블러 처리 영역 */
.price-hidden {
  filter: blur(6px);
  user-select: none;
  pointer-events: none;
  opacity: 0.6;
  transition: filter 0.3s ease;
}

/* 8. 종목 카드 매수 버튼 오버라이드 (shared.css 보완) */
.stock-card .buy-btn {
  width: 100%;
  margin-top: 12px;
  border-radius: 12px;
  padding: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.3px;
}

/* 9. 포트폴리오 표 로고형 리디자인 */
.holding-name-cell {
  min-width: 220px;
}

.holding-stock-btn.rich {
  width: 100%;
  border: none;
  background: transparent;
  padding: 6px 2px;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-main);
  cursor: pointer;
}

.holding-stock-btn.rich:hover {
  transform: translateX(2px);
}

.holding-logo-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(239, 246, 255, 0.9));
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.16);
  border: 1px solid color-mix(in srgb, var(--border) 62%, #fff 38%);
  flex: 0 0 44px;
}

.holding-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 4px;
}

.holding-logo-fallback {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.96rem;
  font-weight: 900;
  color: #13305d;
}

.holding-meta {
  min-width: 0;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}

.holding-name {
  font-size: 0.93rem;
  font-weight: 900;
  color: var(--text-main);
  line-height: 1.15;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.holding-ticker-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.holding-ticker {
  font-size: 0.74rem;
  color: var(--text-sub);
  font-weight: 800;
  letter-spacing: 0.3px;
}

.holding-market-badge {
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.4px;
  border-radius: 999px;
  padding: 2px 6px;
  border: 1px solid transparent;
}

.holding-market-badge.kr {
  color: #1e3a8a;
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.28);
}

.holding-market-badge.us {
  color: #065f46;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.32);
}

/* 10. 오늘의 경제뉴스 */
#dailyNewsSection {
  --news-paper: #f8f5ec;
  --news-paper-strong: #fffdf7;
  --news-paper-soft: #efe8d8;
  --news-ink: #172033;
  --news-muted: #4b5668;
  --news-faint: #687386;
  --news-accent: #1d4ed8;
  --news-accent-soft: rgba(29, 78, 216, 0.12);
  background: var(--news-paper);
  color: var(--news-ink);
  border-color: rgba(23, 32, 51, 0.24);
}

#dailyNewsSection .helper-text {
  color: var(--news-muted);
  font-weight: 800;
}

.daily-news-paper-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  color: var(--news-ink);
  border-bottom: 3px double rgba(23, 32, 51, 0.64);
  padding-bottom: 12px;
}

.daily-news-paper-head h2 {
  margin: 2px 0 4px;
  color: var(--news-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.daily-news-paper-head p {
  margin: 0;
  color: var(--news-muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.daily-news-edition {
  color: var(--news-accent);
  font-size: 0.72rem;
  font-weight: 1000;
}

.daily-news-date {
  flex: 0 0 auto;
  border: 1px solid rgba(23, 32, 51, 0.52);
  border-radius: 0;
  padding: 7px 10px;
  color: var(--news-ink);
  background: var(--news-paper-strong);
  font-size: 0.8rem;
  font-weight: 1000;
}

.daily-news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0;
  margin-top: 16px;
  border: 1px solid rgba(23, 32, 51, 0.2);
  background: var(--news-paper-strong);
  color: var(--news-ink);
}

.daily-news-card {
  border: 0;
  border-right: 1px solid rgba(23, 32, 51, 0.16);
  border-bottom: 1px solid rgba(23, 32, 51, 0.16);
  border-radius: 0;
  background: transparent;
  color: var(--news-ink);
  padding: 18px;
  min-width: 0;
}

.daily-news-card:first-child {
  grid-column: 1 / -1;
  background: linear-gradient(180deg, #fffdf7 0%, #f5efe2 100%);
}

.daily-news-empty-card {
  grid-column: 1 / -1;
  padding: 24px 18px;
  text-align: center;
  background: var(--news-paper-strong);
  color: var(--news-ink);
}

.daily-news-empty-card h3 {
  margin: 0 0 8px;
  color: var(--news-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  letter-spacing: 0;
}

.daily-news-empty-card p {
  margin: 0;
  color: var(--news-muted);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.5;
}

.daily-news-meta {
  color: var(--news-faint);
  font-size: 0.74rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.daily-news-source-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  margin: 0 0 10px;
  border: 1px solid rgba(23, 32, 51, 0.22);
  border-radius: 4px;
  padding: 6px 10px;
  background: rgba(255, 253, 247, 0.72);
  color: var(--news-accent);
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1.2;
  text-decoration: none;
}

.daily-news-source-link:hover,
.daily-news-source-link:focus-visible {
  border-color: rgba(23, 32, 51, 0.42);
  color: var(--news-ink);
  text-decoration: underline;
}

.daily-news-image {
  position: relative;
  overflow: hidden;
  margin: 0 0 12px;
  border: 1px solid rgba(23, 32, 51, 0.18);
  background: var(--news-paper-soft);
}

.daily-news-image img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  filter: saturate(0.92) contrast(0.96);
}

.daily-news-image figcaption {
  position: absolute;
  left: 8px;
  bottom: 8px;
  border: 1px solid rgba(23, 32, 51, 0.26);
  border-radius: 999px;
  padding: 4px 7px;
  background: rgba(255, 253, 247, 0.86);
  color: var(--news-muted);
  font-size: 0.68rem;
  font-weight: 900;
  line-height: 1.15;
}

.daily-news-card h3 {
  margin: 0 0 8px;
  color: var(--news-ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.24rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.daily-news-card:first-child h3 {
  font-size: 1.58rem;
}

.daily-news-summary {
  margin: 0 0 10px;
  color: var(--news-accent);
  font-weight: 900;
  line-height: 1.5;
}

.daily-news-summary-block {
  margin: 12px 0 12px;
  border: 1px solid rgba(29, 78, 216, 0.28);
  border-left: 4px solid var(--news-accent);
  background: rgba(239, 246, 255, 0.54);
  padding: 11px 12px;
  color: var(--news-ink);
}

.daily-news-summary-block span {
  display: block;
  margin-bottom: 5px;
  color: var(--news-accent);
  font-size: 0.76rem;
  font-weight: 1000;
}

.daily-news-summary-block p {
  margin: 0;
  color: var(--news-ink);
  font-size: 0.96rem;
  font-weight: 900;
  line-height: 1.55;
}

.daily-news-section-label {
  margin: 12px 0 5px;
  color: var(--news-muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.daily-news-original {
  margin: 10px 0 12px;
  border: 1px solid rgba(23, 32, 51, 0.16);
  border-radius: 0;
  background: var(--news-paper-soft);
  color: var(--news-ink);
}

.daily-news-original summary {
  padding: 9px 11px;
  cursor: pointer;
  color: var(--news-ink);
  font-size: 0.86rem;
  font-weight: 900;
}

.daily-news-original-body {
  border-top: 1px solid rgba(23, 32, 51, 0.14);
  padding: 11px;
  color: var(--news-ink);
  column-width: 240px;
  column-gap: 22px;
  font-size: 0.92rem;
  line-height: 1.68;
  white-space: pre-line;
}

.daily-news-generated-article {
  margin: 10px 0 12px;
  border-top: 1px solid rgba(23, 32, 51, 0.16);
  border-bottom: 1px solid rgba(23, 32, 51, 0.16);
  padding: 2px 0 12px;
}

.daily-news-generated-body {
  margin: 7px 0 0;
  color: var(--news-ink);
  font-size: 0.95rem;
  line-height: 1.68;
  white-space: pre-line;
}

.daily-news-body {
  margin: 0;
  color: var(--news-ink);
  font-size: 0.93rem;
  line-height: 1.6;
  white-space: pre-line;
}

.daily-news-takeaways {
  display: grid;
  gap: 7px;
}

.daily-news-takeaway-row {
  display: grid;
  grid-template-columns: minmax(64px, max-content) minmax(0, 1fr);
  gap: 8px 10px;
  border-bottom: 1px solid rgba(23, 32, 51, 0.12);
  padding-bottom: 7px;
}

.daily-news-takeaway-row:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.daily-news-takeaway-label {
  color: var(--news-accent);
  font-size: 0.8rem;
  font-weight: 1000;
}

.daily-news-takeaway-text {
  color: var(--news-ink);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.56;
}

.daily-news-glossary {
  margin-top: 14px;
  border-top: 1px solid rgba(23, 32, 51, 0.16);
  padding-top: 12px;
  color: var(--news-ink);
}

.daily-news-glossary strong {
  display: block;
  margin-bottom: 8px;
  color: var(--news-ink);
}

.daily-news-glossary dl {
  display: grid;
  gap: 7px 10px;
  grid-template-columns: minmax(64px, max-content) minmax(0, 1fr);
  margin: 0;
}

.daily-news-glossary dt,
.daily-news-glossary dd {
  margin: 0;
  line-height: 1.45;
}

.daily-news-glossary dt {
  color: var(--news-accent);
  font-size: 0.82rem;
  font-weight: 900;
}

.daily-news-glossary dd {
  color: var(--news-ink);
  font-size: 0.86rem;
}

.daily-news-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.daily-news-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--news-accent-soft);
  color: var(--news-accent);
  border: 1px solid rgba(29, 78, 216, 0.26);
  font-size: 0.76rem;
  font-weight: 900;
}

.daily-news-thinking,
.daily-news-quiz-list {
  margin-top: 14px;
  border-top: 1px solid rgba(23, 32, 51, 0.16);
  padding-top: 12px;
  color: var(--news-ink);
}

.daily-news-thinking strong,
.daily-news-quiz-list strong {
  color: var(--news-ink);
}

.daily-news-thinking p {
  margin: 5px 0 0;
  color: var(--news-ink);
  line-height: 1.5;
}

.daily-news-quiz {
  margin-top: 10px;
  padding: 10px;
  border-radius: 0;
  background: var(--news-paper-soft);
  border: 1px solid rgba(23, 32, 51, 0.14);
  color: var(--news-ink);
}

.daily-news-quiz-question {
  margin: 0 0 6px;
  color: var(--news-ink);
  font-weight: 900;
  line-height: 1.4;
}

.daily-news-quiz ol {
  margin: 0;
  padding-left: 20px;
  color: var(--news-ink);
  line-height: 1.5;
}

.daily-news-quiz details {
  margin-top: 8px;
  color: var(--news-muted);
  font-size: 0.86rem;
}

.daily-news-quiz summary,
.daily-news-quiz details p {
  color: var(--news-muted);
}

.daily-news-notice {
  margin: 12px 0 0;
  color: var(--news-muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .exchange-step-grid {
    grid-template-columns: 1fr;
  }

  .exchange-field-label input[type="number"] {
    max-width: none;
  }

  .holding-name-cell {
    min-width: 180px;
  }

  .holding-logo-wrap {
    width: 38px;
    height: 38px;
    flex-basis: 38px;
  }

  .holding-name {
    max-width: 130px;
    font-size: 0.87rem;
  }

  .holding-ticker {
    font-size: 0.7rem;
  }

  .daily-news-glossary dl {
    grid-template-columns: 1fr;
  }

  .daily-news-takeaway-row {
    grid-template-columns: 1fr;
  }

  .daily-news-paper-head {
    flex-direction: column;
  }

  .daily-news-date {
    align-self: flex-start;
  }

  .daily-news-card:first-child h3 {
    font-size: 1.32rem;
  }

  .daily-news-original-body {
    column-width: auto;
  }
}
