/* =====================================================================
   Posts (Community): Karten, Umfragen, Bild-Raster, Composer, Lightbox,
   Startseiten-Regal. Siehe public/js/posts.js und README "Posts".
   ===================================================================== */

.posts-column, .post-page { max-width: 680px; margin: 0 auto; }
.channel-tabs { margin-top: 8px; }

/* ---- Karte ---- */
.post-card {
  border: 1px solid var(--border-soft); border-radius: var(--radius-m);
  background: var(--bg-1); padding: 16px; margin-bottom: 16px;
}
.post-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.post-head .avatar { width: 40px; height: 40px; }
.post-head-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.post-author { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.post-date { font-size: 12px; color: var(--text-secondary); }
.post-date:hover { text-decoration: underline; }
.post-head-actions { display: flex; gap: 2px; }
.post-body { font-size: 14px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; margin-bottom: 12px; }
.post-body[hidden] { display: none; }

.post-edit-form { margin-bottom: 12px; }
.post-edit-form textarea { width: 100%; resize: vertical; }
.post-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

/* ---- Bilder ---- */
.post-images { display: grid; gap: 4px; margin-bottom: 12px; border-radius: var(--radius-m); overflow: hidden; }
.post-image { padding: 0; background: var(--bg-2); cursor: zoom-in; display: block; overflow: hidden; }
.post-image img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-images.n1 .post-image img { max-height: 520px; object-fit: contain; background: #000; }
.post-images.n2 { grid-template-columns: 1fr 1fr; aspect-ratio: 2 / 1; }
.post-images.n3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 16 / 9; }
.post-images.n3 .post-image:first-child { grid-row: 1 / 3; }
.post-images.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; aspect-ratio: 16 / 9; }
.post-images.n5 { grid-template-columns: repeat(6, 1fr); grid-template-rows: 2fr 1fr; aspect-ratio: 16 / 10; }
.post-images.n5 .post-image:nth-child(1), .post-images.n5 .post-image:nth-child(2) { grid-column: span 3; }
.post-images.n5 .post-image:nth-child(n+3) { grid-column: span 2; }

