/* ── Reset & Root ─────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

:root {
  --red:      #FF0000;
  --red-dark: #cc0000;
  --gold:     #FFCC00;
  --black:    #1a1a1a;
  --gray1:    #f6f6f6;
  --gray2:    #ebebeb;
  --gray3:    #cccccc;
  --gray4:    #999999;
  --text:     #1a1a1a;
  --muted:    #666666;
  --border:   #e2e2e2;
  --white:    #ffffff;
  --green:    #2a9d2a;
  --rose:     #cc0000;
  --col-grid: 52px 52px 1fr 170px 130px 160px 36px;
}

html { scroll-behavior: smooth; }

body {
  font-family: Rajdhani, sans-serif;
  background: var(--white);
  color: var(--text);
  min-height: 100vh;
}

/* ══════════════════════════════════════════════════════
   HEADER
══════════════════════════════════════════════════════ */
.wm-header {
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  position: sticky;
  top: 0;
  z-index: 100;
}

/* Logo bar */
.wm-header-middle { padding: 16px 0; border-bottom: 1px solid var(--border); }
.wm-header-middle-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wm-logo img { display: block; max-height: 64px; width: auto; }

/* Nav bar */
.wm-nav {
  background: var(--white);
  border-bottom: 3px solid var(--red);
}
.wm-nav-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}
.wm-nav-list {
  list-style: none;
  display: flex;
  gap: 0;
  justify-content: center;
}
.wm-nav-list > li { position: relative; }
.wm-nav-list > li > a {
  display: block;
  padding: 12px 18px;
  font-family: 'Rajdhani', Arial, sans-serif;
  font-size: 1.1rem;
  font-weight: 400;
  color: var(--black);
  text-decoration: none;
  letter-spacing: 0;
  text-transform: none;
  transition: color .15s, background .15s;
}
.wm-nav-list > li > a:hover,
.wm-nav-list > li > a.active { color: var(--red); }
.wm-nav-list > li > a.active { border-bottom: 3px solid var(--red); margin-bottom: -3px; }

/* Dropdown */
.wm-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-top: 2px solid var(--red);
  min-width: 200px;
  list-style: none;
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  z-index: 200;
}
.has-dropdown:hover .wm-dropdown { display: block; }
.wm-dropdown li a {
  display: block;
  padding: 9px 16px;
  font-family: 'Rajdhani', Arial, sans-serif;
  font-size: 0.95rem;
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--border);
}
.wm-dropdown li:last-child a { border-bottom: none; }
.wm-dropdown li a:hover { background: var(--gray1); color: var(--red); }

/* ══════════════════════════════════════════════════════
   HERO
══════════════════════════════════════════════════════ */
.wm-hero {
  position: relative;
  min-height: 560px;
  display: flex;
  align-items: flex-end;
  padding: 0 24px 48px;
  text-align: center;
  border-bottom: 4px solid var(--red);
  background: url('../../assets/image/teaser.webp') center center / cover no-repeat;
}
.wm-hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0.72) 100%);
}
.wm-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
}

.wm-hero-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 800;
  color: var(--white);
  line-height: 1.15;
  letter-spacing: -0.5px;
}
.wm-hero-sub {
  margin-top: 14px;
  color: var(--gray3);
  font-size: 0.95rem;
}
.wm-hero-updated {
  margin-top: 10px;
  font-size: 0.78rem;
  color: var(--gray4);
}

/* ══════════════════════════════════════════════════════
   CONTROLS
══════════════════════════════════════════════════════ */
.wm-controls-bar { display: none; }
.wm-controls-bar-hidden {
  background: var(--gray1);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.wm-controls-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: nowrap;
}
.search-wrap { flex: 1; min-width: 200px; position: relative; }
.search-wrap svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; stroke: var(--gray4); }
#search {
  width: 100%;
  padding: 8px 10px 8px 33px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 0.88rem;
  font-family: Rajdhani, sans-serif;
  outline: none;
  transition: border-color .2s;
}
#search:focus { border-color: var(--red); }
#search::placeholder { color: var(--gray4); }

.wm-select {
  padding: 8px 30px 8px 10px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 3px;
  color: var(--text);
  font-size: 0.88rem;
  font-family: Rajdhani, sans-serif;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M2 4l4 4 4-4' stroke='%23999' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  transition: border-color .2s;
}
.wm-select:focus { border-color: var(--red); }
.wm-select option { background: var(--white); }

.wm-btn-red {
  padding: 8px 16px;
  background: var(--red);
  border: none;
  border-radius: 3px;
  color: var(--white);
  font-size: 0.88rem;
  font-family: 'Rajdhani', Arial, sans-serif;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background .2s;
  white-space: nowrap;
}
.wm-btn-red:hover { background: var(--red-dark); }
.wm-btn-red:disabled { opacity: .4; cursor: not-allowed; }

