/* ═══════════════════════════════════════════════════════════════════
   FEED
   ═══════════════════════════════════════════════════════════════════ */

/* ── Feed View: sticky header, scrollable content ────────────── */

#view-feed {
  display: flex;
  flex-direction: column;
  /* 100vh minus .view top+bottom padding (2rem each) */
  height: calc(100vh - 4rem);
}

#view-feed .view-header {
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 10;
  padding-bottom: 1rem;
  margin-bottom: 0;
}

#feed-content {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-bottom: 2rem;
}

/* Mobile: account for topbar height */
@media (max-width: 768px) {
  #view-feed {
    /* .view padding: 1.25rem * 2, topbar: 64px */
    height: calc(100vh - 64px - 2.5rem);
  }
}

@media (max-width: 600px) {
  #view-feed {
    height: calc(100vh - 60px - 2.5rem);
  }
}

@media (max-width: 420px) {
  #view-feed {
    height: calc(100vh - 56px - 2.5rem);
  }
}

/* ── Unified Feed List ────────────────────────────────────────── */

.feed-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-width: 680px;
  margin: 0 auto;
}

/* ── Post-Composer Modal ──────────────────────────────────────── */

.post-composer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 1rem;
}

.post-composer-modal {
  background: var(--bg-card);
  border: 1px solid var(--border-warm);
  border-radius: var(--radius);
  width: 100%;
  max-width: 520px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.post-composer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.875rem 1.25rem 0;
}

.post-composer-header h3 {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  margin: 0;
}

.post-composer-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0.2rem 0.4rem;
  border-radius: var(--radius-xs);
  transition: color 0.15s;
}
.post-composer-close:hover { color: var(--text); }

.post-composer-modal .feed-composer {
  border: none;
  border-radius: 0;
  margin-bottom: 0;
  padding: 0.75rem 1.25rem 1.25rem;
}

/* ── Upload Progress Bar ─────────────────────────────────────── */

.upload-progress {
  margin: 0.5rem 0 0.25rem;
  background: var(--bg-elevated);
  border-radius: var(--radius-xs);
  overflow: hidden;
  height: 6px;
  position: relative;
}

.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: var(--radius-xs);
  transition: width 0.2s ease;
}

.upload-progress-label {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

/* ── Tasting Card: Layout ──────────────────────────────────────── */

/* Beer meta above image */
.feed-card-beer-meta {
  margin-bottom: 0.6rem;
}
.feed-beer-name-row {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
}
.feed-beer-name-row a {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.feed-beer-name-row a:hover { color: var(--accent); }
.feed-beer-abv {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
  white-space: nowrap;
  flex-shrink: 0;
}
.feed-brewery-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  margin-top: 0.15rem;
  flex-wrap: wrap;
}
.feed-brewery-row a { color: var(--text-muted); }
.feed-brewery-row a:hover { color: var(--accent); }
.feed-country {
  color: var(--text-muted);
  font-size: 0.82rem;
}
.feed-meta-sep {
  color: var(--border-warm);
  font-size: 0.75rem;
}

/* Full-width image */
.feed-card-img-full {
  width: 100%;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-elevated);
  margin-bottom: 0.6rem;
  height: 380px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.feed-card-img-full img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.feed-card-img-full .card-img-placeholder {
  font-size: 3rem;
  padding: 2rem;
  color: var(--text-dim);
}

/* ── Bild-Karussell ───────────────────────────────────────── */

.feed-carousel {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  margin-bottom: 0.6rem;
  height: 380px;
}
.fc-track {
  display: flex;
  height: 100%;
  transition: transform 0.28s ease;
}
.fc-track img {
  width: 100%;
  height: 100%;
  flex-shrink: 0;
  object-fit: contain;
  display: block;
}
.fc-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(0, 0, 0, 0.42);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 36px;
  height: 36px;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
  z-index: 5;
  padding: 0;
  padding-bottom: 2px;
}
.fc-btn:hover { background: rgba(0, 0, 0, 0.68); }
.fc-prev { left: 0.5rem; }
.fc-next { right: 0.5rem; }
.fc-dots {
  position: absolute;
  bottom: 0.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 0.35rem;
  z-index: 5;
}
.fc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  transition: background 0.15s;
}
.fc-dot.active {
  background: #fff;
}

