/* ========================================
   SERIES DETAIL PAGE STYLES
   ======================================== */

.series-header {
  margin-bottom: 3rem;
  padding: 2rem 1.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

:where(.dark, .dark *) .series-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.series-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  line-height: 1.2;
}

.series-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.series-post-count-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  font-size: 0.875rem;
  border-radius: 8px;
  font-weight: 500;
  background: rgba(139, 92, 246, 0.1);
  color: rgb(139, 92, 246);
}

:where(.dark, .dark *) .series-post-count-badge {
  background: rgba(139, 92, 246, 0.2);
  color: rgb(167, 139, 250);
}

.series-description {
  font-size: 1.125rem;
  color: rgba(0, 0, 0, 0.7);
  margin: 0 0 1.25rem 0;
  line-height: 1.6;
}

:where(.dark, .dark *) .series-description {
  color: rgba(255, 255, 255, 0.7);
}

.series-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.series-tag {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  background: rgba(0, 0, 0, 0.05);
  border-radius: 6px;
  color: rgba(0, 0, 0, 0.7);
  text-decoration: none;
  transition: all 0.2s;
}

.series-tag:hover {
  background: rgba(0, 0, 0, 0.1);
  color: rgba(0, 0, 0, 0.9);
}

:where(.dark, .dark *) .series-tag {
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.7);
}

:where(.dark, .dark *) .series-tag:hover {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.9);
}

/* Collapsible Sections */
.collapsible-section {
  margin-bottom: 2rem;
  padding: 0 1.5rem;
}

.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  user-select: none;
  position: relative;
  z-index: 1;
}

.collapsible-header:hover {
  border-color: rgba(0, 0, 0, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

:where(.dark, .dark *) .collapsible-header {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

:where(.dark, .dark *) .collapsible-header:hover {
  border-color: rgba(255, 255, 255, 0.15);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

/* When expanded, adjust the header styling */
.collapsible-section.expanded .collapsible-header {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
  box-shadow: none;
}

.collapsible-section.expanded .collapsible-header:hover {
  box-shadow: none;
}

.collapsible-header-content {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex: 1;
}

.collapsible-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.post-count {
  padding: 0.25rem 0.75rem;
  font-size: 0.75rem;
  border-radius: 6px;
  font-weight: 500;
  background: rgba(139, 92, 246, 0.1);
  color: rgb(139, 92, 246);
}

:where(.dark, .dark *) .post-count {
  background: rgba(139, 92, 246, 0.2);
  color: rgb(167, 139, 250);
}

.collapsible-icon {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: rgba(0, 0, 0, 0.5);
  flex-shrink: 0;
}

:where(.dark, .dark *) .collapsible-icon {
  color: rgba(255, 255, 255, 0.5);
}

.collapsible-section.expanded .collapsible-icon {
  transform: rotate(180deg);
}

.collapsible-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-top: none;
  border-bottom-left-radius: 12px;
  border-bottom-right-radius: 12px;
  opacity: 0;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
}

:where(.dark, .dark *) .collapsible-content {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.08);
}

.collapsible-section.expanded .collapsible-content {
  max-height: 5000px;
  opacity: 1;
}

/* Table Wrapper for Horizontal Scrolling */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  padding: 0rem 1.5rem 1rem 1.5rem;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.3) rgba(0, 0, 0, 0.05);
}

.table-wrapper::-webkit-scrollbar {
  height: 8px;
}

.table-wrapper::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.3);
  border-radius: 4px;
}

.table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.5);
}

:where(.dark, .dark *) .table-wrapper {
  scrollbar-color: rgba(167, 139, 250, 0.3) rgba(255, 255, 255, 0.05);
}

:where(.dark, .dark *) .table-wrapper::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

:where(.dark, .dark *) .table-wrapper::-webkit-scrollbar-thumb {
  background: rgba(167, 139, 250, 0.3);
}

:where(.dark, .dark *) .table-wrapper::-webkit-scrollbar-thumb:hover {
  background: rgba(167, 139, 250, 0.5);
}

/* Posts Table */
.posts-table {
  width: 100%;
  min-width: 600px;
  border-collapse: separate;
  border-spacing: 0;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 12px;
}

:where(.dark, .dark *) .posts-table {
  background: rgba(255, 255, 255, 0.02);
  border-color: rgba(255, 255, 255, 0.08);
}

