/* Modern CSS Design System with Glassmorphism for "Upgrade Diri" */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Outfit:wght@400;500;600;700;800&display=swap');

:root {
  /* Theme Colors */
  --bg-dark: #090d16;
  --color-primary: #6366f1; /* Indigo */
  --color-primary-rgb: 99, 102, 241;
  --color-accent: #14b8a6; /* Cyber Teal */
  --color-accent-rgb: 20, 184, 166;
  --color-coral: #f43f5e; /* Sunset Coral */
  --color-coral-rgb: 244, 63, 94;
  --color-gold: #f59e0b; /* RPG Gold */
  
  /* Glassmorphism Tokens */
  --glass-surface: rgba(255, 255, 255, 0.03);
  --glass-surface-hover: rgba(255, 255, 255, 0.07);
  --glass-border: rgba(255, 255, 255, 0.08);
  --glass-border-glow: rgba(99, 102, 241, 0.25);
  --glass-blur: blur(16px);
  
  /* Text Colors */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dark: #0f172a;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  line-height: 1.5;
}

/* Ambient Background Blobs */
.ambient-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -10;
  pointer-events: none;
  overflow: hidden;
}

.ambient-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.18;
  animation: floatBlobs 20s infinite alternate ease-in-out;
}

.blob-1 {
  width: 400px;
  height: 400px;
  background: var(--color-primary);
  top: -10%;
  left: 10%;
}

.blob-2 {
  width: 500px;
  height: 500px;
  background: var(--color-accent);
  bottom: -10%;
  right: 15%;
  animation-delay: -5s;
}

.blob-3 {
  width: 350px;
  height: 350px;
  background: var(--color-coral);
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  animation-delay: -10s;
}

@keyframes floatBlobs {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -50px) scale(1.1); }
  100% { transform: translate(-30px, 30px) scale(0.9); }
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.1);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* App Container Layout */
.app-container {
  display: flex;
  min-height: 100vh;
}

/* Navigation Sidebar */
.sidebar {
  width: 280px;
  background: rgba(10, 15, 30, 0.6);
  backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--glass-border);
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 100;
}

.logo-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 3rem;
  padding: 0 0.5rem;
}

.logo-icon {
  font-size: 2rem;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 2px 10px rgba(99, 102, 241, 0.3));
}

.logo-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #94a3b8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-links {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  flex-grow: 1;
}

.nav-item a {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  border-radius: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid transparent;
}

.nav-item a i {
  font-size: 1.25rem;
}

.nav-item a:hover {
  color: var(--text-main);
  background: var(--glass-surface-hover);
  border-color: rgba(255, 255, 255, 0.05);
}

.nav-item.active a {
  color: #ffffff;
  background: rgba(99, 102, 241, 0.12);
  border-color: var(--glass-border-glow);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.15);
}

/* Sidebar Footer (Mini User Info) */
.sidebar-user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem;
  background: var(--glass-surface);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
}

.sidebar-avatar {
  font-size: 1.5rem;
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(20, 184, 166, 0.2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--glass-border);
}

.sidebar-user-info {
  overflow: hidden;
}

.sidebar-username {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.sidebar-userlevel {
  font-size: 0.75rem;
  color: var(--color-accent);
  font-weight: bold;
}

/* Main Content Area */
.main-content {
  flex-grow: 1;
  padding: 2.5rem 3rem;
  overflow-y: auto;
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

/* Glass Card Component */
.glass-card {
  background: var(--glass-surface);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-card.interactive:hover {
  transform: translateY(-4px);
  border-color: var(--glass-border-glow);
  box-shadow: 0 15px 35px rgba(99, 102, 241, 0.08);
}

/* Animations for Tab Switching */
.page-view {
  animation: fadeInUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
  display: none;
}

.page-view.active {
  display: block;
}

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

/* Page Header styling */
.page-header {
  margin-bottom: 2rem;
}

.page-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 2.2rem;
  letter-spacing: -0.5px;
  background: linear-gradient(to right, #ffffff, #cbd5e1);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.page-subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-top: 0.25rem;
}

/* ==========================================================================
   PAGE: DASHBOARD
   ========================================================================== */

/* Hero Section (Stats Panel) */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 2rem;
  margin-bottom: 2rem;
}

.hero-stats-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.hero-stats-card::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 250px;
  height: 250px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15) 0%, transparent 70%);
  pointer-events: none;
}

.character-summary {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.avatar-large {
  font-size: 3.5rem;
  width: 90px;
  height: 90px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(20, 184, 166, 0.15) 100%);
  border-radius: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--glass-border);
  box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}

