.tabpanels-responsive {
  height: calc(100dvh - 9.7rem);
  overflow: auto;
}

@media (max-width: 768px) {
  .tabpanels-responsive {
    height: calc(100dvh - 8.5rem);
  }
}

.series-wrapper {
  position: relative;
  border-radius: 0.75rem;
  overflow: hidden;
  border: 1px solid var(--p-content-border-color);
}

.series-main {
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.series-details {
  > * + * {
    margin-top: 1rem;
  }
}

// ── Hero ──

.series-hero {
  display: flex;
  gap: 1.5rem;
  padding: 0.5rem;
  align-items: stretch;

  @media (max-width: 767px) {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
}

.hero-cover-section {
  flex-shrink: 0;

  @media (max-width: 767px) {
    display: flex;
    justify-content: center;
  }
}

.hero-cover-img {
  width: 240px;
  height: 360px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);

  @media (max-width: 767px) {
    width: 180px;
    height: 270px;
  }
}

.hero-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.series-title {
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;

  @media (min-width: 768px) {
    font-size: 1.875rem;
  }
}

.series-authors {
  font-size: 1rem;
  margin: 0;
}

.author-link {
  cursor: pointer;
  color: var(--primary-text-color);

  &:hover {
    text-decoration: underline;
  }
}

// ── Metadata cards ──

.metadata-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;

  @media (max-width: 767px) {
    justify-content: center;
  }
}

.meta-card {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.7rem;
  border-radius: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid;
  white-space: nowrap;

  i {
    font-size: 0.8rem;
  }
}

