/* Global Reset & Box-Sizing */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

/* CSS-Variablen */
:root {
  /* ─── COLORS ─────────────────────────────────────────────────────────── */
  --primary:        #E63312;
  --primary-dark:   #BB2D3B;
  --primary-light:  #ff6b4a;
  --success:        #4caf50;
  --success-dark:   #388e3c;
  --warning:        #ffeb3b;
  --warning-dark:   #ffc107;
  --error:          #f44336;
  --error-dark:     #d32f2f;
  --info:           #2196F3;
  --info-dark:      #1976d2;
  
  /* Text & Background Colors */
  --text-color:     #333;
  --text-muted:     #666;
  --text-light:     #999;
  --bg-color:       #fff;
  --bg-alt:         #f8f9fa;
  --card-bg:        #f9f9f9;
  --border-color:   #ccc;
  --border-light:   #dee2e6;
  --border-dark:    #adb5bd;
  --bar-bg:         #ddd;
  --overlay-bg:     rgba(0, 0, 0, 0.1);
  
  /* Achievement Colors */
  --achievement-gold: #ffd700;
  --achievement-gold-dark: #b8860b;
  --achievement-unlock: #fffacd;
  
  /* Timer Colors */
  --timer-normal:   #2196F3;
  --timer-warning:  #ff9800;
  --timer-danger:   #f44336;

  /* ─── SPACING ────────────────────────────────────────────────────────── */
  --space-xs:       0.25rem;  /* 4px */
  --space-sm:       0.5rem;   /* 8px */
  --space-md:       1rem;     /* 16px */
  --space-lg:       1.5rem;   /* 24px */
  --space-xl:       2rem;     /* 32px */
  --space-xxl:      3rem;     /* 48px */
  
  /* Container Spacing */
  --container-padding: 1.25rem; /* 20px */
  --card-padding:      var(--space-lg);
  --section-spacing:   var(--space-xl);

  /* ─── TYPOGRAPHY ─────────────────────────────────────────────────────── */
  --font-size-xs:   0.75rem;  /* 12px */
  --font-size-sm:   0.875rem; /* 14px */
  --font-size-base: 1rem;     /* 16px */
  --font-size-lg:   1.125rem; /* 18px */
  --font-size-xl:   1.25rem;  /* 20px */
  --font-size-xxl:  1.5rem;   /* 24px */
  --font-size-xxxl: 2rem;     /* 32px */
  
  --font-weight-normal: 400;
  --font-weight-medium: 500;
  --font-weight-bold:   700;
  
  --line-height-tight:  1.2;
  --line-height-normal: 1.4;
  --line-height-loose:  1.6;

  /* ─── BORDERS & RADIUS ───────────────────────────────────────────────── */
  --border-width:   1px;
  --border-width-thick: 2px;
  --border-radius-sm: 0.25rem; /* 4px */
  --border-radius:    0.5rem;  /* 8px */
  --border-radius-lg: 0.75rem; /* 12px */
  --border-radius-xl: 1rem;    /* 16px */

  /* ─── SHADOWS ────────────────────────────────────────────────────────── */
  --shadow-sm:      0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow:         0 0.25rem 0.625rem rgba(0, 0, 0, 0.1);
  --shadow-md:      0 4px 12px rgba(0, 0, 0, 0.15);
  --shadow-lg:      0 8px 24px rgba(0, 0, 0, 0.2);
  --shadow-xl:      0 8px 32px rgba(0, 0, 0, 0.25);
  
  /* Achievement Shadows */
  --shadow-achievement: 0 2px 8px rgba(255, 215, 0, 0.2);
  --shadow-achievement-strong: 0 2px 8px rgba(255, 215, 0, 0.3);

  /* ─── TRANSITIONS ────────────────────────────────────────────────────── */
  --transition-fast:   0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow:   0.6s ease-out;
  --ease-in-out:       cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:          cubic-bezier(0, 0, 0.2, 1);
  
  /* Component-specific Transitions */
  --transition-hover:  background-color var(--transition-fast), 
                       color var(--transition-fast),
                       border-color var(--transition-fast);
  --transition-transform: transform var(--transition-normal);

  /* ─── COMPONENT SIZES ────────────────────────────────────────────────── */
  --button-height:     2.75rem; /* 44px */
  --input-height:      2.5rem;  /* 40px */
  --timer-circle:      3rem;    /* 48px */
  --timer-bar-height:  3rem;    /* 48px */
  --progress-bar:      0.625rem; /* 10px */
  --progress-bar-thin: 0.5rem;  /* 8px */
  
  /* Container Sizes */
  --app-max-width:     31.25rem; /* 500px */
  --stats-max-width:   75rem;    /* 1200px */
  --achievement-icon:  6.25rem;  /* 100px */

  /* ─── Z-INDEX LAYERS ─────────────────────────────────────────────────── */
  --z-base:         1;
  --z-dropdown:     100;
  --z-sticky:       200;
  --z-overlay:      500;
  --z-modal:        1000;
  --z-notification: 9999;
  --z-tooltip:      10000;
  --z-loading:      10001;
  --z-error:        10002;
}