/* ---- eingebettetes Video ---- */
.post-video { display: flex; gap: 12px; padding: 8px; margin-bottom: 12px; border: 1px solid var(--border-soft); border-radius: var(--radius-m); background: var(--bg-0); color: var(--text-primary); }
.post-video:hover { background: var(--bg-2); }
.post-video-thumb { position: relative; width: 190px; flex-shrink: 0; aspect-ratio: 16 / 9; border-radius: 8px; overflow: hidden; background: var(--bg-2); }
.post-video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-video-meta { min-width: 0; flex: 1; }
.post-video-title { font-size: 14px; font-weight: 500; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.post-video-sub { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
@media (max-width: 520px) { .post-video { flex-direction: column; } .post-video-thumb { width: 100%; } }

/* ---- Umfrage ---- */
.post-poll { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.poll-option {
  text-align: left; padding: 12px 14px; font-size: 14px; border-radius: var(--radius-m);
  border: 1px solid var(--border); background: var(--bg-0); color: var(--text-primary);
}
.poll-option:hover { background: var(--bg-2); border-color: var(--text-secondary); }
.poll-result { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-m); background: var(--bg-0); border: 1px solid var(--border-soft); overflow: hidden; font-size: 14px; }
.poll-result-bar { position: absolute; inset: 0 auto 0 0; background: var(--bg-3); transition: width 0.4s ease; }
.poll-result.top .poll-result-bar { background: rgba(62, 166, 255, 0.28); }
.poll-result-text, .poll-result-pct { position: relative; }
.poll-result-text { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.poll-result.mine .poll-result-text { font-weight: 600; }
.poll-result-pct { font-weight: 600; flex-shrink: 0; }
.poll-foot { font-size: 12px; color: var(--text-secondary); }

/* ---- Aktionen ---- */
.post-actions { display: flex; align-items: center; gap: 4px; }
.post-react-btn, .post-action-link, .post-action-static, .post-share-btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px;
  border-radius: var(--radius-round); font-size: 13px; color: var(--text-primary);
}
.post-react-btn:hover, .post-action-link:hover, .post-share-btn:hover { background: var(--bg-3); }
.post-react-btn.active { color: var(--link); }
.post-react-btn.active .icon { color: var(--link); fill: currentColor; }
.post-share-btn { margin-left: auto; }

/* ---- Composer ---- */
.post-composer { border: 1px solid var(--border-soft); border-radius: var(--radius-m); background: var(--bg-1); padding: 14px 16px; margin-bottom: 20px; }
.post-composer-row { display: flex; gap: 12px; align-items: flex-start; }
.post-composer-row .avatar { width: 40px; height: 40px; flex-shrink: 0; }
.post-composer-input { flex: 1; min-width: 0; background: transparent; border: 0; border-bottom: 1px solid var(--border); color: var(--text-primary); font: inherit; font-size: 14px; padding: 8px 0; resize: none; outline: none; }
.post-composer-input:focus { border-bottom-color: var(--text-primary); }
.post-composer-attachment:not(:empty) { margin-top: 12px; }
.post-composer-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.post-attach-btns { display: flex; gap: 4px; flex-wrap: wrap; }
.post-attach-btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: var(--radius-round); font-size: 13px; color: var(--text-secondary); }
.post-attach-btn:hover:not(:disabled) { background: var(--bg-3); color: var(--text-primary); }
.post-attach-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.post-attach-btn .icon { width: 20px; height: 20px; }
.post-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.composer-images { display: flex; flex-wrap: wrap; gap: 8px; }
.composer-image { position: relative; width: 96px; height: 96px; border-radius: 8px; overflow: hidden; background: var(--bg-2); }
.composer-image img { width: 100%; height: 100%; object-fit: cover; }
.composer-remove { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; background: rgba(0, 0, 0, 0.75); }
.composer-remove .icon { width: 14px; height: 14px; color: #fff; }
.composer-video { position: relative; display: flex; gap: 12px; align-items: center; padding: 8px 40px 8px 8px; border: 1px solid var(--border-soft); border-radius: var(--radius-m); background: var(--bg-0); }
.composer-video img { width: 120px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; }
.composer-video-title { font-size: 14px; font-weight: 500; }
.composer-video .composer-remove { top: 8px; right: 8px; }
.composer-poll { display: flex; flex-direction: column; gap: 8px; }
.composer-poll-row { display: flex; gap: 8px; align-items: center; }
.composer-poll-row .input { flex: 1; }
.composer-remove-opt { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; flex-shrink: 0; }
.composer-remove-opt:hover { background: var(--bg-3); }
.composer-poll-foot { display: flex; justify-content: space-between; align-items: center; }

/* ---- Video-Auswahl-Dialog ---- */
.vidpick-list { display: flex; flex-direction: column; gap: 6px; max-height: 60vh; overflow-y: auto; }
.vidpick-item { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--radius-m); text-align: left; color: var(--text-primary); }
.vidpick-item:hover { background: var(--bg-3); }
.vidpick-item img { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.vidpick-title { flex: 1; font-size: 14px; font-weight: 500; }
.vidpick-dur { font-size: 12px; color: var(--text-secondary); }

/* ---- Lightbox ---- */
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(0, 0, 0, 0.92); display: grid; place-items: center; }
.lightbox img { max-width: 94vw; max-height: 90vh; object-fit: contain; }
.lightbox-close { position: absolute; top: 14px; right: 14px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.1); }
.lightbox-close .icon { color: #fff; }
.lightbox-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: rgba(255, 255, 255, 0.1); }
.lightbox-nav .icon { color: #fff; width: 24px; height: 24px; }
.lightbox-nav.prev { left: 14px; transform: translateY(-50%) scaleX(-1); }
.lightbox-nav.next { right: 14px; }
.lightbox-count { position: absolute; bottom: 16px; left: 0; right: 0; text-align: center; font-size: 13px; color: rgba(255, 255, 255, 0.8); }

/* ---- Startseite: Posts-Regal ---- */
.posts-shelf { grid-column: 1 / -1; padding: 12px 0 8px; border-top: 1px solid var(--border-soft); border-bottom: 1px solid var(--border-soft); margin: 8px 0; }
.posts-shelf-title { display: flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 600; margin: 0 0 12px; }
.posts-shelf-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.post-mini { flex: 0 0 280px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 10px; padding: 14px; border: 1px solid var(--border-soft); border-radius: var(--radius-m); background: var(--bg-1); color: var(--text-primary); }
.post-mini:hover { background: var(--bg-2); }
.post-mini-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.post-mini-head .avatar { width: 28px; height: 28px; }
.post-mini-author { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-mini-date { font-size: 12px; color: var(--text-secondary); white-space: nowrap; }
.post-mini-body { font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.post-mini-media { position: relative; border-radius: 8px; overflow: hidden; aspect-ratio: 16 / 9; background: var(--bg-2); }
.post-mini-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-mini-badge { position: absolute; bottom: 6px; right: 6px; display: inline-flex; align-items: center; gap: 4px; padding: 2px 6px; border-radius: 4px; background: rgba(0, 0, 0, 0.8); font-size: 12px; color: #fff; }
.post-mini-badge .icon { width: 14px; height: 14px; color: #fff; }
.post-mini-poll { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 8px; background: var(--bg-0); font-size: 13px; color: var(--text-secondary); }
.post-mini-foot { display: flex; gap: 16px; margin-top: auto; font-size: 12px; color: var(--text-secondary); }
.post-mini-foot span { display: inline-flex; align-items: center; gap: 4px; }
