/* ============================================================
   LEVEL — huy hiệu cấp độ, thanh tiến trình EXP, modal điểm danh
   ============================================================ */

/* ---- Huy hiệu cấp độ (dùng ở hồ sơ, sidebar, bảng xếp hạng) ---- */
.lv-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 12px;
  line-height: 1;
  padding: 3px 8px;
  border-radius: 8px;
  color: #160F2E;
  background: var(--cyan);
  box-shadow: 0 2px 10px -3px rgba(var(--shadow-rgb), .5);
  white-space: nowrap;
  vertical-align: middle;
}
.lv-badge--sm { font-size: 10.5px; padding: 2px 6px; border-radius: 6px; }

/* Tên + huy hiệu trên sidebar nằm cùng hàng */
.sidebar__user-name { display: flex; align-items: center; gap: 6px; }

/* Top Level tính lifetime → ẩn hẳn bộ lọc thời gian (đè display:flex của .itabs) */
#rankPeriod[hidden] { display: none !important; }

/* ---- Bảng xếp hạng + bảng tính Level (2 cột) ---- */
/* Top Donate rộng 680px (#rank trong rank.css). Khi mở Top Level: nới màn vừa
   đủ để CHỪA chỗ bảng tính bên phải, còn LIST vẫn đúng 680px như Top Donate. */
#rank.is-level { max-width: 1002px; }   /* 680 (list) + 18 (gap) + 304 (guide) */

.rank-wrap { display: flex; gap: 18px; align-items: flex-start; }
.rank-wrap .rank-list { flex: 1 1 0; min-width: 0; max-width: 680px; }

.lv-guide {
  width: 304px;
  flex-shrink: 0;
  margin-top: 16px;                /* hạ xuống ngang đường border ô xếp hạng đầu tiên */
  background: linear-gradient(180deg, var(--surface2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 18px 18px 12px;
  position: sticky;
  top: 84px;
}
.lv-guide[hidden] { display: none; }
.lv-guide__head { font-size: 16px; font-weight: 800; }
.lv-guide__note { font-size: 12.5px; color: var(--faint); margin: 6px 0 14px; line-height: 1.5; }

.lv-guide__list { display: flex; flex-direction: column; }
.lv-tier {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 0;
  border-top: 1px solid var(--line-soft);
}
.lv-tier:first-child { border-top: 0; }
.lv-tier .lv-badge { width: 70px; justify-content: center; flex-shrink: 0; font-size: 12.5px; }
.lv-tier__name { flex: 1; font-size: 13.5px; color: var(--ink); font-weight: 600; }
.lv-tier__exp  { font-family: var(--font-mono); font-size: 13px; color: var(--gold); font-weight: 600; }

@media (max-width: 1100px) {
  .rank-wrap { flex-direction: column; }
  .lv-guide { width: 100%; position: static; margin-top: 0; }
}

/* Bậc danh hiệu (5 cấp/bậc) */
.lv-t1 { background: var(--cyan); }
.lv-t2 { background: var(--green); }
.lv-t3 { background: var(--pink);   color: var(--on-accent); }
.lv-t4 { background: var(--violet); color: var(--on-accent); }
.lv-t5 { background: var(--gold); }
.lv-t6 {
  background: linear-gradient(100deg, var(--pink), var(--gold), var(--cyan), var(--violet));
  background-size: 240% 100%;
  color: var(--on-accent);
  animation: lv-shine 4s linear infinite;
}
@keyframes lv-shine { to { background-position: 240% 0; } }

/* ---- Thanh tiến trình EXP trên hồ sơ ---- */
.lv-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0 2px;
  max-width: 360px;
}
.lv-bar__track {
  flex: 1;
  height: 8px;
  border-radius: 99px;
  background: var(--surface2);
  overflow: hidden;
  border: 1px solid var(--line-soft);
}
.lv-bar__fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--pink), var(--violet), var(--cyan));
  box-shadow: 0 0 12px -2px var(--violet);
  transition: width .5s var(--ease);
}
.lv-bar__txt { font-size: 11.5px; color: var(--muted); font-weight: 600; white-space: nowrap; }

/* ---- Nút điểm danh + chấm nhắc ---- */
.topbar__icon-btn--checkin { position: relative; }
.topbar__icon-btn--checkin:hover { border-color: var(--gold); }
.topbar__icon-btn--checkin.has-dot::after {
  content: "";
  position: absolute;
  top: 6px; right: 6px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--red);
  border: 2px solid var(--bg);
  animation: ci-pulse 1.4s ease-in-out infinite;
}
@keyframes ci-pulse { 50% { transform: scale(1.25); opacity: .7; } }

/* ---- Modal điểm danh ---- */
.ci-overlay {
  position: fixed; inset: 0;
  background: rgba(var(--scrim-rgb), .68);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  z-index: 200;
  animation: fade-in .2s ease;
  padding: 20px;
}
.ci {
  position: relative;
  width: min(440px, 100%);
  background: linear-gradient(180deg, var(--surface2), var(--surface));
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 22px 22px 18px;
  box-shadow: 0 24px 60px -18px rgba(var(--shadow-rgb), .7);
}
.ci__x {
  position: absolute; top: 12px; right: 12px;
  width: 30px; height: 30px;
  border: 0; border-radius: 9px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}
.ci__x:hover { color: var(--ink); background: var(--bg2); }
.ci__head { text-align: center; margin-bottom: 16px; }
.ci__title { font-size: 19px; font-weight: 800; }
.ci__sub { color: var(--muted); font-size: 13px; margin-top: 4px; }

.ci__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.ci-day {
  position: relative;
  border: 1px solid var(--line-soft);
  background: var(--surface);
  border-radius: 12px;
  padding: 10px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ci-day__n  { font-size: 11px; color: var(--faint); font-weight: 600; }
.ci-day__rw { font-family: var(--font-mono); font-weight: 700; font-size: 13px; color: var(--gold); }
.ci-day--big { background: linear-gradient(160deg, rgba(var(--gold-rgb), .16), var(--surface)); border-color: var(--gold); }
.ci-day--big .ci-day__rw { font-size: 14.5px; }

.ci-day.is-done { opacity: .65; }
.ci-day.is-done .ci-day__rw { color: var(--green); }
.ci-day__check {
  position: absolute; top: 4px; right: 6px;
  color: var(--green); font-weight: 800; font-size: 13px;
}
.ci-day.is-today {
  border-color: var(--pink);
  box-shadow: 0 0 0 2px rgba(var(--pink-rgb), .35), 0 8px 20px -8px var(--pink);
  transform: translateY(-2px);
}
/* Ngày 7 chiếm trọn 1 hàng cho nổi bật */
.ci-day--big { grid-column: span 4; flex-direction: row; justify-content: center; gap: 10px; align-items: center; }
.ci-day--big .ci-day__n { font-size: 12.5px; color: var(--gold); }

.ci__claim { margin-top: 2px; }
.ci__note { color: var(--faint); font-size: 11.5px; text-align: center; margin-top: 10px; line-height: 1.5; }

@media (max-width: 420px) {
  .ci__grid { grid-template-columns: repeat(3, 1fr); }
  .ci-day--big { grid-column: span 3; }
}

/* ---- AdminCP: cấu hình điểm danh ---- */
.ci-admin__toggle { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.ci-admin__toggle input { width: 18px; height: 18px; accent-color: var(--pink); }
.ci-admin__rewards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ci-admin__rw { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); }
.ci-admin__rw input { padding: 7px 8px; }
