/* ─── Community Feed Layout ─── */
.community-header {
  padding: 1rem 1rem 0;
}

.feed-container {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}
#community-feed {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ─── Filter / Sort Bar ─── */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.filter-group, .sort-group {
  display: flex;
  gap: 6px;
}
.filter-bar .filter-btn {
  padding: 6px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.filter-bar .filter-btn:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}
.filter-bar .filter-btn.active {
  background: #111827;
  border-color: #111827;
  color: #fff;
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-80px);
  background: #059669;
  color: #fff;
  padding: 12px 24px;
  border-radius: 12px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0,0,0,0.15);
  z-index: 999;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
  opacity: 0;
  pointer-events: none;
}
.toast.toast-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.toast.toast-hidden {
  transform: translateX(-50%) translateY(-80px);
  opacity: 0;
  pointer-events: none;
}

/* ─── Name Modal ─── */
.name-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 250;
  padding: 1rem;
}
.name-modal-overlay.active {
  display: flex;
}
.name-modal {
  background: #fff;
  border-radius: 20px;
  padding: 1.5rem;
  width: min(340px, 100%);
  box-shadow: 0 24px 80px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.06);
  text-align: center;
}
.name-modal h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.25rem;
}
.name-modal p {
  font-size: 0.82rem;
  color: #6b7280;
  margin: 0 0 1rem;
}
.name-modal-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 0.88rem;
  outline: none;
  box-sizing: border-box;
  font-family: inherit;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}
.name-modal-input:focus {
  border-color: #3b82f6;
}
.name-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.name-modal-cancel, .name-modal-submit {
  padding: 8px 20px;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  border: none;
}
.name-modal-cancel {
  background: #f3f4f6;
  color: #374151;
}
.name-modal-cancel:hover {
  background: #e5e7eb;
}
.name-modal-submit {
  background: #111827;
  color: #fff;
}
.name-modal-submit:hover {
  background: #1f2937;
}

/* ─── Post Card ─── */
.post-card {
  background: #fff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  box-shadow: 0 8px 28px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  padding: 1.25rem;
  transition: box-shadow 0.25s ease, transform 0.2s ease;
}
.post-card:hover {
  box-shadow: 0 16px 40px rgba(0,0,0,0.10), 0 2px 8px rgba(0,0,0,0.06);
  transform: translateY(-2px);
}
.post-card-official {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 50%, #bbf7d0 100%);
  border-color: #86efac;
  box-shadow: 0 8px 28px rgba(16,185,129,0.08), 0 1px 4px rgba(16,185,129,0.04);
}
.post-card-official:hover {
  box-shadow: 0 16px 40px rgba(16,185,129,0.14), 0 2px 8px rgba(16,185,129,0.06);
  transform: translateY(-2px);
}
.post-card-official .post-caption {
  color: #065f46;
}
.post-card-official .action-btn {
  background: rgba(255,255,255,0.7);
  border-color: #a7f3d0;
  color: #047857;
}
.post-card-official .action-btn:hover {
  background: #fff;
  border-color: #6ee7b7;
  color: #065f46;
}
.post-card-official .action-btn.active {
  background: #d1fae5;
  border-color: #10b981;
  color: #047857;
}
.post-card-official .post-comments {
  border-top-color: #a7f3d0;
}
.post-card-official .comment-body {
  color: #065f46;
}
.post-card-official .comment-body strong {
  color: #064e3b;
}
.post-card-official .comment-dot {
  background: #6ee7b7;
}
.post-card-official .comment-timeline::before {
  background: #a7f3d0;
}
.post-card-official .comment-input {
  background: rgba(255,255,255,0.7);
  border-color: #a7f3d0;
  color: #065f46;
}
.post-card-official .comment-input::placeholder {
  color: #6ee7b7;
}
.post-card-official .comment-input:focus {
  border-color: #10b981;
}
.post-card-official .comment-send {
  border-color: #a7f3d0;
}
.post-card-official .comment-send:hover {
  background: rgba(255,255,255,0.8);
}
.post-card-official .post-datetime {
  color: #047857;
}
.post-card-official .post-author {
  color: #065f46;
}