/* Allgemeine Komponenten */
/* ─── LAYOUT COMPONENTS ──────────────────────────────────────────────── */

.app {
  max-width: var(--app-max-width);
  width: 100%;
  margin: 0 auto;
  height: auto;
  padding: var(--container-padding);
  box-sizing: border-box;
}

/* Legacy ID selector for backward compatibility */
#app {
  max-width: var(--app-max-width);
  width: 100%;
  margin: 0 auto;
  height: auto;
  padding: var(--container-padding);
  box-sizing: border-box;
}

h1 {
  text-align: center;
  color: var(--primary);
}

.card {
  background-color: var(--card-bg);
  padding: var(--card-padding);
  border-radius: var(--border-radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: var(--space-lg);
}

.hidden {
  display: none !important;
}

/* Formular-Elemente */
label {
  display: block;
  margin-bottom: var(--space-sm);
}

/* ─── FORM COMPONENTS ────────────────────────────────────────────────────────────────────────── */

.form-select,
select {
  width: 100%;
  height: var(--input-height);
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-xs);
  font-size: var(--font-size-base);
  border-radius: var(--border-radius);
  border: var(--border-width) solid var(--border-color);
  background-color: var(--bg-color);
  color: var(--text-color);
  transition: var(--transition-hover);
}

.form-select:focus,
select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(230, 51, 18, 0.2);
}

.button,
button {
  width: 100%;
  min-height: var(--button-height);
  padding: var(--space-sm) var(--space-md);
  margin-top: var(--space-xs);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-medium);
  border-radius: var(--border-radius);
  border: var(--border-width) solid transparent;
  background-color: var(--primary);
  color: var(--bg-color);
  cursor: pointer;
  transition: var(--transition-hover);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.button:hover,
button:hover {
  background-color: var(--primary-dark);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.button:active,
button:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.button:disabled,
button:disabled {
  background-color: var(--text-light) !important;
  color: var(--bg-color) !important;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ─── QUIZ COMPONENTS ────────────────────────────────────────────────────────────────────────── */

.quiz-controller__answers {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.quiz-controller__answer-button,
#answerButtons button {
  text-transform: none;
  margin: var(--space-sm) 0;
  background-color: var(--bg-alt);
  color: var(--text-color);
  border: var(--border-width) solid var(--border-light);
  transition: var(--transition-hover);
  text-align: left;
  font-weight: var(--font-weight-normal);
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.4;
  height: auto;
  min-height: var(--button-height);
}

.quiz-controller__answer-button:hover,
#answerButtons button:hover {
  background-color: var(--border-light);
  border-color: var(--border-color);
  transform: translateY(-1px);
}

.quiz-controller__answer-button--correct,
#answerButtons button.correct {
  background-color: var(--success) !important;
  color: var(--bg-color) !important;
  border-color: var(--success-dark) !important;
}

.quiz-controller__answer-button--wrong,
#answerButtons button.wrong {
  background-color: var(--error) !important;
  color: var(--bg-color) !important;
  border-color: var(--error-dark) !important;
}

.quiz-controller__question-image,
#questionImage {
  width: 100%;
  max-height: 100%;
  object-fit: cover;
  margin: var(--space-md) 0;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
}

/* ─── PROGRESS COMPONENTS ───────────────────────────────────────────────────────────────────── */

.progress__text,
.progress-text {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--space-md);
  color: var(--text-color);
}

