/* Hay Quest - RPG Dark Fantasy Theme */
:root {
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #0f3460;
  --bg-card-hover: #1a4a7a;
  --text-primary: #e8e8e8;
  --text-secondary: #a8a8b8;
  --gold: #ffd700;
  --gold-dark: #b8960f;
  --purple: #6c3caf;
  --purple-light: #9b59b6;
  --green: #27ae60;
  --green-light: #2ecc71;
  --red: #e74c3c;
  --blue: #3498db;
  --gem-color: #00d4ff;
  --xp-bar: linear-gradient(90deg, #6c3caf, #9b59b6, #d4a8ff);
  --xp-bar-bg: #2d2d44;
  --border-color: #2d2d5e;
  --shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }

body {
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* Navigation */
.navbar-quest {
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-card));
  border-bottom: 2px solid var(--gold-dark);
  box-shadow: var(--shadow);
}

.navbar-quest .navbar-brand {
  color: var(--gold) !important;
  font-weight: 700;
  font-size: 1.3rem;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.navbar-quest .nav-link {
  color: var(--text-secondary) !important;
  transition: color 0.3s ease;
}

.navbar-quest .nav-link:hover,
.navbar-quest .nav-link.active {
  color: var(--gold) !important;
}

/* Cards */
.card-quest {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-secondary));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
}

.card-quest:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(108, 60, 175, 0.2);
}

.card-quest .card-header {
  background: rgba(108, 60, 175, 0.15);
  border-bottom: 1px solid var(--border-color);
  color: var(--text-primary);
}

.card-quest .card-body {
  color: var(--text-primary);
}

/* XP Bar */
.xp-bar-container {
  background: var(--xp-bar-bg);
  border-radius: 20px;
  height: 24px;
  position: relative;
  overflow: hidden;
  border: 2px solid var(--border-color);
}

.xp-bar-fill {
  background: var(--xp-bar);
  height: 100%;
  border-radius: 20px;
  transition: width 0.6s ease;
  position: relative;
  overflow: hidden;
}

.xp-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: xp-shimmer 2s infinite;
}

@keyframes xp-shimmer {
  100% { left: 100%; }
}

.xp-bar-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.7rem;
  font-weight: 700;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  white-space: nowrap;
}

/* Level Badge */
.level-badge {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #1a1a2e;
  font-weight: 800;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.4);
}

/* Gems */
.gem-display {
  color: var(--gem-color);
  font-weight: 700;
  text-shadow: 0 0 8px rgba(0, 212, 255, 0.3);
}

/* Streak */
.streak-display {
  font-size: 1.1rem;
  font-weight: 600;
}

.streak-fire {
  animation: fire-pulse 1.5s ease-in-out infinite;
}

@keyframes fire-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.15); }
}

/* Quest Cards */
.quest-card {
  background: linear-gradient(145deg, var(--bg-card), #0a2647);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.75rem;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.quest-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
}

.quest-card.difficulty-easy::before { background: var(--green); }
.quest-card.difficulty-medium::before { background: var(--blue); }
.quest-card.difficulty-hard::before { background: var(--gold); }
.quest-card.difficulty-epic::before { background: var(--purple-light); }

.quest-card.completed {
  opacity: 0.6;
  border-color: var(--green);
}

.quest-card.completed::after {
  content: '✓';
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.5rem;
  color: var(--green-light);
}

/* Difficulty badges */
.badge-easy { background-color: var(--green); color: #fff; }
.badge-medium { background-color: var(--blue); color: #fff; }
.badge-hard { background-color: var(--gold); color: #1a1a2e; }
.badge-epic { background: linear-gradient(135deg, var(--purple), var(--purple-light)); color: #fff; }

/* Category icons */
.category-badge {
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 10px;
  background: rgba(108, 60, 175, 0.2);
  color: var(--purple-light);
  border: 1px solid var(--purple);
}

/* Buttons */
.btn-quest {
  background: linear-gradient(135deg, var(--purple), var(--purple-light));
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.5rem 1.2rem;
  font-weight: 600;
  transition: all 0.3s ease;
  box-shadow: 0 3px 10px rgba(108, 60, 175, 0.3);
}

.btn-quest:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(108, 60, 175, 0.5);
  color: #fff;
}

.btn-quest:active {
  transform: translateY(1px);
}

.btn-complete {
  background: linear-gradient(135deg, var(--green), var(--green-light));
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 0.4rem 1rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.btn-complete:hover {
  box-shadow: 0 4px 12px rgba(39, 174, 96, 0.4);
  color: #fff;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #1a1a2e;
  border: none;
  font-weight: 700;
}

.btn-gold:hover {
  box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
  color: #1a1a2e;
}

/* Reward cards */
.reward-card {
  background: linear-gradient(145deg, var(--bg-card), #0a2647);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: all 0.3s ease;
}

.reward-card:hover {
  border-color: var(--gem-color);
  box-shadow: 0 0 15px rgba(0, 212, 255, 0.15);
}

.reward-cost {
  color: var(--gem-color);
  font-weight: 700;
  font-size: 1.1rem;
}

/* Achievement badges */
.achievement-badge {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-secondary));
  border: 2px solid var(--border-color);
  border-radius: 12px;
  padding: 1rem;
  text-align: center;
  transition: all 0.3s ease;
}

.achievement-badge.earned {
  border-color: var(--gold);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.2);
}

.achievement-badge.locked {
  opacity: 0.5;
  filter: grayscale(0.5);
}

.achievement-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.5rem;
}

/* Avatar */
.avatar-display {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--purple), var(--gold-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  box-shadow: 0 0 15px rgba(108, 60, 175, 0.4);
  border: 3px solid var(--gold-dark);
}

/* Boss challenge */
.boss-card {
  background: linear-gradient(145deg, #2d1b4e, #1a1a2e);
  border: 2px solid var(--purple);
  border-radius: 12px;
  padding: 1.2rem;
  position: relative;
  overflow: hidden;
}

.boss-card::before {
  content: '⚔️';
  position: absolute;
  top: -10px;
  right: -10px;
  font-size: 4rem;
  opacity: 0.1;
}

/* Stats panel */
.stat-item {
  text-align: center;
  padding: 0.5rem;
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Animations */
.fade-in {
  animation: fadeIn 0.5s ease;
}

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

.xp-popup {
  position: fixed;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--purple), var(--gold-dark));
  color: #fff;
  padding: 1rem 2rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1.2rem;
  z-index: 9999;
  animation: popUp 2s ease forwards;
  pointer-events: none;
}

@keyframes popUp {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.8); }
  20% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1.1); }
  40% { transform: translateX(-50%) translateY(0) scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-30px); }
}

