/* Base theme moved to theme.css */

/* === search styling (shared look) === */
#table-search-group .input-group-text,
#table-search-input {
  background-color: rgba(20, 22, 26, 0.65);
  color: #dfe6ee;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
#table-search-input::placeholder {
  color: #9aa3ac;
}

/* === subject + chapter groups === */
.as-subject {
  margin-top: 1.25rem;
}
.as-subject > .as-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #cfd7df;
  font-weight: 600;
  margin-bottom: 0.5rem;
}
.as-chapter {
  margin: 0.25rem 0 1rem;
}
.as-chapter > .as-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #cfd7df;
  font-weight: 600;
  font-size: 1rem;
  margin: 0.25rem 0 0.5rem;
  opacity: 0.9;
}
.as-count {
  font-size: 0.875rem;
  color: #9aa3ac;
}

.as-toggle {
  color: #cfd7df;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.1rem 0.25rem;
  border-radius: 8px;
}
.as-toggle:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
}
.as-toggle .bi {
  transition: transform 0.2s ease;
}
.as-toggle[aria-expanded="true"] .bi {
  transform: rotate(90deg);
}

/* === card grid (like worksheet cards) === */
.as-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 1rem;
}
@media (max-width: 575.98px) {
  .as-grid {
    grid-template-columns: repeat(1, 1fr);
  }
}
@media (min-width: 576px) {
  .as-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 992px) {
  .as-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.as-card.card {
  --bg: rgba(20, 22, 26, 0.65);
  background: var(--bg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  transition: transform 0.15s ease, box-shadow 0.15s ease,
    border-color 0.15s ease;
  cursor: pointer;
  position: relative;
}
.as-card.card:hover {
  transform: translateY(-2px);
  border-color: rgba(13, 110, 253, 0.35);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25);
}
.as-card-opening {
  transform: scale(0.985) !important;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35) !important;
}
.as-card .card-title {
  font-size: 1.05rem;
}
.as-meta {
  color: #9aa3ac;
}
.as-actions .btn {
  width: 100%;
}

/* started/completed borders */
.as-card.started {
  border-color: rgba(13, 110, 253, 0.9) !important;
  border-width: 2px;
}
.as-card.completed {
  border-color: rgba(25, 135, 84, 0.95) !important;
  border-width: 2px;
}

/* progress + score */
.as-score {
  display: inline-block;
  margin-right: 0.5rem;
}
.as-progress .progress {
  height: 0.9rem;
  background: rgba(255, 255, 255, 0.06);
}
.as-progress .progress-bar {
  font-size: 0.75rem;
}

/* star button */
.as-star-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 6px;
  color: #cfd7df;
  background: transparent;
  border-radius: 999px;
  border: 0px solid rgba(255, 255, 255, 0.12);
  z-index: 2;
}
.as-star-btn:hover {
  color: #fffc66;
}
.as-starred .bi-star-fill {
  color: #ffd166;
}

.as-starred .bi-star-fill:hover {
  color: #fffc66;
}

/* --- lightweight animations utilities (shared) --- */
/* Subtle fade-in for content swaps */
.fade-in { animation: fadeIn 160ms ease-out; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* Generic enter/exit animations for items/cards */
.anim-enter { animation: fadeInUp 220ms ease-out both; }
.anim-enter-fast { animation: fadeInUp 140ms ease-out both; }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.anim-out { animation: fadeOutDown 160ms ease-in forwards; }
@keyframes fadeOutDown { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(6px); } }

/* Star button micro-interactions */
.as-star-btn .bi { transition: transform 140ms ease, color 160ms ease; transform-origin: center; }
.as-star-btn:active .bi { transform: scale(0.85); }
.as-star-btn.star-animate .bi { animation: starPop 320ms cubic-bezier(.2,.8,.2,1) both; }
@keyframes starPop {
  0% { transform: scale(0.6) rotate(-15deg); }
  60% { transform: scale(1.15) rotate(10deg); }
  100% { transform: scale(1) rotate(0); }
}

@media (prefers-reduced-motion: reduce) {
  .fade-in, .anim-enter, .anim-enter-fast, .anim-out { animation: none !important; }
  .as-card.card, .as-star-btn .bi { transition: none !important; }
}

/* highlight */
mark {
  background: rgba(255, 193, 7, 0.35);
  padding: 0 0.2em;
  border-radius: 4px;
}

/* state helpers */
.d-none {
  display: none !important;
}

/* Subtle page fade when navigating into assignment */
body .container-lg {
  transition: opacity 120ms ease;
}
body.page-leave .container-lg {
  opacity: 0.0;
}

@media (prefers-reduced-motion: reduce) {
  body .container-lg { transition: none !important; }
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.4),
    rgba(255, 255, 255, 0.22)
  );
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.55),
    rgba(255, 255, 255, 0.3)
  );
  background-clip: padding-box;
}
