/**
 * Collection Block Renderer Styles
 *
 * Shared styles for rendered collection blocks in portfolio tabs,
 * topic page tabs, and other embedded contexts.
 */

/* New element-based format: absolute positioning */
.collection-blocks-container {
  position: relative;
  min-height: 400px;
  max-width: 1336px;
  margin: 0 auto;
  padding: 24px;
}

/* Elements use absolute positioning */
.ce-element {
  position: absolute;
  /* x, y, width set via inline styles */
}

/* Old V3 block-based format: flexbox */
.collection-blocks {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.collection-empty {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--color-text-tertiary);
}

/* Heading */
.cb-heading {
  margin: 0;
  color: var(--color-text-primary);
}

/* Text */
.cb-text {
  color: var(--color-text-secondary);
  line-height: 1.6;
}

.cb-text a {
  color: var(--color-accent, #00a8ff);
}

/* Divider */
.cb-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0.5rem 0;
}

/* Spacer */
.cb-spacer {
  flex-shrink: 0;
}

/* Post Card */
.cb-post-card {
  display: flex;
  flex-direction: column;
  background: var(--color-bg-secondary, #1e1e2e);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.2s ease;
}

.cb-post-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.cb-post-thumb {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.cb-post-thumb-placeholder {
  width: 100%;
  aspect-ratio: 16/9;
  background: rgba(255, 255, 255, 0.04);
}

.cb-post-info {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.cb-post-title {
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--color-text-primary);
}

.cb-post-creator {
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
}

/* Post Grid */
.cb-post-grid {
  display: grid;
  gap: 1rem;
}

.cb-post-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cb-post-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cb-post-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* Embed */
.cb-embed {
  border-radius: 8px;
  overflow: hidden;
}

/* Uploaded Media */
.cb-media img {
  max-width: 100%;
  border-radius: 8px;
}

/* Topic Feed */
.cb-topic-feed-title {
  margin: 0 0 0.75rem;
}

.cb-topic-feed-title a {
  color: var(--color-text-primary);
  text-decoration: none;
}

.cb-topic-feed-title a:hover {
  text-decoration: underline;
}

/* Columns */
.cb-columns {
  display: grid;
  gap: 1.5rem;
}

.cb-columns.layout-1-1 { grid-template-columns: 1fr 1fr; }
.cb-columns.layout-1-1-1 { grid-template-columns: 1fr 1fr 1fr; }
.cb-columns.layout-2-1 { grid-template-columns: 2fr 1fr; }
.cb-columns.layout-1-2 { grid-template-columns: 1fr 2fr; }

.cb-column {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Topic Card */
.cb-topic-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg-secondary, #1e1e2e);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}

.cb-topic-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.cb-topic-card-img {
  width: 40px;
  height: 40px;
  border-radius: 4px;
  object-fit: cover;
}

.cb-topic-card-name {
  font-weight: 500;
  color: var(--color-text-primary);
}

.cb-topic-card-count {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
}

/* Creator Card */
.cb-creator-card {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--color-bg-secondary, #1e1e2e);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
}

.cb-creator-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
}

.cb-creator-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
}

.cb-creator-name {
  font-weight: 500;
  color: var(--color-text-primary);
}

.cb-creator-bio {
  font-size: 0.8rem;
  color: var(--color-text-tertiary);
}

/* Group */
.cb-group {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 1rem;
}

.cb-group-title {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--color-text-primary);
}

.cb-group-items {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Timeline Embed */
.cb-timeline-embed {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 1rem;
}

.cb-timeline-title {
  margin: 0 0 1rem;
}

.cb-timeline-item {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.cb-timeline-item:last-child {
  border-bottom: none;
}

.cb-timeline-caption {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  color: var(--color-text-secondary);
}

/* Collection Embed */
.cb-collection-embed {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 1rem;
}

/* ============================================================
   New Element-Based Collection Styles (ce-* prefix)
   ============================================================ */

/* Wrapper for collection elements - match .section-container layout */
.collection-elements-wrapper {
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 2rem;
  box-sizing: border-box;
}

.collection-elements {
  width: 100%;
  margin: 0;
  padding: 1.5rem 0;
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
}

@media (max-width: 768px) {
  .collection-elements-wrapper {
    padding: 0 1rem;
  }
}

@media (max-width: 480px) {
  .collection-elements-wrapper {
    padding: 0 0.75rem;
  }
}

/* Element: Heading */
.ce-heading {
  margin: 0;
  color: var(--color-text-primary);
}

/* Element: Text Box */
.ce-text-box {
  color: var(--color-text-secondary);
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 1rem;
}

.ce-text-box a {
  color: var(--color-accent, #00a8ff);
}

/* Element: Divider */
.ce-divider {
  border: none;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  margin: 0.5rem 0;
}

/* Element: Spacer */
.ce-spacer {
  flex-shrink: 0;
}

/* Element: Image */
.ce-image {
  width: 100%;  /* Fill parent container (absolute positioned) */
  border-radius: 8px;
  overflow: hidden;
}

.ce-image img {
  width: 100%;
  display: block;
  border-radius: 8px;
}

.ce-image .image-caption {
  margin: 8px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  text-align: center;
  font-style: italic;
}

.ce-image.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  background: rgba(255, 255, 255, 0.02);
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
}

/* Responsive for image - width handled by parent container */

/* Element: Post Unavailable */
.ce-post-unavailable {
  padding: 2rem;
  text-align: center;
  color: var(--color-text-tertiary);
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.1);
}

/* Element: Athlete Header - matches editor styling */
.ce-athlete-header {
  display: flex;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  min-height: 120px;
  width: 100%;  /* Fill parent container (absolute positioned) */
  height: 100%; /* Fill parent height when resized */
}

.ah-image-section {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 140px;
  flex-shrink: 0;
  padding: 12px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.05) 0%, rgba(255, 255, 255, 0.02) 100%);
  height: 100%; /* Fill parent height */
}

