
/**************************
    POST WIDGET (GLASSMORPHISM, UNIVERSAL)
**************************/
.post-widget {
  /*background: var(--glass-bg);*/
  background: var(--glass-bg-light);
  border-radius: 2em;
  box-shadow: var(--glass-shadow);
  margin: 0;
  padding: 0;
  overflow: hidden;
  transition: box-shadow 0.16s, background 0.18s;
  position: relative;
}
.post-widget:hover {
  box-shadow: 0 8px 32px 0 var(--glass-border);
}

/* --- ХЕДЕР ПОСТА: КОМПАКТНИЙ GLASS --- */
.post-header {
  display: flex;
  align-items: center;
  padding: 0.5em;
  gap: 0.55em;
  background: transparent;
  min-height: 38px;
}
.post-avatar, .user-avatar-mini {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #fff;
  box-shadow: 0 2px 9px 0 var(--glass-border);
  background: #f6f6f6;
  margin: 0;
  transition: box-shadow 0.17s, border-color 0.14s;
}
.post-user-meta {
  flex: 1 1 30px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.post-author {
  font-weight: 600;
  color: var(--color-main);
  font-size: 1em;
  letter-spacing: 0.01em;
  margin-bottom: 0.04em;
}
.post-date {
  font-size: 0.92em;
  color: var(--text-faint);
  margin-left: 0.2em;
  margin-top: 0;
}

/* --- DROPDOWN MENU (GLASS) --- */
.post-actions-dropdown-wrapper {
  position: relative;
  margin-left: auto;
  display: inline-block;
  z-index: 11;
}
.btn-post-menu {
  font-size: 1.12em;
  background: var(--glass-bg-light);
  border: none;
  border-radius: 50%;
  width: 2em;
  height: 2em;
  cursor: pointer;
  transition: background 0.13s, color 0.12s;
  color: var(--color-main);
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-post-menu:hover,
.btn-post-menu:focus {
  background: var(--color-main);
  color: var(--text-contrast);
}
.post-actions-dropdown {
  display: none;
  position: absolute;
  top: 2em;
  right: 0;
  min-width: 155px;
  background: var(--glass-bg-light);
  border: 1.2px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: 0 6px 22px 0 var(--glass-shadow);
  z-index: 1111;
  padding: 0.25em 0;
  font-size: 0.97em;
  backdrop-filter: blur(12px) saturate(120%);
  flex-direction: column;
  list-style: none;
  animation: fade-in-glass 0.18s;
}
@keyframes fade-in-glass {
  0% {
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.post-actions-dropdown.open {
  display: block;
}
.post-actions-dropdown li {
  list-style: none;
  margin: 0;
}
.post-actions-dropdown .dropdown-action {
  background: none;
  border: none;
  width: 100%;
  text-align: left;
  padding: 0.75em 1em;
  font-size: 1em;
  color: var(--color-dark);
  cursor: pointer;
  transition: background 0.11s, color 0.13s;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 0.5em;
}
.post-actions-dropdown .dropdown-action:hover,
.post-actions-dropdown .dropdown-action:focus {
  background: var(--glass-bg);
  color: var(--color-main);
  outline: none;
}

/* --- ГАЛЕРЕЯ ЗОБРАЖЕНЬ --- */
.post-images-grid {
  display: grid;
  gap: 0.5em;
  margin-bottom: 0.7em;
  margin-top: 0.5em;
  grid-template-columns: repeat(3, 1fr);
}
.post-images-grid.one-image {
  display: flex;
  justify-content: center;
}
.post-images-grid.one-image .img-gallery {
  width: 100%;
  max-width: 600px;
}
.post-images-grid.one-image .img-gallery img {
  aspect-ratio: unset;
  max-width: 100%;
  max-height: 440px;
  object-fit: contain;
}
.post-images-grid.two-images {
  grid-template-columns: 1fr 1fr;
}
.post-images-grid.three-images {
  grid-template-areas:
    "a b"
    "c c";
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
}
.post-images-grid.three-images .img-gallery:nth-child(1) {
  grid-area: a;
}
.post-images-grid.three-images .img-gallery:nth-child(2) {
  grid-area: b;
}
.post-images-grid.three-images .img-gallery:nth-child(3) {
  grid-area: c;
}
.post-images-grid.four-images {
  grid-template-columns: 1fr 1fr;
}
.post-images-grid.many-images {
  grid-template-columns: repeat(3, 1fr);
}
.img-gallery {
  background: transparent;
  border-radius: 0.18em;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 74px;
  min-width: 0;
  padding: 0;
}
.img-gallery img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4/3;
  object-fit: contain;
  background: transparent;
  display: block;
  max-height: 290px;
  max-width: 100%;
  margin: 0;
}
@media (max-width: 800px) {
  .img-gallery img {
    max-height: 180px;
    aspect-ratio: 16/11;
  }
}
@media (max-width: 540px) {
  .post-images-grid {
    gap: 0.3em;
  }
  .img-gallery img {
    max-height: 110px;
    border-radius: 0.8em;
  }
}

/* --- ВІДЕО-БЛОК + ПАГІНАЦІЯ --- */
.post-video-block {
  width: 100%;
  margin: 1em 0 0.8em 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  border-radius: 0 !important;
}
.video-embed-noborder {
  width: 100%;
  max-width: 540px;
  aspect-ratio: 16/9;
  min-height: 180px;
  border: none;
  background: #000;
  border-radius: 1em;
  box-shadow: 0 2px 12px 0 var(--glass-shadow);
  margin-bottom: 0.45em;
}
.video-playlist-player {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-playlist-pagination {
  display: flex;
  gap: 0.42em;
  justify-content: center;
  margin-top: 0.1em;
  margin-bottom: 0.3em;
}
.video-pagination-btn {
  width: 2em;
  height: 2em;
  border-radius: 50%;
  border: 1.5px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.88);
  color: var(--color-main);
  font-size: 1.1em;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 1px 4px 0 var(--glass-shadow);
  transition: background 0.14s, color 0.13s, border-color 0.12s;
  outline: none;
  position: relative;
  padding: 0;
}
.video-pagination-btn.active,
.video-pagination-btn:focus {
  background: var(--color-main);
  color: var(--text-contrast);
  border-color: var(--color-main);
  z-index: 1;
}
.video-pagination-btn:hover {
  background: var(--color-light);
  color: var(--color-dark);
  border-color: var(--color-main);
}
@media (max-width: 600px) {
  .video-embed-noborder {
    max-width: 99vw;
    min-height: 130px;
  }
  .video-pagination-btn {
    width: 1.6em;
    height: 1.6em;
    font-size: 1em;
  }
}

/* --- АУДІО СПИСОК (GLASS) --- */
.audio-list-title {
  font-weight: 600;
  font-size: 1.03em;
  color: var(--color-main);
  display: flex;
  align-items: center;
  gap: 0.42em;
  margin-bottom: 0.5em;
  margin-top: 0.3em;
  letter-spacing: 0.02em;
}
.audio-list {
  display: flex;
  flex-direction: column;
  gap: 0.28em;
  margin: 0.3em 0 0.5em 0;
  padding: 0;
  list-style: none;
}
.audio-list-item {
  display: flex;
  align-items: center;
  gap: 0.95em;
  background: var(--glass-bg-light);
  color: var(--color-dark);
  font-size: 1.09em;
  border-radius: 1.1em;
  padding: 0.42em 1.3em 0.42em 1em;
  cursor: pointer;
  transition: background 0.16s, color 0.14s;
  position: relative;
  box-shadow: 0 2px 7px 0 var(--glass-shadow);
}
.audio-list-item:hover,
.audio-list-item.active {
  background: var(--color-main);
  color: var(--text-contrast);
}
.audio-list-item i.fa-music {
  color: #23bfae;
  font-size: 1.16em;
  margin-right: 0.18em;
}
.audio-list-item .btn-listen-audio {
  border: none;
  background: none;
  color: var(--color-main);
  font-size: 1.09em;
  margin-left: 0.38em;
  padding: 0.13em 0.85em;
  border-radius: 2em;
  cursor: pointer;
  transition: background 0.12s, color 0.13s;
  display: flex;
  align-items: center;
  gap: 0.32em;
}
.audio-list-item .btn-listen-audio:hover,
.audio-list-item .btn-listen-audio:focus {
  background: var(--glass-bg);
  color: var(--color-dark);
}
.audio-list-item .btn[disabled], .audio-list-item .btn-listen-audio:disabled {
  opacity: 0.5;
  color: #bbb;
  cursor: not-allowed;
}

/* --- ДОКУМЕНТИ --- */
.post-docs {
  margin: 0.6em 0 0.7em 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75em;
}
.doc-link {
  background: #f7fafb;
  color: var(--color-main);
  border-radius: 1em;
  padding: 0.39em 1.2em 0.39em 0.9em;
  text-decoration: none;
  display: flex;
  align-items: center;
  font-size: 1.05em;
  box-shadow: 0 1px 7px 0 var(--glass-shadow);
  transition: background 0.15s, color 0.13s;
}
.doc-link i {
  margin-right: 0.53em;
  font-size: 1.18em;
}
.doc-link:hover {
  background: var(--color-main);
  color: var(--text-contrast);
}

/* --- КОНТЕНТ ПОСТА (GLASS) --- */
.post-content.glass-white {
  background: rgba(255, 255, 255, 0.93);
  border-radius: 1.35em;
  padding: 1.08em 1.7em 1em 1.7em;
  font-size: 1.13em;
  margin: 0.7em 0.8em 0.6em 0.8em;
  box-shadow: 0 2px 10px 0 var(--glass-shadow);
  color: var(--color-dark);
  min-height: 32px;
  word-break: break-word;
}

/* --- LINK PREVIEWS (GLASS) --- */
.post-link-previews {
  margin-top: 1.05em;
  display: flex;
  flex-direction: column;
  gap: 0.6em;
}
.link-preview-card {
  display: flex;
  align-items: flex-start;
  gap: 1em;
  border-radius: 1.2em;
  background: var(--glass-bg-light);
  border: 1.2px solid var(--glass-border);
  box-shadow: 0 1px 7px 0 var(--glass-shadow);
  padding: 0.75em 1.2em 0.75em 0.65em;
  min-height: 54px;
  text-decoration: none;
  transition: box-shadow 0.13s, border-color 0.11s, background 0.13s;
}
.link-preview-card:hover,
.link-preview-card:focus {
  box-shadow: 0 4px 16px 0 var(--glass-shadow);
  background: var(--glass-bg);
  border-color: var(--color-main);
}
.link-preview-favicon {
  flex: 0 0 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  margin-top: 3px;
}
.link-preview-favicon img {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 1px 3px 0 var(--glass-shadow);
}
.link-preview-content {
  flex: 1 1 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  gap: 0.14em;
}
.link-preview-image {
  margin-bottom: 0.19em;
}
.link-preview-image img {
  max-width: 76px;
  max-height: 54px;
  border-radius: 0.5em;
  object-fit: cover;
  background: #f7fafc;
  box-shadow: 0 1px 3px 0 var(--glass-shadow);
}
.link-preview-title {
  font-size: 1.04em;
  font-weight: 600;
  color: var(--color-dark);
  line-height: 1.2;
  word-break: break-word;
  margin-bottom: 0.04em;
}
.link-preview-desc {
  font-size: 0.98em;
  color: var(--color-main);
  opacity: 0.87;
  margin-bottom: 0.09em;
  line-height: 1.32;
}
.link-preview-url {
  font-size: 0.93em;
  color: var(--color-main);
  opacity: 0.74;
  word-break: break-all;
  margin-top: 0.03em;
}

/* --- ДІЇ З ПОСТОМ --- */
.post-actions {
  display: flex;
  align-items: center;
  gap: 0.7em;
  padding: 0.25em 1.5em 0.5em 1.5em;
  margin-top: 0.3em;
}
.btn-post-action {
  border: none;
  background: none;
  color: var(--color-main);
  font-size: 1.16em;
  border-radius: 2em;
  cursor: pointer;
  padding: 0.33em 0.9em 0.33em 0.9em;
  margin-right: 0.2em;
  transition: background 0.14s, color 0.13s;
  position: relative;
}
.btn-post-action span {
  margin-left: 0.37em;
  font-size: 1em;
}
.btn-post-action:hover {
  background: var(--glass-bg-light);
  color: var(--color-dark);
}

/**************************
    АДАПТИВ ДЛЯ ПОСТА
**************************/
@media (max-width: 680px) {
  .post-header,
  .post-actions,
  .post-comments-widget {
    padding-left: 0.7em;
    padding-right: 0.7em;
  }
  .post-content.glass-white {
    padding-left: 0.7em;
    padding-right: 0.7em;
  }
  .post-media {
    margin-left: 0.3em;
    margin-right: 0.3em;
  }
}
@media (max-width: 600px) {
  .post-widget {
    padding: 0 0 0.2em 0;
    border-radius: 1.1em;
  }
  .post-header {
    padding-left: 0.5em;
    padding-right: 0.5em;
    gap: 0.45em;
    min-height: 30px;
  }
  .post-avatar,
  .user-avatar-mini {
    width: 30px;
    height: 30px;
    margin-right: 0.35em;
  }
  .post-user-meta .post-author {
    font-size: 0.98em;
  }
  .post-date {
    font-size: 0.89em;
  }
  .audio-list-item {
    padding: 0.27em 0.75em 0.27em 0.6em;
    font-size: 0.98em;
  }
  .link-preview-card {
    padding: 0.47em 0.67em;
    gap: 0.55em;
  }
  .link-preview-title {
    font-size: 0.97em;
  }
  .link-preview-favicon img {
    width: 19px;
    height: 19px;
  }
  .link-preview-image img {
    max-width: 55px;
    max-height: 37px;
  }
}

/**************************
    "ЧИТАТИ ДАЛІ" — GLASSMORPHISM POST TEXT LIMIT
**************************/
.post-text {
  position: relative;
  font-size: 0.92em;
  line-height: 1;
  word-break: break-word;
  white-space: pre-line;
  padding-bottom: 1em;
}
.post-text-collapsed {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-height: 24.6em; /* приблизно 6 рядків */
  position: relative;
}
.read-more-fade {
  content: "";
  display: block;
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1.4em;
  pointer-events: none;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}
.btn-read-more {
  margin: 0.33em 0 0.4em 0;
  font-size: 1em;
  padding: 0.32em 1.1em;
  color: var(--ocean-main, #1891c3);
  background: var(--glass-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--glass-border);
  box-shadow: 0 2px 12px 0 rgba(24, 145, 195, 0.10);
  cursor: pointer;
  transition: background 0.13s, color 0.13s;
  display: inline-block;
}
.btn-read-more:hover {
  background: var(--ocean-main);
  color: #fff;
}

@media (max-width: 600px) {
  .post-text {
    font-size: 1em;
    padding-bottom: 1em;
  }
  .post-text-collapsed {
    max-height: 7.2em; /* ~6 рядків на mobile */
  }
  .read-more-fade {
    height: 2.1em;
  }
}
.post-views {
  display: inline-flex;
  align-items: center;
  gap: 0.3em;
  color: var(--ocean-dark, #085177);
  font-size: 1em;
  background: var(--glass-bg-light, rgba(182,239,255,0.13));
  border-radius: var(--radius-sm, 0.45em);
  padding: 0.12em 0.6em 0.12em 0.5em;
  margin-left: 0.7em;
}
.post-views i {
  font-size: 1.1em;
  margin-right: 0.25em;
}
/* === POST WIDGET (GLASS CARD) === */
.post-widget {
  border-radius: 2em !important;
  box-shadow: 0 7px 36px 0 rgba(24,145,195,0.13), var(--glass-shadow);
  margin-bottom: 2.2em;
  padding: 0;
  overflow: hidden;
  transition: box-shadow 0.16s, background 0.18s;
  position: relative;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: var(--border);
}

/* -- Glass Header (compact) -- */
.post-header {
  display: flex;
  align-items: center;
  gap: 1.2em;
  padding: 1.15em 2em 0.7em 2em;
  background: transparent;
  min-height: 38px;
}
@media (max-width: 600px) {
  .post-header {
    padding: 0.85em 0.7em 0.5em 0.7em;
    gap: 0.7em;
  }
}

/* -- Post Content -- */
.post-content {
  background: rgba(255,255,255,0.90);
  border-radius: 1.3em;
  padding: 1.1em 2em;
  margin: 0 1.4em 1em 1.4em;
  box-shadow: 0 2px 12px 0 var(--glass-shadow);
  color: var(--color-dark);
  font-size: 1.13em;
  min-height: 32px;
  word-break: break-word;
}
@media (max-width: 700px) {
  .post-content {
    padding: 0.9em 0.7em;
    margin: 0 0.5em 1em 0.5em;
    font-size: 1em;
  }
}

/* -- Glass DropDown -- */
.post-actions-dropdown {
  border-radius: 1.2em !important;
  box-shadow: 0 7px 32px 0 rgba(24,145,195,0.13), var(--glass-shadow) !important;
}

/* -- Modern shadow, radius -- */
.rounded-2xl { border-radius: 2em !important; }
.shadow { box-shadow: 0 7px 36px 0 rgba(24,145,195,0.13), var(--glass-shadow) !important; }

/* -- Post actions -- */
.post-actions {
  display: flex;
  align-items: center;
  gap: 1.2em;
  padding: 0.8em 2em 1.2em 2em;
  background: none;
  border-bottom-left-radius: 2em;
  border-bottom-right-radius: 2em;
}
@media (max-width: 600px) {
  .post-actions { padding: 0.5em 0.7em 1em 0.7em; gap: 0.5em;}
}

/* -- Like/Views -- */
.post-views {
  display: inline-flex;
  align-items: center;
  gap: 0.33em;
  color: var(--color-main);
  font-size: 1em;
  background: var(--glass-bg-light, rgba(182,239,255,0.16));
  border-radius: var(--radius-sm, 0.7em);
  padding: 0.13em 0.7em 0.13em 0.6em;
  margin-left: 0.7em;
}
.post-views i { font-size: 1.1em; margin-right: 0.25em; }

/* -- Read More -- */
.btn-read-more {
  margin: 0.7em 0 0.6em 0;
  font-size: 1em;
  padding: 0.38em 1.2em;
  color: var(--color-main);
  background: var(--glass-bg);
  border-radius: 1em;
  border: 1px solid var(--glass-border);
  box-shadow: 0 2px 10px 0 rgba(24,145,195,0.10);
  cursor: pointer;
  transition: background 0.13s, color 0.13s;
  display: inline-block;
}
.btn-read-more:hover {
  background: var(--color-main);
  color: #fff;
}

@media (max-width: 600px) {
  .btn-read-more { font-size: 0.93em; padding: 0.3em 0.8em;}
}

.post-media { margin: 0.7em 0 1.1em 0; }
.post-images-grid, .audio-list, .post-docs, .post-link-previews { gap: 0.8em; }

/* --- FIX: не обрізати випадайку всередині картки поста --- */
.post-widget {
  overflow: visible !important; /* було hidden */
}

/* Додатково гарантуємо поверх інших шарів */
.post-actions-dropdown-wrapper { z-index: 2000; }
.post-actions-dropdown        { z-index: 3000; }
