:root {
  --primary-color: #6366f1;
  --secondary-color: #a855f7;
  --bg-color: #0f172a;
  --card-bg: #1e293b;
  --text-color: #f8fafc;
  --text-muted: #94a3b8;
  --success: #22c55e;
  --warning: #f59e0b;
}

* {
  box-sizing: border_box;
  margin: 0;
  padding: 0;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

body {
  background-color: var(--bg-color);
  color: var(--text-color);
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  padding-bottom: 90px;
}

.app-container {
  width: 100%;
  max-width: 480px; /* Mobile-first view simulation */
  background-color: var(--bg-color);
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Header & Profile */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--card-bg);
  padding: 15px;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-icon {
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
}

.profile-info h2 {
  font-size: 1rem;
  margin-bottom: 2px;
}

.level-badge {
  font-size: 0.7rem;
  background: linear-gradient(
    135deg,
    var(--primary-color),
    var(--secondary-color)
  );
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: bold;
}

.gamification-stats {
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.streak {
  color: var(--warning);
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
  font-size: 0.9rem;
}

.points {
  color: var(--text-muted);
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.points i {
  color: var(--secondary-color);
}

/* View Controls */
.view-controls {
  display: flex;
  background: var(--card-bg);
  padding: 4px;
  border-radius: 8px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.view-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: all 0.2s;
}

.view-btn.active {
  background: var(--bg-color);
  color: var(--text-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* AI Input Section */
.ai-input-section {
  background: var(--card-bg);
  padding: 15px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

textarea {
  background: #334155;
  border: none;
  color: white;
  padding: 10px;
  border-radius: 8px;
  resize: none;
  height: 80px;
  font-size: 0.9rem;
}

textarea:focus {
  outline: 2px solid var(--primary-color);
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  border: none;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: bold;
  transition: filter 0.2s;
}

.btn-primary:hover {
  filter: brightness(1.1);
}

/* Timeline / Schedule */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 15px;
  padding-bottom: 20px;
}

.timeline-item {
  display: flex;
  gap: 12px;
  position: relative;
}

/* Vertical line */
.timeline-item::before {
  content: "";
  position: absolute;
  left: 24px; /* Align with circle center */
  top: 30px;
  bottom: -20px;
  width: 2px;
  background: #334155;
  z-index: 0;
}

.timeline-item:last-child::before {
  display: none;
}

.time-marker {
  min-width: 50px;
  text-align: right;
  font-size: 0.85rem;
  color: var(--text-muted);
  padding-top: 5px;
}

.card {
  background: var(--card-bg);
  padding: 12px 15px;
  border-radius: 12px;
  flex-grow: 1;
  position: relative;
  z-index: 1;
  border-left: 4px solid var(--primary-color);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s;
}

.card:active {
  transform: scale(0.98);
}

/* Action buttons inside card */
.card-actions {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  gap: 8px;
}

.action-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  font-size: 0.9rem;
}

.action-btn.check:hover {
  color: var(--success);
}
.action-btn.edit:hover {
  color: var(--primary-color);
}
.action-btn.delete:hover {
  color: #ef4444;
}

.card.invisible-task {
  border-left-color: var(--text-muted);
  opacity: 0.8;
  background: #1e293b80; /* lighter/transparent */
}

.card.habit-task {
  border-left-color: var(--success);
}

.card h3 {
  font-size: 1rem;
  margin-bottom: 5px;
  display: flex;
  align-items: center;
}

.card p {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  margin-top: 8px;
  background: #334155;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Floating Action Button */
.fab {
  position: fixed;
  bottom: 80px;
  right: 20px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary-color);
  color: white;
  border: none;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.4);
  font-size: 1.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 200;
  transition: transform 0.2s;
}

.fab:active {
  transform: scale(0.9);
}

/* Bottom Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--card-bg);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid #334155;
  z-index: 100;
}

.nav-item {
  color: var(--text-muted);
  text-decoration: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.75rem;
  gap: 4px;
  padding: 8px;
  flex: 1;
  transition: color 0.2s;
}

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

.nav-item.active {
  color: var(--primary-color);
}

.nav-item:hover {
  color: var(--text-color);
}

/* Loading Animation */
.loading {
  display: none;
  text-align: center;
  padding: 20px;
  color: var(--text-muted);
}
.loading.active {
  display: block;
}

/* Hidden helper */
.hidden {
  display: none !important;
}

/* Animation for XP Float */
@keyframes floatUp {
  0% {
    transform: translateY(0);
    opacity: 1;
  }
  100% {
    transform: translateY(-40px);
    opacity: 0;
  }
}

.xp-float {
  position: absolute;
  color: var(--warning);
  font-weight: bold;
  font-size: 1rem;
  pointer-events: none;
  animation: floatUp 1.2s ease-out forwards;
  z-index: 999;
}

/* Pulse animation for header stats */
@keyframes slightPulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.2);
    color: var(--success);
  }
  100% {
    transform: scale(1);
  }
}

.pulse-anim {
  animation: slightPulse 0.4s ease;
}
