/* ============================================
   Strux Labs Component Library
   ADHD-Optimized Component Implementations
   ============================================ */

/* ============================================
   BASE RESET & GLOBAL STYLES
   ============================================ */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-primary);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: var(--leading-normal);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Focus visible for accessibility */
:focus-visible {
  outline: 3px solid var(--brand-primary);
  outline-offset: 2px;
}

/* Remove default focus for mouse users */
:focus:not(:focus-visible) {
  outline: none;
}

/* ============================================
   BUTTONS - ADHD OPTIMIZED
   ============================================ */

.btn {
  /* Base button styles */
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  letter-spacing: var(--tracking-wider);
  text-decoration: none;
  cursor: pointer;
  border: var(--border-base) solid transparent;
  transition: all var(--transition-base) var(--ease-out);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  user-select: none;
  min-height: 44px;
}

/* Primary button - High contrast for ADHD focus */
.btn-primary {
  background: var(--brand-primary);
  color: white;
  border-color: var(--brand-primary);
}

.btn-primary:hover {
  background: var(--brand-primary-light);
  border-color: var(--brand-primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(88, 115, 203, 0.3);
}

.btn-primary:active {
  background: var(--brand-primary-dark);
  transform: translateY(0);
}

/* Success button - Completion actions */
.btn-success {
  background: var(--success);
  color: white;
  border-color: var(--success);
}

.btn-success:hover {
  background: var(--success-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
}

/* Ghost button - Secondary actions */
.btn-ghost {
  background: transparent;
  color: var(--text-primary);
  border-color: var(--border-color);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border-color-hover);
}

/* Button sizes */
.btn-sm {
  padding: var(--space-2) var(--space-3);
  font-size: var(--text-sm);
  min-height: 32px;
}

.btn-lg {
  padding: var(--space-3) var(--space-6);
  font-size: var(--text-xl);
  min-height: 56px;
}

/* Button states */
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn.is-loading {
  color: transparent;
}

.btn.is-loading::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  border: 2px solid white;
  border-radius: 50%;
  border-top-color: transparent;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================
   QUEST CARDS - GAMIFIED TASKS
   ============================================ */

.quest-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  position: relative;
  transition: all var(--transition-base) var(--ease-out);
  overflow: hidden;
}

/* Priority indicator bar */
.quest-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--priority-medium);
  transition: all var(--transition-base);
}

.quest-card.priority-high::before {
  background: var(--gradient-orange);
  height: 4px;
}

.quest-card.priority-critical::before {
  background: var(--gradient-red);
  height: 6px;
  animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
  0%, 100% { 
    opacity: 1;
    box-shadow: 0 0 10px currentColor;
  }
  50% { 
    opacity: 0.7;
    box-shadow: 0 0 20px currentColor;
  }
}

/* Quest card hover state */
.quest-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-color-hover);
  box-shadow: var(--shadow-lg);
}

/* Quest card header */
.quest-card__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.quest-card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.quest-card__icon {
  font-size: 24px;
  color: var(--brand-primary);
}

/* Quest status badge */
.quest-card__status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.quest-card__status.status-pending {
  background: var(--quest-pending);
  color: white;
}

.quest-card__status.status-in-progress {
  background: var(--quest-in-progress);
  color: white;
}

.quest-card__status.status-completed {
  background: var(--quest-completed);
  color: white;
}

/* Quest card body */
.quest-card__body {
  margin-bottom: var(--space-4);
}

.quest-card__description {
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-3);
}

/* Quest metadata */
.quest-card__meta {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-4);
}