.ah-image {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
}

.ah-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ah-image-placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.ah-info-section {
  flex: 1;
  padding: 12px 16px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.ah-name {
  margin-bottom: 4px;
}

.ah-first-name {
  font-size: 14px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.6);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  line-height: 1.1;
}

.ah-last-name {
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  line-height: 1.1;
}

.ah-placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.ah-team-line {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
}

.ah-bio-table {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-size: 11px;
}

.ah-bio-row {
  display: contents;
}

.ah-bio-label {
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
  text-transform: uppercase;
  font-size: 11px;
  letter-spacing: 0.05em;
}

.ah-bio-value {
  color: #fff;
  font-weight: 500;
}

.ah-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ah-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
}

.ah-status-dot.inactive {
  background: #ef4444;
}

.ah-status-dot.retired {
  background: #6b7280;
}

.ah-social {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

.ah-social-link {
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color 0.2s ease;
}

.ah-social-link:hover {
  color: #00a8ff;
}

/* Element: Athlete Bio
   NOTE: These .ab-* styles must stay synchronized with .athlete-bio-* classes
   in collection-editor-unified.css to ensure WYSIWYG consistency */
.ce-athlete-bio {
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 20px;
  min-height: 120px;
  width: 100%;  /* Fill parent container (absolute positioned) */
  height: 100%; /* Fill parent height when resized */
  overflow: hidden; /* Handle overflow when content is larger than container */
}

.ab-awards {
  flex: 1;
}

.ab-awards-header,
.ab-bio-header,
.ce-news-header {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 10px;
}

.ab-awards-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ab-award-item {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  width: auto;
}

.ab-award-year {
  font-size: 12px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
}

.ab-award-title {
  font-size: 13px;
  font-weight: 500;
  color: #fff;
}

.ab-awards-placeholder,
.ab-bio-placeholder {
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
  font-style: italic;
}

/* Bio shown first, no top border */
.ab-bio {
  flex: 1;
}

/* Awards section shown second, has top border */
.ab-awards {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 16px;
  margin-top: 8px;
}

.ab-bio-text {
  font-size: 14px;
  line-height: 1.6;
  color: #fff;
  white-space: pre-wrap;
}

/* Responsive for athlete bio - width handled by parent container */

/* Element: Article Header */
.ce-article-header {
  width: 100%;
  height: 100%;
  padding: 32px 16px;
  text-align: center;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  box-sizing: border-box;
}

.ce-article-header.empty {
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
  padding: 24px;
}

.ce-article-header .article-header-title {
  margin: 0 0 16px 0;
  font-size: 42px;
  font-weight: 700;
  color: #fff;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.ce-article-header .article-header-subtitle {
  margin: 0 0 20px 0;
  font-size: 20px;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.5;
  max-width: 700px;
  margin-left: auto;
  margin-right: auto;
}

.ce-article-header .article-header-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 15px;
  color: rgba(255, 255, 255, 0.5);
}

.ce-article-header .article-header-author {
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
}

.ce-article-header .article-header-divider {
  color: rgba(255, 255, 255, 0.3);
}

.ce-article-header .article-header-date {
  color: rgba(255, 255, 255, 0.5);
}

/* Responsive for article header */
@media (max-width: 768px) {
  .ce-article-header .article-header-title {
    font-size: 28px;
  }

  .ce-article-header .article-header-subtitle {
    font-size: 16px;
  }

  .ce-article-header .article-header-meta {
    flex-direction: column;
    gap: 4px;
  }

  .ce-article-header .article-header-divider {
    display: none;
  }
}

/* Transparent variant for article header and rich text */
.ce-article-header.transparent,
.ce-rich-text.transparent {
  background: transparent;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border: none;
}

/* Element: Pull Quote */
.ce-pull-quote {
  width: 100%;
  height: 100%;
  padding: 20px 24px;
  border-left: 4px solid currentColor;
  background: transparent;
  box-sizing: border-box;
  margin: 0;
}

.ce-pull-quote.empty {
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
  padding: 24px;
}

.ce-pull-quote-text {
  margin: 0 0 8px 0;
  font-size: 22px;
  font-style: italic;
  font-weight: 500;
  color: #fff;
  line-height: 1.4;
}

.ce-pull-quote-attribution {
  display: block;
  font-size: 14px;
  font-style: normal;
  color: rgba(255, 255, 255, 0.5);
}

@media (max-width: 768px) {
  .ce-pull-quote-text {
    font-size: 18px;
  }
}

/* Element: Rich Text */
.ce-rich-text {
  width: 100%;
  height: 100%;
  color: #fff;
  line-height: 1.7;
  font-size: 16px;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
  overflow: hidden;
  box-sizing: border-box;
}

.ce-rich-text.empty {
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
  padding: 24px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}

/* Rich text content styling */
.ce-rich-text p {
  margin: 0 0 1em 0;
}

.ce-rich-text p:last-child {
  margin-bottom: 0;
}

.ce-rich-text b,
.ce-rich-text strong {
  font-weight: 600;
  color: #fff;
}

.ce-rich-text i,
.ce-rich-text em {
  font-style: italic;
}

