/* ==========================================================================
   YEARS & SUBJECT ACCORDION STYLES (VANILLA CSS)
   Mobile-First Responsive Architecture
   ========================================================================== */

/* Year Hero Header */
.year-header-hero {
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-default);
  padding: clamp(2rem, 5vw, 3rem) 0 clamp(1.75rem, 4vw, 2.5rem);
  position: relative;
  overflow: hidden;
  width: 100%;
}

.year-header-hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent-amber), var(--accent-teal));
}

.year-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.85rem;
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: clamp(0.75rem, 1.8vw, 0.825rem);
  font-weight: 800;
  color: var(--accent-amber);
  margin-bottom: 0.85rem;
}

.year-hero-title {
  font-size: clamp(1.6rem, 4.5vw, 2.3rem);
  font-weight: 900;
  color: var(--text-main);
  margin-bottom: 0.5rem;
  line-height: 1.25;
}

.year-hero-desc {
  font-size: clamp(0.9rem, 2vw, 1.05rem);
  color: var(--text-muted);
  max-width: 780px;
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

/* Semester Navigation Pills */
.semester-pills-row {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  width: 100%;
}

.sem-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-default);
  color: var(--text-main);
  font-size: clamp(0.8rem, 2vw, 0.875rem);
  font-weight: 700;
  text-decoration: none;
  min-height: 44px;
  box-sizing: border-box;
  touch-action: manipulation;
  transition: all var(--transition-fast);
}

.sem-pill:hover {
  background: var(--bg-surface);
  border-color: var(--accent-amber);
  color: var(--accent-amber);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.sem-pill .pill-count {
  font-size: 0.75rem;
  color: var(--text-subtle);
  font-weight: 600;
}

/* Year Main Content */
.year-main-content {
  padding-top: clamp(1.75rem, 4vw, 2.5rem);
  padding-bottom: clamp(3rem, 6vw, 4.5rem);
  flex: 1;
  width: 100%;
}

/* Collapsible Semester Section (Accordion Logic) */
.semester-block {
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-xl);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  width: 100%;
  box-sizing: border-box;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.semester-block:hover {
  border-color: var(--border-strong);
}

.semester-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(1rem, 2.5vw, 1.25rem) clamp(1rem, 3vw, 1.75rem);
  background: var(--bg-surface-subtle);
  border-bottom: 1px solid var(--border-default);
  cursor: pointer;
  user-select: none;
  min-height: 52px;
  touch-action: manipulation;
  transition: background-color var(--transition-fast);
}

.semester-title-bar:hover {
  background: var(--bg-surface-hover);
}

.sem-heading {
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  font-weight: 900;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin: 0;
}

.sem-header-left {
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 2vw, 0.85rem);
  flex-wrap: wrap;
}

.sem-courses-count {
  font-size: clamp(0.7rem, 1.8vw, 0.8rem);
  font-weight: 800;
  padding: 0.2rem 0.65rem;
  border-radius: var(--radius-full);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  color: var(--text-subtle);
  white-space: nowrap;
}

.sem-chevron {
  font-size: 1.1rem;
  color: var(--accent-amber);
  flex-shrink: 0;
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Collapsed State for Semester Accordion */
.semester-block.is-collapsed .sem-chevron {
  transform: rotate(180deg);
}

.semester-block.is-collapsed .subjects-accordion-list {
  display: none;
}

.semester-block.is-collapsed .semester-title-bar {
  border-bottom: none;
}

/* Subjects List */
.subjects-accordion-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: clamp(1rem, 2.5vw, 1.5rem) clamp(0.75rem, 2.5vw, 1.75rem) clamp(1.25rem, 3vw, 2rem);
  animation: fadeIn 0.2s ease forwards;
  width: 100%;
  box-sizing: border-box;
}

.subject-card {
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  width: 100%;
  box-sizing: border-box;
  transition: all var(--transition-fast);
}

.subject-card:hover {
  border-color: var(--accent-amber);
  box-shadow: var(--shadow-md), 0 0 14px var(--accent-amber-glow);
}

.subject-header-btn {
  width: 100%;
  padding: clamp(0.9rem, 2vw, 1.15rem) clamp(0.85rem, 2vw, 1.35rem);
  background: transparent;
  border: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  text-align: right;
  gap: 0.75rem;
  min-height: 52px;
  box-sizing: border-box;
  touch-action: manipulation;
}

.subject-info-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  flex: 1;
}