.progress__bar-wrapper,
.progress-bar-wrapper {
  width: 100%;
  height: var(--progress-bar);
  background-color: var(--bar-bg);
  border-radius: calc(var(--progress-bar) / 2);
  overflow: hidden;
  margin-top: var(--space-md);
  position: relative;
}

.progress__bar,
.progress-bar {
  height: 100%;
  width: 0%;
  background-color: var(--success);
  transition: width var(--transition-normal);
  border-radius: 0;
}

.progress__bar--complete,
.progress-bar.result-complete {
  background-color: var(--success) !important;
}

.progress__circle,
.circle {
  position: relative;
  width: 7.5rem;
  height: 7.5rem;
  margin: 0 auto;
}

.progress__circle svg,
.circle svg {
  transform: rotate(-90deg);
}

.progress__circle-text,
.circle-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  color: var(--text-color);
  pointer-events: none;
}

.progress__circle-progress,
#progressCircle {
  transition: stroke-dashoffset var(--transition-slow), stroke var(--transition-normal);
}

.percentage,
#percentage {
  font-size: var(--font-size-xxxl);
  font-weight: var(--font-weight-bold);
  text-align: center;
  margin-top: var(--space-md);
  color: var(--text-color);
}

/* ─── TIMER COMPONENTS ─────────────────────────────────────────────────────────────────────── */

.timer__bar,
#questionTimerBar {
  position: relative;
  width: 100%;
  height: var(--timer-bar-height);
  background-color: var(--overlay-bg);
  border-radius: var(--border-radius);
  margin-bottom: var(--space-lg);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.timer__progress,
#questionTimerProgress {
  height: 100%;
  width: 100%;
  background-color: var(--timer-normal);
  transition: background-color var(--transition-normal);
  border-radius: var(--border-radius);
}

.timer__text,
#questionTimerText {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: var(--font-size-xxl);
  font-weight: var(--font-weight-bold);
  color: var(--bg-color);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  z-index: var(--z-dropdown);
  pointer-events: none;
}

/* Timer-Farben werden dynamisch via JS gesetzt */

.timer__bar::before,
#questionTimerBar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.2), transparent);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
  pointer-events: none;
  z-index: var(--z-base);
}

.quiz-controller__question-container,
#questionContainer {
  position: relative;
  padding-top: 0;
}

.progress__text-display,
#progressText {
  margin-bottom: var(--space-md);
  text-align: center;
  position: relative;
  z-index: var(--z-sticky);
  background: var(--primary);
  color: var(--bg-color);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--border-radius);
  font-weight: var(--font-weight-bold);
}

.timer__wrapper,
#timerWrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: var(--space-md) auto;
  width: var(--timer-circle);
  height: var(--timer-circle);
  position: relative;
  transition: var(--transition-transform);
}

.timer__wrapper:hover,
#timerWrapper:hover {
  transform: scale(1.05);
}

.timer__wrapper svg,
#timerWrapper svg {
  transform: rotate(-90deg);
  display: block;
  margin: auto;
}

#pauseOverlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: var(--z-sticky);
  width: 24px;
  height: 24px;
}

/* Pause Symbol (zwei Balken) */
#pauseOverlay.pause-icon::before {
  content: '';
  position: absolute;
  top: 0;
  left: 6px;
  width: 3px;
  height: 24px;
  background-color: var(--text-color);
  border-radius: 1px;
}

#pauseOverlay.pause-icon::after {
  content: '';
  position: absolute;
  top: 0;
  right: 6px;
  width: 3px;
  height: 24px;
  background-color: var(--text-color);
  border-radius: 1px;
}

/* Play Symbol (Dreieck) */
#pauseOverlay.play-icon::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-30%, -50%);
  width: 0;
  height: 0;
  border-left: 12px solid var(--text-color);
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}

.trainer__wrapper,
#trainerWrapper {
  height: auto;
  padding: var(--container-padding);
}

/* ─── RESPONSIVE DESIGN ──────────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .timer__bar,
  #questionTimerBar {
    height: 2.5rem;
    margin-bottom: var(--space-md);
  }
  
  .timer__text,
  #questionTimerText {
    font-size: var(--font-size-xl);
  }
  
  .quiz-controller__question-container,
  #questionContainer {
    padding-top: 4rem;
  }
}

/* ─── ANIMATIONS ───────────────────────────────────────────────────────────────────────── */