.ce-rich-text u {
  text-decoration: underline;
}

.ce-rich-text ul,
.ce-rich-text ol {
  margin: 0 0 1em 0;
  padding-left: 1.5em;
}

.ce-rich-text li {
  margin-bottom: 0.5em;
}

.ce-rich-text li:last-child {
  margin-bottom: 0;
}

.ce-rich-text a {
  color: var(--color-accent, #00a8ff);
  text-decoration: none;
}

.ce-rich-text a:hover {
  text-decoration: underline;
}

/* Responsive for rich text */
@media (max-width: 768px) {
  .ce-rich-text {
    font-size: 15px;
  }
}

/* Element: Embed */
.ce-embed {
  width: 100%;  /* Fill parent container (absolute positioned) */
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.ce-embed.empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
}

/* YouTube embed */
.ce-embed-youtube .embed-responsive {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 */
  height: 0;
}

.ce-embed-youtube .embed-responsive iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

/* Twitter embed */
.ce-embed-twitter {
  padding: 8px;
}

.ce-embed-twitter .tweet-container {
  max-width: 100%;
}

.ce-embed-twitter .tweet-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: rgba(255, 255, 255, 0.5);
  gap: 12px;
}

.ce-embed-twitter .loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: embed-spin 0.8s linear infinite;
}

@keyframes embed-spin {
  to { transform: rotate(360deg); }
}

/* Instagram embed */
.ce-embed-instagram {
  padding: 12px;
}

.ce-embed-instagram .instagram-media {
  margin: 0 !important;
  max-width: 100% !important;
}

/* TikTok embed */
.ce-embed-tiktok {
  padding: 12px;
}

.ce-embed-tiktok .tiktok-embed {
  margin: 0 !important;
  max-width: 100% !important;
}

/* Generic link embed */
.ce-embed-generic {
  padding: 16px;
}

.ce-embed-generic .embed-link {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #00a8ff;
  text-decoration: none;
  font-size: 14px;
  word-break: break-all;
}

.ce-embed-generic .embed-link:hover {
  text-decoration: underline;
}

.ce-embed-generic .embed-link svg {
  flex-shrink: 0;
  opacity: 0.7;
}

/* Responsive for embed - width handled by parent container */

/* Responsive */
@media (max-width: 1024px) {
  .collection-blocks {
    padding: 1.5rem;
  }

  .cb-post-grid.cols-4 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .collection-blocks {
    padding: 1rem;
  }

  .cb-post-grid.cols-3,
  .cb-post-grid.cols-4 {
    grid-template-columns: repeat(2, 1fr);
  }

  .cb-columns.layout-1-1,
  .cb-columns.layout-1-1-1,
  .cb-columns.layout-2-1,
  .cb-columns.layout-1-2 {
    grid-template-columns: 1fr;
  }

  /* Athlete header responsive - stack vertically on small screens */
  .ce-athlete-header {
    flex-direction: column;
  }

  .ah-image-section {
    width: 100%;
    padding: 16px;
  }

  .ah-info-section {
    text-align: center;
    align-items: center;
    padding: 16px;
  }

  .ah-name {
    text-align: center;
  }

  .ah-bio-table {
    display: flex;
    flex-direction: column;
    gap: 4px;
    text-align: center;
  }

  .ah-bio-row {
    display: flex;
    justify-content: center;
    gap: 8px;
  }

  .ah-social {
    justify-content: center;
  }
}

/* ============================================================
   Stats Header Block (View Page)
   ============================================================ */

.ce-stats-header {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  min-height: 120px;
  height: 100%;
}

.ce-stats-header-title {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  padding: 12px 16px 4px;
  line-height: 1.5;
}

.ce-stats-header-content {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  padding: 12px 16px;
  gap: 12px;
  flex: 1;
  align-items: center;
  overflow: hidden;
}

.ce-stats-header-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.ce-stats-header-label {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 2px;
}

.ce-stats-header-value {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  line-height: 1;
}

.ce-stats-header-rank {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 2px;
}

.ce-stats-header-empty {
  padding: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
}

/* ============================================================
   News Block (View Page)
   ============================================================ */

.ce-news {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.ce-news > .ce-news-header {
  padding: 14px 16px 0;
}

.ce-news-article-item {
  display: flex;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  align-items: center;
  text-decoration: none;
  color: inherit;
  transition: background 0.15s ease;
}

.ce-news-article-item:last-child { border-bottom: none; }

.ce-news-article-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

a.ce-news-article-item {
  cursor: pointer;
}

.ce-news-thumb {
  width: 80px;
  height: 60px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
}

.ce-news-thumb-empty {
  background: rgba(255, 255, 255, 0.05);
}

.ce-news-info {
  flex: 1;
  min-width: 0;
}

.ce-news-title {
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ce-news-author {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
}

.ce-news-empty {
  padding: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
}

/* ============================================================
   Post Embed Block (View Page)
   ============================================================ */

.ce-post-embed {
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
}

.ce-post-twitter,
.ce-post-instagram {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
}

.ce-post-youtube,
.ce-post-tiktok {
  position: relative;
  width: 100%;
  height: 100%;
}

.ce-post-youtube .youtube-wrapper,
.ce-post-tiktok .tiktok-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
}

.ce-post-youtube iframe,
.ce-post-tiktok iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 8px;
}

.ce-post-unavailable {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
}

.ce-post-card {
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  height: 100%;
  transition: background 0.2s ease;
}

