.plyr {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 60vh; /* Prevents portrait videos from taking up the whole screen */
  background: #000;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  margin-top: 10px;
  cursor: pointer;
}

.plyr__video-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.plyr video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.plyr__sr-only {
  display: none !important;
}

/* Hide the clunky bottom bar completely */
.plyr__controls {
  display: none !important;
}

/* The Center Play Button */
.plyr__control--overlaid {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 15%;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  border: 2px solid rgba(255, 255, 255, 0.8);
  pointer-events: auto; /* THIS MAKES IT CLICKABLE */
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.plyr__control--overlaid:hover {
  transform: translate(-50%, -50%) scale(1.05);
}
.plyr__control--overlaid svg {
  width: 28px;
  height: 28px;
  fill: #fff;
  margin-left: 4px;
}
.plyr__control--overlaid span {
  display: none !important;
}

/* Hide the button when playing, show when paused */
.plyr.playing .plyr__control--overlaid {
  opacity: 0;
  pointer-events: none;
}
.plyr:not(.playing) .plyr__control--overlaid {
  opacity: 1;
}

/* --- Audio Player Specific Styling --- */
.plyr--audio {
  aspect-ratio: auto !important;
  max-height: none !important;
  height: 56px !important;
  border-radius: 12px;
  background: var(--bg-3);
  border: 1px solid var(--border);
  margin-top: 10px;
  cursor: default;
  overflow: hidden;
}

.plyr--audio .plyr__control--overlaid {
  display: none !important;
}

.plyr--audio .plyr__controls {
  display: flex !important;
  position: relative !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  align-items: center !important;
  justify-content: flex-start !important;
  height: 100% !important;
  width: 100% !important;
  padding: 0 16px !important;
  background: transparent !important;
  gap: 12px !important;
  z-index: 10;
}

/* --- The Play/Pause Button --- */
.plyr--audio .plyr__control {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 36px !important;
  height: 36px !important;
  background: var(--accent) !important;
  border-radius: 50% !important;
  color: #fff !important;
  flex-shrink: 0;
  margin: 0 !important;
  padding: 0 !important;
}

.plyr--audio .plyr__control:hover {
  background: var(--accent-hover) !important;
}

/* Force the icon to show up properly */
.plyr--audio .plyr__control svg {
  width: 16px !important;
  height: 16px !important;
  fill: #fff !important;
  display: block !important;
  margin: 0 !important;
}

/* --- Progress Bar --- */
.plyr--audio .plyr__progress {
  flex: 1 !important;
  display: flex !important;
  align-items: center !important;
  margin: 0 !important;
  min-width: 0;
  position: relative;
  height: 20px;
}

.plyr--audio .plyr__progress__buffer,
.plyr--audio .plyr__progress__value {
  display: none !important;
}

.plyr--audio .plyr__progress input[type="range"] {
  -webkit-appearance: none !important;
  width: 100% !important;
  height: 4px !important;
  background: rgba(255, 255, 255, 0.2) !important;
  border-radius: 2px !important;
  outline: none !important;
  margin: 0 !important;
  cursor: pointer;
}

.plyr--audio .plyr__progress input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none !important;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent) !important;
  cursor: pointer;
}

/* --- Timecodes --- */
.plyr--audio .plyr__time {
  display: inline-flex !important;
  align-items: center !important;
  font-size: 12px !important;
  color: var(--text-2) !important;
  white-space: nowrap !important;
  margin: 0 !important;
  padding: 0 !important;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

/* Hide the second timecode (00:00) to prevent it from wrapping */
.plyr--audio .plyr__time:last-of-type {
  display: none !important;
}

/* Hide volume, settings, etc. */
.plyr--audio .plyr__volume,
.plyr--audio .plyr__menu,
.plyr--audio .plyr__control[data-plyr="restart"],
.plyr--audio .plyr__control[data-plyr="rewind"],
.plyr--audio .plyr__control[data-plyr="fast-forward"] {
  display: none !important;
}
/* --- Media Containers --- */
.publication-video {
  margin-top: 10px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #000;
}
.publication-image {
  margin-top: 10px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-2);
  width: 100%;
  aspect-ratio: 16 / 9; /* Forces a fixed rectangle size */
  position: relative;
}

