/* ╔══════════════════════════════════════════════════╗
   ║              Course Page CSS                     ║
   ║   استایل مشترک صفحات لیست ترم‌ها                 ║
   ╚══════════════════════════════════════════════════╝ */

/* ════════════════════════════════════════
   لینک نمای موضوعی
   ════════════════════════════════════════ */

.topics-link-bar {
  margin-bottom: 36px;
  animation: fadeInUp 0.5s ease backwards;
}

.topics-link-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: var(--bg-white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9em;
  font-weight: 600;
  color: var(--text-secondary);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.topics-link-btn:hover {
  border-color: var(--course-accent, #4a5c8a);
  color: var(--course-accent, #4a5c8a);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.topics-link-btn svg {
  opacity: 0.5;
  flex-shrink: 0;
}

.topics-link-btn:hover svg {
  opacity: 0.8;
}

/* ════════════════════════════════════════
   سکشن‌های سطح
   ════════════════════════════════════════ */

.term-section {
  margin-bottom: 52px;
  animation: fadeInUp 0.7s ease backwards;
}

.term-section:nth-child(2) { animation-delay: 0.08s; }
.term-section:nth-child(3) { animation-delay: 0.16s; }
.term-section:nth-child(4) { animation-delay: 0.24s; }
.term-section:nth-child(5) { animation-delay: 0.32s; }
.term-section:nth-child(6) { animation-delay: 0.40s; }

.term-section:last-child {
  margin-bottom: 0;
}

.term-section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
  padding: 20px 24px;
  background: var(--bg-white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border-right: 5px solid var(--level-color);
  flex-wrap: wrap;
}

.term-section-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.55em;
  flex-shrink: 0;
}

.term-section-title {
  font-size: 1.25em;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 3px;
}

.term-section-desc {
  font-size: 0.86em;
  color: var(--text-secondary);
  line-height: 1.75;
}

.term-section-badge {
  margin-right: auto;
  padding: 6px 15px;
  background: var(--bg);
  border-radius: 50px;
  font-size: 0.74em;
  font-weight: 800;
  color: var(--text-muted);
  white-space: nowrap;
  direction: ltr;
}

/* ════════════════════════════════════════
   کارت‌های ترم
   ════════════════════════════════════════ */

.terms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(305px, 1fr));
  gap: 20px;
}

.terms-grid.single-term {
  grid-template-columns: minmax(305px, 1fr);
  max-width: 420px;
}

.term-card {
  position: relative;
  background: var(--bg-white);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  min-height: 245px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border);
  overflow: hidden;
  cursor: pointer;
}

.term-card::before {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  height: 4px;
  background: var(--accent);
  transition: var(--transition);
}

.term-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-xl);
  border-color: var(--accent);
}

.term-card:hover::before {
  height: 6px;
}

.term-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  opacity: 0;
  transition: var(--transition);
  background: linear-gradient(135deg, var(--accent-light) 0%, transparent 56%);
  pointer-events: none;
}

.term-card:hover::after {
  opacity: 0.65;
}

.term-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.term-number {
  align-self: flex-start;
  padding: 4px 14px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 50px;
  font-size: 0.78em;
  font-weight: 800;
  margin-bottom: 15px;
  transition: var(--transition);
}

.term-card:hover .term-number {
  background: var(--accent);
  color: white;
}

.term-title {
  font-size: 1.2em;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 10px;
  transition: var(--transition);
}

.term-card:hover .term-title {
  color: var(--accent);
}

.term-description {
  font-size: 0.88em;
  color: var(--text-secondary);
  line-height: 1.85;
  margin-bottom: 18px;
  flex-grow: 1;
}

.term-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.term-meta span {
  font-size: 0.78em;
  color: var(--text-muted);
  font-weight: 600;
}

.term-action {
  align-self: flex-start;
  font-size: 0.83em;
  font-weight: 800;
  color: var(--accent);
  opacity: 0;
  transform: translateY(6px);
  transition: var(--transition);
}

.term-card:hover .term-action {
  opacity: 1;
  transform: translateY(0);
}

/* ════════════════════════════════════════
   Responsive
   ════════════════════════════════════════ */

@media (max-width: 768px) {
  .term-section {
    margin-bottom: 42px;
  }

  .term-section-header {
    padding: 17px 18px;
    gap: 12px;
  }

  .term-section-badge {
    margin-right: 0;
    width: 100%;
    text-align: center;
    margin-top: 4px;
  }

  .terms-grid,
  .terms-grid.single-term {
    grid-template-columns: 1fr;
    max-width: none;
    gap: 15px;
  }

  .term-card {
    padding: 23px 21px 21px;
    min-height: auto;
  }

  .term-action {
    opacity: 1;
    transform: translateY(0);
  }
}