/**
 * Entity Page Styles
 * 
 * Shared styles for subject, league, and tag pages.
 * Card styles come from explore.css and index-shared.css
 */

/* ============================================================================
 * Page Layout
 * ============================================================================ */

.entity-page {
  position: relative;
  min-height: 100vh;
}

/* Ensure all main sections sit above ambient background */
.entity-page > section {
  position: relative;
  z-index: 1;
}

/* Topic timeline area - wrapper for animation and panels sections */
.topic-timeline-area {
  position: relative;
  width: 100%;
}

/* Topic page ambient animation - position behind panels */
.topic-timeline-area .ambient-animation-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

/* Ensure panels section sits above ambient animation */
.topic-timeline-area .topic-panels-section {
  position: relative;
  z-index: 1;
  background: transparent;
}

/* ============================================================================
 * Entity Hero Section (Title + Search)
 * ============================================================================ */

/* Hide hero section on topic pages */
.topic-page .entity-hero {
  display: none;
}

/* Make timeline section transparent on topic pages */
.topic-page .explore-timeline-section {
  background: transparent;
}

.entity-hero {
  text-align: center;
  padding: 0 var(--spacing-xl);
  max-width: 900px;
  margin: 0 auto;
}

.entity-hero .hero-brand-title {
  margin-top: 0;
  margin-bottom: 0;
  padding-top: 3.5rem;
}

.entity-hero .brand-dash {
  font-size: 3rem;
}

.entity-hero .hero-brand-tagline {
  margin-top: var(--spacing-xs);
  margin-bottom: var(--spacing-sm);
}

.entity-hero .search-container {
  margin-top: var(--spacing-sm);
  margin-bottom: var(--spacing-lg);
}

/* ============================================================================
 * Header Section
 * ============================================================================ */

/* Entity header section wrapper */
.entity-header-section {
  margin: 1.5rem 0 2rem;
}

/* Ensure section-container constrains entity-header correctly */
.entity-header-section .section-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  box-sizing: border-box;
}

.entity-header {
  position: relative;
  width: 100%;
  max-width: 100%;
  height: 480px;
  overflow: hidden;
  background: linear-gradient(135deg,
    var(--color-bg-secondary) 0%,
    var(--color-bg-tertiary) 100%);
  border-radius: var(--radius-lg);
  box-sizing: border-box;
}

.entity-header-image {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center 35%; /* Show slightly above center */
  opacity: 0;
  transition: opacity 0.3s ease;
  border-radius: var(--radius-lg);
}

.entity-header-image.loaded {
  opacity: 1;
}

/* Brand placeholder - larger size for the big entity header */
.entity-header .entity-brand-placeholder img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
}

.entity-header .entity-brand-placeholder span {
  font-size: 1.75rem;
}

.entity-header-image[href]:hover {
  transform: scale(1.01);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.entity-header-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.3) 0%,
    rgba(0, 0, 0, 0.7) 100%
  );
  display: flex;
  align-items: flex-end;
  padding: 2rem;
}

.entity-header-content {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.entity-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(8px);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  color: white;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
}

.entity-type-icon {
  font-size: 1.25rem;
}

/* Type-specific badge colors */
.subject-badge {
  background: rgba(99, 102, 241, 0.2);
  border: 1px solid rgba(99, 102, 241, 0.3);
}