/* ══════════════════════════════════════════════════════
   STATS
══════════════════════════════════════════════════════ */
.wm-stats-bar {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
}
.wm-stats-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
}
.wm-stat { display: flex; flex-direction: column; gap: 2px; }
.wm-stat-label {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  font-family: 'Rajdhani', Arial, sans-serif;
}
.wm-stat-value {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--red);
  font-family: 'Rajdhani', Arial, sans-serif;
}

/* ══════════════════════════════════════════════════════
   TABLE HEADER
══════════════════════════════════════════════════════ */
.wm-table-header {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
  display: grid;
  grid-template-columns: var(--col-grid);
  border-bottom: 2px solid var(--red);
  padding-top: 16px;
  padding-bottom: 6px;
  background: var(--white);
}
.wm-th {
  font-size: 0.68rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  font-family: 'Rajdhani', Arial, sans-serif;
  font-weight: 700;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px 4px 0;
  transition: color .15s;
}
.wm-th:hover { color: var(--red); }
.wm-th.sorted { color: var(--red); }
.wm-th .sort-icon { font-size: 0.68rem; opacity: .7; }

/* ══════════════════════════════════════════════════════
   LIST
══════════════════════════════════════════════════════ */
.wm-list-wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px 48px;
  background: var(--white);
}

/* ── Card wrapper ── */
.card-wrapper { border-bottom: 1px solid var(--border); }
.card-wrapper:last-child { border-bottom: none; }

/* ── Card row ── */
.card {
  display: grid;
  grid-template-columns: var(--col-grid);
  align-items: center;
  padding: 11px 0;
  cursor: pointer;
  transition: background .12s;
}
.card:hover { background: var(--gray1); }
.card.open   { background: #fff8f8; }

/* Rank */
.card-rank { padding: 0 8px; text-align: center; }
.rank-num  {
  font-size: 1rem;
  font-weight: 700;
  color: var(--red);
  font-family: 'Rajdhani', Arial, sans-serif;
  line-height: 1;
}

/* Photo */
.card-photo { padding: 0 8px; }
.photo-img {
  width: 38px; height: 38px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 2px solid var(--border);
}
.photo-placeholder {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--gray2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--red);
  font-family: 'Rajdhani', Arial, sans-serif;
  letter-spacing: .5px;
  border: 2px solid var(--border);
}

/* Person */
.card-person { padding: 0 12px 0 0; }
.person-name {
  font-size: 0.93rem;
  font-weight: 600;
  color: var(--black);
  line-height: 1.3;
  font-family: Rajdhani, sans-serif;
}
.person-source { font-size: 0.77rem; color: var(--muted); margin-top: 2px; }
.person-name-link {
  color: inherit;
  text-decoration: none;
}
.person-name-link:hover { color: var(--red); text-decoration: underline; }

/* Worth */
.card-worth { padding: 0 8px 0 0; }
.worth-main {
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--black);
  font-family: 'Rajdhani', Arial, sans-serif;
}
.worth-change { font-size: 0.74rem; margin-top: 2px; font-family: Rajdhani, sans-serif; }
.worth-change.pos { color: var(--green); }
.worth-change.neg { color: var(--rose); }
.worth-change.neu { color: var(--muted); }

/* Country / Industry */
.card-country, .card-industry {
  font-size: 0.83rem;
  color: var(--muted);
  padding: 0 8px 0 0;
}

/* Toggle */
.card-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gray3);
  font-size: 1.1rem;
  font-weight: 400;
  transition: transform .22s, color .15s;
}
.card.open .card-toggle { color: var(--red); transform: rotate(90deg); }

/* ══════════════════════════════════════════════════════
   DETAIL PANEL
══════════════════════════════════════════════════════ */
.detail-panel {
  display: none;
  background: #fffdf5;
  border-top: 1px solid var(--border);
  border-left: 3px solid var(--red);
  padding: 24px 20px 28px 24px;
  animation: slideDown .18s ease;
}
.detail-panel.open { display: block; }

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

.detail-inner {
  max-width: 880px;
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 24px;
  align-items: start;
}

.detail-profile { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.detail-photo {
  width: 72px; height: 72px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--red);
  display: block;
}
.detail-photo-placeholder {
  width: 72px; height: 72px;
  border-radius: 50%;
  background: var(--gray2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--red);
  font-family: 'Rajdhani', Arial, sans-serif;
  border: 2px solid var(--red);
}

.detail-content { min-width: 0; }
.detail-bio {
  font-size: 0.87rem;
  color: var(--muted);
  line-height: 1.65;
  margin-bottom: 20px;
  max-width: 660px;
}