.quest-card__meta-item {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

.quest-card__meta-icon {
  font-size: 18px;
  color: var(--text-muted);
}

/* Quest progress bar */
.quest-progress {
  margin-bottom: var(--space-4);
}

.quest-progress__label {
  display: flex;
  justify-content: space-between;
  font-size: var(--text-sm);
  color: var(--text-secondary);
  margin-bottom: var(--space-2);
}

.quest-progress__bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.quest-progress__fill {
  height: 100%;
  background: var(--gradient-blue);
  transition: width var(--transition-slow) var(--ease-out);
  position: relative;
}

/* Milestone markers on progress bar */
.quest-progress__milestone {
  position: absolute;
  width: 2px;
  height: 12px;
  background: rgba(255, 255, 255, 0.2);
  top: -2px;
}

/* Quest card actions */
.quest-card__actions {
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* ============================================
   COGNITIVE LOAD INDICATORS
   ============================================ */

.cognitive-load {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.cognitive-load__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  transition: all var(--transition-fast);
}

.cognitive-load__dot.filled {
  background: var(--difficulty-medium);
}

.cognitive-load--easy .cognitive-load__dot.filled {
  background: var(--difficulty-easy);
}

.cognitive-load--hard .cognitive-load__dot.filled {
  background: var(--difficulty-hard);
}

.cognitive-load__label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
  margin-left: var(--space-1);
}

/* ============================================
   TIME URGENCY INDICATORS
   ============================================ */

.urgency-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  position: relative;
}

.urgency-badge--overdue {
  background: var(--urgency-overdue-bg);
  color: var(--urgency-overdue);
  animation: pulse 2s infinite;
}

.urgency-badge--today {
  background: var(--urgency-today-bg);
  color: var(--urgency-today);
}

.urgency-badge--tomorrow {
  background: var(--urgency-tomorrow-bg);
  color: var(--urgency-tomorrow);
}

.urgency-badge--this-week {
  background: rgba(88, 115, 203, 0.2);
  color: #7A91D4;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

/* ============================================
   AI ELEMENTS
   ============================================ */

.ai-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-3);
  background: var(--ai-bg);
  color: var(--ai-primary);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--font-semibold);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.ai-badge__icon {
  font-size: 14px;
}

/* AI confidence meter */
.ai-confidence {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.ai-confidence__meter {
  width: 60px;
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}

.ai-confidence__fill {
  height: 100%;
  transition: all var(--transition-base);
}

.ai-confidence__fill.high {
  background: var(--ai-confidence-high);
}

.ai-confidence__fill.medium {
  background: var(--ai-confidence-medium);
}

.ai-confidence__fill.low {
  background: var(--ai-confidence-low);
}

.ai-confidence__label {
  font-size: var(--text-xs);
  color: var(--text-secondary);
}

/* AI reasoning tooltip */
.ai-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: help;
}

.ai-tooltip__trigger {
  font-size: 16px;
  color: var(--ai-primary);
  opacity: 0.7;
  transition: opacity var(--transition-fast);
}

.ai-tooltip:hover .ai-tooltip__trigger {
  opacity: 1;
}

.ai-tooltip__content {
  position: absolute;
  bottom: calc(100% + var(--space-2));
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--bg-tertiary), rgba(156, 39, 176, 0.1));
  border: 1px solid var(--ai-primary);
  color: var(--text-primary);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: var(--leading-relaxed);
  width: 250px;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  box-shadow: var(--shadow-xl);
  z-index: var(--z-tooltip);
}

.ai-tooltip:hover .ai-tooltip__content {
  opacity: 1;
  pointer-events: auto;
}

/* ============================================
   FOCUS MODE CONTAINER
   ============================================ */

.focus-mode {
  background: var(--bg-primary);
  border-radius: var(--radius-xl);
  padding: var(--space-8);
  margin: var(--space-8) 0;
  position: relative;
  border: 2px solid transparent;
  background-clip: padding-box;
}

.focus-mode::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  background: var(--gradient-primary);
  border-radius: var(--radius-xl);
  z-index: -1;
  opacity: 0.2;
}

.focus-mode__title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  margin-bottom: var(--space-4);
  text-align: center;
}

.focus-mode__content {
  max-width: var(--content-prose);
  margin: 0 auto;
}

/* ============================================
   EMPTY STATES - ADHD FRIENDLY
   ============================================ */

