/* ============================================================
   BCA STORE — Analytics Dashboard Styles v2.0
   ============================================================ */

/* ── IMPORTS & FONT ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800;900&display=swap');

/* ── PAGE LAYOUT ────────────────────────────────────────────── */
.analytics-page {
  min-height: 100vh;
  padding: 100px 0 60px;
}

.analytics-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

/* ── HERO HEADER ────────────────────────────────────────────── */
.ana-hero {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: 28px;
  padding: 36px 40px;
  color: #fff;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.ana-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 240px; height: 240px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
  pointer-events: none;
}

.ana-hero::after {
  content: '';
  position: absolute;
  bottom: -40px; left: 40px;
  width: 160px; height: 160px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
  pointer-events: none;
}

.ana-hero-avatar {
  width: 72px; height: 72px;
  background: rgba(255,255,255,0.2);
  border-radius: 20px;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.4rem;
  flex-shrink: 0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  backdrop-filter: blur(8px);
}

.ana-hero-info { flex: 1; min-width: 200px; }

.ana-hero-greeting {
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 4px;
}

.ana-hero-name {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 8px;
  line-height: 1.2;
}

.ana-hero-rank {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.15);
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 0.85rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

/* ── XP BAR ─────────────────────────────────────────────────── */
.ana-xp-section {
  min-width: 260px;
  flex: 1;
}

.ana-xp-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  font-weight: 600;
  opacity: 0.85;
  margin-bottom: 8px;
}

.ana-xp-bar-track {
  background: rgba(255,255,255,0.2);
  border-radius: 99px;
  height: 10px;
  overflow: hidden;
}

.ana-xp-bar-fill {
  height: 100%;
  background: rgba(255,255,255,0.9);
  border-radius: 99px;
  transition: width 1.5s cubic-bezier(0.34,1.56,0.64,1);
  position: relative;
}

.ana-xp-bar-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0; bottom: 0;
  width: 20px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.6));
  animation: xpShimmer 2s infinite;
}

@keyframes xpShimmer {
  0% { opacity: 0; }
  50% { opacity: 1; }
  100% { opacity: 0; }
}

.ana-xp-next { font-size: 0.75rem; opacity: 0.7; margin-top: 6px; text-align: right; }

/* ── STREAK BADGE ───────────────────────────────────────────── */
.ana-streak-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.15);
  padding: 16px 20px;
  border-radius: 20px;
  backdrop-filter: blur(8px);
  text-align: center;
  min-width: 90px;
}

.ana-streak-fire {
  font-size: 2rem;
  animation: firePulse 1.5s ease-in-out infinite;
}

@keyframes firePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15) rotate(5deg); }
}

.ana-streak-num {
  font-size: 1.6rem;
  font-weight: 900;
  line-height: 1;
}

.ana-streak-label {
  font-size: 0.65rem;
  font-weight: 700;
  opacity: 0.8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── KPI CARDS ROW ──────────────────────────────────────────── */
.ana-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
}

.ana-kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 18px;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: kpiFadeIn 0.6s ease both;
}

.ana-kpi-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(99,102,241,0.15);
}

@keyframes kpiFadeIn {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

.ana-kpi-icon {
  width: 52px; height: 52px;
  border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.6rem;
  flex-shrink: 0;
}

.kpi-blue   { background: rgba(99,102,241,0.12); }
.kpi-green  { background: rgba(16,185,129,0.12); }
.kpi-orange { background: rgba(245,158,11,0.12); }
.kpi-pink   { background: rgba(236,72,153,0.12); }
.kpi-purple { background: rgba(139,92,246,0.12); }
.kpi-red    { background: rgba(239,68,68,0.12); }

.ana-kpi-info { flex: 1; }

.ana-kpi-value {
  font-size: 1.9rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}

.ana-kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
}

.ana-kpi-sub {
  font-size: 0.72rem;
  color: var(--primary);
  font-weight: 600;
  margin-top: 2px;
}

/* ── SECTION HEADERS ────────────────────────────────────────── */
.ana-section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 20px;
}

.ana-section-title span {
  font-size: 1.3rem;
}

/* ── SUBJECT ANALYSIS CARDS ─────────────────────────────────── */
.ana-subjects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.ana-subject-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 22px;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  animation: kpiFadeIn 0.6s ease both;
}

.ana-subject-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(99,102,241,0.12);
}