/* Tasting meta below image */
.feed-card-tasting-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 0.25rem;
}

.feed-badges {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  align-items: center;
}

/* Stars in tasting meta */
.feed-card-tasting-meta .star-row {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}
.feed-card-tasting-meta .stars {
  color: var(--accent);
  font-size: 0.95rem;
  letter-spacing: 0.05em;
}
.feed-card-tasting-meta .star-num {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
}
.tasting-ort {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ── Eigene Beiträge hervorheben ──────────────────────────────── */

.feed-card.is-own,
.feed-post-card.is-own {
  border-left: 3px solid var(--accent);
  background: linear-gradient(
    to right,
    rgba(232,145,10,0.04) 0%,
    var(--bg-card) 60%
  );
}

/* ── Avatar + Header ───────────────────────────────────────────── */

.feed-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  border: 2px solid var(--border-warm);
}
.feed-avatar-placeholder {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.95rem;
  flex-shrink: 0;
  border: 2px solid var(--border-warm);
}

.feed-card-header,
.feed-post-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.875rem;
}
.feed-header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.feed-post-meta {
  flex: 1;
  min-width: 0;
}
.feed-post-username {
  display: block;
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 600;
  line-height: 1.3;
}
.feed-post-date {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Tasting-Label im Header */
.feed-type-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.feed-type-label strong {
  color: var(--accent);
  font-weight: 600;
}

/* ── Status Post Card ─────────────────────────────────────────── */

.feed-post-body {
  font-size: 0.96rem;
  color: var(--text);
  line-height: 1.65;
  margin: 0 0 0.875rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.post-inline-link {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.post-link-preview {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-warm);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  color: var(--accent);
  text-decoration: none;
  margin-bottom: 0.875rem;
  max-width: 100%;
  overflow: hidden;
  transition: border-color 0.15s;
}
.post-link-preview:hover { border-color: var(--accent); }
.post-link-url {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-photos {
  display: grid;
  gap: 0.35rem;
  margin-bottom: 0.875rem;
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.post-photos-1 { grid-template-columns: 1fr; }
.post-photos-2 { grid-template-columns: 1fr 1fr; }
.post-photos-3 { grid-template-columns: 1fr 1fr; grid-template-rows: auto auto; }
.post-photos-3 .post-photo-img:first-child { grid-column: 1 / -1; }
.post-photos-4 { grid-template-columns: 1fr 1fr; }

.post-photo-img {
  width: 100%;
  max-height: 320px;
  object-fit: scale-down;
  display: block;
  border-radius: var(--radius-xs);
}

/* ── Tasting Notes ────────────────────────────────────────────── */

.tasting-notes {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0.75rem 0 0;
  padding: 0.55rem 0.875rem;
  border-left: 2px solid var(--border-warm);
  background: var(--bg-elevated);
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  font-style: italic;
}

/* ── Footer Strip ─────────────────────────────────────────────── */

.card-footer-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.875rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.card-footer-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1;
  min-width: 0;
  flex-wrap: wrap;
}

/* Tags in footer */
.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

/* Like-Button im Feed (scoped unter .reaction-wrap um collection.css zu überschreiben) */
.reaction-wrap .card-like-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.1rem;
  width: auto;
  height: auto;
  border-radius: 0;
  background: none !important;
  border: none;
  box-shadow: none !important;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.15s, transform 0.1s;
  white-space: nowrap;
}
.reaction-wrap .card-like-btn:hover {
  color: var(--accent-light);
  transform: scale(1.04);
}
.reaction-wrap .card-like-btn.liked {
  color: var(--accent-light);
}
.reaction-entry {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
}
.reaction-entry-count {
  font-size: 0.78rem;
  font-weight: 600;
  color: inherit;
}

/* ── Reaktions-Picker ─────────────────────────────────────────── */

.reaction-wrap {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
}

/* Bridges the invisible gap between button and picker so hover stays active */
.reaction-wrap::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  height: 10px;
}

.reaction-picker {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border-warm);
  border-radius: 28px;
  padding: 5px 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s, transform 0.15s;
  transform: translateX(-50%) translateY(4px);
  z-index: 200;
  white-space: nowrap;
}