.empty-state {
  text-align: center;
  padding: var(--space-12) var(--space-6);
}

.empty-state__icon {
  font-size: 192px;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
  opacity: 0.5;
  display: block;
}

.empty-state__title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

.empty-state__description {
  font-size: var(--text-base);
  color: var(--text-secondary);
  max-width: 400px;
  margin: 0 auto var(--space-6);
  line-height: var(--leading-relaxed);
}

.empty-state__action {
  display: inline-block;
}

/* ============================================
   ACHIEVEMENT CELEBRATIONS
   ============================================ */

@keyframes celebrate {
  0% { transform: scale(0) rotate(0); opacity: 0; }
  50% { transform: scale(1.2) rotate(180deg); opacity: 1; }
  100% { transform: scale(1) rotate(360deg); opacity: 1; }
}

.achievement {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  background: var(--gradient-success);
  border-radius: 50%;
  position: relative;
  animation: celebrate 0.6s var(--ease-bounce);
}

.achievement__icon {
  font-size: 40px;
  color: white;
}

.achievement__sparkles {
  position: absolute;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.achievement__sparkle {
  position: absolute;
  width: 4px;
  height: 4px;
  background: white;
  border-radius: 50%;
  animation: sparkle 1s ease-out;
}

@keyframes sparkle {
  0% {
    transform: translate(0, 0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translate(var(--x), var(--y)) scale(0);
    opacity: 0;
  }
}

/* ============================================
   FORM INPUTS & DATA ENTRY
   ============================================ */

/* Input Fields */
.input {
  width: 100%;
  padding: var(--space-3) var(--space-4);
  background: var(--bg-secondary);
  border: 2px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: var(--text-base);
  font-family: var(--font-primary);
  line-height: var(--leading-normal);
  transition: all var(--transition-base);
}

.input::placeholder {
  color: var(--text-muted);
}

.input:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.input:focus {
  outline: none;
  border-color: var(--brand-primary);
  box-shadow: 0 0 0 3px rgba(88, 115, 203, 0.2);
}

.input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: var(--bg-tertiary);
}

/* Input States */
.input--error {
  border-color: var(--error);
}

.input--error:focus {
  box-shadow: 0 0 0 3px rgba(244, 67, 54, 0.2);
}

.input--success {
  border-color: var(--success);
}

.input--success:focus {
  box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

/* Textarea */
.textarea {
  min-height: 120px;
  resize: vertical;
  font-family: var(--font-primary);
}

/* Select Dropdown */
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23A0A0A0' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  padding-right: var(--space-10);
}

/* Form Field Group */
.form-field {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
}

.form-label--required::after {
  content: '*';
  color: var(--error);
  margin-left: var(--space-1);
}

.form-hint {
  display: block;
  margin-top: var(--space-1);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

.form-error {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-2);
  font-size: var(--text-sm);
  color: var(--error);
}

/* Checkbox & Radio */
.checkbox,
.radio {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  cursor: pointer;
  user-select: none;
}

.checkbox input,
.radio input {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkbox__box,
.radio__circle {
  width: 20px;
  height: 20px;
  background: var(--bg-secondary);
  border: 2px solid rgba(255, 255, 255, 0.1);
  transition: all var(--transition-base);
}

.checkbox__box {
  border-radius: var(--radius-sm);
}

.radio__circle {
  border-radius: 50%;
}

.checkbox:hover .checkbox__box,
.radio:hover .radio__circle {
  border-color: var(--brand-primary);
}

.checkbox input:checked ~ .checkbox__box {
  background: var(--brand-primary);
  border-color: var(--brand-primary);
}

.checkbox input:checked ~ .checkbox__box::after {
  content: '✓';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.radio input:checked ~ .radio__circle {
  border-color: var(--brand-primary);
}

.radio input:checked ~ .radio__circle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 10px;
  height: 10px;
  background: var(--brand-primary);
  border-radius: 50%;
}

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

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  z-index: var(--z-modal, 1000);
  animation: fadeIn 0.2s ease-out;
}

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

/* Modal Container */
.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-2xl);
  max-width: 600px;
  width: 100%;
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  animation: slideUp 0.3s ease-out;
}

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