.league-badge {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.tag-badge {
  background: rgba(236, 72, 153, 0.2);
  border: 1px solid rgba(236, 72, 153, 0.3);
}

.entity-name {
  font-size: 3rem;
  font-weight: 800;
  color: white;
  margin: 0 0 1rem 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.entity-featured-info {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.featured-index-title {
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  transition: all 0.2s;
  text-align: left;
  line-height: 1.3;
}

.featured-index-title:hover {
  color: var(--color-primary);
  text-shadow: 0 0 12px rgba(0, 168, 255, 0.6);
}

.entity-creator-attribution {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.9rem;
}

.attribution-label {
  opacity: 0.8;
}

.attribution-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: white;
  text-decoration: none;
  transition: color 0.2s ease;
}

.attribution-link:hover {
  color: #33c4ff;
}

.attribution-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.attribution-link:hover .attribution-avatar {
  border-color: rgba(0, 168, 255, 0.6);
  box-shadow: 0 0 10px rgba(0, 168, 255, 0.5);
}

.attribution-username {
  font-weight: 600;
}

.entity-no-image-message {
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  font-style: italic;
  margin-top: 0.75rem;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  max-width: 350px;
  line-height: 1.4;
}

.no-image-cta-link {
  color: var(--color-primary);
  text-decoration: underline;
  font-style: italic;
  transition: opacity 0.2s ease;
}

.no-image-cta-link:hover {
  opacity: 0.8;
}

/* ============================================================================
 * Topic Library Grid Cards
 * ============================================================================ */

.topic-page .library-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  padding: 0;
}

@media (max-width: 1200px) {
  .topic-page .library-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 900px) {
  .topic-page .library-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 500px) {
  .topic-page .library-grid {
    grid-template-columns: 1fr;
  }
}

.library-grid-card {
  background: var(--color-bg-secondary, #0c0c0e);
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid var(--color-border, rgba(255, 255, 255, 0.1));
}

.library-grid-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4);
}

.library-grid-card-media {
  position: relative;
  aspect-ratio: 16 / 10;
  background-size: cover;
  background-position: center;
  background-color: var(--color-bg-tertiary, #16213e);
}

.library-grid-card-type-badge {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 28px;
  height: 28px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}

.library-grid-card-type-badge svg {
  width: 14px;
  height: 14px;
  color: rgba(255, 255, 255, 0.9);
}

.library-grid-card-content {
  padding: 0.875rem 1rem;
}

.library-grid-card-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text-primary, #fff);
  margin: 0 0 0.5rem 0;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.library-grid-card-creator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: var(--color-text-tertiary, rgba(255, 255, 255, 0.6));
}

.library-grid-card-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
}

.library-grid-card-username {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Library Empty State */
.topic-page .library-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
  color: var(--color-text-tertiary, rgba(255, 255, 255, 0.5));
}

.topic-page .library-empty svg {
  margin-bottom: 1rem;
  opacity: 0.5;
}

.topic-page .library-empty h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-text-primary, #fff);
  margin: 0 0 0.5rem 0;
}

.topic-page .library-empty p {
  margin: 0;
  font-size: 0.9rem;
}

.library-empty-link {
  color: var(--color-primary, #00a8ff);
  text-decoration: underline;
}

/* Library Loading */
.topic-page .library-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 2rem;
  text-align: center;
  width: 100%;
  gap: 1rem; /* Explicit gap to prevent inheritance issues */
}

.topic-page .library-loading .profile-loading-text {
  line-height: 1.4; /* Fixed line-height prevents reflow from dots animation */
}

.topic-page .library-loading .profile-loading-bar {
  margin: 0 auto;
}

/* ============================================================================
 * Data Section (for subjects/leagues with data mappings)
 * ============================================================================ */

.entity-data-section {
  background: var(--color-bg-secondary);
  padding: 2rem 0;
  border-bottom: 1px solid var(--color-border);
}

.data-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

.data-card {
  background: var(--color-bg-primary);
  border-radius: var(--radius-lg);
  padding: 2rem;
  border: 1px solid var(--color-border);
}

/* ============================================================================
 * Indexes Section
 * ============================================================================ */

.entity-indexes-section {
  padding: 1.5rem 2rem;
  min-height: 400px;
}

.indexes-container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
}

.section-header h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-text-primary);
  margin: 0;
}

.index-count {
  font-size: 0.95rem;
  color: var(--color-text-muted);
}

/* Use fixed-width columns for consistent card sizing */
.indexes-grid {
  display: grid;
  grid-template-columns: repeat(3, 340px);
  gap: 2rem;
  margin-bottom: 2rem;
  justify-content: center;
}

/* Ensure cards don't exceed grid column width */
.indexes-grid .index-card {
  width: 100%;
  max-width: 340px;
}

/* ============================================================================
 * Load More
 * ============================================================================ */