@keyframes pulse {
  0%, 100% { transform: translate(-50%, -50%) scale(1); }
  50% { transform: translate(-50%, -50%) scale(1.1); }
}

.timer__text--warning,
#questionTimerText.warning {
  animation: pulse 1s infinite;
}

/* ─── BUTTON VARIANTS ──────────────────────────────────────────────────────────────────── */

.button--compact {
    display: inline-block;
    width: auto;
    height: auto;
    padding: var(--space-sm) var(--space-md);
    margin-right: var(--space-sm);
    margin-top: 0;
}

.button--secondary {
    background-color: var(--bg-alt);
    color: var(--text-color);
    border: var(--border-width) solid var(--border-color);
}

.button--secondary:hover {
    background-color: var(--border-light);
    color: var(--text-color);
    border-color: var(--border-dark);
}

/* ─── STATISTICS COMPONENTS ────────────────────────────────────────────────────────────────── */

.stats {
    max-width: var(--stats-max-width);
    margin: 0 auto;
    padding: var(--container-padding);
}

/* Legacy class for backward compatibility */
.trainer-stats {
    max-width: var(--stats-max-width);
    margin: 0 auto;
    padding: var(--container-padding);
}

.stats__overview,
.stats-overview {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--container-padding);
    margin-bottom: var(--section-spacing);
}

.stats__card,
.stat-card {
    background: var(--bg-color);
    border: var(--border-width) solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--container-padding);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: var(--transition-hover);
}

.stats__card:hover,
.stat-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.stats__card-title,
.stat-card h3 {
    margin: 0 0 var(--space-sm) 0;
    color: var(--primary);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
}

.stats__value,
.stat-value {
    font-size: var(--font-size-xxxl);
    font-weight: var(--font-weight-bold);
    color: var(--text-color);
    margin: var(--space-sm) 0;
    line-height: var(--line-height-tight);
}

.stats__subtitle,
.stat-subtitle {
    font-size: var(--font-size-sm);
    color: var(--text-muted);
    margin-top: var(--space-xs);
    line-height: var(--line-height-normal);
}

.stats__section,
.stats-section {
    background: var(--bg-color);
    border: var(--border-width) solid var(--border-light);
    border-radius: var(--border-radius);
    padding: var(--container-padding);
    margin-bottom: var(--container-padding);
    box-shadow: var(--shadow-sm);
}

.stats__section-title,
.stats-section h3 {
    margin: 0 0 var(--space-md) 0;
    color: var(--primary);
    border-bottom: var(--border-width-thick) solid var(--primary);
    padding-bottom: var(--space-sm);
    font-size: var(--font-size-lg);
    font-weight: var(--font-weight-bold);
}

.stats__metric-grid,
.metric-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--container-padding);
}

.stats__metric-item,
.metric-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: var(--border-width) solid var(--bg-alt);
}

.stats__metric-item:last-child,
.metric-item:last-child {
    border-bottom: none;
}

.stats__metric-label,
.metric-label {
    font-weight: var(--font-weight-medium);
    color: var(--text-color);
}

.stats__metric-value,
.metric-value {
    font-weight: var(--font-weight-bold);
    color: var(--text-color);
}

.stats__chart-container,
.chart-container {
    width: 100%;
    height: 300px;
    margin-top: var(--container-padding);
}

.stats__chart-controls,
.chart-controls {
    margin-bottom: var(--container-padding);
}

.stats__time-buttons,
.time-buttons {
    display: flex;
    gap: var(--space-sm);
    justify-content: center;
    margin-bottom: var(--space-md);
}

.stats__time-btn,
.time-btn {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-alt);
    border: var(--border-width) solid var(--border-light);
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-medium);
    color: var(--text-muted);
    transition: var(--transition-hover);
}

.stats__time-btn:hover,
.time-btn:hover {
    background: var(--border-light);
    border-color: var(--border-dark);
    color: var(--text-color);
}

.stats__time-btn--active,
.time-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--bg-color) !important;
}

.range-slider-container {
    margin: 20px 0;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 6px;
}

.range-slider {
    position: relative;
    height: 20px;
    margin: 15px 0;
    padding: 7px 0;
}

.range-track {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 6px;
    background: #dee2e6;
    border-radius: 3px;
}