.character-details h2 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.8rem;
  margin-bottom: 0.25rem;
}

.character-title-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.75rem;
  background: rgba(20, 184, 166, 0.15);
  border: 1px solid rgba(20, 184, 166, 0.3);
  color: var(--color-accent);
  border-radius: 99px;
  font-size: 0.8rem;
  font-weight: bold;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* RPG Level Progress Bar */
.level-progress-container {
  margin-bottom: 1.5rem;
}

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  margin-bottom: 0.5rem;
}

.level-text {
  font-weight: bold;
  color: var(--color-primary);
  font-size: 1rem;
}

.xp-ratio-text {
  color: var(--text-muted);
}

.progress-bar-outer {
  height: 16px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  position: relative;
}

.progress-bar-inner {
  height: 100%;
  width: 0%;
  background: linear-gradient(to right, var(--color-primary), var(--color-accent));
  border-radius: 99px;
  position: relative;
  transition: width 0.8s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 0 10px rgba(20, 184, 166, 0.5);
}

.progress-bar-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  animation: shine 2s infinite linear;
}

@keyframes shine {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Coins & Streak Stats Panel */
.stats-cards-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.mini-stat-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: all 0.3s ease;
}

.mini-stat-card:hover {
  background: rgba(255, 255, 255, 0.04);
}

.mini-stat-icon {
  font-size: 1.8rem;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mini-stat-icon.coin {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--color-gold);
  text-shadow: 0 0 8px rgba(245, 158, 11, 0.4);
}

.mini-stat-icon.streak {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--color-coral);
  animation: flamePulse 1.5s infinite alternate ease-in-out;
}

@keyframes flamePulse {
  0% {
    text-shadow: 0 0 5px rgba(244, 63, 94, 0.4);
    transform: scale(1);
  }
  100% {
    text-shadow: 0 0 15px rgba(244, 63, 94, 0.8);
    transform: scale(1.05);
  }
}

.mini-stat-content {
  display: flex;
  flex-direction: column;
}

.mini-stat-val {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
}

.mini-stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Today's Tasks Section */
.today-tasks-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.section-title-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.section-title {
  font-family: 'Outfit', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-link {
  font-size: 0.85rem;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.3s;
}

.section-link:hover {
  color: var(--color-accent);
}

.task-list-today {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

/* Empty task state */
.empty-state-box {
  padding: 2.5rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.01);
  border: 1px dashed var(--glass-border);
  border-radius: 16px;
  color: var(--text-muted);
}

.empty-state-emoji {
  font-size: 2.5rem;
  margin-bottom: 0.75rem;
}

/* Radar Analytics Chart Section */
.analytics-card {
  display: flex;
  flex-direction: column;
}

.canvas-container {
  position: relative;
  flex-grow: 1;
  min-height: 280px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.canvas-container canvas {
  width: 100%;
  height: 100%;
}

/* Daily Quests Widget */
.quests-widget {
  margin-top: 2rem;
}

.quest-item {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-top: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.3s ease;
}

.quest-item:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(20, 184, 166, 0.2);
}

.quest-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.quest-icon {
  font-size: 1.4rem;
}

.quest-text {
  font-size: 0.9rem;
  font-weight: 500;
}

.quest-xp-reward {
  font-size: 0.8rem;
  font-weight: bold;
  color: var(--color-accent);
  background: rgba(20, 184, 166, 0.1);
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  border: 1px solid rgba(20, 184, 166, 0.2);
}

.quest-item.completed {
  opacity: 0.6;
  border-color: var(--glass-border);
  background: rgba(255, 255, 255, 0.005);
}

.quest-item.completed .quest-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.quest-item.completed .quest-xp-reward {
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.05);
  border-color: transparent;
}

/* ==========================================================================
   PAGE: TASKS & PROJECTS
   ========================================================================== */

.tasks-split-layout {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 2rem;
  align-items: start;
}

/* Task Creation Form */
.task-form-card {
  position: sticky;
  top: 2.5rem;
}

.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  padding: 0.75rem 1rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.25);
  background: rgba(0, 0, 0, 0.3);
}

.difficulty-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
}

.difficulty-radio {
  display: none;
}

.difficulty-label {
  display: block;
  text-align: center;
  padding: 0.6rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.difficulty-label:hover {
  background: var(--glass-surface-hover);
}

.difficulty-radio:checked + .difficulty-label {
  color: #ffffff;
}

.difficulty-radio[value="trivial"]:checked + .difficulty-label {
  background: rgba(20, 184, 166, 0.15);
  border-color: var(--color-accent);
  box-shadow: 0 0 10px rgba(20, 184, 166, 0.2);
}

.difficulty-radio[value="medium"]:checked + .difficulty-label {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--color-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.2);
}