.chart-section-title {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--gray4);
  font-family: 'Rajdhani', Arial, sans-serif;
  font-weight: 700;
  margin-bottom: 10px;
}
.sparkline { display: block; width: 100%; max-width: 640px; height: auto; overflow: visible; }

.chart-summary {
  margin-top: 10px;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}
.chart-stat { font-size: 0.8rem; }
.chart-stat strong { font-family: 'Rajdhani', Arial, sans-serif; font-size: 0.9rem; }
.chart-stat.up   strong { color: var(--green); }
.chart-stat.down strong { color: var(--rose); }
.chart-stat      strong { color: var(--black); }

.detail-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  color: var(--muted);
  font-size: 0.87rem;
}
.detail-error { padding: 12px 0; color: var(--rose); font-size: 0.87rem; }
.no-history { font-size: 0.84rem; color: var(--gray4); padding: 8px 0; }

/* ══════════════════════════════════════════════════════
   CHART TOOLTIP
══════════════════════════════════════════════════════ */
.chart-tooltip {
  position: fixed;
  display: none;
  background: var(--black);
  border: 1px solid #333;
  border-left: 3px solid var(--gold);
  border-radius: 3px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--white);
  pointer-events: none;
  z-index: 300;
  line-height: 1.5;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  white-space: nowrap;
}
.chart-tooltip strong { color: var(--gold); display: block; font-family: 'Rajdhani', Arial, sans-serif; font-size: 0.9rem; }

/* ══════════════════════════════════════════════════════
   SPINNER & PAGE STATES
══════════════════════════════════════════════════════ */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

.state-box { text-align: center; padding: 80px 24px; }
.state-box .spinner { width: 40px; height: 40px; border-width: 3px; margin: 0 auto 16px; }
.state-box p { color: var(--muted); }
.error-icon  { font-size: 2.5rem; margin-bottom: 12px; }
.error-msg   { color: var(--rose); font-size: 1rem; margin-bottom: 8px; }
.retry-btn   {
  margin-top: 16px;
  padding: 10px 20px;
  background: var(--red);
  border: none;
  border-radius: 3px;
  color: var(--white);
  font-size: 0.9rem;
  font-family: 'Rajdhani', Arial, sans-serif;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  cursor: pointer;
}
.empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }
.empty-state .icon { font-size: 2rem; margin-bottom: 12px; }

/* ══════════════════════════════════════════════════════
   FOOTER
══════════════════════════════════════════════════════ */
.wm-footer {
  background: var(--black);
  color: var(--white);
  margin-top: 0;
}
.wm-footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 24px;
}
.wm-footer-logo-row {
  padding: 32px 0 24px;
}
.wm-footer-logo-row img { display: block; max-height: 36px; width: auto; }
.wm-footer-divider {
  height: 1px;
  background: #333;
}
.wm-footer-menu-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 14px 0;
  border-bottom: 1px solid #2a2a2a;
  flex-wrap: wrap;
}
.wm-footer-menu-label {
  font-family: 'Rajdhani', Arial, sans-serif;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--white);
  white-space: nowrap;
  min-width: 140px;
}
.wm-footer-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}
.wm-footer-menu a {
  font-family: 'Rajdhani', Arial, sans-serif;
  font-size: 0.95rem;
  color: var(--gold);
  text-decoration: none;
  padding: 1px 10px;
  transition: color .15s;
}
.wm-footer-menu a:hover { color: var(--red); }

.wm-footer-bottom {
  padding: 18px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.wm-footer-legal { display: flex; gap: 16px; flex-wrap: wrap; }
.wm-footer-legal a {
  font-size: 0.8rem;
  color: var(--gray4);
  text-decoration: none;
  transition: color .15s;
}
.wm-footer-legal a:hover { color: var(--gold); }
.wm-footer-copy { font-size: 0.78rem; color: var(--gray4); }

/* ══════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════ */
@media (max-width: 1000px) {
  :root { --col-grid: 46px 46px 1fr 130px 0 0 32px; }
  .card-country, .card-industry,
  .wm-th:nth-child(5), .wm-th:nth-child(6) { display: none; }
  .detail-inner { grid-template-columns: 1fr; }
  .wm-footer-menu-label { min-width: 100px; }
}
@media (max-width: 640px) {
  :root { --col-grid: 42px 42px 1fr 110px 32px; }
  .wm-nav-list > li > a { padding: 8px 10px; font-size: 0.9rem; }
  .wm-hero-title { font-size: 1.8rem; }
  .wm-footer-menu-row { flex-direction: column; gap: 6px; }
  .wm-footer-menu-label { min-width: auto; }
  .wm-footer-bottom { flex-direction: column; align-items: flex-start; }
}