.subject-name {
  font-size: clamp(0.95rem, 2.2vw, 1.1rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.3;
}

.subject-title-stack {
  display: flex;
  min-width: 0;
  max-width: 100%;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.08rem;
  text-align: start;
}

.subject-name-ar {
  display: block;
  max-width: 100%;
  color: color-mix(in srgb, var(--text-main) 78%, transparent);
  font-size: clamp(0.72rem, 1.35vw, 0.82rem);
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}


.badge-lab {
  font-size: 0.725rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
  border: 1px solid rgba(16, 185, 129, 0.35);
  white-space: nowrap;
}

.subject-code-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius-sm);
  background: rgba(245, 158, 11, 0.14);
  color: var(--accent-amber);
  border: 1px solid rgba(245, 158, 11, 0.35);
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.subject-cat-badge {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: var(--radius-sm);
  background: rgba(14, 165, 233, 0.12);
  color: var(--accent-teal);
  border: 1px solid rgba(14, 165, 233, 0.3);
  white-space: nowrap;
}

.subject-actions-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.subject-tool-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  border-radius: var(--radius-md);
  background: var(--bg-surface-subtle);
  border: 1px solid var(--border-default);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  touch-action: manipulation;
  transition: all var(--transition-fast);
}

.subject-tool-btn:hover {
  color: var(--accent-amber);
  border-color: var(--accent-amber);
  transform: scale(1.06);
}

.subject-tool-btn.is-fav {
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.14);
  border-color: var(--accent-amber);
}

.accordion-chevron {
  font-size: 0.9rem;
  color: var(--text-subtle);
  transition: transform var(--transition-fast);
}

.subject-card.is-open .accordion-chevron {
  transform: rotate(180deg);
  color: var(--accent-amber);
}

/* Subject Resources Body */
.subject-resources-body {
  display: none;
  padding: 0 clamp(0.85rem, 2vw, 1.35rem) clamp(1rem, 2vw, 1.35rem);
  border-top: 1px solid var(--border-subtle);
  background: var(--bg-surface-subtle);
  width: 100%;
  box-sizing: border-box;
}

.subject-card.is-open .subject-resources-body {
  display: block;
  animation: fadeIn 0.2s ease forwards;
}

/* Responsive Flex Wrap / Grid Container for Resource Badges */
.resources-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.65rem;
  padding-top: 1rem;
  width: 100%;
  box-sizing: border-box;
}

.resource-chip-link {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.6rem;
  padding: 0.75rem 0.85rem;
  min-height: 56px;
  box-sizing: border-box;
  background: var(--bg-surface);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-decoration: none;
  font-size: clamp(0.8rem, 1.8vw, 0.875rem);
  font-weight: 800;
  touch-action: manipulation;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.resource-chip-link:hover {
  border-color: var(--accent-amber);
  color: var(--accent-amber);
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 4px 14px var(--accent-amber-glow);
}

.resource-chip-link i {
  color: var(--accent-teal);
  font-size: 1.05rem;
  flex-shrink: 0;
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.resource-chip-link:hover i {
  color: var(--accent-amber);
}

.resource-title-stack {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.15rem;
  min-width: 0;
  line-height: 1.25;
}

.resource-name {
  display: block;
  font-size: clamp(0.8rem, 1.6vw, 0.875rem);
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.resource-chip-link:hover .resource-name {
  color: var(--accent-amber);
}

.resource-name-ar {
  display: block;
  font-size: clamp(0.7rem, 1.35vw, 0.76rem);
  font-weight: 700;
  color: var(--accent-teal);
  line-height: 1.25;
  transition: color 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.resource-chip-link:hover .resource-name-ar {
  color: var(--accent-amber);
}

/* Mobile Polish */
@media (max-width: 640px) {
  .resources-grid {
    grid-template-columns: repeat(auto-fill, minmax(135px, 1fr));
    gap: 0.5rem;
  }

  .resource-chip-link {
    padding: 0.65rem 0.5rem;
    min-height: 52px;
    gap: 0.45rem;
  }

  .resource-chip-link i {
    font-size: 0.95rem;
  }

  .resource-name {
    font-size: 0.78rem;
  }

  .resource-name-ar {
    font-size: 0.68rem;
  }

  .subject-header-btn {
    padding: 0.85rem;
  }

  .subject-name {
    font-size: 0.95rem;
  }

  .subject-name-ar {
    font-size: 0.73rem;
  }

  .semester-pills-row {
    flex-direction: column;
  }

  .sem-pill {
    width: 100%;
    justify-content: space-between;
  }
}

@media (max-width: 420px) {
  .resources-grid {
    grid-template-columns: 1fr;
  }
}
