:root {
  --color-primary: 5, 150, 105; /* Emerald 600 */
  --color-primary-dark: 4, 120, 87; /* Emerald 700 */
  --color-accent: 234, 88, 12; /* Orange 600 */
  --color-bg: 248, 250, 252; /* Slate 50 */
  --color-surface: 255, 255, 255;
  --color-text: 15, 23, 42; /* Slate 900 */
  --color-text-muted: 100, 116, 139; /* Slate 500 */
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: rgb(var(--color-bg));
  color: rgb(var(--color-text));
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

/* Animations */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes pulseGlow {
  0% { box-shadow: 0 0 0 0 rgba(var(--color-primary), 0.4); }
  70% { box-shadow: 0 0 0 10px rgba(var(--color-primary), 0); }
  100% { box-shadow: 0 0 0 0 rgba(var(--color-primary), 0); }
}

.animate-fade-in {
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-up {
  animation: slideUp 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.animate-slide-in-right {
  animation: slideInRight 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* Staggered animations */
.stagger-1 { animation-delay: 0.1s; }
.stagger-2 { animation-delay: 0.2s; }
.stagger-3 { animation-delay: 0.3s; }
.stagger-4 { animation-delay: 0.4s; }

/* Card Hover Effects */
.hover-card-lift {
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.3s ease;
}
.hover-card-lift:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.1);
}

/* Toast Notification */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}
.toast-msg {
  background: #ffffff;
  color: #0f172a;
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  display: flex;
  align-items: center;
  gap: 12px;
  pointer-events: auto;
  border-left: 4px solid rgb(var(--color-primary));
  animation: slideInRight 0.3s ease forwards;
  min-width: 300px;
}
.toast-msg.error {
  border-left-color: #ef4444;
}
.toast-msg.leaving {
  animation: fadeIn 0.3s ease reverse forwards;
}

/* Heatmap specifics */
.heatmap-cell {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  background-color: #e2e8f0;
  transition: all 0.2s ease;
}
.heatmap-cell[data-level="1"] { background-color: #a7f3d0; } /* Light Emerald */
.heatmap-cell[data-level="2"] { background-color: #34d399; }
.heatmap-cell[data-level="3"] { background-color: #10b981; }
.heatmap-cell[data-level="4"] { background-color: #059669; } /* Dark Emerald */

/* Flashcard Flip */
.perspective-1000 { perspective: 1000px; }
.transform-style-3d { transform-style: preserve-3d; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1); }
.backface-hidden { backface-visibility: hidden; }
.rotate-y-180 { transform: rotateY(180deg); }

/* Custom inputs */
.input-field {
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 0.75rem;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  transition: all 0.2s;
  outline: none;
}
.input-field:focus {
  background: #ffffff;
  border-color: rgb(var(--color-primary));
  box-shadow: 0 0 0 3px rgba(var(--color-primary), 0.1);
}

/* Glassmorphism utilities */
.glass-panel {
  background: rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.5);
}


@media (max-width: 640px) {
  .toast-container {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }

  .toast-msg {
    min-width: 0;
    width: 100%;
    padding: 14px 16px;
  }

  .heatmap-cell {
    width: 12px;
    height: 12px;
  }

  #flashcard-inner {
    min-height: 18rem;
  }
}