/* ============================================================
   WISSen — Card family + lists + empty/loading/error states
   ============================================================ */

/* ============================================================
   Cards (Material-3 inspired, Dashboard tokens)
   ============================================================ */
.m-card {
  background: linear-gradient(180deg, var(--surface), var(--surface-press-bg));
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  -webkit-tap-highlight-color: transparent;
  /* m-card may render as <button> for tappable noteCards — kill default
   * button chrome so the card visual stays consistent regardless of tag. */
  font: inherit;
  color: inherit;
  text-align: left;
  width: 100%;
}
button.m-card {
  cursor: pointer;
}
.m-card.is-clickable {
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.m-card.is-clickable:active {
  transform: scale(.98);
  background: var(--surface-2);
  border-color: var(--accent-border);
}
/* Frisch-Markierung — gelber Akzent links + sanfter Background-Glow.
   Greift sowohl bei Noten- als auch bei Stundenplan-Cards (Zimmerwechsel).
   Wird per IntersectionObserver beim Sehen mit POST /api/seen ack'd; nach
   24h fällt der Server selbst zurück auf "nicht frisch", die Klasse wird
   dann beim nächsten Re-Render einfach nicht mehr gesetzt. */
.m-card.is-fresh {
  /* DESIGN.md side-stripe ban: the warning-tint gradient + "Neu" pill
   * already communicate freshness. No left border. */
  position: relative;
  border-color: var(--warning-border);
  background:
    linear-gradient(90deg, var(--warning-soft-strong) 0%, transparent 45%),
    var(--surface);
}

/* Deep-link flash — mirrors the desktop PlanEvent flash. Fires once after the
 * card scrolls into view from a "Letzte Änderung" tap on Aktuell. Two short
 * yellow pulses on a transparent ::after overlay so the static is-fresh
 * background underneath stays put and the GPU compositor handles the pulse. */
.m-plan-card {
  position: relative;
}
.m-plan-card.is-flash::after {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--warning-flash);
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  animation: m-plan-card-flash 2400ms cubic-bezier(.2, .7, .2, 1);
}
@keyframes m-plan-card-flash {
  0%   { opacity: 0; }
  15%  { opacity: 1; }
  35%  { opacity: 0; }
  55%  { opacity: 1; }
  100% { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .m-plan-card.is-flash::after { animation: none; opacity: 0; }
}
/* "Neu"-Pill als echter <span> (renderFreshPill in JS) damit Screen-Reader
 * den Text zuverlässig ankündigen — CSS ::after content ist auf mobile-SR
 * (VoiceOver/TalkBack) nicht garantiert. */
.m-card__fresh-pill {
  position: absolute;
  top: 6px;
  right: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--warning);
  background: var(--warning-soft);
  padding: 2px 6px;
  border-radius: 999px;
  pointer-events: none;
}
.m-card__main { flex: 1; min-width: 0; }
.m-card__title {
  font-weight: 600;
  font-size: 15px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.m-card__sub {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-mute);
}
.m-card__grade {
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
  min-width: 44px;
  text-align: right;
}
.m-grade--good      { color: var(--g-good); }
.m-grade--excellent { color: var(--g-excellent); }
.m-grade--fail      { color: var(--g-fail); }
.m-grade--none      { color: var(--text-dim); font-size: 22px; }

/* Smaller grade variant for the per-semester average row. */
.m-card__grade--sm { font-size: 22px; }

/* Diff-Variante: prev → curr in einer Zeile, baseline-aligned. Tritt auf
 * wenn pruefungCard erkennt dass prev_bewertung gesetzt und ungleich
 * bewertung ist. Halbe Schriftgröße + Opacity am Vorgänger, der Pfeil
 * trägt die Vorher-Bedeutung. */
.m-card__grade {
  display: inline-flex;
  align-items: baseline;
  justify-content: flex-end;
  gap: 5px;
}
.m-card__grade-prev {
  font-size: 16px;
  font-weight: 600;
  opacity: 0.55;
}
.m-card__grade-arrow {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dim);
}
.m-card__grade-curr {
  /* aktuelle Note erbt die volle 26px-Schriftgröße + Farbklasse vom Container */
  font-weight: 700;
}

/* Per-semester averages row — equal-spaced columns inside a single card. */
.m-sem-grid {
  justify-content: space-around;
}
.m-sem-grid__col {
  text-align: center;
}

.m-list { display: grid; gap: 10px; }
/* h2/h3 element resets — these classes are now real headings (a11y) so we
 * have to override the UA's default 1em font-size + bold + double margin. */
h2.m-day-h, h3.m-section-h { line-height: 1.3; }

.m-section-h {
  margin: 18px 4px 8px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-mute);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.m-section-h__count {
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.04em;
}
.m-day-h {
  margin: 18px 4px 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

/* ============================================================
   Empty / loading / error states
   ============================================================ */
.m-empty, .m-loading, .m-error {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-mute);
  font-size: 14px;
}
.m-error { color: var(--danger); }
.m-spinner {
  width: 28px; height: 28px;
  border: 2.5px solid var(--surface-3);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 0 auto 12px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
