/* ============================================================
   Leaderboard + Dashboard Styles
   ============================================================ */

/* ============================================================
   TABS (leaderboard filter)
   ============================================================ */
.tab-row {
  display: flex; gap: .5rem; flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
  padding: .4rem;
  background: #fff;
  border: 1.5px solid var(--g200);
  border-radius: 99px;
  box-shadow: var(--sm);
  max-width: fit-content;
  margin-left: auto; margin-right: auto;
}
.tab {
  background: transparent; border: none; cursor: pointer;
  font-family: var(--font); font-weight: 700; font-size: .88rem;
  color: var(--mute);
  padding: 8px 18px; border-radius: 99px;
  transition: all .25s;
}
.tab:hover { color: var(--g700); }
.tab.active {
  background: linear-gradient(135deg, var(--g400), var(--g500));
  color: #fff;
  box-shadow: 0 4px 12px rgba(93,167,120,.3);
}

/* Secondary filter row (province/school) */
.filter-row {
  display: flex; gap: .7rem; flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 1.5rem;
}
.filter-row select {
  padding: .65rem 1.1rem;
  border: 1.5px solid var(--g300);
  border-radius: 99px;
  background: #fff;
  font-family: var(--font-body);
  font-size: .9rem; color: var(--ink);
  cursor: pointer;
  min-width: 200px;
}
.filter-row select:focus {
  outline: none;
  border-color: var(--g500);
  box-shadow: 0 0 0 3px rgba(93,167,120,.15);
}

/* ============================================================
   PODIUM (top 3)
   ============================================================ */
.podium {
  display: grid;
  grid-template-columns: 1fr 1.2fr 1fr;
  gap: 1rem;
  max-width: 720px;
  margin: 2rem auto;
  align-items: end;
}
@media (max-width: 640px) { .podium { grid-template-columns: 1fr; gap: .8rem; } }

.podium-spot {
  background: #fff;
  border: 2px solid;
  border-radius: 20px;
  padding: 1.3rem 1rem;
  text-align: center;
  position: relative;
  transition: transform .25s;
  animation: popUp .4s cubic-bezier(.34,1.56,.64,1) backwards;
}
@keyframes popUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}
.podium-spot:hover { transform: translateY(-4px); }