/* Modal Sizes */
.modal--sm {
  max-width: 400px;
}

.modal--md {
  max-width: 600px;
}

.modal--lg {
  max-width: 800px;
}

.modal--xl {
  max-width: 1000px;
}

.modal--full {
  max-width: 95vw;
  max-height: 95vh;
}

/* Modal Header */
.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal__title {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin: 0;
}

.modal__close {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-base);
}

.modal__close:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* Modal Body */
.modal__body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-6);
}

.modal__body::-webkit-scrollbar {
  width: 8px;
}

.modal__body::-webkit-scrollbar-track {
  background: transparent;
}

.modal__body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
}

.modal__body::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Modal Footer */
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: var(--space-6);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* Modal Variants */
.modal--danger .modal__header {
  background: rgba(244, 67, 54, 0.1);
  border-bottom-color: rgba(244, 67, 54, 0.3);
}

.modal--danger .modal__title {
  color: var(--error);
}

.modal--success .modal__header {
  background: rgba(76, 175, 80, 0.1);
  border-bottom-color: rgba(76, 175, 80, 0.3);
}

.modal--success .modal__title {
  color: var(--success);
}

/* ============================================
   ACCESSIBILITY UTILITIES
   ============================================ */

/* Screen reader only */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  padding: inherit;
  margin: inherit;
  overflow: visible;
  clip: auto;
  white-space: normal;
}

/* Skip to main content link */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--brand-primary);
  color: white;
  padding: var(--space-2) var(--space-4);
  z-index: var(--z-max);
  text-decoration: none;
  border-radius: 0 0 var(--radius-md) 0;
}

.skip-link:focus {
  top: 0;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  :root {
    --border-color: rgba(255, 255, 255, 0.3);
    --text-secondary: var(--text-primary);
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ============================================
   ACHIEVEMENT CARDS - GAMIFICATION
   ============================================ */

.achievement-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

/* Unlocked achievement with gradient background */
.achievement-card--unlocked {
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.08) 0%, rgba(255, 165, 0, 0.04) 100%);
  border-color: rgba(255, 215, 0, 0.3);
}

.achievement-card--unlocked::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 215, 0, 0.1) 50%, transparent 70%);
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%) translateY(-100%) rotate(45deg); }
  100% { transform: translateX(100%) translateY(100%) rotate(45deg); }
}

/* Locked achievement with grayscale */
.achievement-card--locked {
  opacity: 0.6;
  filter: grayscale(80%);
}

.achievement-card__icon {
  font-size: 64px;
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 1;
}

.achievement-card--unlocked .achievement-card__icon {
  animation: celebrate 0.6s var(--ease-bounce);
}

.achievement-card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

.achievement-card__description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
  margin-bottom: var(--space-4);
}

/* Achievement progress bar */
.achievement-card__progress {
  width: 100%;
  margin-bottom: var(--space-3);
}

.achievement-card__progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-2);
}

.achievement-card__progress-fill {
  height: 100%;
  background: var(--gradient-success);
  transition: width var(--transition-slow) var(--ease-out);
}

.achievement-card__progress-text {
  font-size: var(--text-xs);
  color: var(--text-secondary);
  text-align: center;
}

/* Achievement XP reward */
.achievement-card__xp {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-3);
  background: rgba(255, 215, 0, 0.15);
  color: #FFD700;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: var(--font-semibold);
  margin-bottom: var(--space-3);
}

/* Achievement unlock date */
.achievement-card__unlock-date {
  font-size: var(--text-xs);
  color: var(--text-muted);
}

/* Compact Achievement Badges */
.compact-achievement {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
}