.range-fill {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    height: 6px;
    background: #E63312;
    border-radius: 3px;
    left: 0%;
    width: 100%;
    cursor: grab;
    z-index: 3;
}

.range-fill:active {
    cursor: grabbing;
}

.range-input {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 20px;
    background: transparent;
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    margin: 0;
    padding: 0;
    outline: none;
    pointer-events: none;
}

.range-input::-webkit-slider-runnable-track {
    background: transparent;
    height: 20px;
    border: none;
    outline: none;
}

.range-input::-moz-range-track {
    background: transparent;
    height: 20px;
    border: none;
    outline: none;
}

.range-input::-webkit-slider-thumb {
    width: 4px;
    height: 24px;
    background: #E63312;
    border-radius: 2px;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    cursor: ew-resize;
    -webkit-appearance: none;
    appearance: none;
    margin-top: -9px;
    transform: translateX(-2px);
    pointer-events: auto;
}

.range-input::-moz-range-thumb {
    width: 4px;
    height: 24px;
    background: #E63312;
    border-radius: 2px;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    cursor: ew-resize;
    -moz-appearance: none;
    appearance: none;
    transform: translateX(-2px);
    pointer-events: auto;
}

.range-input:first-child {
    z-index: 1;
}

.range-input:last-child {
    z-index: 2;
}

.range-labels {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #666;
    margin-top: 8px;
}

.category-performance {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.category-card {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    border-radius: 6px;
    padding: 15px;
}

.category-name {
    font-weight: bold;
    color: #E63312;
    margin-bottom: 10px;
}

.difficulty-stats {
    display: flex;
    justify-content: space-between;
    margin-bottom: 8px;
    font-size: 0.9em;
}


/* Progress Bar für Kategorie-Performance (Trainer Stats) */
.category-card .progress-bar,
.stats .progress-bar {
    width: 100%;
    height: 8px;
    background-color: #e9ecef;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.category-card .progress-fill,
.stats .progress-fill {
    height: 100%;
    background-color: #28a745;
    transition: width 0.3s ease;
}

/* Trainer Stats - Metric Value Colors */
.metric-value.positive {
    color: #28a745 !important;
}

.metric-value.negative {
    color: #dc3545 !important;
}

.metric-value.neutral {
    color: #333 !important;
}

/* Trainer Stats - Additional Styles */
.category-total-stats {
    text-align: center;
    margin-top: 8px;
    font-size: 0.9em;
    color: #666;
}

.chart-metrics {
    margin-top: 20px;
}

/* Trainer Stats - Error Handling */
.stats-error {
    background: #fff;
    border: 1px solid #dc3545;
    border-radius: 8px;
    padding: 20px;
    margin: 20px;
    text-align: center;
    color: #721c24;
}

.stats-error h2 {
    color: #dc3545;
    margin-bottom: 10px;
}

/* ─── Animations extracted from app.js ───────────────────────────────────── */

/* Temporary Messages */
.temp-message {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: #4CAF50;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: bold;
    z-index: 1000;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.temp-message.slide-in {
    animation: slideInDown 0.3s ease-out;
}

.temp-message.slide-out {
    animation: slideOutUp 0.3s ease-in;
}

@keyframes slideInDown {
    from { transform: translateX(-50%) translateY(-100%); opacity: 0; }
    to { transform: translateX(-50%) translateY(0); opacity: 1; }
}

@keyframes slideOutUp {
    from { transform: translateX(-50%) translateY(0); opacity: 1; }
    to { transform: translateX(-50%) translateY(-100%); opacity: 0; }
}

/* Points Animation */
.points-animation {
    position: fixed;
    top: 30%;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    padding: 16px 24px;
    border-radius: 12px;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 2000;
    box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.points-animation.positive {
    background: #4CAF50;
}

.points-animation.negative {
    background: #f44336;
}

.points-animation.slide-in {
    animation: pointsSlideIn 0.5s ease-out;
}

.points-animation.slide-out {
    animation: pointsSlideOut 0.3s ease-in;
}

@keyframes pointsSlideIn {
    from { 
        transform: translateX(-50%) translateY(-100px) scale(0.8); 
        opacity: 0; 
    }
    to { 
        transform: translateX(-50%) translateY(0) scale(1); 
        opacity: 1; 
    }
}

@keyframes pointsSlideOut {
    from { 
        transform: translateX(-50%) translateY(0) scale(1); 
        opacity: 1; 
    }
    to { 
        transform: translateX(-50%) translateY(-50px) scale(0.9); 
        opacity: 0; 
    }
}

/* Secondary Points Animation */
.points-secondary {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translateX(-50%);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: bold;
    z-index: 1500;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    animation: secondarySlideIn 0.4s ease-out;
}

.points-secondary.positive {
    background: #2196F3;
}

.points-secondary.negative {
    background: #ff5722;
}

@keyframes secondarySlideIn {
    from { 
        transform: translateX(-50%) translateY(-30px) scale(0.9); 
        opacity: 0; 
    }
    to { 
        transform: translateX(-50%) translateY(0) scale(1); 
        opacity: 1; 
    }
}

/* Loading Animation (Start Button) */
.loading-dots {
    display: inline-block;
    margin-left: 4px;
}

.loading-dots .dot {
    animation: loading-bounce 1.5s infinite;
    display: inline-block;
    font-size: 1.5em;
    font-weight: bold;
    color: white;
    text-shadow: 0 0 2px rgba(0,0,0,0.3);
}

.loading-dots .dot:nth-child(1) {
    animation-delay: 0ms;
}

.loading-dots .dot:nth-child(2) {
    animation-delay: 150ms;
}

.loading-dots .dot:nth-child(3) {
    animation-delay: 300ms;
}

@keyframes loading-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

#startBtn:disabled {
    background-color: #9e9e9e !important;
    color: white !important;
    cursor: not-allowed;
    animation: loading-pulse 2s ease-in-out infinite;
}

@keyframes loading-pulse {
    0%, 100% {
        opacity: 0.8;
    }
    50% {
        opacity: 1;
    }
}

/* Points Loading Animation */
.loading-pulse {
    animation: points-pulse 1.5s ease-in-out infinite;
}

@keyframes points-pulse {
    0%, 100% {
        color: #666;
        opacity: 0.7;
    }
    50% {
        color: #333;
        opacity: 1;
    }
}

/* Points Loading Dots (different selector to avoid conflicts) */
#pointsDisplay .loading-dots .dot {
    animation: points-bounce 1.5s infinite;
    display: inline-block;
    margin: 0 2px;
    color: #4CAF50;
    font-size: 1rem;
    font-weight: normal;
}

#pointsDisplay .loading-dots .dot:nth-child(1) {
    animation-delay: 0ms;
}

#pointsDisplay .loading-dots .dot:nth-child(2) {
    animation-delay: 300ms;
}