.reaction-wrap:hover .reaction-picker,
.reaction-wrap.picker-open .reaction-picker {
  opacity: 1;
  pointer-events: all;
  transform: translateX(-50%) translateY(0);
}

.reaction-pick-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.35rem;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.12s, background 0.1s;
  padding: 0;
  line-height: 1;
}
.reaction-pick-btn:hover {
  transform: scale(1.35) translateY(-3px);
  background: var(--bg-elevated);
}
.reaction-pick-btn.active {
  background: var(--accent-glow);
  transform: scale(1.15);
}

/* Reaktions-Emojis im Button */
.reaction-top-emojis {
  letter-spacing: -0.05em;
  font-size: 0.95rem;
  line-height: 1;
}

/* Kommentar-Button */
.btn-comments-toggle {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.btn-comments-toggle:hover { color: var(--text); }
.btn-comments-toggle .comment-count {
  font-weight: 600;
  margin-left: 0.15rem;
}

/* ── Feed Composer ────────────────────────────────────────────── */

.feed-composer {
  background: var(--bg-card);
  border: 1px solid var(--border-warm);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1.375rem;
}

.composer-textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-warm);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.65rem 0.875rem;
  font-size: 0.95rem;
  font-family: var(--font);
  resize: vertical;
  min-height: 72px;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
.composer-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow2);
}
.composer-textarea::placeholder { color: var(--text-dim); }

.composer-extras { margin-top: 0.6rem; }

.composer-link-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font);
  margin-bottom: 0.5rem;
  box-sizing: border-box;
  display: none;
}
.composer-link-input:focus {
  outline: none;
  border-color: var(--accent);
}

.composer-photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.4rem;
}
.composer-thumb {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  border: 1px solid var(--border-warm);
}
.composer-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.composer-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(0,0,0,0.65);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.6rem;
  line-height: 18px;
  text-align: center;
  padding: 0;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.65rem;
}
.composer-toolbar-left {
  display: flex;
  gap: 0.4rem;
}
.composer-photo-btn {
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

/* ── Post Inline Edit ────────────────────────────────────────── */

.post-edit-form {
  margin-bottom: 0.875rem;
}

.post-edit-textarea {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 0.5rem;
}

.post-edit-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

.post-edit-error {
  margin-top: 0.35rem;
  font-size: 0.82rem;
}

/* ── Post-Edit: Foto-Manager ────────────────────────────────── */
.post-edit-photo-manager {
  margin-bottom: 0.5rem;
}

.post-edit-photo-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
}

.post-edit-photo-item {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid var(--border, #e0e0e0);
}

.post-edit-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-edit-photo-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  cursor: pointer;
  font-size: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
}

.post-edit-photo-remove:hover {
  background: rgba(200,30,30,0.85);
}

.post-edit-photo-new {
  border-color: var(--accent, #f59e0b);
}

.post-edit-add-photo {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  cursor: pointer;
  font-size: 0.82rem;
}

/* ── Feed: Mobile ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  .composer-toolbar { flex-wrap: wrap; gap: 0.5rem; }
  .feed-card-header,
  .feed-post-header { gap: 0.5rem; }
  .card-footer-strip { flex-wrap: wrap; }
}

/* ── Kommentare ───────────────────────────────────────────────── */

.comments-section {
  margin-top: 0.875rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}

.comment-list { margin-bottom: 0.75rem; }

.comment {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.865rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}
.comment:last-child { border-bottom: none; }
.comment strong { color: var(--accent); font-weight: 600; font-size: 0.825rem; }
.comment-body { flex: 1; color: var(--text-muted); }

.comment-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.comment-input {
  flex: 1;
  background: var(--bg-input);
  border: 1px solid var(--border-warm);
  border-radius: var(--radius-sm);
  color: var(--text);
  padding: 0.45rem 0.75rem;
  font-size: 0.875rem;
  font-family: var(--font);
  transition: border-color 0.2s;
}
.comment-input:focus {
  outline: none;
  border-color: var(--accent);
}
.comment-input::placeholder { color: var(--text-dim); }