.load-more-container {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

.btn-load-more {
  padding: 0.75rem 2rem;
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-load-more:hover {
  background: var(--color-primary);
  color: white;
  border-color: var(--color-primary);
}

/* ============================================================================
 * Empty State
 * ============================================================================ */

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

.empty-state p {
  font-size: 1.125rem;
  margin-bottom: 1.5rem;
}

/* ============================================================================
 * Entity Timeline Section
 * ============================================================================ */

.entity-timeline-section {
  padding: 1.5rem 2rem;
}

.entity-timeline-section .section-container {
  max-width: 1200px;
  margin: 0 auto;
}

.view-all-link {
  color: var(--color-text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: opacity 0.2s;
}

.view-all-link:hover {
  opacity: 0.8;
  color: var(--color-text-primary);
}

/* Entity Timeline Section uses timeline.css classes directly */
/* Timeline viewport is outside section-container for full-width scrolling */

/* ============================================================================
 * Related Topics Section
 * ============================================================================ */

.related-topics-section {
  padding: 1.5rem 2rem;
}

.related-topics-section .section-container {
  max-width: 1200px;
  margin: 0 auto;
}

.related-topics-section .section-header h2 {
  margin: 0 0 1rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
}

.related-topics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
}

/* Square topic preview card */
.related-topic-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}

.related-topic-card:hover {
  border-color: rgba(0, 168, 255, 0.5);
  box-shadow: 0 4px 20px rgba(0, 168, 255, 0.15);
  transform: translateY(-2px);
}

.related-topic-media {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 0.4s ease;
}

.related-topic-card:hover .related-topic-media {
  transform: scale(1.05);
}

.related-topic-overlay {
  position: absolute;
  inset: -2px;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.8) 0%,
    rgba(0, 0, 0, 0.3) 50%,
    transparent 100%
  );
  z-index: 1;
}

.related-topic-content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 0.75rem;
  z-index: 2;
}

.related-topic-name {
  color: white;
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0;
  line-height: 1.2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Fallback for topics without media */
.related-topic-card-no-media {
  background: linear-gradient(135deg, var(--color-bg-base-light) 0%, var(--color-bg-base-mid) 100%);
}

.related-topic-card-no-media .related-topic-overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.2) 100%);
}

/* Responsive adjustments */
@media (max-width: 900px) {
  .related-topics-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 600px) {
  .related-topics-section {
    padding: 1rem;
  }
  
  .related-topics-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  
  .related-topic-name {
    font-size: 0.8rem;
  }
  
  .related-topic-content {
    padding: 0.5rem;
  }
}

/* ============================================================================
 * Entity Leaderboard Section
 * ============================================================================ */

.entity-leaderboard-section {
  padding: 1.5rem 2rem;
}

.entity-leaderboard-section .section-container {
  max-width: 1200px;
  margin: 0 auto;
}

.leaderboard-sort {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sort-select-mini {
  padding: 0.5rem 1rem;
  background: rgba(0, 168, 255, 0.1);
  border: 1px solid rgba(0, 168, 255, 0.3);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 0.875rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  padding-right: 2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23ffffff' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.sort-select-mini:focus {
  border-color: rgba(0, 168, 255, 0.6);
  box-shadow: 0 0 0 2px rgba(0, 168, 255, 0.2);
}

.sort-select-mini option {
  background: #141416;
  color: #f1f5f9;
  padding: 0.5rem;
}

.entity-leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
}

.leaderboard-card {
  background: var(--color-bg-tertiary);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
  border: 1px solid rgba(0, 168, 255, 0.3);
  box-shadow: 0 0 8px rgba(0, 168, 255, 0.15);
}

.leaderboard-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0, 168, 255, 0.6);
  box-shadow: 0 0 24px rgba(0, 168, 255, 0.35), 0 8px 16px rgba(0, 0, 0, 0.3);
}

.leaderboard-card-rank {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  width: 24px;
  height: 24px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
}