#pointsDisplay .loading-dots .dot:nth-child(3) {
    animation-delay: 600ms;
}

@keyframes points-bounce {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.4;
    }
    30% {
        transform: translateY(-4px);
        opacity: 1;
    }
}

/* Achievement Styles */
.achievements-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.achievement-category h4 {
    margin: 0 0 1rem 0;
    color: var(--primary);
    font-size: 1.1rem;
    border-bottom: 2px solid var(--primary);
    padding-bottom: 0.5rem;
}

.achievement-items {
    display: grid;
    gap: 1rem;
    grid-template-columns: 1fr;
}

@media (min-width: 768px) {
    .achievement-items {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    }
}

.achievement-item {
    display: flex;
    align-items: center;
    padding: 1rem;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    background: var(--card-bg);
    transition: var(--transition-fast);
}

.achievement-item.unlocked {
    border-color: #ffd700;
    background: linear-gradient(135deg, #fffacd, #fff8dc);
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.2);
}

.achievement-item.locked {
    opacity: 0.7;
}

.achievement-icon {
    margin-right: 1rem;
    flex-shrink: 0;
}

.achievement-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(0,0,0,0.1);
    transition: var(--transition-fast);
}

.achievement-placeholder.unlocked {
    border-color: #ffcc00;
    box-shadow: 0 2px 8px rgba(255, 215, 0, 0.3);
}

.achievement-placeholder.locked {
    filter: grayscale(100%);
    border-color: #999;
}

.achievement-info {
    flex: 1;
    min-width: 0;
}

.achievement-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

.achievement-item.unlocked .achievement-title {
    color: #b8860b;
}