.posts-table thead {
  background: rgba(0, 0, 0, 0.02);
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

:where(.dark, .dark *) .posts-table thead {
  background: rgba(255, 255, 255, 0.03);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.posts-table th {
  padding: 0.875rem 1rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(0, 0, 0, 0.6);
}

:where(.dark, .dark *) .posts-table th {
  color: rgba(255, 255, 255, 0.6);
}

/* Round top-left corner */
.posts-table thead tr:first-child th:first-child {
  border-top-left-radius: 12px;
}

/* Round top-right corner */
.posts-table thead tr:first-child th:last-child {
  border-top-right-radius: 12px;
}

.posts-table tbody tr {
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  transition: background 0.15s ease;
  cursor: pointer;
}

:where(.dark, .dark *) .posts-table tbody tr {
  border-bottom-color: rgba(255, 255, 255, 0.05);
}

.posts-table tbody tr:last-child {
  border-bottom: none;
}

/* Round bottom-left corner */
.posts-table tbody tr:last-child td:first-child {
  border-bottom-left-radius: 12px;
}

/* Round bottom-right corner */
.posts-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 12px;
}

.posts-table tbody tr:hover {
  background: rgba(139, 92, 246, 0.04);
}

:where(.dark, .dark *) .posts-table tbody tr:hover {
  background: rgba(139, 92, 246, 0.08);
}

.posts-table td {
  padding: 1rem;
  font-size: 0.875rem;
}

.col-number {
  width: 80px;
  font-weight: 500;
  color: rgba(0, 0, 0, 0.5);
}

:where(.dark, .dark *) .col-number {
  color: rgba(255, 255, 255, 0.5);
}

.col-title {
  flex: 1;
  max-width: 500px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-title a {
  color: inherit;
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s;
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.col-title a:hover {
  color: rgb(139, 92, 246);
}

:where(.dark, .dark *) .col-title a:hover {
  color: rgb(167, 139, 250);
}

.col-reading {
  width: 160px;
  text-align: center;
  color: rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

:where(.dark, .dark *) .col-reading {
  color: rgba(255, 255, 255, 0.6);
}

.col-date {
  width: 160px;
  text-align: right;
  color: rgba(0, 0, 0, 0.6);
  white-space: nowrap;
}

:where(.dark, .dark *) .col-date {
  color: rgba(255, 255, 255, 0.6);
}

.no-posts {
  text-align: center;
  padding: 3rem 1.5rem;
  color: rgba(0, 0, 0, 0.5);
  font-size: 1rem;
}

:where(.dark, .dark *) .no-posts {
  color: rgba(255, 255, 255, 0.5);
}

/* Override prose styles */
.prose h1,
.prose h2,
.prose h3 {
  margin-top: 0;
}

/* Increase page content width */
.prose {
  max-width: 90rem;
}

@media (min-width: 1280px) {
  .prose {
    max-width: 100rem;
  }
}

@media (min-width: 1536px) {
  .prose {
    max-width: 110rem;
  }
}

/* Responsive Design */
@media (max-width: 640px) {
  .series-header {
    padding: 1.5rem 1rem;
  }

  .series-title {
    font-size: 2rem;
  }

  .series-description {
    font-size: 1rem;
  }

  .series-meta {
    gap: 0.75rem;
  }

  .series-post-count-badge {
    font-size: 0.8125rem;
    padding: 0.375rem 0.75rem;
  }

  /* Make tags significantly smaller on mobile */
  .series-tags {
    gap: 0.375rem;
  }

  .series-tag {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    border-radius: 4px;
  }

  .collapsible-section {
    padding: 0 1rem;
  }

  .collapsible-header {
    padding: 1rem;
  }

  .collapsible-title {
    font-size: 1.125rem;
  }

  .collapsible-header-content {
    flex-wrap: wrap;
  }

  .post-count {
    padding: 0.2rem 0.625rem;
    font-size: 0.6875rem;
  }

  .table-wrapper {
    padding: 0rem 1rem 0.75rem 1rem;
  }

  .posts-table {
    min-width: 550px;
  }

  .posts-table th {
    padding: 0.75rem 0.625rem;
    font-size: 0.6875rem;
  }

  .posts-table td {
    padding: 0.75rem 0.625rem;
    font-size: 0.8125rem;
  }

  .col-number {
    width: 60px;
  }

  .col-title {
    min-width: 180px;
    max-width: 250px;
  }

  .col-reading {
    width: 125px;
    font-size: 0.75rem;
  }

  .col-date {
    width: 125px;
    font-size: 0.75rem;
  }
}

@media (min-width: 641px) and (max-width: 768px) {
  /* Smaller tags for tablets too */
  .series-tag {
    padding: 0.3rem 0.625rem;
    font-size: 0.8125rem;
  }

  .table-wrapper {
    padding: 0 1.25rem 0.875rem 1.25rem;
  }

  .posts-table {
    min-width: 650px;
  }

  .posts-table th {
    font-size: 0.7rem;
  }

  .posts-table td {
    font-size: 0.8125rem;
  }

  .col-title {
    max-width: 350px;
  }

  .col-date {
    width: 145px;
    font-size: 0.8125rem;
  }

  .col-reading {
    width: 145px;
    font-size: 0.8125rem;
  }
}

@media (min-width: 1024px) {
  .series-header {
    padding: 2rem 3rem;
  }

  .collapsible-section {
    padding: 0 3rem;
  }

  .table-wrapper {
    padding: 0rem 1.5rem 1rem 1.5rem;
  }

  .posts-table th,
  .posts-table td {
    padding: 1rem 1.25rem;
  }

  .col-title {
    max-width: 600px;
  }
}