/* ─── Post Header ─── */
.post-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex-shrink: 0;
  overflow: hidden;
}
.user-avatar {
  background: #3b82f6;
  overflow: hidden;
}
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 50%;
}
.official-avatar {
  background: transparent;
  width: auto;
  height: 36px;
  border-radius: 0;
}
.official-logo {
  height: 100%;
  width: auto;
  object-fit: contain;
  display: block;
}
.post-author {
  font-weight: 600;
  font-size: 0.9rem;
  color: #111827;
  flex: 1;
}
.post-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 0.75rem;
}
.post-datetime {
  font-size: 0.72rem;
  color: #9ca3af;
  cursor: default;
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

.post-caption {
  font-size: 0.95rem;
  color: #374151;
  line-height: 1.55;
  margin: 0 0 0.85rem;
  white-space: pre-wrap;
  word-break: break-word;
}
.caption-link {
  display: inline-block;
  background: #eff6ff;
  color: #2563eb;
  padding: 1px 8px;
  border-radius: 9999px;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid #bfdbfe;
  transition: background 0.15s;
  word-break: break-all;
}
.caption-link:hover {
  background: #dbeafe;
}
.caption-tag {
  font-style: italic;
  font-weight: 700;
  color: #7c3aed;
}
.caption-price {
  font-weight: 700;
  color: #dc2626;
}

.post-img-wrap {
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 0.85rem;
  aspect-ratio: 3 / 2;
  background: #f3f4f6;
}
.post-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ─── Action Buttons ─── */
.post-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  background: #fff;
  font-size: 0.82rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.18s ease;
  user-select: none;
}
.action-btn:hover {
  border-color: #d1d5db;
  background: #f9fafb;
}
.action-btn.active {
  background: #eff6ff;
  border-color: #3b82f6;
  color: #2563eb;
}
.action-btn svg, .toggle-comments-btn svg, .comment-send svg {
  vertical-align: middle;
  flex-shrink: 0;
}
.action-btn .count {
  font-weight: 600;
}
.share-btn:hover {
  background: #f0fdf4;
  border-color: #86efac;
  color: #16a34a;
}

/* ─── Toggle Comments Button ─── */
.toggle-comments-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
  padding: 5px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  background: #fff;
  font-size: 0.78rem;
  font-weight: 500;
  color: #6b7280;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.toggle-comments-btn:hover {
  border-color: #d1d5db;
  background: #f9fafb;
  color: #374151;
}
.toggle-comments-btn .count {
  font-weight: 600;
  color: #3b82f6;
}
.post-card-official .toggle-comments-btn {
  background: rgba(255,255,255,0.7);
  border-color: #a7f3d0;
  color: #047857;
}
.post-card-official .toggle-comments-btn:hover {
  background: #fff;
  border-color: #6ee7b7;
  color: #065f46;
}
.post-card-official .toggle-comments-btn .count {
  color: #059669;
}

/* ─── Comment Timeline ─── */
.post-comments {
  border-top: 1px solid #f3f4f6;
  padding-top: 0.75rem;
  margin-top: 0.75rem;
}
.post-comments.no-comments {
  display: none !important;
}

.comment-timeline {
  position: relative;
  padding-left: 20px;
  margin-bottom: 0.6rem;
}
.comment-timeline::before {
  content: '';
  position: absolute;
  left: 6px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: #e5e7eb;
  border-radius: 9999px;
}

.comment-node {
  position: relative;
  padding: 4px 0 8px 0;
}
.comment-dot {
  position: absolute;
  left: -17px;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #d1d5db;
  border: 2px solid #fff;
  z-index: 1;
}

.comment-body {
  font-size: 0.85rem;
  color: #374151;
  line-height: 1.4;
}
.comment-body strong {
  color: #111827;
  font-weight: 600;
}
.comment-time {
  display: block;
  font-size: 0.7rem;
  color: #9ca3af;
  margin-top: 1px;
}