.leaderboard-card.rank-1 .leaderboard-card-rank {
  background: linear-gradient(135deg, #ffd700, #ffb800);
}

.leaderboard-card.rank-2 .leaderboard-card-rank {
  background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
}

.leaderboard-card.rank-3 .leaderboard-card-rank {
  background: linear-gradient(135deg, #cd7f32, #b87333);
}

.leaderboard-card {
  position: relative;
}

.leaderboard-card-avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 4px solid rgba(0, 168, 255, 0.5);
  box-shadow: 0 0 16px rgba(0, 168, 255, 0.4);
}

.leaderboard-card:hover .leaderboard-card-avatar {
  border-color: rgba(0, 168, 255, 0.8);
  box-shadow: 0 0 24px rgba(0, 168, 255, 0.6);
}

.leaderboard-card-username {
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 0.75rem;
  font-size: 1rem;
}

.leaderboard-card-stats {
  display: flex;
  gap: 1.5rem;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.leaderboard-card-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.leaderboard-card-stat-value {
  font-weight: 700;
  color: var(--color-text-primary);
  font-size: 1rem;
}

/* ============================================================================
 * Admin Controls - Topic Default Image
 * ============================================================================ */

.topic-admin-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 10;
}

.admin-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-md);
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.admin-btn:hover {
  background: rgba(0, 168, 255, 0.3);
  border-color: rgba(0, 168, 255, 0.5);
}

.admin-btn svg {
  flex-shrink: 0;
}

/* ============================================================================
 * Default Image Modal
 * ============================================================================ */

/* Default Image Popup (matches Sign In popup style) */
.default-image-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}

.default-image-popup {
  position: relative;
  width: 100%;
  max-width: 400px;
  margin: 20px;
  padding: 32px;
  background: var(--color-bg-elevated, #141416);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.default-image-popup-close {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: all 0.2s ease;
}

.default-image-popup-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.default-image-popup-header {
  text-align: center;
  margin-bottom: 24px;
}

.default-image-popup-header h2 {
  margin: 0 0 8px;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--color-text-primary, #fff);
}

.default-image-popup-header p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--color-text-secondary, rgba(255, 255, 255, 0.6));
}

.default-image-popup-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.default-image-popup-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.default-image-popup-field label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-secondary, rgba(255, 255, 255, 0.7));
}