.difficulty-radio[value="hard"]:checked + .difficulty-label {
  background: rgba(245, 158, 11, 0.15);
  border-color: var(--color-gold);
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.difficulty-radio[value="epic"]:checked + .difficulty-label {
  background: rgba(244, 63, 94, 0.15);
  border-color: var(--color-coral);
  box-shadow: 0 0 10px rgba(244, 63, 94, 0.2);
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, var(--color-primary) 0%, rgba(99, 102, 241, 0.8) 100%);
  border: none;
  padding: 0.8rem;
  border-radius: 10px;
  color: white;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

.btn-primary:active {
  transform: translateY(0);
}

/* Tabs & Task Lists */
.tasks-board-card {
  min-height: 500px;
}

.board-tabs {
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 0.75rem;
  margin-bottom: 1.5rem;
}

.board-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.5rem 1rem;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.3s;
}

.board-tab-btn:hover {
  color: var(--text-main);
  background: var(--glass-surface);
}

.board-tab-btn.active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}

/* Task Item Card UI */
.task-item-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: 1.25rem;
  margin-bottom: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1.5rem;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: taskEnter 0.3s ease;
}

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

.task-item-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.035);
  transform: translateX(4px);
}

.task-item-card.completed {
  border-color: rgba(20, 184, 166, 0.1);
  background: rgba(20, 184, 166, 0.01);
  opacity: 0.7;
}

.task-item-card.completed:hover {
  transform: none;
}

.task-item-left {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.task-title-area {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.task-checkbox {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 2px solid var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  background: transparent;
  flex-shrink: 0;
}

.task-checkbox:hover {
  border-color: var(--color-accent);
  background: rgba(20, 184, 166, 0.1);
}

.task-checkbox i {
  color: var(--text-dark);
  font-size: 0.8rem;
  display: none;
}

.task-item-card.completed .task-checkbox {
  background: var(--color-accent);
  border-color: var(--color-accent);
  box-shadow: 0 0 8px rgba(20, 184, 166, 0.4);
}

.task-item-card.completed .task-checkbox i {
  display: block;
}

.task-title-text {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--text-main);
  transition: color 0.2s;
}

.task-item-card.completed .task-title-text {
  text-decoration: line-through;
  color: var(--text-muted);
}

.task-description-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
  padding-left: 1.75rem;
}

.task-item-card.completed .task-description-text {
  color: rgba(148, 163, 184, 0.6);
}

/* Badges Row */
.task-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-left: 1.75rem;
  margin-top: 0.25rem;
}

.tag-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 500;
}

.tag-badge.category {
  color: white;
}

.tag-badge.difficulty-trivial {
  background: rgba(20, 184, 166, 0.1);
  border: 1px solid rgba(20, 184, 166, 0.2);
  color: var(--color-accent);
}

.tag-badge.difficulty-medium {
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--color-primary);
}

.tag-badge.difficulty-hard {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: var(--color-gold);
}

.tag-badge.difficulty-epic {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--color-coral);
}

.tag-badge.due-date {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
}

.tag-badge.due-date.overdue {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.2);
  color: var(--color-coral);
}

/* Task Actions (Buttons) */
.task-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  color: var(--text-muted);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-icon:hover {
  background: var(--glass-surface-hover);
  color: var(--text-main);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-icon.complete:hover {
  color: var(--color-accent);
  background: rgba(20, 184, 166, 0.1);
  border-color: rgba(20, 184, 166, 0.3);
}

.btn-icon.fail:hover {
  color: var(--color-coral);
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
}

.btn-icon.delete:hover {
  color: var(--color-coral);
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.3);
}

/* Progress-Toggle Buttons (To-Do <-> In-Progress) */
.btn-progress {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.2);
  color: var(--color-primary);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-progress:hover {
  background: var(--color-primary);
  color: white;
}

/* ==========================================================================
   PAGE: ACHIEVEMENTS (HISTORY)
   ========================================================================== */

.history-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 2rem;
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--glass-border);
  padding: 1.25rem;
  border-radius: 16px;
}

.control-item {
  flex: 1 1 200px;
}

.history-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  align-items: start;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.history-item-card {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--glass-border);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.2s;
}

.history-item-card:hover {
  background: rgba(255, 255, 255, 0.035);
  border-color: rgba(255, 255, 255, 0.12);
}