.ce-post-card:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ce-post-thumb {
  width: 100%;
  flex: 1;
  min-height: 120px;
  object-fit: cover;
}

.ce-post-thumb-placeholder {
  width: 100%;
  flex: 1;
  min-height: 120px;
  background: rgba(255, 255, 255, 0.05);
}

.ce-post-info {
  padding: 12px 16px;
}

.ce-post-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ce-post-author,
.ce-post-provider {
  display: block;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 4px;
}

/* ============================================================
   Post Gallery Block — iOS Folder Style (View Page)
   ============================================================ */

.ce-post-gallery-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 12px;
}

/* Collapsed folder card — fills full element width */
.ce-element .post-gallery-folder {
  display: flex;
  flex-direction: column;
  height: 100%;
  cursor: pointer;
  transition: transform 0.15s ease;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
}

.ce-element .post-gallery-folder:active {
  transform: scale(0.98);
}

.ce-element .pg-folder-grid {
  display: grid;
  gap: 8px;
  flex: 1;
  min-height: 0;
  border-radius: 12px;
  overflow: hidden;
  padding: 12px;
}

.ce-element .pg-folder-grid-1 { grid-template-columns: 1fr; }
.ce-element .pg-folder-grid-2 { grid-template-columns: 1fr 1fr; }
.ce-element .pg-folder-grid-3 { grid-template-columns: 1fr 1fr; }
.ce-element .pg-folder-grid-4 { grid-template-columns: 1fr 1fr; }

.ce-element .pg-folder-thumb {
  overflow: hidden;
  min-height: 0;
  border-radius: 8px;
}

.ce-element .pg-folder-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 8px;
}

.ce-element .pg-folder-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 4px;
  gap: 2px;
  flex-shrink: 0;
}

.ce-element .pg-folder-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ce-element .pg-folder-count {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.4);
}

/* ============================================================
   Gallery Overlay (Expanded View — shared with editor)
   ============================================================ */

.gallery-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-y: auto;
  padding: 60px 40px 40px;
  animation: galleryFadeIn 0.2s ease;
}

.gallery-overlay-closing {
  animation: galleryFadeOut 0.2s ease forwards;
}

@keyframes galleryFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes galleryFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

.gallery-overlay-header {
  text-align: center;
  margin-bottom: 28px;
  flex-shrink: 0;
}

.gallery-overlay-title {
  font-size: 28px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

.gallery-overlay-count {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
  margin-top: 4px;
}

.gallery-overlay-close {
  position: fixed;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: none;
  background: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s ease;
  z-index: 10001;
  padding: 0;
}

.gallery-overlay-close:hover {
  opacity: 0.7;
}

.gallery-overlay-grid {
  position: relative;
  width: 100%;
  max-width: 1200px;
  min-height: 400px;
}

.gallery-overlay-grid .masonry-item {
  box-sizing: border-box;
}

/* --- Instagram embeds in gallery overlay (full column width) --- */
.gallery-overlay-grid .library-item-instagram {
  width: 100%;
}
.gallery-overlay-grid .library-item-instagram .instagram-container {
  position: relative;
  width: 100%;
  min-height: 200px;
}
.gallery-overlay-grid .library-item-instagram .instagram-media {
  margin: 0 !important;
  max-width: 100% !important;
  min-width: 100% !important;
  width: 100% !important;
}
.gallery-overlay-grid .library-item-instagram .instagram-container iframe {
  border: none !important;
  width: 100% !important;
  min-width: 100% !important;
}
.gallery-overlay-grid .library-item-instagram .instagram-skeleton {
  background: #ffffff;
  border: 1px solid #dbdbdb;
  border-radius: 12px;
  overflow: hidden;
}
.gallery-overlay-grid .library-item-instagram .instagram-skeleton-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 12px;
}
.gallery-overlay-grid .library-item-instagram .instagram-skeleton-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #efefef;
}
.gallery-overlay-grid .library-item-instagram .instagram-skeleton-username {
  width: 120px;
  height: 12px;
  background: #efefef;
  border-radius: 4px;
}
.gallery-overlay-grid .library-item-instagram .instagram-skeleton-image {
  width: 100%;
  aspect-ratio: 1;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-overlay-grid .library-item-instagram .instagram-skeleton-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.gallery-overlay-grid .library-item-instagram .instagram-skeleton-view-more {
  padding: 14px 16px;
  font-size: 14px;
}
.gallery-overlay-grid .library-item-instagram .instagram-skeleton-view-more a {
  color: #00376b;
  text-decoration: none;
}

/* --- Sports Index cards in gallery overlay (uses profile.css .si-internal-preview styles) --- */
.gallery-overlay-grid .library-item-si-content {
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
}

.gallery-overlay-grid .tweet-container .twitter-tweet iframe {
  border-radius: 8px !important;
  color-scheme: light !important;
}

/* ============================================================
   Library Item Embeds for Post Blocks (View Page)
   These mirror profile.css styles for consistent rendering
   ============================================================ */

/* Post element containers - allow overflow for tweet scaling */
.ce-element[data-type="post"] {
  overflow: visible;
}

/* Base library-item container */
.ce-element .library-item {
  position: relative;
  width: 100%;
  height: 100%;
}

/* Sports Index internal content (collection/timeline) featured-embed card */
.ce-element:has(.library-item-si-content) {
  overflow: hidden;
  border-radius: 12px;
}
.ce-element .library-item-si-content {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
}
/* Disable hover effects on featured-embed cards and instagram in collection view */
.ce-element .library-item-si-content .featured-embed:hover,
.ce-element .library-item-si-content .featured-embed:hover .featured-embed-bg,
.ce-element .library-item-instagram:hover {
  transform: none !important;
  box-shadow: none !important;
}
/* Disable ALL hover effects in gallery overlay */
.gallery-overlay .masonry-item:hover,
.gallery-overlay .masonry-item:hover .featured-embed,
.gallery-overlay .masonry-item:hover .featured-embed .featured-embed-bg,
.gallery-overlay .library-item.library-item-instagram:hover,
.gallery-overlay .library-item.library-item-tiktok:hover,
.gallery-overlay .library-item.library-item-twitter:hover,
.gallery-overlay .library-item.library-item-youtube:hover,
.gallery-overlay .library-item.library-item-substack:hover,
.gallery-overlay .library-item.library-item-espn:hover,
.gallery-overlay .library-item.library-item-generic:hover,
.gallery-overlay .library-item.library-item-uploaded-media:hover,
.gallery-overlay .si-internal-preview.featured-embed:hover,
.gallery-overlay .si-internal-preview.featured-embed:hover .featured-embed-bg {
  transform: none !important;
  box-shadow: none !important;
  border-color: inherit !important;
}
/* In collection canvas (ce-element), featured-embed fills the parent absolutely */
.ce-element .library-item-si-content .featured-embed {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
  border-radius: inherit;
  background: #000;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

/* Featured-embed card styles for masonry/gallery overlay (mirrored from core.css) */
.masonry-item .featured-embed {
  position: relative;
  min-height: 220px;
  background: #000;
}
.masonry-item .featured-embed .featured-embed-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  background-color: #0c0c0e;
  mask-image: linear-gradient(to bottom, black 0%, black 50%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, black 0%, black 50%, transparent 100%);
}
.masonry-item .featured-embed .featured-embed-gradient { display: none; }
.masonry-item .featured-embed .featured-embed-type {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.85);
  z-index: 5;
}
.masonry-item .featured-embed .featured-embed-type svg {
  width: 14px;
  height: 14px;
}
.masonry-item .featured-embed .featured-embed-bottom {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 80px;
  z-index: 5;
}
.masonry-item .featured-embed .featured-embed-title {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  line-height: 1.3;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.masonry-item .featured-embed .featured-embed-desc {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  line-height: 1.4;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.masonry-item .featured-embed .featured-embed-author {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 5;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.85);
}
.masonry-item .featured-embed .featured-embed-author img {
  width: 28px;
  height: 28px;
  min-width: 28px;
  max-width: 28px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.3);
  object-fit: cover;
}
.masonry-item .featured-embed .featured-embed-author span {
  max-width: 70px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Brand placeholder (centered logo when no thumbnail) */
.featured-embed-brand-placeholder {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  gap: 10px;
  z-index: 2;
  pointer-events: none;
}
.featured-embed-brand-placeholder img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  box-shadow: 0 0 12px rgba(0, 168, 255, 0.3);
}
.featured-embed-brand-placeholder span {
  font-size: 1.25rem;
  font-weight: 600;
  font-style: italic;
  color: rgba(255, 255, 255, 0.95);
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(255, 255, 255, 0.15);
}