.default-image-popup-field input[type="text"] {
  padding: 12px 14px;
  background: var(--color-bg-base, #1e1f24);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: var(--color-text-primary, #fff);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.default-image-popup-field input[type="text"]:focus {
  border-color: rgba(0, 168, 255, 0.5);
  box-shadow: 0 0 0 3px rgba(0, 168, 255, 0.1);
}

.default-image-popup-field input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.default-image-popup-field input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  background: var(--color-bg-base, #1e1f24);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: var(--color-text-primary, #fff);
  font-size: 0.9rem;
  cursor: pointer;
}

.default-image-popup-field input[type="file"]::file-selector-button {
  padding: 6px 14px;
  margin-right: 12px;
  background: rgba(0, 168, 255, 0.15);
  border: 1px solid rgba(0, 168, 255, 0.3);
  border-radius: 6px;
  color: #00a8ff;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.default-image-popup-field input[type="file"]::file-selector-button:hover {
  background: rgba(0, 168, 255, 0.25);
  border-color: rgba(0, 168, 255, 0.5);
}

.default-image-popup-field .upload-preview {
  margin-top: 8px;
}

.default-image-popup-field .upload-preview img {
  max-width: 100%;
  max-height: 200px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.default-image-popup-field .current-preview {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  background: var(--color-bg-base, #1e1f24);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.default-image-popup-field .current-preview img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}

.remove-default-btn {
  padding: 8px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 6px;
  color: #ef4444;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.remove-default-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.5);
}

.default-image-popup-error {
  padding: 10px 12px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #ef4444;
  font-size: 0.85rem;
  text-align: center;
  display: none;
}

.default-image-popup-error:not(:empty) {
  display: block;
}

.default-image-popup-submit {
  padding: 14px 20px;
  background: transparent;
  border: 2px solid rgba(0, 168, 255, 0.6);
  border-radius: 8px;
  color: #00a8ff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 0 15px rgba(0, 168, 255, 0.2), inset 0 0 15px rgba(0, 168, 255, 0.05);
}

.default-image-popup-submit:hover:not(:disabled) {
  background: rgba(0, 168, 255, 0.1);
  border-color: rgba(0, 168, 255, 0.8);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0 25px rgba(0, 168, 255, 0.4), inset 0 0 20px rgba(0, 168, 255, 0.1);
}

.default-image-popup-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
}

/* ============================================================================
 * Topic Page - Recent Uploads Header Width Constraint
 * ============================================================================ */

/* Override full-viewport width to match masonry wrapper */
.topic-page .recent-posts-header-grid {
  width: 100%;
  margin-left: 0;
  padding: 0.75rem 2rem;
  max-width: 1400px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Adjust divider line to not extend beyond content */
.topic-page .recent-posts-header-grid::after {
  left: 2rem;
  right: 2rem;
}

/* Match topic filter bar to masonry wrapper width */
.topic-page .topic-filter-bar-section .section-container {
  max-width: 1400px;
  padding: 0 2rem;
  margin: 0 auto;
  box-sizing: border-box;
}

/* ============================================================================
 * Responsive Design
 * ============================================================================ */

@media (max-width: 1200px) {
  .indexes-grid {
    grid-template-columns: repeat(2, 340px);
  }
}

@media (max-width: 768px) {
  .entity-header {
    height: 360px;
  }

  .entity-name {
    font-size: 2rem;
  }

  .entity-header-overlay {
    padding: 1rem;
  }

  .indexes-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .indexes-grid .index-card {
    max-width: none;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.5rem;
  }

  .entity-indexes-section {
    padding: 2rem 1rem;
  }

  .entity-timeline-section,
  .entity-leaderboard-section {
    padding: 2rem 1rem;
  }

  .entity-leaderboard-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================================
 * Topic Page - Library Table View Adjustments
 * Match portfolio page proportions (no Creator column)
 * ============================================================================ */

/* Topic page tabs - transparent background (no dark strip) */
.topic-page .portfolio-tabs {
  background: transparent;
}

.topic-page .portfolio-tabs::before {
  display: none;
}

/* Topic page table - use fixed layout to force full width */
.topic-page .library-table {
  width: 100%;
  table-layout: fixed;
}

/* Topic page table column widths - Name column gets remaining space */
.topic-page .library-table .col-name {
  width: 25%;
}

.topic-page .library-table .col-type {
  width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topic-page .library-table .col-tags {
  width: 240px;
}

.topic-page .library-table .col-date {
  width: 100px;
}

/* Mobile - phone */
@media (max-width: 480px) {
  .entity-header {
    height: 280px;
  }

  .entity-name {
    font-size: 1.5rem;
  }

  .entity-header-overlay {
    padding: 0.75rem;
  }

  .entity-indexes-section,
  .entity-timeline-section,
  .entity-leaderboard-section {
    padding: 1.5rem 0.75rem;
  }

  .entity-leaderboard-grid {
    grid-template-columns: 1fr;
  }

  .topic-page .library-table {
    table-layout: auto;
  }

  .topic-page .library-table .col-name {
    width: auto;
  }

  .topic-page .library-table .col-type {
    width: auto;
  }

  .topic-page .library-table .col-tags {
    display: none;
  }

  .topic-page .library-table .col-date {
    width: 80px;
  }

  .topic-page .portfolio-tabs {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* ============================================================================
   League Browse Section
   ============================================================================ */

.league-browse-section {
  padding: 20px var(--spacing-lg) 8px;
  max-width: 1200px;
  margin: 0 auto;
}

.league-browse-group {
  margin-bottom: 16px;
}

.league-browse-group-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0 0 10px;
}

.league-browse-row {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.league-browse-row::-webkit-scrollbar {
  height: 4px;
}

.league-browse-row::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 2px;
}

.league-browse-card {
  flex: 0 0 auto;
  width: 120px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  padding: 10px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}

.league-browse-card:hover {
  background: rgba(255, 255, 255, 0.05);
}

.league-browse-card-img {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
}

.league-browse-card-placeholder {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
}

.league-browse-card-name {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  text-align: center;
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

@media (max-width: 768px) {
  .league-browse-section {
    padding: 16px var(--spacing-md) 4px;
  }

  .league-browse-card {
    width: 100px;
  }

  .league-browse-card-img {
    width: 52px;
    height: 52px;
  }
}


/* GPA narrative styles moved to collection-blocks.css (block-based rendering) */