.publication-image img {
  width: 100%;
  height: 100%;
  object-fit: cover; /* Crops the image to fill the box without stretching */
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

/* Ensure the wrapper doesn't break the fixed size */
.lozad-media:not.collage-grid .lozad-media{
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
}

.publication-audio {
  margin-top: 10px;
}


.collage-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.collage-grid.mb-2 { margin-bottom: 2px; }
.collage-grid.mt-2 { margin-top: 2px; }
.collage-grid__item {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-2);
}
.collage-grid__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  aspect-ratio: 1 / 1;
}
.collage-grid__item:only-child {
  grid-column: span 2;
}
.collage-grid__item:only-child img {
  aspect-ratio: 16 / 9;
}
.collage-grid:has(> :nth-child(3)) > :first-child {
  grid-column: span 2;
  aspect-ratio: 2 / 1;
}

.publication-poll {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-2);
}
.publication-poll__inner {
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 8px;
}
.publication-poll__option {
  position: relative;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg-3);
  cursor: pointer;
  overflow: hidden;
  border: 1px solid transparent;
  transition: background 0.2s ease;
}
.publication-poll__option:hover { background: var(--bg-4); }
.publication-poll__option.active { border-color: var(--accent); }
.bar-slider {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--accent-soft);
  z-index: 0;
  transition: width 0.4s ease;
}
.bar-icon, .bar-text, .bar-num {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
}
.bar-icon { width: 20px; margin-right: 8px; color: var(--accent); }
.publication-poll__option:not(.active) .bar-icon { opacity: 0.5; }
.bar-text { flex: 1; font-size: 14px; color: var(--text); }
.bar-num { font-weight: 700; font-size: 13px; color: var(--accent); }
.publication-poll__total-votes {
  text-align: center;
  font-size: 12px;
  color: var(--text-2);
  margin-top: 4px;
}

.publication-document { margin-top: 10px; }
.document-file {
  display: flex;
  align-items: center;
  padding: 12px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text);
  gap: 12px;
}
.document-file__icon { color: var(--accent); display: flex; align-items: center; justify-content: center; }
.document-file__icon svg { width: 24px; height: 24px; }
.document-file__body { flex: 1; font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.document-file__type { font-size: 11px; color: var(--text-2); font-weight: 600; }

.publication-og { margin-top: 10px; }
.publication-og__inner {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-2);
}
.publication-og__image img { width: 100%; height: auto; max-height: 300px; object-fit: cover; }
.publication-og__description { padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.publication-og__description h5 { margin: 0; font-size: 14px; font-weight: 700; }
.publication-og__description p { margin: 0; font-size: 13px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.publication-og__description a { font-size: 12px; color: var(--accent); text-decoration: none; }

.publication-paid {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--bg-2);
  padding: 24px;
  text-align: center;
}
.publication-paid__header { display: flex; justify-content: center; margin-bottom: 12px; }
.pubowner-avatar { width: 48px; height: 48px; border-radius: 50%; border: 3px solid var(--bg-2); overflow: hidden; background: var(--bg-3); }
.pubowner-avatar:nth-child(2) { margin-left: -16px; }
.pubowner-avatar img { width: 100%; height: 100%; object-fit: cover; }
.publication-paid__body h5 { margin: 0 0 4px; font-size: 16px; }
.publication-paid__body p { margin: 0 0 16px; font-size: 13px; color: var(--text-2); }

.publication-funding {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  background: var(--bg-2);
}
.publication-funding__header { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.funding-progress { height: 8px; background: var(--bg-4); border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.funding-progress__bar { height: 100%; background: var(--success); border-radius: 4px; }
.funding-total { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-2); margin-bottom: 16px; }

.pubbox-images__list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.pubbox-images__list-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.pubbox-images__list-item img { width: 100%; height: 100%; object-fit: cover; }
.pubbox-open-graph__data {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  margin-top: 12px;
  background: var(--bg-2);
}
.pubbox-open-graph__image img { width: 100%; max-height: 200px; object-fit: cover; }
.pubbox-open-graph__description { padding: 12px; }
.pubbox-open-graph__description h5 { margin: 0 0 4px; font-size: 14px; }
.pubbox-open-graph__description p { margin: 0 0 4px; font-size: 12px; color: var(--text-2); }
.pubbox-open-graph__description a { font-size: 12px; color: var(--accent); }
.pubbox-poll {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 12px;
  background: var(--bg-2);
}
.pubbox-poll__header h4 { margin: 0 0 12px; font-size: 15px; }
.pubbox-poll__input-item { position: relative; margin-bottom: 8px; }
.pubbox-poll__input-item input {
  width: 100%;
  padding: 10px 40px 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-3);
  color: var(--text);
  font-size: 14px;
}
.pubbox-poll__input-item small { position: absolute; right: 40px; top: 50%; transform: translateY(-50%); font-size: 11px; color: var(--text-2); }
.delete-poll-option { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: transparent; border: none; color: var(--danger); cursor: pointer; display: flex; align-items: center; padding: 4px; }
.pubbox-poll__footer { display: flex; justify-content: space-between; margin-top: 12px; }
.pubbox-donate { background: var(--bg-3); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.pubbox-donate input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-2); color: var(--text); }