.achievement-description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.achievement-progress {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.unlock-date {
    display: block;
    margin-top: 4px;
    font-size: 0.75rem;
    color: #999;
}

.unlocked-badge {
    background: var(--success);
    color: white;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.points-reward {
    background: #ffd700;
    color: #b8860b;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-size: 0.8rem;
    font-weight: bold;
}

.progress-bar-achievement {
    background: var(--bar-bg);
    height: 8px;
    border-radius: 4px;
    flex: 1;
    min-width: 100px;
    overflow: hidden;
}

.progress-fill-achievement {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), #ff6b4a);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.progress-text {
    font-size: 0.8rem;
    color: #666;
    white-space: nowrap;
}

.no-achievements {
    text-align: center;
    padding: 2rem;
    color: #666;
    font-style: italic;
}

/* ─── AJAX Manager Notifications ──────────────────────────────────────────── */

.ajax-offline-notification {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 10000;
    background: var(--warning);
    color: var(--text-color);
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 500;
    max-width: 300px;
    animation: slideInFromRight 0.3s var(--ease-in-out);
    border-left: 4px solid var(--warning);
}

.ajax-offline-notification .offline-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ajax-offline-notification .offline-icon {
    font-size: 16px;
    flex-shrink: 0;
}

.ajax-offline-notification .offline-text {
    line-height: 1.4;
}

/* AJAX Error Notifications */
.ajax-error-notification {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 10001;
    background: var(--error);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    font-size: 14px;
    font-weight: 500;
    max-width: 350px;
    animation: slideInFromRight 0.3s var(--ease-in-out);
    border-left: 4px solid #d32f2f;
}

.ajax-error-notification .error-content {
    display: flex;
    align-items: flex-start;
    gap: 8px;
}

.ajax-error-notification .error-icon {
    font-size: 16px;
    flex-shrink: 0;
    margin-top: 2px;
}

.ajax-error-notification .error-text {
    line-height: 1.4;
}

.ajax-error-notification .error-details {
    margin-top: 6px;
    font-size: 12px;
    opacity: 0.9;
    font-weight: normal;
}

/* AJAX Success Notifications */
.ajax-success-notification {
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 9999;
    background: var(--success);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-size: 14px;
    font-weight: 500;
    max-width: 300px;
    animation: slideInFromRight 0.3s var(--ease-in-out);
    border-left: 4px solid #388e3c;
}

/* Loading State Indicator */
.ajax-loading-indicator {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10002;
    background: rgba(255, 255, 255, 0.95);
    padding: 24px;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    min-width: 200px;
}

.ajax-loading-indicator .loading-spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.ajax-loading-indicator .loading-text {
    font-size: 14px;
    color: var(--text-color);
    text-align: center;
}

/* Animations */
@keyframes slideInFromRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutToRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Module Warning Notifications */
.module-warning-notification {
    animation: slideInFromRight 0.3s ease-out;
}

.module-warning-notification.slide-out {
    animation: slideOutToRight 0.3s ease-in;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Help Overlay Close Button - Modern UI Pattern */
#closeHelp:hover {
    background: #f5f5f5 !important;
    color: #333 !important;
    border-color: #999 !important;
    transform: scale(1.1);
}

#closeHelp:active {
    transform: scale(0.9);
}

/* Mobile Responsiveness for Notifications */
@media (max-width: 480px) {
    .ajax-offline-notification,
    .ajax-error-notification,
    .ajax-success-notification {
        top: 10px;
        left: 10px;
        right: 10px;
        max-width: none;
        border-radius: 6px;
    }
    
    .ajax-loading-indicator {
        left: 20px;
        right: 20px;
        width: auto;
        transform: translate(0, -50%);
    }
}

/* ─── NAVIGATION LINKS ──────────────────────────────────────────────────────────────────────── */

.page-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: var(--font-size-sm);
    color: var(--primary);
    text-decoration: none;
    padding: var(--space-xs) var(--space-sm);
    border-radius: var(--border-radius-sm);
    transition: var(--transition-hover);
    background: transparent;
}

.page-nav-link:hover {
    background: var(--bg-alt);
    color: var(--primary-dark);
    text-decoration: none;
}

.page-nav-container {
    text-align: center;
    margin: var(--space-md) 0;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-light);
}

.stats-header-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    flex-wrap: wrap;
    gap: var(--space-sm);
}

@media (max-width: 576px) {
    .stats-header-nav {
        flex-direction: column;
        align-items: flex-start;
    }
}
