/* ==================================================================
   KenaliDiri.id — Packages Design System
   Extend dari shared.css. Untuk halaman paket, path Duolingo-style,
   gamifikasi (XP, streak, badge).
   ================================================================== */

/* ==================================================================
   GROUP HEADER (8 Kelompok Besar)
   ================================================================== */
.pkg-group-section {
  margin-bottom: 56px;
}
.pkg-group-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--line-soft);
}
.pkg-group-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: var(--group-bg, var(--terracotta-light));
  flex-shrink: 0;
}
.pkg-group-titles h2 {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 700;
  margin: 0 0 4px 0;
  color: var(--ink);
}
.pkg-group-titles p {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0;
  font-style: italic;
}

/* ==================================================================
   PACKAGE CARD (Kartu Paket)
   ================================================================== */
.pkg-card {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--r-xl);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: all .25s ease;
  position: relative;
  overflow: hidden;
  min-height: 100%;
}
.pkg-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 5px;
  background: var(--pkg-color, var(--terracotta));
}
.pkg-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--pkg-color, var(--terracotta));
  color: inherit;
}

.pkg-card-icon {
  font-size: 36px;
  line-height: 1;
  margin-bottom: 4px;
}
.pkg-card-name {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  line-height: 1.25;
}
.pkg-card-tagline {
  font-size: 13px;
  color: var(--pkg-color, var(--terracotta));
  font-style: italic;
  margin: 0;
}
.pkg-card-description {
  font-size: 13px;
  color: var(--ink-mid);
  line-height: 1.55;
  flex-grow: 1;
}

.pkg-card-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 14px;
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  font-size: 12px;
  color: var(--ink-soft);
}
.pkg-card-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.pkg-card-status {
  position: absolute;
  top: 14px;
  right: 14px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  letter-spacing: 0.04em;
}
.pkg-status-active    { background: var(--sage-light);       color: var(--sage);       border: 1px solid var(--sage); }
.pkg-status-completed { background: var(--blue-light);       color: var(--blue);       border: 1px solid var(--blue); }
.pkg-status-new       { background: var(--terracotta-light); color: var(--terracotta); border: 1px solid var(--terracotta); }

/* Progress bar mini di card */
.pkg-card-progress {
  height: 4px;
  background: var(--line-soft);
  border-radius: 99px;
  overflow: hidden;
  margin-top: 6px;
}
.pkg-card-progress-fill {
  height: 100%;
  background: var(--pkg-color, var(--terracotta));
  transition: width .3s ease;
}

/* Sensitive marker */
.pkg-sensitive-marker {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--terracotta);
  font-weight: 600;
  padding: 3px 8px;
  background: var(--terracotta-light);
  border-radius: 99px;
  margin-top: 4px;
}

/* ==================================================================
   PACKAGE DETAIL — HEADER
   ================================================================== */
.pkg-detail-header {
  background: linear-gradient(135deg, var(--pkg-color-light, var(--terracotta-light)) 0%, var(--cream) 100%);
  padding: 48px 32px 40px;
  border-bottom: 1px solid var(--line-soft);
  position: relative;
  overflow: hidden;
}
.pkg-detail-header::before {
  content: '';
  position: absolute;
  bottom: -100px; right: -50px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, var(--pkg-color, var(--terracotta)) 0%, transparent 70%);
  opacity: .12;
  pointer-events: none;
}
.pkg-detail-inner {
  max-width: 720px;
  margin: 0 auto;
  position: relative;
}
.pkg-detail-icon {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 14px;
}
.pkg-detail-name {
  font-family: 'Fraunces', serif;
  font-size: clamp(28px, 4vw, 40px);
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px 0;
  letter-spacing: -0.015em;
}
.pkg-detail-tagline {
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-size: 18px;
  color: var(--pkg-color, var(--terracotta));
  margin: 0 0 20px 0;
}
.pkg-detail-description {
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink-mid);
  max-width: 560px;
  margin: 0 0 20px 0;
}

.pkg-detail-meta {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--ink-soft);
}
.pkg-detail-meta-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.pkg-detail-meta-item strong {
  color: var(--ink);
  font-weight: 600;
}

