.student-term-card {
    --term-card-accent: var(--module-accent, var(--student-gold, #bb8c2b));
    --term-card-accent-soft: var(--module-accent-soft, rgba(201, 152, 47, .09));
    position: relative;
    min-height: 292px;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(201, 152, 47, 0.5);
    border-radius: 8px;
    background: #ffffff;
    color: var(--student-ink, #101827);
    box-shadow: 5px 5px 20px 0px rgba(201, 152, 47, .07);
    transition: border-color 240ms ease, box-shadow 240ms ease;
}

.student-term-card:hover,
.student-term-card:focus-within {
  border-color: var(--term-card-accent);
  box-shadow: 0 18px 42px rgba(15, 23, 42, .1);
}

.student-term-card .sofl-term-status-indicator {
  top: .8rem;
  right: .8rem;
}

.student-term-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.65rem 1.4rem 1.15rem;
}

.student-term-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .85rem;
}

/* Keep difficulty aligned above the actions, regardless of title wrapping. */
.student-term-card-body > .difficulty-indicator {
  margin-top: auto;
  flex-shrink: 0;
}

.student-term-category {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: min(100%, 350px);
  overflow: hidden;
  padding-left: .72rem;
  color: var(--term-card-accent);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .04em;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.student-term-premium-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: var(--term-card-accent, #bb8c2b);
  font-size: .75rem;
}

.student-term-category::before {
  content: "";
  position: absolute;
  left: 0;
  width: 3px;
  height: 24px;
  border-radius: 999px;
  background: var(--term-card-accent);
}

.student-term-card h3 {
    margin: 0;
    min-height: calc(1.13em * 2);
    color: var(--student-navy, #0b1f3a);
    font-family: var(--font-heading);
    font-size: clamp(1.25rem, 1.25rem, 2rem);
    font-weight: 700;
    letter-spacing: 0;
    line-height: 1.13;
}

.student-term-card h3 a {
  color: inherit;
}

.student-term-card h3 a:hover,
.student-term-card h3 a:focus-visible {
  color: var(--term-card-accent);
}

.difficulty-indicator {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  gap: .75rem;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: .45rem .8rem;
  background: #f8fafc;
  color: var(--student-navy, #0b1f3a);
  box-shadow: none;
}

.difficulty-indicator__title {
  flex: 0 1 auto;
  color: #475569;
  font-size: .78rem;
  font-weight: 600;
  line-height: 1.2;
}

.difficulty-indicator__value {
  flex: 0 0 auto;
  min-width: 0;
  gap: .65rem;
}

.difficulty-dots {
  flex: 0 0 auto;
  gap: .3rem;
}

.difficulty-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 10px;
  border: 1.5px solid #334155;
  border-radius: 50%;
  background: #fff;
}

.difficulty-dot.is-filled {
  background: #1e293b;
}

.difficulty-indicator__label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  min-height: 24px;
  padding-left: .65rem;
  border-color: #cbd5e1 !important;
  color: var(--student-navy, #0b1f3a);
  font-size: .85rem;
  font-weight: 700;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.student-term-actions {
  flex-wrap: wrap;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-top: auto;
  padding: 1rem 1.4rem 1.15rem;
  border-top: 1px solid rgba(120, 113, 108, .15);
}

.student-term-actions form {
  margin: 0;
}

.student-term-action-group {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.student-term-action-btn {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  border: 1px solid rgba(120, 113, 108, .15);
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: .95rem;
  line-height: 1;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease;
}

.student-term-action-btn:hover:not(:disabled),
.student-term-action-btn:focus-visible {
  border-color: rgba(201, 152, 47, .34);
  background: var(--term-card-accent-soft);
  color: var(--term-card-accent);
}

.student-term-action-btn.is-active {
  color: var(--term-card-accent);
}

.student-term-action-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  color: #667085;
  background: #f7f8fa;
}

.student-term-view-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  min-height: 40px;
  padding: .55rem .85rem;
  margin-left: auto;
  flex-shrink: 0;
  border: 1px solid var(--term-card-accent);
  border-radius: 9px;
  background: var(--term-card-accent);
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.student-term-view-link i {
  color: inherit;
  font-size: 1rem;
  transition: transform 160ms ease;
}

.student-term-view-link:hover,
.student-term-view-link:focus-visible {
  background: color-mix(in srgb, var(--term-card-accent) 90%, #0f172a);
  color: #fff;
  box-shadow: 0 3px 8px rgba(15, 23, 42, .12);
}

.student-term-view-link:hover i {
  transform: translateX(2px);
}

.student-term-view-link:focus-visible {
  outline: 2px solid var(--student-ink, #101827);
  outline-offset: 3px;
}

.student-term-view-link:active {
  transform: translateY(1px);
  box-shadow: none;
}

@media (max-width: 575.98px) {
  .student-term-card {
    min-height: 272px;
  }

  .student-term-card-body {
    padding: 1.35rem 1.1rem 1rem;
  }

  .student-term-card-top {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .student-term-card h3 {
    min-height: auto;
    font-size: 1.55rem;
  }

  .student-term-actions {
    padding: .9rem 1.1rem 1rem;
  }
}

@media (max-width: 380px) {
  .student-term-actions {
    padding-inline: .75rem;
    gap: .5rem;
  }

  .student-term-action-btn {
    width: 32px;
    height: 40px;
  }

  .student-term-action-group {
    gap: .25rem;
  }

  .student-term-view-link {
    padding-inline: .5rem;
    gap: .4rem;
    font-size: .75rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .student-term-card,
  .student-term-view-link,
  .student-term-view-link i {
    transition: none;
  }
}