.compact-achievement:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.compact-achievement--unlocked {
  border-color: rgba(255, 215, 0, 0.3);
  background: linear-gradient(135deg, rgba(255, 215, 0, 0.08) 0%, rgba(255, 165, 0, 0.04) 100%);
}

.compact-achievement--locked {
  opacity: 0.5;
  filter: grayscale(80%);
}

.compact-achievement__icon {
  font-size: 32px;
  flex-shrink: 0;
}

.compact-achievement__info {
  flex: 1;
  min-width: 0;
}

.compact-achievement__title {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.compact-achievement__xp {
  font-size: var(--text-sm);
  color: #FFD700;
  font-weight: var(--font-semibold);
}

/* Achievement expandable details */
.compact-achievement__details {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-base);
}

.compact-achievement.is-expanded .compact-achievement__details {
  max-height: 200px;
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--border-color);
}

.compact-achievement__description {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: var(--leading-relaxed);
}

/* ============================================
   COURSE GRADE CARDS
   ============================================ */

.course-grade-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  transition: all var(--transition-base);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.course-grade-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--border-color-hover);
}

/* Custom course color tint background */
.course-grade-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: currentColor;
  opacity: 0.05;
  pointer-events: none;
}

.course-grade-card__header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: var(--space-4);
  position: relative;
  z-index: 1;
}

.course-grade-card__title {
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  margin-bottom: var(--space-1);
}

.course-grade-card__teacher {
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* Semantic grade letter colors */
.course-grade-card__grade {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  line-height: 1;
  border-radius: var(--radius-md);
  padding: var(--space-2) var(--space-3);
}

.course-grade-card__grade--a {
  color: var(--grade-a);
  background: rgba(76, 175, 80, 0.15);
}

.course-grade-card__grade--b {
  color: var(--grade-b);
  background: rgba(33, 150, 243, 0.15);
}

.course-grade-card__grade--c {
  color: var(--grade-c);
  background: rgba(255, 193, 7, 0.15);
}

.course-grade-card__grade--d {
  color: var(--grade-d);
  background: rgba(255, 152, 0, 0.15);
}

.course-grade-card__grade--f {
  color: var(--grade-f);
  background: rgba(244, 67, 54, 0.15);
}

.course-grade-card__details {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  position: relative;
  z-index: 1;
}

.course-grade-card__detail {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.course-grade-card__detail-label {
  font-size: var(--text-xs);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wider);
}

.course-grade-card__detail-value {
  font-size: var(--text-base);
  color: var(--text-primary);
  font-weight: var(--font-semibold);
}

/* ============================================
   TYPOGRAPHY UTILITY CLASSES
   ============================================ */

h1, .h1 {
  font-size: var(--text-4xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

h2, .h2 {
  font-size: var(--text-3xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-4);
}

h3, .h3 {
  font-size: var(--text-2xl);
  font-weight: var(--font-bold);
  line-height: var(--leading-tight);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

h4, .h4 {
  font-size: var(--text-xl);
  font-weight: var(--font-semibold);
  line-height: var(--leading-snug);
  color: var(--text-primary);
  margin-bottom: var(--space-3);
}

h5, .h5 {
  font-size: var(--text-lg);
  font-weight: var(--font-semibold);
  line-height: var(--leading-snug);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

h6, .h6 {
  font-size: var(--text-base);
  font-weight: var(--font-semibold);
  line-height: var(--leading-normal);
  color: var(--text-primary);
  margin-bottom: var(--space-2);
}

/* ============================================
   CONTAINER HIERARCHY SYSTEM
   ============================================ */

.container-primary {
  background: var(--bg-primary);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
}

.container-secondary {
  background: var(--bg-secondary);
  padding: var(--space-6);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-color);
}

.container-tertiary {
  background: var(--bg-tertiary);
  padding: var(--space-4);
  border-radius: var(--radius-md);
}

/* Nested container spacing */
.container-primary .container-secondary {
  margin: var(--space-4) 0;
}

.container-secondary .container-tertiary {
  margin: var(--space-3) 0;
}