.meta-card--publisher {
  background: color-mix(in srgb, #3b82f6, transparent 85%);
  border-color: color-mix(in srgb, #3b82f6, transparent 60%);
  color: #93c5fd;
  cursor: pointer;

  &:hover {
    background: color-mix(in srgb, #3b82f6, transparent 75%);
  }

  i { color: #60a5fa; }
}

.meta-card--books {
  background: color-mix(in srgb, #8b5cf6, transparent 85%);
  border-color: color-mix(in srgb, #8b5cf6, transparent 60%);
  color: #c4b5fd;

  i { color: #a78bfa; }
}

.meta-card--years {
  background: color-mix(in srgb, #f59e0b, transparent 85%);
  border-color: color-mix(in srgb, #f59e0b, transparent 60%);
  color: #fcd34d;

  i { color: #fbbf24; }
}

.meta-card--pages {
  background: color-mix(in srgb, #10b981, transparent 85%);
  border-color: color-mix(in srgb, #10b981, transparent 60%);
  color: #6ee7b7;

  i { color: #34d399; }
}

.meta-card--format {
  background: color-mix(in srgb, #f43f5e, transparent 85%);
  border-color: color-mix(in srgb, #f43f5e, transparent 60%);
  color: #fda4af;

  i { color: #fb7185; }
}

.meta-card--audio {
  background: color-mix(in srgb, #06b6d4, transparent 85%);
  border-color: color-mix(in srgb, #06b6d4, transparent 60%);
  color: #67e8f9;

  i { color: #22d3ee; }
}

.meta-card--language {
  background: color-mix(in srgb, #ec4899, transparent 85%);
  border-color: color-mix(in srgb, #ec4899, transparent 60%);
  color: #f9a8d4;

  i { color: #f472b6; }
}

.meta-card--owned {
  background: color-mix(in srgb, #14b8a6, transparent 85%);
  border-color: color-mix(in srgb, #14b8a6, transparent 60%);
  color: #5eead4;

  i { color: #2dd4bf; }
}

.publisher-link {
  color: inherit;
}

// ── Ratings ──

.ratings-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;

  @media (max-width: 767px) {
    justify-content: center;
  }
}

.rating-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.25rem 0.6rem;
  border-radius: 0.375rem;
  background: color-mix(in srgb, var(--p-surface-700), transparent 50%);
  border: 1px solid var(--border-color);
  font-size: 0.8rem;
}

.rating-icon {
  font-size: 0.75rem;

  &.personal { color: #facc15; }
  &.goodreads { color: #8b5cf6; }
  &.amazon { color: #f97316; }
  &.hardcover { color: #06b6d4; }
}

.rating-value {
  font-weight: 700;
  color: var(--text-color);
}

.rating-label {
  color: var(--text-secondary-color);
  font-size: 0.7rem;
}

// ── Categories ──

.categories-scroll {
  overflow-x: auto;
  max-width: 100%;
}

.categories-list {
  display: flex;
  gap: 0.4rem;
  width: max-content;

  @media (max-width: 767px) {
    margin: 0 auto;
  }
}

.category-link {
  flex-shrink: 0;
  text-decoration: none;
  cursor: pointer;
}

// ── Description (matches metadata-viewer) ──

.description-section {
  background: var(--card-background);
  border: 1px solid var(--border-color);
  border-radius: 0.75rem;
  overflow: hidden;
  margin: 0 0.5rem;
  transition: box-shadow 0.3s ease;

  &:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }
}

.description-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.625rem 0.875rem;
  background: var(--surface-ground);
  border-bottom: 1px solid var(--border-color);
  border-radius: 0.75rem 0.75rem 0 0;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-color);

  i {
    font-size: 0.95rem;
    color: var(--primary-color);
  }
}

.description-body {
  padding: 0.875rem;
}

.description-content {
  overflow: hidden;
  transition: max-height 0.3s ease-in-out;
}

.description-content.line-clamp-7 {
  max-height: 37px;
}

.description-content:not(.line-clamp-7) {
  max-height: none;
}

.description-html {
  color: var(--text-color-secondary);
  line-height: 1.6;
  font-size: 0.9375rem;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.expand-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 0.5rem;
  padding: 0.25rem 0.5rem;
  background: transparent;
  border: none;
  border-radius: 0.25rem;
  color: var(--primary-color);
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;

  &:hover {
    background: var(--surface-hover);
    color: var(--primary-hover-color);
  }

  i {
    font-size: 0.7rem;
  }
}

// ── Hero status (next up + progress, aligned to cover bottom) ──

.hero-status {
  display: flex;
  align-items: flex-end;
  gap: 0.75rem;
  width: 100%;
  margin-top: auto;

  @media (max-width: 767px) {
    flex-direction: column;
    align-items: stretch;
    margin-top: 0;
  }
}

// ── Reading progress ──

.read-progress-card {
  display: flex;
  align-items: center;
  padding: 0.75rem 1rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--p-surface-700), transparent 50%);
  border: 1px solid var(--border-color);
  flex: 1;
  min-width: 0;

  @media (min-width: 768px) {
    min-width: 16rem;
    max-width: 22rem;
  }
}

.read-progress-section {
  flex: 1;
  min-width: 0;
}

.read-progress-bar {
  display: flex;
  height: 0.625rem;
  border-radius: 0.375rem;
  overflow: hidden;
  background: color-mix(in srgb, var(--p-surface-600), transparent 50%);
  gap: 2px;
}

.read-progress-segment {
  height: 100%;
  min-width: 4px;
  border-radius: 0.375rem;
}

.read-progress-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.5rem;
  font-size: 0.75rem;
  color: var(--text-color-secondary);
  align-items: center;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1rem 0.4rem 0.1rem 0.3rem;
  border-radius: 9999px;
  border: 1px solid;
  font-size: 0.7rem;
  background: color-mix(in srgb, var(--p-surface-700), transparent 60%);
}

.legend-dot {
  display: inline-block;
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  flex-shrink: 0;
}

.read-percent-label {
  margin-left: auto;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-secondary-color);
}

// ── Next Up card ──

.next-up-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--p-surface-700), transparent 50%);
  border: 1px solid var(--border-color);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;

  &:hover {
    background: color-mix(in srgb, var(--p-surface-700), transparent 30%);
    border-color: var(--primary-text-color);
  }

  @media (min-width: 768px) {
    min-width: 16rem;
    max-width: 22rem;
  }
}

.next-up-thumb {
  width: 2.75rem;
  height: 4rem;
  object-fit: cover;
  border-radius: 0.25rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.next-up-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.next-up-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--text-secondary-color);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.25rem;

  i {
    font-size: 0.6rem;
    color: var(--primary-text-color);
  }
}

.next-up-title {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.next-up-progress-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.next-up-progress {
  flex: 1;
  height: 0.25rem;
}

.next-up-percent {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-secondary-color);
  flex-shrink: 0;
}

// ── Section title ──

.section-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-color-secondary);
  margin: 0.75rem 0 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.5rem 0;
  border-top: 1px solid var(--border-color);

  i {
    font-size: 1rem;
    color: var(--text-secondary-color);
  }
}

// ── Book grid ──

.series-items-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(1px, 1fr));
  gap: 1rem;
  align-items: start;
  width: 100%;
  overflow-y: auto;
}

// ── Book list tab ──

.book-list-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.5rem;
}

.book-list-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  border-radius: 0.5rem;
  background: color-mix(in srgb, var(--p-surface-700), transparent 65%);
  border: 1px solid color-mix(in srgb, var(--border-color), transparent 60%);
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;

  &:hover {
    background: color-mix(in srgb, var(--p-surface-700), transparent 40%);
    border-color: var(--border-color);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  @media (max-width: 768px) {
    gap: 0.5rem;
    padding: 0.5rem;
  }
}

.list-number-col {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 0.375rem;
  background: color-mix(in srgb, var(--primary-color), transparent 85%);
}

.list-series-number {
  font-weight: 700;
  font-size: 0.8rem;
  color: var(--primary-color);
}

.list-thumb {
  width: 2.75rem;
  height: 4rem;
  object-fit: cover;
  border-radius: 0.375rem;
  flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.list-book-info {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
  flex: 1;
}

.list-book-title {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-book-meta {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.85rem;
  color: var(--text-color-secondary);
  flex-wrap: wrap;
}

.list-meta-dot {
  color: var(--text-color-secondary);
  opacity: 0.5;
}

.list-book-authors {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 16rem;
}

.list-book-year,
.list-book-pages {
  white-space: nowrap;
  flex-shrink: 0;
}

.list-right-col {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
}

.list-badges {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.list-status-badge {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 9999px;
  font-size: 0.7rem;
  font-weight: 700;
  color: white;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.list-format-badge {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.7rem;
  font-weight: 700;
  border: 1px solid;
  white-space: nowrap;
  text-transform: uppercase;
  letter-spacing: 0.03em;

  @media (max-width: 768px) {
    display: none;
  }
}

// ── List: progress bar ──

.list-progress-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.15rem;
}

.list-progress-bar {
  width: 5rem;
  height: 0.25rem;
  border-radius: 0.25rem;
  background: color-mix(in srgb, var(--p-surface-600), transparent 50%);
  overflow: hidden;
}

.list-progress-fill {
  height: 100%;
  border-radius: 0.25rem;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.list-progress-text {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-color-secondary);
}

// ── List: rating stars ──

.list-rating-row {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  margin-top: 0.1rem;
}

.list-star {
  font-size: 0.65rem;
  color: #facc15;
}

.list-rating-value {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-color-secondary);
  margin-left: 0.25rem;
}

// ── List: action buttons ──

.list-actions {
  display: flex;
  gap: 0.35rem;
}

.list-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 0.4rem;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.15s ease;

  i {
    font-size: 0.85rem;
  }

  &.btn-read {
    background: color-mix(in srgb, #10b981, transparent 85%);
    border-color: color-mix(in srgb, #10b981, transparent 55%);
    color: #6ee7b7;

    &:hover {
      background: color-mix(in srgb, #10b981, transparent 65%);
    }
  }

  &.btn-details {
    background: color-mix(in srgb, #3b82f6, transparent 85%);
    border-color: color-mix(in srgb, #3b82f6, transparent 55%);
    color: #93c5fd;

    &:hover {
      background: color-mix(in srgb, #3b82f6, transparent 65%);
    }
  }
}

.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-secondary-color);
}

// ── Loading ──

.loading-state {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  height: 100%;
  gap: 1rem;
}

// ── Footer ──

.book-browser-footer {
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  display: flex;
  align-items: center;
  padding: 1rem 0.5rem 0.5rem;
  z-index: 100;
  border-radius: 10px 10px 0 0;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-width: 1px 1px 0px 1px;
  background-color: var(--card-background);

  > .footer-content {
    width: 100%;
  }

  @media (max-width: 768px) {
    left: 0;
    right: 0;
  }
}

.footer-content {
  display: flex;
  align-items: center;
}

.footer-left {
  display: flex;
  align-items: center;
  padding-left: 0.5rem;
  width: 25%;
}

.footer-center {
  display: flex;
  justify-content: center;
  width: 50%;
}

.footer-right {
  width: 25%;
}

.footer-action-group {
  display: flex;
  gap: 0.5rem;

  @media (min-width: 768px) {
    gap: 1.5rem;
  }
}

.more-actions-wrapper {
  display: flex;
  justify-content: center;
}

.selected-count-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  color: var(--text-color);

  i {
    font-size: 1rem;
  }
}

.badge-icon {
  margin-right: 0.5rem;
}

.badge-count {
  font-weight: 700;
  font-size: 1rem;
}

.badge-label {
  margin-left: 0.25rem;
}

@media (max-width: 768px) {
  .selected-count-badge {
    padding: 0.4rem 0.8rem;
    font-size: 0.85rem;

    i {
      font-size: 0.9rem;
    }
  }
}