.history-item-card.completed {
  border-left: 4px solid var(--color-accent);
}

.history-item-card.failed {
  border-left: 4px solid var(--color-coral);
  opacity: 0.85;
}

.history-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.history-title {
  font-weight: 600;
  font-size: 1rem;
}

.history-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.history-badge {
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-size: 0.7rem;
  font-weight: bold;
}

.history-badge.success {
  background: rgba(20, 184, 166, 0.1);
  color: var(--color-accent);
}

.history-badge.fail {
  background: rgba(244, 63, 94, 0.1);
  color: var(--color-coral);
}

.history-reward-points {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.1rem;
  text-align: right;
}

.history-reward-points.gained {
  color: var(--color-accent);
}

.history-reward-points.lost {
  color: var(--color-coral);
}

/* Reflection Log Card */
.reflection-log-card {
  max-height: 600px;
  overflow-y: auto;
}

.reflection-item {
  border-bottom: 1px solid var(--glass-border);
  padding: 1rem 0;
}

.reflection-item:last-child {
  border-bottom: none;
}

.reflection-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.reflection-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.reflection-text {
  font-size: 0.85rem;
  color: #cbd5e1;
  background: rgba(244, 63, 94, 0.05);
  border-left: 2px solid var(--color-coral);
  padding: 0.5rem 0.75rem;
  border-radius: 0 6px 6px 0;
  font-style: italic;
}

/* ==========================================================================
   PAGE: REWARD SHOP
   ========================================================================== */

.shop-balance-banner {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(20, 184, 166, 0.1) 100%);
  border: 1px solid var(--glass-border-glow);
  padding: 1.5rem 2rem;
  border-radius: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.shop-balance-info h3 {
  font-family: 'Outfit', sans-serif;
  font-size: 1.1rem;
  color: var(--text-muted);
}

.shop-balance-val {
  font-family: 'Outfit', sans-serif;
  font-weight: 800;
  font-size: 2.2rem;
  color: var(--color-gold);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

.rewards-grid-layout {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.reward-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 220px;
  position: relative;
}

.reward-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.reward-emoji-box {
  font-size: 2.5rem;
  width: 60px;
  height: 60px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reward-title-box h3 {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 1.15rem;
  margin-bottom: 0.25rem;
}

.reward-claimed-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.reward-cost-tag {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-gold);
  display: flex;
  align-items: center;
  gap: 0.25rem;
  margin-bottom: 1.5rem;
}

.btn-buy {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  color: var(--color-gold);
  width: 100%;
  padding: 0.7rem;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-buy:hover:not(:disabled) {
  background: var(--color-gold);
  color: var(--text-dark);
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.4);
  transform: translateY(-2px);
}

.btn-buy:disabled {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--glass-border);
  color: var(--text-muted);
  cursor: not-allowed;
}

/* Add custom reward button card */
.reward-card.add-new {
  border: 1px dashed var(--glass-border);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.reward-card.add-new:hover {
  background: rgba(255, 255, 255, 0.015);
  border-color: var(--color-primary);
}

.add-new-icon {
  font-size: 2rem;
  color: var(--text-muted);
}

.reward-card.add-new:hover .add-new-icon {
  color: var(--color-primary);
  transform: scale(1.1);
  transition: transform 0.2s;
}

/* ==========================================================================
   PAGE: SETTINGS
   ========================================================================== */

.settings-grid-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
}

.cat-edit-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1rem;
}