.podium-1 {
  border-color: #FFD700;
  background: linear-gradient(135deg, #FFFBE6, #fff);
  padding-top: 2rem;
  animation-delay: .3s;
  transform: translateY(-10px);
}
.podium-1:hover { transform: translateY(-14px); }

.podium-2 {
  border-color: #C0C0C0;
  background: linear-gradient(135deg, #F8F8F8, #fff);
  animation-delay: .1s;
}
.podium-3 {
  border-color: #CD7F32;
  background: linear-gradient(135deg, #FDF5EC, #fff);
  animation-delay: .5s;
}

.podium-spot .crown {
  font-size: 2.4rem; margin-bottom: .3rem;
  display: inline-block;
  animation: float-gentle 2.5s ease-in-out infinite;
}
.podium-1 .crown { font-size: 3rem; }
@keyframes float-gentle { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-6px)} }

.podium-spot .rank-num {
  font-family: var(--font); font-weight: 900;
  font-size: 1.3rem;
  background: linear-gradient(135deg, var(--g600), var(--au500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  margin-bottom: .3rem;
}
.podium-spot .p-name {
  font-family: var(--font); font-weight: 700;
  color: var(--g700); font-size: 1rem;
  margin-bottom: .3rem;
  line-height: 1.3;
}
.podium-spot .p-school {
  font-size: .78rem; color: var(--mute);
  margin-bottom: .6rem;
  line-height: 1.4;
  overflow: hidden; display: -webkit-box;
  -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.podium-spot .p-score {
  font-family: var(--font); font-weight: 800;
  font-size: 1.6rem;
  background: linear-gradient(135deg, var(--g600), var(--au500));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.podium-spot .p-score em {
  font-style: normal; color: var(--mute);
  font-weight: 600; font-size: .78rem;
}

/* ============================================================
   LEADERBOARD TABLE
   ============================================================ */
.lb-card {
  background: #fff;
  border: 1.5px solid var(--g200);
  border-radius: 20px;
  padding: 1rem;
  box-shadow: var(--sm);
  overflow: hidden;
}
.lb-table {
  width: 100%; border-collapse: collapse;
  font-size: .9rem;
}
.lb-table thead th {
  font-family: var(--font); font-weight: 700;
  color: var(--g700); font-size: .82rem;
  text-align: left;
  padding: .9rem .8rem;
  background: linear-gradient(135deg, var(--g50), var(--au50));
  border-bottom: 2px dashed var(--g300);
  white-space: nowrap;
}
.lb-table thead th:first-child { border-top-left-radius: 12px; }
.lb-table thead th:last-child  { border-top-right-radius: 12px; text-align: center; }
.lb-table tbody td {
  padding: .8rem;
  border-bottom: 1px solid var(--g100);
  color: var(--ink);
}
.lb-table tbody tr {
  transition: background .2s;
}
.lb-table tbody tr:hover {
  background: var(--g50);
}
.lb-table tbody tr.highlight {
  background: linear-gradient(90deg, var(--au100), transparent);
  border-left: 4px solid var(--au500);
}
.lb-table tbody tr:last-child td { border-bottom: none; }

.lb-rank {
  font-family: var(--font); font-weight: 800;
  color: var(--g700);
  width: 60px;
}
.lb-rank-1 { color: #E3A32E; font-size: 1.1rem; }
.lb-rank-2 { color: #888; font-size: 1.05rem; }
.lb-rank-3 { color: #CD7F32; font-size: 1.05rem; }

.lb-name {
  font-weight: 600;
  color: var(--ink);
}
.lb-name .lb-attempts {
  display: inline-block;
  background: var(--au100);
  color: var(--au700);
  padding: 1px 7px; border-radius: 99px;
  font-size: .7rem; font-family: var(--font);
  font-weight: 700; margin-left: 6px;
}
.lb-school, .lb-province {
  color: var(--mute); font-size: .83rem;
}
.lb-score {
  font-family: var(--font); font-weight: 800;
  color: var(--g700); text-align: center;
  font-size: 1rem;
}
.lb-score-sub {
  color: var(--mute); font-size: .72rem;
  font-weight: 600; display: block;
}

/* responsive table -> cards on mobile */
@media (max-width: 720px) {
  .lb-table thead { display: none; }
  .lb-table tbody tr {
    display: block; margin-bottom: .8rem;
    background: #fff;
    border: 1.5px solid var(--g200);
    border-radius: 14px;
    padding: .8rem 1rem;
  }
  .lb-table tbody tr.highlight {
    border-color: var(--au400);
    background: linear-gradient(135deg, var(--au50), #fff);
  }
  .lb-table tbody tr:hover { background: #fff; }
  .lb-table tbody td {
    display: flex; justify-content: space-between;
    padding: .3rem 0; border-bottom: none;
  }
  .lb-table tbody td::before {
    content: attr(data-label);
    font-family: var(--font); font-weight: 700;
    color: var(--g700); font-size: .78rem;
  }
  .lb-table td.lb-rank {
    width: auto;
    border-bottom: 1px dashed var(--g200) !important;
    padding-bottom: .5rem; margin-bottom: .3rem;
  }
  .lb-table td.lb-rank::before { content: 'อันดับ'; }
  .lb-score { text-align: right; }
}

/* ============================================================
   DASHBOARD (chart blocks)
   ============================================================ */
.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0;
}
.dash-card {
  background: #fff;
  border: 1.5px solid var(--g200);
  border-radius: 20px;
  padding: 1.4rem;
  box-shadow: var(--sm);
  transition: all .25s;
}
.dash-card:hover {
  border-color: var(--g400);
  box-shadow: var(--md);
}
.dash-card h3 {
  font-family: var(--font); font-weight: 700; font-size: 1rem;
  color: var(--g700); margin-bottom: 1rem;
  display: flex; align-items: center; gap: 8px;
}
.dash-card .ic {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, var(--g100), var(--au100));
  display: grid; place-items: center; font-size: 1.1rem;
}
.dash-chart { position: relative; height: 260px; }

.dash-card.span-2 { grid-column: span 2; }
@media (max-width: 860px) { .dash-card.span-2 { grid-column: span 1; } }

/* Top list inside dash card */
.top-list {
  list-style: none;
  display: flex; flex-direction: column; gap: .5rem;
}
.top-list li {
  display: flex; align-items: center; gap: 10px;
  padding: .6rem .8rem;
  background: linear-gradient(135deg, var(--g50), #fff);
  border: 1px solid var(--g200);
  border-radius: 12px;
  font-size: .88rem;
}
.top-list li .tl-rank {
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(135deg, var(--g400), var(--g500));
  color: #fff;
  display: grid; place-items: center;
  font-family: var(--font); font-weight: 800; font-size: .8rem;
  flex-shrink: 0;
}
.top-list li:nth-child(1) .tl-rank {
  background: linear-gradient(135deg, #FFD700, #FFA500);
}
.top-list li:nth-child(2) .tl-rank {
  background: linear-gradient(135deg, #C0C0C0, #888);
}
.top-list li:nth-child(3) .tl-rank {
  background: linear-gradient(135deg, #CD7F32, #A0522D);
}
.top-list .tl-name {
  flex: 1;
  font-weight: 600; color: var(--ink);
}
.top-list .tl-val {
  font-family: var(--font); font-weight: 800; color: var(--g700);
}

/* dream school popular */
.dream-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .7rem;
}
.dream-card {
  background: linear-gradient(135deg, #fff, var(--au50));
  border: 1.5px dashed var(--au400);
  border-radius: 14px;
  padding: .8rem 1rem;
  text-align: center;
}
.dream-card .dc-name {
  font-family: var(--font); font-weight: 700;
  color: var(--g700); font-size: .92rem;
  line-height: 1.3; margin-bottom: .3rem;
}
.dream-card .dc-count {
  color: var(--au700);
  font-family: var(--font); font-weight: 700;
  font-size: 1.3rem;
}
.dream-card .dc-lbl {
  color: var(--mute); font-size: .74rem;
}