.ana-subject-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 99px 99px 0 0;
}

.ana-subject-card.completed::before {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.ana-subject-card.weak::before {
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.ana-subcard-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.ana-subcard-icon {
  width: 40px; height: 40px;
  background: var(--primary-light);
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem;
  flex-shrink: 0;
}

.ana-subcard-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.3;
}

.ana-subcard-code {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 2px;
}

.ana-subcard-tag {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  flex-shrink: 0;
}

.tag-completed { background: rgba(16,185,129,0.15); color: #10b981; }
.tag-weak      { background: rgba(239,68,68,0.15);  color: #ef4444; }
.tag-strong    { background: rgba(99,102,241,0.15); color: #6366f1; }
.tag-neutral   { background: rgba(100,116,139,0.15); color: #64748b; }

.ana-subcard-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.ana-subcard-progress-track {
  background: var(--primary-light);
  border-radius: 99px;
  height: 7px;
  overflow: hidden;
  margin-bottom: 14px;
}

.ana-subcard-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  transition: width 1.2s cubic-bezier(0.34,1.56,0.64,1);
}

.ana-subcard-stats {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}

.ana-subcard-stat {
  text-align: center;
  background: var(--bg);
  border-radius: 10px;
  padding: 8px 4px;
}

.ana-subcard-stat-num {
  font-size: 1rem;
  font-weight: 800;
  color: var(--primary);
}

.ana-subcard-stat-lbl {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ── HEATMAP ────────────────────────────────────────────────── */
.ana-heatmap-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
}

.ana-heatmap-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-top: 16px;
}

.ana-heatmap-day-label {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 8px;
}

.ana-heatmap-dl {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-align: center;
  font-weight: 600;
}

.ana-hm-cell {
  aspect-ratio: 1;
  border-radius: 6px;
  background: var(--bg);
  cursor: pointer;
  transition: transform 0.2s ease;
  position: relative;
}

.ana-hm-cell:hover { transform: scale(1.3); z-index: 2; }

.ana-hm-cell[data-level="0"] { background: rgba(99,102,241,0.07); }
.ana-hm-cell[data-level="1"] { background: rgba(99,102,241,0.25); }
.ana-hm-cell[data-level="2"] { background: rgba(99,102,241,0.5); }
.ana-hm-cell[data-level="3"] { background: rgba(99,102,241,0.75); }
.ana-hm-cell[data-level="4"] { background: var(--primary); box-shadow: 0 0 8px rgba(99,102,241,0.4); }
.ana-hm-cell[data-future="true"] { background: transparent; }

.ana-hm-legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  justify-content: flex-end;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.ana-hm-legend-cell {
  width: 12px; height: 12px;
  border-radius: 3px;
}

/* ── SUGGESTIONS ────────────────────────────────────────────── */
.ana-suggestions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.ana-suggestion-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  animation: kpiFadeIn 0.6s ease both;
}

.ana-sugg-icon {
  font-size: 1.6rem;
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
}

.sugg-type-warning { background: rgba(245,158,11,0.12); }
.sugg-type-info    { background: rgba(99,102,241,0.12); }
.sugg-type-success { background: rgba(16,185,129,0.12); }

.ana-sugg-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ── BADGES WALL ────────────────────────────────────────────── */
.ana-badges-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
}

.ana-badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.ana-badge-item {
  background: var(--bg);
  border-radius: 16px;
  padding: 16px 8px;
  text-align: center;
  border: 1px solid var(--border);
  transition: all 0.3s ease;
  cursor: default;
  position: relative;
}

.ana-badge-item.earned {
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.1));
  border-color: rgba(99,102,241,0.3);
  box-shadow: 0 4px 16px rgba(99,102,241,0.1);
}

.ana-badge-item.earned:hover {
  transform: translateY(-4px) scale(1.04);
  box-shadow: 0 8px 24px rgba(99,102,241,0.2);
}

.ana-badge-item.locked {
  opacity: 0.4;
  filter: grayscale(1);
}

.ana-badge-icon { font-size: 1.8rem; display: block; margin-bottom: 6px; }
.ana-badge-name { font-size: 0.65rem; font-weight: 700; color: var(--text); line-height: 1.3; }
.ana-badge-xp   { font-size: 0.6rem; color: var(--primary); font-weight: 600; margin-top: 3px; }