/* Twitter/X tweet embed */
.ce-element .library-item-twitter {
  display: block;
  min-height: 100px;
  overflow: visible;
}

.ce-element .library-item-twitter .tweet-container {
  width: 100%;
  min-height: 100px;
  overflow: visible;
}

/* Tweet wrapper scaling - matches editor behavior */
.ce-element .library-item-twitter .twitter-tweet,
.ce-element .library-item-twitter .twitter-tweet-rendered,
.ce-element .library-item-twitter .twitter-tweet-rendered-true {
  transform-origin: top left;
  margin: 0 !important;
  background: transparent !important;
  border-radius: 0 !important;
  overflow: visible !important;
}

.ce-element .library-item-twitter .twitter-tweet iframe {
  border-radius: 8px !important;
  color-scheme: light !important;
  transform: none !important;
}

.ce-element .library-item-twitter .tweet-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: rgba(255, 255, 255, 0.5);
  gap: 12px;
}

.ce-element .library-item-twitter .tweet-error {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 14px;
}

/* YouTube embed with loading state */
.ce-element .library-item-youtube .youtube-wrapper {
  position: relative;
  width: 100%;
  padding-bottom: 56.25%;
  height: 0;
  overflow: hidden;
  border-radius: 8px;
}

.ce-element .library-item-youtube .youtube-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 150%;
  height: 150%;
  border: none;
  transform: scale(0.6667);
  transform-origin: top left;
}

.ce-element .library-item-youtube .youtube-wrapper.youtube-loading .youtube-thumbnail-placeholder {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
  z-index: 2;
}

.ce-element .library-item-youtube .youtube-wrapper.youtube-loading .youtube-loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 8px;
  z-index: 3;
}

.ce-element .library-item-youtube .youtube-wrapper.youtube-loading iframe {
  opacity: 0;
}

.ce-element .library-item-youtube .youtube-wrapper:not(.youtube-loading) .youtube-thumbnail-placeholder,
.ce-element .library-item-youtube .youtube-wrapper:not(.youtube-loading) .youtube-loading-overlay {
  display: none;
}

.ce-element .library-item-youtube .youtube-wrapper:not(.youtube-loading) iframe {
  opacity: 1;
}

/* TikTok embed */
.ce-element .library-item-tiktok {
  border-radius: 12px;
  overflow: hidden;
}

