/* =====================================================================
   LiGaMu Statistik Dashboard — Playful Style
   v1.0 · 31 Mei 2026
   ===================================================================== */

.stats-page {
  font-family: var(--font-sans, 'Plus Jakarta Sans', system-ui, sans-serif);
  color: var(--ink, #1a1a1a);
  max-width: 1100px;
  margin: 0 auto;
}

/* ============ HEADER ============ */
.stats-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
}
.stats-greeting {
  font-size: 0.875rem;
  color: var(--ink-mute, #6b7280);
  margin-bottom: 4px;
}
.stats-title {
  font-family: var(--font-serif, 'Lora', Georgia, serif);
  font-size: 2rem;
  font-weight: 500;
  margin: 0 0 4px 0;
  color: #1B4D3E;
  letter-spacing: -0.5px;
}
.stats-sub {
  font-size: 0.9375rem;
  color: var(--ink-soft, #4b5563);
  margin: 0;
}
.stats-live {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: rgba(22, 163, 74, 0.1);
  border-radius: 999px;
  color: #16a34a;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.stats-live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #16a34a;
  animation: stats-pulse 1.6s ease-in-out infinite;
}
@keyframes stats-pulse {
  0%, 100% { opacity: 1; transform: scale(1); box-shadow: 0 0 0 0 rgba(22,163,74,0.5); }
  50% { opacity: 0.7; transform: scale(1.4); box-shadow: 0 0 0 8px rgba(22,163,74,0); }
}

/* ============ HERO GRID (2 BIG CARDS) ============ */
.stats-hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-bottom: 1rem;
}
.stats-hero-card {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  padding: 1.75rem;
  color: #fff;
  isolation: isolate;
}
.stats-hero-green {
  background: linear-gradient(135deg, #1B4D3E 0%, #2d6b5a 100%);
}
.stats-hero-purple {
  background: linear-gradient(135deg, #7C3AED 0%, #9d5dff 100%);
}
.stats-hero-label {
  font-size: 0.75rem;
  opacity: 0.85;
  margin-bottom: 8px;
  letter-spacing: 1px;
  font-weight: 500;
}
.stats-hero-label i { font-size: 14px; vertical-align: -2px; margin-right: 4px; }
.stats-hero-num {
  font-size: 3rem;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  font-family: var(--font-serif, 'Lora', Georgia, serif);
}
.stats-hero-sub {
  font-size: 0.8125rem;
  opacity: 0.85;
  margin-top: 10px;
}
.stats-hero-bg-icon {
  position: absolute;
  right: -16px;
  bottom: -16px;
  font-size: 140px;
  opacity: 0.08;
  z-index: -1;
}

/* ============ MINI COUNTERS (4) ============ */
.stats-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 1.5rem;
}
.stats-mini {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  padding: 1rem 1.125rem;
  transition: transform 0.15s, box-shadow 0.15s;
}
.stats-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
}
.stats-mini-label {
  font-size: 0.75rem;
  color: var(--ink-mute, #6b7280);
  margin-bottom: 6px;
}
.stats-mini-label i { font-size: 13px; vertical-align: -2px; margin-right: 4px; }
.stats-mini-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.stats-mini-num {
  font-size: 1.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--ink, #1a1a1a);
}
.stats-mini-delta {
  font-size: 0.6875rem;
  white-space: nowrap;
}
.stats-up { color: #16a34a; font-weight: 500; }
.stats-mute { color: var(--ink-mute, #6b7280); }

/* ============ CARD WRAPPER ============ */
.stats-card {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 14px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
}
.stats-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 12px;
  flex-wrap: wrap;
  gap: 6px;
}
.stats-card-head h3 {
  font-size: 1.0625rem;
  font-weight: 600;
  margin: 0;
  color: #1B4D3E;
}
.stats-card-sub {
  font-size: 0.75rem;
  color: var(--ink-mute, #6b7280);
}

.stats-grid-2col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 14px;
  margin-bottom: 1rem;
}

/* ============ CHART ============ */
.stats-chart-wrap {
  position: relative;
  width: 100%;
}
.stats-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.75rem;
  color: var(--ink-soft, #4b5563);
  margin-bottom: 8px;
}
.stats-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.stats-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  display: inline-block;
}

/* ============ DISTRICT INSIGHTS ============ */
.stats-insight-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}
.stats-insight-pill {
  background: linear-gradient(135deg, #f7faf8, #eef7f2);
  border: 1px solid rgba(27,77,62,0.08);
  border-radius: 999px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
}
.stats-insight-label {
  font-size: 0.72rem;
  color: var(--ink-mute, #6b7280);
}
.stats-insight-pill strong {
  font-size: 0.8125rem;
  color: #1B4D3E;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats-chart-note {
  margin-top: 10px;
  font-size: 0.75rem;
  color: var(--ink-mute, #6b7280);
}

/* ============ ACTIVITY FEED ============ */
.stats-activity {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 4px;
}
.stats-activity::-webkit-scrollbar { width: 4px; }
.stats-activity::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.1); border-radius: 2px; }
.stats-activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.8125rem;
  line-height: 1.45;
}
.stats-activity-icon {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.stats-act-green { background: rgba(22, 163, 74, 0.12); color: #16a34a; }
.stats-act-purple { background: rgba(124, 58, 237, 0.12); color: #7C3AED; }
.stats-act-blue { background: rgba(8, 145, 178, 0.12); color: #0891b2; }
.stats-act-amber { background: rgba(217, 119, 6, 0.12); color: #d97706; }
.stats-activity-body { flex: 1; min-width: 0; }
.stats-activity-time {
  font-size: 0.6875rem;
  color: var(--ink-mute, #6b7280);
  margin-top: 2px;
}
.stats-activity-empty {
  text-align: center;
  padding: 1.5rem 1rem;
  color: var(--ink-mute, #6b7280);
}
.stats-activity-empty i {
  font-size: 32px;
  opacity: 0.5;
  margin-bottom: 8px;
  display: block;
}
.stats-activity-empty p {
  font-size: 0.8125rem;
  margin: 0;
  line-height: 1.5;
}

/* ============ POPULAR BOOKS LIST ============ */
.stats-popular-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.stats-popular-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fafafa;
  text-decoration: none;
  color: var(--ink, #1a1a1a);
  transition: background 0.15s, transform 0.15s;
}
.stats-popular-item:hover {
  background: #f3f4f6;
  transform: translateX(3px);
}
.stats-popular-rank {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #1B4D3E;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8125rem;
  font-weight: 600;
  flex-shrink: 0;
}
.stats-popular-body { flex: 1; min-width: 0; }
.stats-popular-title {
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.stats-popular-meta {
  font-size: 0.75rem;
  color: var(--ink-mute, #6b7280);
  margin-top: 2px;
}
.stats-popular-meta i { font-size: 11px; vertical-align: -1px; margin-right: 2px; }
.stats-popular-chevron {
  color: var(--ink-mute, #6b7280);
  flex-shrink: 0;
  font-size: 18px;
}

/* ============ DIGITAL SERVICES (3 CARDS) ============ */
.stats-digital-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.stats-digital-card {
  background: linear-gradient(135deg, #fafafa, #f3f4f6);
  border-radius: 12px;
  padding: 1.125rem;
}
.stats-digital-label {
  font-size: 0.75rem;
  color: var(--ink-mute, #6b7280);
  margin-bottom: 6px;
}
.stats-digital-label i { font-size: 13px; vertical-align: -2px; margin-right: 4px; }
.stats-digital-num {
  font-size: 1.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #1B4D3E;
  font-family: var(--font-serif, 'Lora', Georgia, serif);
}
.stats-digital-sub {
  font-size: 0.6875rem;
  color: var(--ink-mute, #6b7280);
  margin-top: 4px;
}

/* ============ ACHIEVEMENTS ============ */
.stats-achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.stats-achievement {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 12px;
  transition: transform 0.15s;
}
.stats-achievement:hover {
  transform: translateY(-2px);
}
.stats-ach-green { background: rgba(27, 77, 62, 0.07); }
.stats-ach-purple { background: rgba(124, 58, 237, 0.07); }
.stats-ach-amber { background: rgba(212, 165, 116, 0.10); }
.stats-ach-blue { background: rgba(8, 145, 178, 0.07); }
.stats-achievement-icon {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}
.stats-achievement-title {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ink, #1a1a1a);
}
.stats-achievement-sub {
  font-size: 0.6875rem;
  color: var(--ink-mute, #6b7280);
  margin-top: 2px;
}

/* ============ FOOTER ============ */
.stats-footer {
  text-align: center;
  padding: 1.5rem 0;
  font-size: 0.75rem;
  color: var(--ink-mute, #6b7280);
}
.stats-footer i { vertical-align: -2px; margin-right: 4px; }

/* ============ RESPONSIVE ============ */
@media (max-width: 768px) {
  .stats-title { font-size: 1.5rem; }
  .stats-hero-num { font-size: 2.25rem; }
  .stats-mini-num { font-size: 1.25rem; }
  .stats-heatmap { grid-template-columns: repeat(13, 1fr); gap: 2px; }
  .stats-card { padding: 1rem; }
}

/* ============ MEMBER PROFILE PLUS ============ */
.stats-section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  margin: 0 0 12px 0;
  border-radius: 999px;
  background: rgba(27, 77, 62, 0.08);
  color: #1B4D3E;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.stats-section-kicker i {
  font-size: 15px;
}
.stats-rank-list {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.stats-rank-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.stats-rank-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.875rem;
}
.stats-rank-head span {
  color: var(--ink, #1a1a1a);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stats-rank-head strong {
  color: #1B4D3E;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.stats-rank-track {
  width: 100%;
  height: 9px;
  border-radius: 999px;
  background: #edf3ef;
  overflow: hidden;
}
.stats-rank-track span {
  display: block;
  height: 100%;
  min-width: 5px;
  border-radius: inherit;
  background: linear-gradient(90deg, #1B4D3E, #43b390);
}
.stats-rank-list-soft .stats-rank-track span {
  background: linear-gradient(90deg, #D4A574, #1B4D3E);
}

@media (max-width: 768px) {
  .stats-section-kicker {
    margin-left: 2px;
  }
  .stats-rank-head {
    font-size: 0.8125rem;
  }
}

/* ============ COLLECTION PROFILE PLUS ============ */
.stats-collection-overview {
  background: linear-gradient(135deg, #ffffff 0%, #f7fbf8 100%);
}
.stats-collection-metrics .stats-digital-card {
  border: 1px solid rgba(27, 77, 62, 0.08);
  background: linear-gradient(135deg, #fbfdfb, #f1f8f4);
}
.stats-rank-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.stats-rank-card {
  padding: 13px;
  border-radius: 12px;
  background: linear-gradient(135deg, #fafafa, #f3f7f4);
  border: 1px solid rgba(27, 77, 62, 0.07);
}
.stats-rank-card .stats-rank-head span {
  white-space: normal;
  line-height: 1.35;
}

@media (max-width: 768px) {
  .stats-rank-grid {
    grid-template-columns: 1fr;
  }
}

/* ============ DIGITAL & OPEN ACCESS PLUS ============ */
.stats-digital-open-card {
  background: linear-gradient(135deg, #ffffff 0%, #f7fbff 45%, #f9f6ef 100%);
  border-color: rgba(27, 77, 62, 0.08);
}
.stats-digital-plus-grid .stats-digital-card {
  border: 1px solid rgba(27, 77, 62, 0.08);
  background: linear-gradient(135deg, #fbfdfb, #f3f7ff);
}
.stats-digital-plus-grid .stats-digital-card:nth-child(2) {
  background: linear-gradient(135deg, #fbfdfb, #edf9f1);
}
.stats-digital-plus-grid .stats-digital-card:nth-child(3) {
  background: linear-gradient(135deg, #fffdf8, #fff7e8);
}
.stats-digital-plus-grid .stats-digital-card:nth-child(4) {
  background: linear-gradient(135deg, #f7fffb, #eef9ff);
}

/* ============ INSIGHT & REKOMENDASI ============ */
.stats-insight-panel {
  position: relative;
  overflow: hidden;
  border-radius: 18px;
  padding: 1.25rem;
  margin: 1.25rem 0;
  background:
    radial-gradient(circle at top right, rgba(212, 165, 116, 0.18), transparent 32%),
    linear-gradient(135deg, rgba(27, 77, 62, 0.07), rgba(255, 255, 255, 0.98));
  border: 1px solid rgba(27, 77, 62, 0.12);
  box-shadow: 0 10px 24px rgba(27, 77, 62, 0.07);
}
.stats-insight-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}
.stats-insight-head h3 {
  margin: 0 0 4px 0;
  font-family: var(--font-serif, 'Lora', Georgia, serif);
  font-size: 1.25rem;
  color: #1B4D3E;
  font-weight: 600;
}
.stats-insight-head p {
  margin: 0;
  color: var(--ink-mute, #6b7280);
  font-size: .86rem;
  max-width: 680px;
}
.stats-insight-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.stats-soft-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(27, 77, 62, 0.16);
  background: rgba(255,255,255,.85);
  color: #1B4D3E;
  border-radius: 999px;
  padding: 8px 12px;
  font-size: .78rem;
  font-weight: 650;
  cursor: pointer;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.stats-soft-btn:hover {
  transform: translateY(-1px);
  background: #fff;
  box-shadow: 0 8px 18px rgba(27,77,62,.08);
}
.stats-insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.stats-insight-card {
  display: flex;
  gap: 12px;
  padding: 14px;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(27, 77, 62, 0.08);
  border-radius: 14px;
}
.stats-insight-icon {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 22px;
}
.stats-insight-body span {
  display: inline-flex;
  margin-bottom: 4px;
  color: var(--ink-mute, #6b7280);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.stats-insight-body h4 {
  margin: 0 0 6px 0;
  font-size: .95rem;
  color: var(--ink, #1a1a1a);
  line-height: 1.3;
}
.stats-insight-body p {
  margin: 0;
  font-size: .79rem;
  color: var(--ink-soft, #4b5563);
  line-height: 1.55;
}
.stats-insight-green .stats-insight-icon { color: #1B4D3E; background: rgba(27,77,62,.10); }
.stats-insight-blue .stats-insight-icon { color: #0e7490; background: rgba(8,145,178,.10); }
.stats-insight-amber .stats-insight-icon { color: #a16207; background: rgba(212,165,116,.18); }
.stats-insight-purple .stats-insight-icon { color: #7c3aed; background: rgba(124,58,237,.10); }
.stats-recommend-box {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(27,77,62,.88);
  color: #fff;
}
.stats-recommend-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  margin-bottom: 8px;
}
.stats-recommend-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
}
.stats-recommend-item {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  font-size: .82rem;
  line-height: 1.45;
}
.stats-recommend-item i { color: #d4a574; margin-top: 2px; flex: 0 0 auto; }
@media print {
  header, .site-header, .mobile-bottom-nav, .chat-widget, .stats-live, .stats-insight-actions, footer, .site-footer { display: none !important; }
  body { background: #fff !important; }
  .stats-page { max-width: none; padding: 0 !important; }
  .stats-card, .stats-insight-panel { box-shadow: none !important; break-inside: avoid; }
}
@media (max-width: 768px) {
  .stats-insight-head { flex-direction: column; }
  .stats-insight-actions { justify-content: flex-start; }
  .stats-insight-panel { padding: 1rem; }
}