.ana-badge-earned-star {
  position: absolute;
  top: 6px; right: 6px;
  font-size: 0.6rem;
  background: var(--primary);
  color: white;
  border-radius: 99px;
  padding: 1px 5px;
  font-weight: 700;
}

/* ── SMART ANALYSIS / TWO-COL SECTION ──────────────────────── */
.ana-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

@media (max-width: 768px) {
  .ana-two-col { grid-template-columns: 1fr; }
}

.ana-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
}

.ana-weak-list, .ana-strong-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.ana-wk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 12px;
  border-left: 3px solid #ef4444;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.ana-st-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 12px;
  border-left: 3px solid #10b981;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.ana-empty-msg {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 24px;
}

/* ── EXAM READINESS RING ────────────────────────────────────── */
.ana-readiness-wrap {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  display: flex;
  align-items: center;
  gap: 32px;
  flex-wrap: wrap;
}

.ana-ring-wrap {
  position: relative;
  width: 140px; height: 140px;
  flex-shrink: 0;
}

.ana-ring-svg { transform: rotate(-90deg); }

.ana-ring-track {
  fill: none;
  stroke: var(--border);
  stroke-width: 10;
}

.ana-ring-fill {
  fill: none;
  stroke: url(#ringGrad);
  stroke-width: 10;
  stroke-linecap: round;
  stroke-dasharray: 339.3;
  stroke-dashoffset: 339.3;
  transition: stroke-dashoffset 2s cubic-bezier(0.34,1.56,0.64,1);
}

.ana-ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.ana-ring-pct {
  font-size: 2rem;
  font-weight: 900;
  color: var(--text);
  line-height: 1;
}

.ana-ring-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.ana-readiness-details { flex: 1; min-width: 200px; }

.ana-readiness-details h3 {
  font-size: 1.1rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.ana-readiness-details p {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.ana-readiness-factors {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.ana-factor-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
}

.ana-factor-name { min-width: 100px; color: var(--text-secondary); font-weight: 500; }
.ana-factor-track { flex: 1; height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; }
.ana-factor-fill { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--primary), var(--secondary)); transition: width 1.5s ease; }
.ana-factor-val { min-width: 36px; text-align: right; font-weight: 700; color: var(--primary); font-size: 0.75rem; }

/* ── MINI ANALYTICS STRIP (on subject.html) ─────────────────── */
.ana-mini-strip {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.ana-mini-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg);
  padding: 5px 12px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

.ana-mini-chip span { color: var(--primary); font-weight: 800; }

.ana-mini-strip-link {
  margin-left: auto;
  font-size: 0.75rem;
  color: var(--primary);
  text-decoration: none;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 99px;
  background: var(--primary-light);
  transition: all 0.2s ease;
  white-space: nowrap;
}

.ana-mini-strip-link:hover { background: var(--primary); color: #fff; }

/* ── PRODUCTIVITY SCORE ─────────────────────────────────────── */
.ana-productivity-card {
  background: linear-gradient(135deg, rgba(99,102,241,0.1), rgba(139,92,246,0.05));
  border: 1px solid rgba(99,102,241,0.2);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
}

.ana-prod-score {
  font-size: 3.5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
  margin-bottom: 4px;
}

.ana-prod-label { font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }

.ana-prod-bar-wrap { margin-top: 16px; }

.ana-prod-bar-track {
  background: rgba(99,102,241,0.1);
  border-radius: 99px;
  height: 8px;
  overflow: hidden;
}

.ana-prod-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--secondary));
  border-radius: 99px;
  transition: width 1.5s cubic-bezier(0.34,1.56,0.64,1);
}

/* ── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 768px) {
  .analytics-page { padding: 80px 0 40px; }
  .ana-hero { padding: 24px 20px; gap: 20px; }
  .ana-hero-name { font-size: 1.4rem; }
  .ana-kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .ana-subjects-grid { grid-template-columns: 1fr; }
  .ana-badges-grid { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
  .ana-readiness-wrap { flex-direction: column; align-items: flex-start; }
  .ana-heatmap-grid, .ana-heatmap-day-label { gap: 4px; }
  .ana-mini-strip { gap: 8px; }
}

@media (max-width: 480px) {
  .ana-kpi-grid { grid-template-columns: 1fr; }
  .ana-hero-avatar { width: 52px; height: 52px; font-size: 1.8rem; }
  .ana-xp-section { width: 100%; }
}