.cat-edit-item {
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.cat-edit-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.cat-edit-color-preview {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.settings-action-row {
  display: flex;
  gap: 1rem;
  margin-top: 1rem;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text-main);
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-secondary:hover {
  background: var(--glass-surface-hover);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.3);
  color: var(--color-coral);
  padding: 0.75rem 1.25rem;
  border-radius: 10px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.btn-danger:hover {
  background: var(--color-coral);
  color: white;
}

/* ==========================================================================
   MODAL DIALOG DIALOGS
   ========================================================================== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(10, 15, 30, 0.75);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-box {
  width: 100%;
  max-width: 480px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--glass-border-glow);
  border-radius: 24px;
  padding: 2.25rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-overlay.active .modal-box {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.modal-title {
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
}

.btn-close-modal:hover {
  color: var(--text-main);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

/* ==========================================================================
   SPECIAL EFFECTS
   ========================================================================== */

/* Level-Up Overlay Display */
.levelup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(9, 13, 22, 0.9);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}

.levelup-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.levelup-banner {
  text-align: center;
  transform: scale(0.7);
  transition: transform 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.levelup-overlay.active .levelup-banner {
  transform: scale(1);
}

.levelup-sparkles {
  font-size: 4rem;
  animation: bounceRotate 2s infinite alternate ease-in-out;
  display: inline-block;
  margin-bottom: 1rem;
}

@keyframes bounceRotate {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(-15px) rotate(15deg); }
}

.levelup-title {
  font-family: 'Outfit', sans-serif;
  font-size: 4rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent), var(--color-gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow: 0 0 30px rgba(99, 102, 241, 0.5);
  letter-spacing: -2px;
  animation: pulseGlow 1.5s infinite linear alternate;
}

@keyframes pulseGlow {
  0% { filter: drop-shadow(0 0 10px rgba(99, 102, 241, 0.3)); }
  100% { filter: drop-shadow(0 0 35px rgba(20, 184, 166, 0.8)); }
}

.levelup-level-num {
  font-family: 'Outfit', sans-serif;
  font-size: 7rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1;
  margin: 1rem 0;
  text-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.levelup-subtitle {
  font-size: 1.25rem;
  color: var(--text-muted);
  margin-bottom: 2rem;
}

/* Particle Canvas Overlay for levelup / coin bursts */
.particle-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: 1500;
  pointer-events: none;
}

/* ==========================================================================
   RESPONSIVENESS (MOBILE LAYOUT)
   ========================================================================== */

@media (max-width: 1024px) {
  .app-container {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    height: auto;
    position: fixed;
    bottom: 0;
    top: auto;
    border-right: none;
    border-top: 1px solid var(--glass-border);
    padding: 0.5rem 1rem calc(0.5rem + env(safe-area-inset-bottom)) 1rem;
    flex-direction: row;
    justify-content: space-around;
    background: rgba(9, 13, 22, 0.95);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .logo-container, .sidebar-user {
    display: none;
  }

  .nav-links {
    flex-direction: row;
    justify-content: space-around;
    width: 100%;
    gap: 0;
  }

  .nav-item a {
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.75rem;
    font-size: 0.75rem;
  }

  .nav-item a i {
    font-size: 1.4rem;
  }

  .main-content {
    padding: 1.5rem 1.5rem calc(6.5rem + env(safe-area-inset-bottom)) 1.5rem; /* extra space at bottom for mobile nav bar */
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .tasks-split-layout {
    grid-template-columns: 1fr;
  }

  .tasks-form-card {
    position: static;
  }

  .history-layout {
    grid-template-columns: 1fr;
  }

  .settings-grid-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding: 1rem 1rem calc(5.5rem + env(safe-area-inset-bottom)) 1rem;
  }

  .glass-card {
    padding: 1.25rem;
  }

  .page-title {
    font-size: 1.8rem;
  }
  
  .hero-stats-card {
    padding: 1.25rem;
  }

  .character-summary {
    gap: 1rem;
  }

  .avatar-large {
    width: 70px;
    height: 70px;
    font-size: 2.5rem;
    border-radius: 16px;
  }

  .character-details h2 {
    font-size: 1.4rem;
  }

  .stats-cards-row {
    grid-template-columns: 1fr;
  }

  /* Wrap action buttons under task details on mobile to prevent squishing */
  .task-item-card {
    flex-direction: column;
    gap: 1rem;
    align-items: stretch;
  }

  .task-actions {
    width: 100%;
    justify-content: flex-end;
    border-top: 1px solid var(--glass-border);
    padding-top: 0.75rem;
    margin-top: 0.25rem;
  }

  .task-badges-row {
    padding-left: 0;
    margin-top: 0.5rem;
  }

  .task-description-text {
    padding-left: 0;
  }

  .levelup-title {
    font-size: 2.8rem;
  }
  .levelup-level-num {
    font-size: 5rem;
  }
}

/* Adjustments for iPhone 12 Mini and extremely narrow viewports */
@media (max-width: 400px) {
  .main-content {
    padding: 1rem 0.5rem calc(5.5rem + env(safe-area-inset-bottom)) 0.5rem;
  }

  .glass-card {
    padding: 1rem;
    border-radius: 16px;
  }

  .nav-item a {
    padding: 0.5rem 0.2rem;
    font-size: 0.65rem;
  }

  .nav-item a i {
    font-size: 1.2rem;
  }

  .avatar-large {
    width: 60px;
    height: 60px;
    font-size: 2rem;
  }

  .character-details h2 {
    font-size: 1.25rem;
  }

  .difficulty-options {
    grid-template-columns: 1fr;
  }
}