/* --- Share Post Modal Fix --- */
.share-post-modal .modal-body {
  padding: 20px 16px !important;
}

.social-media-links .row {
  display: flex !important;
  flex-wrap: wrap !important;
  margin: 0 -6px !important;
}

.social-media-links .col-3 {
  flex: 0 0 25% !important;
  max-width: 25% !important;
  padding: 6px !important;
  display: flex;
  justify-content: center;
}

.social-media-links .link-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 4px;
  background: var(--bg-3);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  transition: background var(--ease), transform var(--ease);
}

.social-media-links .link-item:hover {
  background: var(--bg-4);
  transform: translateY(-2px);
}

.social-media-links .link-item svg {
  width: 24px !important;
  height: 24px !important;
  max-width: 24px !important;
  max-height: 24px !important;
  fill: currentColor;
}

/* Specific brand colors for the icons */
.social-media-links .link-item.twitter    { color: #1DA1F2; }
.social-media-links .link-item.facebook   { color: #1877F2; }
.social-media-links .link-item.linkedin   { color: #0A66C2; }
.social-media-links .link-item.pinterest  { color: #E60023; }
.social-media-links .link-item.reddit     { color: #FF4500; }
.social-media-links .link-item.whatsapp   { color: #25D366; }
.social-media-links .link-item.telegram   { color: #0088cc; }
.social-media-links .link-item.vkontakte  { color: #4C75A3; }

/* Copy Link Section */
.share-post-modal .raw-link {
  margin-top: 24px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.share-post-modal .raw-link p {
  font-size: 14px;
  color: var(--text-2);
  margin-bottom: 10px;
  font-weight: 500;
}

.share-post-modal .link-input {
  display: flex;
  align-items: center;
  background: var(--bg-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 6px 4px 14px;
  overflow: hidden;
}

.share-post-modal .link-input input {
  flex: 1;
  background: transparent !important;
  border: none;
  color: var(--text) !important;
  font-size: 14px;
  outline: none;
  padding: 8px 0;
  min-width: 0;
}

.share-post-modal .clip-board-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  cursor: pointer;
  transition: background var(--ease);
}

.share-post-modal .clip-board-copy:hover {
  background: var(--accent-hover);
}

.share-post-modal .clip-board-copy svg {
  width: 18px !important;
  height: 18px !important;
  fill: #fff;
}

/* Dismiss (X) Icon Fix */
.share-post-modal .dismiss-modal svg {
  width: 20px !important;
  height: 20px !important;
}