.ce-element .library-item-tiktok .tiktok-embed-container {
  position: relative;
  width: 100%;
}

.ce-element .library-item-tiktok .tiktok-embed-container iframe {
  display: block;
  width: 100%;
  height: 780px;
  border: none;
  border-radius: 12px;
}

/* Instagram embed with skeleton */
.ce-element .library-item-instagram {
  border-radius: 12px;
  overflow: visible;
}

.ce-element .library-item-instagram .instagram-container {
  position: relative;
  width: 100%;
  min-height: 200px;
}
.ce-element .library-item-instagram .instagram-media {
  margin: 0 !important;
  max-width: 100% !important;
}

.ce-element .library-item-instagram .instagram-container iframe {
  border: none !important;
}

.ce-element .library-item-instagram .instagram-skeleton {
  background: #ffffff;
  border: 1px solid #dbdbdb;
  border-radius: 12px;
  overflow: hidden;
}

.ce-element .library-item-instagram .instagram-skeleton-header {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  gap: 12px;
}

.ce-element .library-item-instagram .instagram-skeleton-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #efefef;
}

.ce-element .library-item-instagram .instagram-skeleton-username {
  width: 120px;
  height: 12px;
  background: #efefef;
  border-radius: 4px;
}

.ce-element .library-item-instagram .instagram-skeleton-image {
  width: 100%;
  aspect-ratio: 1;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ce-element .library-item-instagram .instagram-skeleton-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ce-element .library-item-instagram .instagram-skeleton-view-more {
  padding: 14px 16px;
  font-size: 14px;
}

.ce-element .library-item-instagram .instagram-skeleton-view-more a {
  color: #00376b;
  text-decoration: none;
}

/* Substack preview */
.ce-element .library-item-substack .substack-preview {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
}

.ce-element .library-item-substack .substack-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ce-element .library-item-substack .substack-preview-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: #fff;
}

.ce-element .library-item-substack .substack-preview-overlay h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}

.ce-element .library-item-substack .substack-preview-subtitle {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.ce-element .library-item-substack .substack-preview-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #ff6719;
  text-decoration: none;
}

/* ESPN preview */
.ce-element .library-item-espn .espn-preview {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
}

.ce-element .library-item-espn .espn-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ce-element .library-item-espn .espn-preview-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: #fff;
}

.ce-element .library-item-espn .espn-preview-overlay h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}

.ce-element .library-item-espn .espn-preview-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: #d00;
  text-decoration: none;
}

.ce-element .library-item-espn .espn-preview-link:hover {
  color: #ff3333;
}

/* Generic link preview */
.ce-element .library-item-generic .generic-link-preview {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.ce-element .library-item-generic .generic-link-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ce-element .library-item-generic .generic-link-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px;
  background: linear-gradient(transparent, rgba(0,0,0,0.8));
  color: #fff;
}

.ce-element .library-item-generic .generic-link-overlay h3 {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
}

.ce-element .library-item-generic .generic-link-url {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.6);
  text-decoration: none;
}

.ce-element .library-item-generic .generic-link-url:hover {
  color: #00a8ff;
}

.ce-element .library-item-generic .generic-link-title {
  margin: 0 0 8px;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
}

/* Generic link without image */
.ce-element .library-item-generic .generic-link-preview.generic-link-no-image {
  display: flex;
  align-items: center;
  justify-content: center;
}

.ce-element .library-item-generic .generic-link-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
}

.ce-element .library-item-generic .generic-link-content svg {
  margin-bottom: 16px;
  opacity: 0.4;
}

/* Uploaded media preview (view page + gallery overlay) */
.ce-element .library-item-uploaded-media .uploaded-media-preview,
.gallery-overlay-grid .library-item-uploaded-media .uploaded-media-preview {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.3);
}

.ce-element .library-item-uploaded-media .uploaded-media-preview img,
.gallery-overlay-grid .library-item-uploaded-media .uploaded-media-preview img,
.ce-element .library-item-uploaded-media .uploaded-media-preview video,
.gallery-overlay-grid .library-item-uploaded-media .uploaded-media-preview video {
  width: 100%;
  display: block;
  object-fit: cover;
}

.ce-element .uploaded-media-overlay,
.gallery-overlay-grid .uploaded-media-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 8px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
}

.ce-element .uploaded-media-title,
.gallery-overlay-grid .uploaded-media-title {
  font-size: 12px;
  color: #fff;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ce-element .uploaded-media-play-icon,
.gallery-overlay-grid .uploaded-media-play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -80%);
  opacity: 0.8;
}

/* Loading spinner for embeds */
.ce-element .library-item .loading-spinner {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-top-color: rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  animation: embed-spin 0.8s linear infinite;
}

/* ============================================================
   Pickleball Results Block (View Page)
   ============================================================ */

.ce-pb-results {
  display: flex;
  flex-direction: column;
  background: #0c0c0e;
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  height: 100%;
}

.ce-pb-header {
  padding: 8px 16px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ce-pb-team-row {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  gap: 12px;
}

.ce-pb-team-row + .ce-pb-team-row {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ce-pb-seed {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.3);
  width: 24px;
  flex-shrink: 0;
}

.ce-pb-players {
  flex: 1;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
}

.ce-pb-team-row.winner .ce-pb-players {
  color: #c8d62c;
}

.ce-pb-games-won {
  font-size: 18px;
  font-weight: 700;
  color: #fff;
  width: 24px;
  text-align: right;
  margin-right: 8px;
}

.ce-pb-team-row.winner .ce-pb-games-won {
  color: #c8d62c;
}

.ce-pb-scores {
  display: flex;
  gap: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.4);
}