/* Progress bar di detail header */
.pkg-detail-progress-wrap {
  margin-top: 24px;
  max-width: 560px;
}
.pkg-detail-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--ink-mid);
  margin-bottom: 6px;
  font-weight: 500;
}
.pkg-detail-progress-bar {
  height: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.pkg-detail-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pkg-color, var(--terracotta)), var(--sage));
  transition: width .4s ease;
  border-radius: 99px;
}

/* ==================================================================
   PATH TREE (Duolingo-style)
   ================================================================== */
.pkg-path {
  max-width: 560px;
  margin: 48px auto;
  padding: 0 32px;
}
.pkg-path-start,
.pkg-path-end {
  text-align: center;
  padding: 20px 0;
}
.pkg-path-start-icon,
.pkg-path-end-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--cream-light);
  border: 3px solid var(--pkg-color, var(--terracotta));
  font-size: 32px;
  margin-bottom: 10px;
}
.pkg-path-start-label,
.pkg-path-end-label {
  font-family: 'Fraunces', serif;
  font-size: 14px;
  color: var(--ink-mid);
  font-style: italic;
}

.pkg-path-line {
  width: 3px;
  height: 32px;
  background: var(--line);
  margin: 0 auto;
}

.pkg-path-node {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px 24px;
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--r-xl);
  transition: all .2s;
  text-decoration: none;
  color: inherit;
  position: relative;
}
.pkg-path-node:hover {
  transform: translateX(4px);
  border-color: var(--pkg-color, var(--terracotta));
  box-shadow: var(--shadow);
  color: inherit;
}
.pkg-path-node.node-completed {
  border-color: var(--sage);
  background: var(--sage-light);
}
.pkg-path-node.node-current {
  border-color: var(--pkg-color, var(--terracotta));
  border-width: 3px;
  box-shadow: 0 0 0 4px var(--pkg-color-light, var(--terracotta-light));
}
.pkg-path-node.node-locked {
  opacity: .55;
  cursor: not-allowed;
  pointer-events: none;
}

.pkg-path-node-number {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--cream-light);
  border: 2px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fraunces', serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink-mid);
  flex-shrink: 0;
}
.node-completed .pkg-path-node-number {
  background: var(--sage);
  border-color: var(--sage);
  color: white;
}
.node-current .pkg-path-node-number {
  background: var(--pkg-color, var(--terracotta));
  border-color: var(--pkg-color, var(--terracotta));
  color: white;
}

.pkg-path-node-content {
  flex: 1;
  min-width: 0;
}
.pkg-path-node-title {
  font-family: 'Fraunces', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 4px 0;
  line-height: 1.3;
}
.pkg-path-node-why {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}
.pkg-path-node-meta {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 6px;
  display: flex;
  gap: 12px;
}

.pkg-path-node-indicator {
  font-size: 24px;
  flex-shrink: 0;
}

/* ==================================================================
   STATS DASHBOARD (XP, Streak, Level)
   ================================================================== */
.pkg-stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.pkg-stat-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  text-align: left;
  transition: all .2s;
}
.pkg-stat-card:hover {
  border-color: var(--clay);
  box-shadow: var(--shadow);
}
.pkg-stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-soft);
  font-weight: 600;
  margin-bottom: 6px;
}
.pkg-stat-value {
  font-family: 'Fraunces', serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.pkg-stat-value-emoji {
  font-size: 22px;
}
.pkg-stat-sub {
  font-size: 11px;
  color: var(--ink-soft);
  margin-top: 4px;
}

@media (max-width: 760px) {
  .pkg-stats-row { grid-template-columns: repeat(2, 1fr); }
}

/* ==================================================================
   LEVEL PROGRESS BAR
   ================================================================== */
.pkg-level-card {
  background: linear-gradient(135deg, var(--blue-light) 0%, var(--cream-light) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin-bottom: 24px;
}
.pkg-level-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.pkg-level-name {
  font-family: 'Fraunces', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 8px;
}
.pkg-level-xp {
  font-size: 13px;
  color: var(--ink-mid);
  font-weight: 500;
}
.pkg-level-progress {
  height: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 99px;
  overflow: hidden;
}
.pkg-level-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--terracotta), var(--blue));
  transition: width .4s ease;
}
.pkg-level-next {
  font-size: 12px;
  color: var(--ink-soft);
  margin-top: 8px;
}

