﻿/* === Level Card === */
.level-card {
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  color: white;
  position: relative;
  overflow: hidden;
  padding: 16px 20px;
}
[data-theme="dark"] .level-card {
  background: linear-gradient(135deg, #0d0d1a 0%, #1a1a3e 50%, #0f2060 100%);
}
.level-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  position: relative;
  z-index: 1;
}
.level-badge {
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  color: #1a1a2e;
  font-weight: 800;
  font-size: 14px;
  padding: 4px 12px;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(255, 215, 0, 0.3);
  min-width: 56px;
  text-align: center;
}
.level-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.level-title span:first-child {
  font-weight: 700;
  font-size: 15px;
}
.level-xp {
  font-size: 11px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
}
.xp-bar {
  width: 100%;
  height: 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
  z-index: 1;
}
.xp-fill {
  height: 100%;
  background: linear-gradient(90deg, #ffd700, #ffaa00, #ff8c00);
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.xp-fill::after {
  content: '';
  position: absolute;
  right: 0;
  top: 0;
  width: 12px;
  height: 100%;
  background: rgba(255,255,255,0.4);
  border-radius: 4px;
}
.xp-glow {
  position: absolute;
  bottom: -20px;
  right: -20px;
  width: 80px;
  height: 80px;
  background: radial-gradient(circle, rgba(255,215,0,0.15) 0%, transparent 70%);
  pointer-events: none;
}

/* === Daily Challenges === */
.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.challenge-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: 10px;
  font-size: 13px;
  transition: all 0.3s ease;
}
.challenge-item.completed {
  background: linear-gradient(135deg, #d1fae5, #a7f3d0);
  color: #065f46;
}
[data-theme="dark"] .challenge-item.completed {
  background: linear-gradient(135deg, #064e3b, #065f46);
  color: #6ee7b7;
}
.challenge-icon {
  font-size: 22px;
  min-width: 28px;
  text-align: center;
}
.challenge-text {
  flex: 1;
  font-weight: 500;
}
.challenge-check {
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.3s;
}
.challenge-item.completed .challenge-check {
  opacity: 1;
}

/* XP popup animation */
.xp-popup {
  position: fixed;
  top: 30%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #ffd700, #ff8c00);
  color: #1a1a2e;
  font-weight: 800;
  font-size: 20px;
  padding: 12px 24px;
  border-radius: 20px;
  z-index: 200;
  pointer-events: none;
  animation: xpFloat 2s ease-out forwards;
  box-shadow: 0 4px 20px rgba(255, 215, 0, 0.4);
}
@keyframes xpFloat {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  20% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  30% { transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(-60px); }
}

/* Level up animation */
.level-up-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.3s ease;
}
.level-up-card {
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  color: white;
  padding: 32px 28px;
  border-radius: 20px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
  animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.level-up-card .new-level {
  font-size: 48px;
  font-weight: 900;
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.level-up-card .title-text {
  font-size: 18px;
  font-weight: 700;
  margin: 8px 0;
}
.level-up-card .sub-text {
  font-size: 13px;
  color: rgba(255,255,255,0.6);
}
.level-up-card button {
  margin-top: 18px;
  padding: 10px 32px;
  border: none;
  background: linear-gradient(135deg, #ffd700, #ffaa00);
  color: #1a1a2e;
  font-weight: 700;
  font-size: 15px;
  border-radius: 20px;
  cursor: pointer;
  font-family: var(--font);
}
@keyframes popIn {
  0% { transform: scale(0.5); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* Mini input helpers */
.mini-label {
  font-size: 11px;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}
.mini-input {
  width: 100%;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
}
.timer-select {
  width: 100%;
  padding: 10px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  margin-bottom: 16px;
}


/* === Today XP === */
.level-today-xp {
  font-size: 12px;
  font-weight: 700;
  color: #ffd700;
  margin-left: 6px;
  text-shadow: 0 0 8px rgba(255, 215, 0, 0.4);
}

/* === Timer Settings === */
.timer-settings {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1.5px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.timer-setting-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg);
  border-radius: 10px;
}
.ts-label {
  font-size: 13px;
  font-weight: 600;
  min-width: 80px;
  color: var(--text);
}
.ts-val {
  font-size: 16px;
  font-weight: 800;
  min-width: 32px;
  text-align: center;
  color: var(--primary);
}
.ts-unit {
  font-size: 11px;
  color: var(--text-muted);
}
.ts-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text);
  transition: all 0.15s;
  font-family: var(--font);
}
.ts-btn:active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(0.9);
}


/* === Calendar === */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  padding: 0 4px;
}
.cal-nav {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--card);
  font-size: 16px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  transition: all 0.15s;
}
.cal-nav:active { background: var(--primary); color: white; }
.cal-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 4px 0;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.cal-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  background: var(--card);
  cursor: default;
  position: relative;
  transition: all 0.2s;
  border: 1.5px solid transparent;
}
.cal-cell.empty {
  background: transparent;
  border: none;
}
.cal-cell.today {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}
.cal-cell .cal-day {
  font-size: 14px;
  font-weight: 600;
}
.cal-cell .cal-icon {
  font-size: 10px;
  margin-top: 1px;
  opacity: 0;
  transition: opacity 0.2s;
}

/* Flame streak colors */
.cal-cell.streak-1 {
  background: linear-gradient(135deg, #fff3cd, #ffe69c);
  color: #92400e;
}
.cal-cell.streak-2 {
  background: linear-gradient(135deg, #ffecd2, #fcb69f);
  color: #9a3412;
}
.cal-cell.streak-3 {
  background: linear-gradient(135deg, #ff9a9e, #fad0c4);
  color: #7f1d1d;
}
.cal-cell.streak-3 .cal-icon,
.cal-cell.streak-2 .cal-icon,
.cal-cell.streak-1 .cal-icon {
  opacity: 0.7;
}

/* Dark mode calendar */
[data-theme="dark"] .cal-cell.streak-1 {
  background: linear-gradient(135deg, #3d2e0a, #5c3d0e);
  color: #fbbf24;
}
[data-theme="dark"] .cal-cell.streak-2 {
  background: linear-gradient(135deg, #4a1a0a, #7c2d12);
  color: #fb923c;
}
[data-theme="dark"] .cal-cell.streak-3 {
  background: linear-gradient(135deg, #4a0a1a, #7f1d2d);
  color: #fca5a5;
}

/* Calendar legend */
.cal-legend {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 14px;
  font-size: 12px;
  color: var(--text-muted);
}
.cal-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
}
.cal-dot {
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--card);
  border: 1.5px solid var(--border);
}
.cal-dot.flame {
  background: linear-gradient(135deg, #ff9a9e, #fad0c4);
  border-color: #fca5a5;
}