.ce-pb-results-empty {
  padding: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
}

/* ============================================================
   Season Stats (view)
   ============================================================ */
.ce-season-stats {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.ce-ss-description {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
  padding: 12px 16px 4px;
  line-height: 1.5;
}

.ce-ss-table-wrapper {
  overflow: auto;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ce-ss-table-wrapper::-webkit-scrollbar {
  display: none;
}

.ce-ss-table {
  width: calc(100% - 1.5rem);
  margin: 0 0.75rem 0.75rem;
  border-collapse: separate;
  border-spacing: 0 0.35rem;
  white-space: nowrap;
  font-size: 13px;
}

.ce-ss-th {
  padding: 0.6rem 0.85rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.45);
  text-align: left;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ce-ss-td {
  padding: 0.5rem 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.02);
  border: none;
  transition: background 0.2s ease;
}

.ce-ss-row:hover .ce-ss-td {
  background: rgba(255, 255, 255, 0.06);
}

.ce-ss-row .ce-ss-td:first-child {
  border-radius: 8px 0 0 8px;
}
.ce-ss-row .ce-ss-td:last-child {
  border-radius: 0 8px 8px 0;
}

.ce-ss-td.ce-ss-season-cell {
  font-weight: 600;
}

.ce-ss-empty {
  padding: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
}


/* ============================================================
   Bar Chart (view)
   ============================================================ */
.ce-bar-chart {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.ce-bc-header {
  margin-bottom: 12px;
  flex-shrink: 0;
}

.ce-bc-title {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  line-height: 1.3;
}

.ce-bc-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 2px;
}

.ce-bc-chart-body {
  flex: 1;
  display: flex;
  align-items: stretch;
  min-height: 0;
  gap: 8px;
}

.ce-bc-y-axis-label {
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0 2px;
}

.ce-bc-chart-area {
  flex: 1;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  min-height: 0;
  padding-bottom: 40px;
  overflow: visible;
}

.ce-bc-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
  height: 100%;
  position: relative;
  overflow: visible;
}

.ce-bc-bar-value {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 4px;
  flex-shrink: 0;
}

.ce-bc-bar {
  width: 100%;
  max-width: 48px;
  min-height: 2px;
  border-radius: 4px 4px 0 0;
  transition: height 0.3s ease;
}

.ce-bc-bar-label {
  position: absolute;
  top: calc(100% + 4px);
  right: 50%;
  font-size: 9px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  transform: rotate(-45deg);
  transform-origin: top right;
}

.ce-bc-x-axis-label {
  text-align: center;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.35);
  margin-top: 8px;
  flex-shrink: 0;
}

.ce-bc-empty {
  padding: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}


/* ============================================================
   Line Chart (view)
   ============================================================ */
.ce-line-chart {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.ce-lc-chart-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ce-lc-svg-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.ce-lc-svg {
  flex: 1;
  width: 100%;
  min-height: 0;
}

.ce-lc-labels {
  display: flex;
  justify-content: space-between;
  padding: 4px 10px 0;
  flex-shrink: 0;
  height: 40px;
  overflow: visible;
}

.ce-lc-label {
  font-size: 9px;
  color: rgba(255, 255, 255, 0.5);
  white-space: nowrap;
  flex: 1;
  min-width: 0;
  text-align: right;
  transform: rotate(-45deg);
  transform-origin: top right;
  overflow: visible;
}

/* Line Chart Legend (multi-line) */
.ce-lc-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0 0 8px;
  flex-shrink: 0;
}

.ce-lc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.ce-lc-legend-swatch {
  width: 12px;
  height: 3px;
  border-radius: 2px;
  flex-shrink: 0;
}


/* ============================================================
   Pie Chart (view)
   ============================================================ */