/* Form styling */
.form-control, .form-select {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.form-control:focus, .form-select:focus {
  background-color: var(--bg-secondary);
  border-color: var(--purple);
  color: var(--text-primary);
  box-shadow: 0 0 0 0.2rem rgba(108, 60, 175, 0.25);
}

.form-label {
  color: var(--text-secondary);
  font-weight: 500;
}

/* Auth pages */
.auth-container {
  max-width: 420px;
  margin: 3rem auto;
  padding: 2rem;
}

.auth-card {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-secondary));
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: var(--shadow);
}

.auth-title {
  color: var(--gold);
  text-align: center;
  font-weight: 700;
  margin-bottom: 1.5rem;
}

/* Mobile optimizations */
@media (max-width: 768px) {
  .quest-card { padding: 0.8rem; }
  .level-badge { width: 40px; height: 40px; font-size: 1rem; }
  .avatar-display { width: 50px; height: 50px; font-size: 1.4rem; }
}

/* Parent dashboard */
.parent-stat-card {
  background: linear-gradient(145deg, var(--bg-card), var(--bg-secondary));
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
}

.approval-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0.5rem;
}

/* Toast notifications */
.toast-quest {
  background: var(--bg-card);
  border: 1px solid var(--gold-dark);
  color: var(--text-primary);
}


/* Avatar picker */
.avatar-option {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.3rem 0.8rem;
  font-size: 0.8rem;
  transition: all 0.2s ease;
}

.avatar-option:hover {
  border-color: var(--purple-light);
  color: var(--text-primary);
  background: var(--bg-card);
}

.avatar-option.active {
  border-color: var(--gold);
  background: rgba(255, 215, 0, 0.1);
  color: var(--gold);
}

/* Navbar toggler for dark theme */
.navbar-toggler {
  border-color: var(--border-color);
}

.navbar-toggler-icon {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='rgba(232, 232, 232, 0.8)' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--purple);
}

/* Activity Heatmap (GitHub-style contribution chart) */
.heatmap-wrapper {
  overflow-x: auto;
  padding-bottom: 0.5rem;
}

.heatmap-months {
  margin-left: 30px;
  height: 16px;
  position: relative;
  font-size: 0.65rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.heatmap-container {
  display: flex;
  gap: 0;
}

.heatmap-days {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0;
  width: 28px;
  flex-shrink: 0;
  height: calc(7 * (11px + 2px));
}

.heatmap-days span {
  font-size: 0.6rem;
  color: var(--text-secondary);
  line-height: 11px;
  height: 11px;
}

.heatmap-grid {
  display: flex;
  gap: 2px;
}

.heatmap-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.heatmap-cell {
  width: 11px;
  height: 11px;
  border-radius: 2px;
  cursor: pointer;
  transition: outline 0.1s ease;
  outline: 1px solid transparent;
}

.heatmap-cell:hover {
  outline: 1px solid var(--text-secondary);
}

.heatmap-cell.selected {
  outline: 2px solid var(--gold);
}

.heatmap-cell-future {
  visibility: hidden;
}

/* Heatmap intensity levels - purple theme matching the app */
.heatmap-cell[data-level="0"] {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
}

.heatmap-cell[data-level="1"] {
  background-color: rgba(108, 60, 175, 0.35);
}

.heatmap-cell[data-level="2"] {
  background-color: rgba(108, 60, 175, 0.55);
}

.heatmap-cell[data-level="3"] {
  background-color: rgba(155, 89, 182, 0.75);
}

.heatmap-cell[data-level="4"] {
  background-color: #9b59b6;
  box-shadow: 0 0 4px rgba(155, 89, 182, 0.4);
}

.heatmap-legend {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-top: 8px;
  justify-content: flex-end;
}

.heatmap-legend .heatmap-cell {
  cursor: default;
}

.heatmap-legend .heatmap-cell:hover {
  outline: none;
}