/* ==================================================================
   STREAK FLAME
   ================================================================== */
.pkg-streak-flame {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #fff3e4, #ffe3d0);
  border: 1px solid var(--terracotta);
  border-radius: 99px;
  font-weight: 600;
  color: var(--terracotta);
  font-size: 13px;
}
.pkg-streak-flame.at-risk {
  background: linear-gradient(135deg, #fef0f0, #ffe0e0);
  border-color: #b54242;
  color: #b54242;
  animation: pkg-pulse 2s ease-in-out infinite;
}
@keyframes pkg-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.03); }
}

/* ==================================================================
   ACHIEVEMENT BADGE
   ================================================================== */
.pkg-achievement-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 16px;
}
.pkg-achievement {
  background: var(--paper);
  border: 2px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 14px;
  text-align: center;
  transition: all .2s;
  position: relative;
}
.pkg-achievement.locked {
  opacity: 0.42;
  filter: grayscale(0.5);
}
.pkg-achievement:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}
.pkg-achievement-emoji {
  font-size: 40px;
  line-height: 1;
  margin-bottom: 10px;
}
.pkg-achievement-name {
  font-family: 'Fraunces', serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.3;
}
.pkg-achievement-desc {
  font-size: 11px;
  color: var(--ink-soft);
  line-height: 1.4;
}
.pkg-achievement.unlocked {
  border-color: var(--sage);
  background: var(--sage-light);
}

/* ==================================================================
   FILTER CHIPS
   ================================================================== */
.pkg-filter-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.pkg-filter-chip {
  font-size: 13px;
  font-weight: 500;
  padding: 8px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 99px;
  cursor: pointer;
  transition: all .15s;
  color: var(--ink-mid);
}
.pkg-filter-chip:hover {
  border-color: var(--clay);
  background: var(--cream-light);
}
.pkg-filter-chip.active {
  background: var(--ink);
  color: var(--cream);
  border-color: var(--ink);
}

/* ==================================================================
   RECOMMENDATION ROW (di dashboard)
   ================================================================== */
.pkg-rec-row {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.pkg-rec-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.pkg-rec-title {
  font-family: 'Fraunces', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.pkg-rec-link {
  font-size: 13px;
  color: var(--terracotta);
  font-weight: 600;
  text-decoration: none;
}
.pkg-rec-link:hover { text-decoration: underline; }

.pkg-rec-items {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
@media (max-width: 760px) {
  .pkg-rec-items { grid-template-columns: 1fr; }
}

/* ==================================================================
   COMPLETION CELEBRATION (saat paket selesai)
   ================================================================== */
.pkg-celebration {
  background: linear-gradient(135deg, var(--sage-light), var(--blue-light));
  border: 2px solid var(--sage);
  border-radius: var(--r-xl);
  padding: 32px 28px;
  text-align: center;
  margin: 40px auto;
  max-width: 560px;
}
.pkg-celebration-emoji {
  font-size: 64px;
  line-height: 1;
  margin-bottom: 14px;
  animation: pkg-bounce-in .6s ease-out;
}
@keyframes pkg-bounce-in {
  0%   { transform: scale(0);    opacity: 0; }
  60%  { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}
.pkg-celebration h2 {
  font-family: 'Fraunces', serif;
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 10px 0;
  color: var(--ink);
}
.pkg-celebration p {
  font-size: 15px;
  color: var(--ink-mid);
  margin: 0 0 18px 0;
}
.pkg-celebration-xp {
  display: inline-block;
  padding: 8px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-weight: 600;
  font-size: 14px;
  color: var(--terracotta);
  margin-bottom: 20px;
}

/* ==================================================================
   DIFFICULTY BADGE
   ================================================================== */
.pkg-difficulty {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 99px;
  letter-spacing: 0.04em;
}
.pkg-difficulty-pemula    { background: var(--sage-light);       color: var(--sage); }
.pkg-difficulty-menengah  { background: #fff7ed;                 color: var(--license-semi); }
.pkg-difficulty-lanjutan  { background: #fee;                    color: var(--license-paid); }

/* ==================================================================
   NAV HIGHLIGHT UNTUK PAKET (di shared.js)
   ================================================================== */
.nav-links a.nav-pkg-link::before {
  content: '🎯 ';
}