.ce-pie-chart {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.ce-pc-chart-body {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 0;
}

.ce-pc-svg-container {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ce-pc-svg {
  width: 160px;
  height: 160px;
}

.ce-pc-legend {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  overflow-y: auto;
  max-height: 100%;
}

.ce-pc-legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}

.ce-pc-legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.ce-pc-legend-label {
  color: rgba(255, 255, 255, 0.7);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ce-pc-legend-value {
  color: rgba(255, 255, 255, 0.45);
  font-size: 11px;
  flex-shrink: 0;
}


/* ============================================================
   Head-to-Head (view)
   ============================================================ */
.ce-h2h {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ce-h2h-title {
  font-size: 15px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  text-align: center;
  margin-bottom: 14px;
}
.ce-h2h-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-bottom: 16px;
  flex-shrink: 0;
}
.ce-h2h-player {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.ce-h2h-player-img {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  background: rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
}
.ce-h2h-player-placeholder {
  border: 1px dashed rgba(255, 255, 255, 0.15);
}
.ce-h2h-player-name {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
}
.ce-h2h-vs {
  font-size: 12px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 1px;
  flex-shrink: 0;
}
.ce-h2h-rows {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
}
.ce-h2h-stat-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}
.ce-h2h-stat-left,
.ce-h2h-stat-right {
  font-size: 14px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  min-width: 55px;
  text-align: center;
  flex-shrink: 0;
}
.ce-h2h-stat-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 0;
}
.ce-h2h-stat-label {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.ce-h2h-bar-bg {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  display: flex;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.04);
}
.ce-h2h-bar-half-left,
.ce-h2h-bar-half-right {
  width: 50%;
  height: 100%;
  position: relative;
  overflow: hidden;
}
.ce-h2h-bar-fill-left {
  position: absolute;
  right: 0;
  top: 0;
  height: 100%;
  border-radius: 2px 0 0 2px;
}
.ce-h2h-bar-fill-right {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  border-radius: 0 2px 2px 0;
}


/* ============================================================
   Scatter Plot (view)
   ============================================================ */
.ce-scatter-plot {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px 20px 10px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ce-sp-chart-body {
  flex: 1;
  display: flex;
  flex-direction: row;
  min-height: 0;
}
.ce-sp-chart-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.ce-sp-svg {
  flex: 1;
  width: 100%;
  min-height: 0;
}


/* ============================================================
   Heatmap (view)
   ============================================================ */
.ce-heatmap {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px 20px 10px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ce-hm-grid {
  display: grid;
  gap: 2px;
  flex: 1;
  min-height: 0;
  overflow: auto;
  align-content: start;
}
.ce-hm-corner {
  /* empty top-left cell */
}
.ce-hm-header-cell {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  text-align: center;
  padding: 4px 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ce-hm-row-label {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.85);
  padding: 6px 8px;
  display: flex;
  align-items: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ce-hm-cell {
  font-size: 11px;
  color: #fff;
  text-align: center;
  padding: 6px 4px;
  border-radius: 4px;
  min-width: 32px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}


/* ============================================================
   Spider Chart (view)
   ============================================================ */
.ce-spider-chart {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ce-spider-chart-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
.ce-spider-svg {
  width: 100%;
  height: 100%;
  max-width: 300px;
  max-height: 300px;
}

/* ============================================================
   Grid (view)
   ============================================================ */
.ce-grid {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.ce-grid-visual {
  display: grid;
  gap: 6px;
  flex: 1;
  min-height: 0;
}
.ce-grid-cell {
  border-radius: 8px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  background: rgba(255, 255, 255, 0.06);
}
.ce-grid-primary {
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.ce-grid-sub {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}


/* ============================================================
   Roster (view)
   ============================================================ */
.ce-roster {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  overflow: hidden;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.ce-ro-table-wrapper {
  overflow: auto;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.ce-ro-table-wrapper::-webkit-scrollbar {
  display: none;
}

.ce-ro-table {
  width: calc(100% - 1.5rem);
  margin: 0 0.75rem 0.75rem;
  border-collapse: separate;
  border-spacing: 0 0.35rem;
  white-space: nowrap;
  font-size: 13px;
}

.ce-ro-th {
  padding: 0.6rem 0.85rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.45);
  text-align: left;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.ce-ro-photo-th {
  width: 40px;
  padding: 0.6rem 0.4rem;
}

.ce-ro-td {
  padding: 0.5rem 0.85rem;
  color: rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.02);
  border: none;
  transition: background 0.2s ease;
}

.ce-ro-row:hover .ce-ro-td {
  background: rgba(255, 255, 255, 0.06);
}

.ce-ro-row .ce-ro-td:first-child {
  border-radius: 8px 0 0 8px;
}
.ce-ro-row .ce-ro-td:last-child {
  border-radius: 0 8px 8px 0;
}

.ce-ro-photo-cell {
  width: 40px;
  padding: 0.35rem 0.4rem !important;
}

.ce-ro-photo-img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.ce-ro-photo-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.25);
}

.ce-ro-empty {
  padding: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
  font-style: italic;
}

/* ============================================================
   PB Box Score — View
   ============================================================ */

.ce-pb-box-score {
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  overflow: hidden;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.ce-bs-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 2px;
}

.ce-bs-meta {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 12px;
}

.ce-bs-table {
  width: 100%;
  border-collapse: collapse;
}

.ce-bs-table th {
  font-size: 11px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  text-align: center;
}

.ce-bs-name-th {
  text-align: left !important;
}

.ce-bs-table td {
  padding: 8px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.ce-bs-name-td {
  text-align: left;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9);
}

.ce-bs-result-td {
  font-weight: 600;
}

.ce-bs-winner .ce-bs-name-td {
  color: #fff;
}

.ce-bs-winner .ce-bs-result-td {
  color: #4ade80;
  font-weight: 700;
}

.ce-bs-player-row:not(.ce-bs-winner) .ce-bs-result-td {
  color: rgba(255, 255, 255, 0.4);
}

/* ============================================================
   PPA Athlete Header — View
   ============================================================ */

/* Rankings row — used by PPA athlete header */
.ah-rankings {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.ah-ranking-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
}

.ah-ranking-label {
  font-size: 10px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.35);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ah-ranking-rank {
  font-size: 18px;
  font-weight: 700;
}

.ah-ranking-pts {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
}

/* ============================================================
   Mobile Responsive - Element-based collections
   Switch from absolute canvas to stacked flow layout.
   JS sets position:static + width:100% on mobile; these rules
   handle spacing, typography, and overflow.
   ============================================================ */

@media (max-width: 768px) {
  .collection-blocks-container {
    position: static;
    min-height: auto;
    max-width: 100%;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  .ce-element {
    position: static !important;
    width: 100% !important;
    height: auto !important;
    left: auto !important;
    top: auto !important;
  }

  /* Data tables: allow horizontal scroll */
  .ce-season-stats,
  .ce-stats-header,
  .ce-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 480px) {
  .collection-blocks-container {
    padding: 0.75rem 0.5rem;
    gap: 0.75rem;
  }

  .collection-blocks {
    padding: 0.75rem 0.5rem;
  }

  .ce-heading {
    font-size: 1.5rem !important;
  }
}