.comment-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 6px;
}
.comment-input {
  flex: 1;
  padding: 8px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  font-size: 0.82rem;
  outline: none;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.comment-input:focus {
  border-color: #3b82f6;
}
.comment-send {
  background: none;
  border: 1px solid #e5e7eb;
  border-radius: 9999px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}
.comment-send:hover {
  background: #f3f4f6;
}

/* ─── Create Post Trigger Button ─── */
.create-trigger-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  background: #111827;
  color: #fff;
  border: none;
  border-radius: 18px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: background 0.2s, transform 0.15s;
}
.create-trigger-btn:hover {
  background: #1f2937;
  transform: translateY(-1px);
}
.create-trigger-btn:active {
  transform: translateY(0);
}

/* ─── Create Post Modal ─── */
.create-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.create-modal-overlay.active {
  display: flex;
}
.create-modal {
  background: #fff;
  border-radius: 20px;
  padding: 1.5rem;
  width: min(420px, 100%);
  box-shadow: 0 24px 80px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.06);
}
.create-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.create-modal-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
  margin: 0;
}
.create-modal-close {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background 0.15s;
}
.create-modal-close:hover {
  background: #f3f4f6;
}
.create-modal .create-field {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  font-size: 0.88rem;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s;
  font-family: inherit;
  margin-bottom: 10px;
}
.create-modal .create-field:focus {
  border-color: #3b82f6;
}
.create-modal textarea.create-field {
  resize: vertical;
  min-height: 80px;
}
.create-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.create-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}
.create-upload-btn:hover {
  background: #f9fafb;
}
.create-file-name {
  font-size: 0.8rem;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.create-progress {
  font-size: 0.8rem;
  color: #3b82f6;
  font-weight: 500;
}
.create-preview {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 14px;
  margin-bottom: 10px;
  background: #f3f4f6;
}
.create-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}
.create-submit-btn {
  padding: 8px 20px;
  background: #111827;
  color: #fff;
  border: none;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.create-submit-btn:hover {
  background: #1f2937;
}
.create-submit-btn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
}

/* ─── Share Popup ─── */
.share-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
}
.share-overlay.active {
  display: flex;
}
.share-card {
  background: #fff;
  border-radius: 20px;
  padding: 1.5rem;
  width: min(360px, 100%);
  box-shadow: 0 24px 80px rgba(0,0,0,0.18), 0 2px 8px rgba(0,0,0,0.06);
  text-align: center;
}
.share-card h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: #111827;
  margin: 0 0 0.25rem;
}
.share-card p {
  font-size: 0.82rem;
  color: #6b7280;
  margin: 0 0 1.25rem;
}
.share-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.share-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
  font-size: 0.9rem;
  font-weight: 500;
  color: #111827;
  text-align: left;
}
.share-option:hover {
  background: #f9fafb;
  border-color: #d1d5db;
}
.share-option .share-icon {
  font-size: 1.3rem;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f3f4f6;
  border-radius: 10px;
  flex-shrink: 0;
}

/* ─── Empty / Error State ─── */
.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: #9ca3af;
  font-size: 1rem;
}

/* ─── Shimmer Skeleton ─── */
@keyframes shimmerAnim {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.post-shimmer {
  background: #fff;
  border-radius: 18px;
  border: 1px solid #e5e7eb;
  padding: 1.25rem;
}
.post-shimmer .shimmer-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.post-shimmer .shimmer-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmerAnim 1.5s ease-in-out infinite;
  flex-shrink: 0;
}
.post-shimmer .shimmer-line {
  height: 14px;
  border-radius: 8px;
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmerAnim 1.5s ease-in-out infinite;
  margin-bottom: 10px;
}
.post-shimmer .shimmer-line.short { width: 60%; }
.post-shimmer .shimmer-img {
  width: 100%;
  aspect-ratio: 3 / 2;
  border-radius: 14px;
  background: linear-gradient(90deg, #e5e7eb 25%, #f3f4f6 50%, #e5e7eb 75%);
  background-size: 200% 100%;
  animation: shimmerAnim 1.5s ease-in-out infinite;
  margin-bottom: 10px;
}
