.dynamics-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  background-color: var(--background-color);
}

.dynamics-list {
  flex-grow: 1;
  overflow-y: auto;
  padding: 10px;
  padding-bottom: 70px; /* Add padding to avoid overlap with bottom nav */
}

.dynamic-card {
  display: flex;
  gap: 15px;
  padding: 15px 0;
  border-bottom: 1px solid var(--border-primary);
  position: relative;
  flex-wrap: wrap;
}

.dynamic-card:last-child {
  border-bottom: none;
}

.dynamic-left {
  flex-shrink: 0;
}

.dynamic-right {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dynamic-header .username {
  font-weight: bold;
  color: var(--text-primary);
  font-size: 16px;
}

.dynamic-left .avatar {
  width: 45px;
  height: 45px;
  border-radius: 8px;
}

.delete-dynamic-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
}
.dynamic-content p {
  margin: 0;
  line-height: 1.5;
}

.dynamic-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.dynamic-actions {
  position: relative; /* For menu positioning */
  display: flex;
  align-items: center;
  gap: 15px;
  margin-left: auto;
}

.more-actions-btn,
.delete-dynamic-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 12px;
  padding: 0;
}

.dynamic-actions button i {
  margin-right: 5px;
}

#post-dynamic-modal .modal-content {
  box-shadow: none;
  border: 1px solid var(--border-color);
}

#post-dynamic-modal .modal-content textarea {
  width: 100%;
  padding: 10px;
  border: none;
  border-radius: 8px;
  resize: vertical;
  background-color: var(--secondary-bg-color);
  color: var(--text-primary);
  font-size: 16px;
  min-height: 120px;
  box-sizing: border-box;
}

#post-dynamic-modal .modal-content textarea:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 122, 255, 0.25);
}

/* .add-dynamic-btn 样式已迁移到 header.css 中的 .header-action-btn */
.comments-section {
  display: none; /* Hidden by default */
  width: 100%;
  margin-top: 8px;
  box-sizing: border-box;
}

.comments-section.has-content {
  display: block;
  background-color: var(--bg-tertiary);
  border-radius: 6px;
  padding: 10px;
  position: relative;
}

.comments-section.has-content::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 20px;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 8px solid var(--bg-tertiary);
}

.likes-list {
  padding-bottom: 4px;
}

.likes-list:not(:empty) + .comments-list:not(:empty) {
    border-top: none; /* Removed separator */
    padding-top: 4px; /* Reduced gap */
}

.like-item {
  font-size: 14px;
  color: var(--text-secondary);
}

.like-item i {
  color: var(--accent-red);
  margin-right: 5px;
}


.like-item {
  font-size: 14px;
  color: var(--text-secondary);
}

.like-item i {
  color: var(--accent-red);
  margin-right: 5px;
}

.more-actions-menu {
  display: none;
  position: absolute;
  right: 100%;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--bg-quaternary);
  border-radius: 6px;
  box-shadow: var(--shadow-medium);
  display: flex;
  gap: 5px;
  padding: 5px;
  margin-right: 10px;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.more-actions-menu.show {
  display: flex;
  opacity: 1;
  pointer-events: auto;
}

.more-actions-menu button {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

.more-actions-menu button:hover {
  background-color: var(--bg-tertiary);
}

.comment {
  font-size: 14px;
  margin-bottom: 5px;
  color: var(--text-secondary);
}

.comment .username {
  font-weight: bold;
  color: var(--text-primary);
  margin-right: 5px;
}

.comment {
  position: relative;
  cursor: pointer;
}


.comment-actions {
  position: absolute;
  bottom: 100%;
  left: 0;
  margin-bottom: 4px;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 8px;
  padding: 4px;
  display: none;
  z-index: 1500;
  box-shadow: var(--shadow-medium);
  backdrop-filter: blur(2px);
}

.comment-actions.show-actions {
  display: flex;
  gap: 4px;
}

.comment-actions button {
  background: none;
  border: none;
  color: white;
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.875rem;
  transition: background-color 0.2s ease;
}

.comment-actions button:hover {
  background-color: rgba(255, 255, 255, 0.2);
}

.comment-actions button:active {
  transform: scale(0.95);
}


/* Fullscreen Edit Modal - Copied from chat.css */
.fullscreen-edit-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--modal-bg);
  display: flex;
  flex-direction: column;
  z-index: 2000;
  animation: fadeIn 0.3s ease;
}

.fullscreen-edit-header {
  background-color: var(--bg-secondary);
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-primary);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.fullscreen-edit-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.fullscreen-edit-close {
  background: none;
  border: none;
  font-size: 1.125rem;
  color: var(--accent-blue);
  cursor: pointer;
  padding: 4px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fullscreen-edit-content {
  flex: 1;
  padding: 16px;
  display: flex;
  flex-direction: column;
}

.fullscreen-edit-textarea {
  flex: 1;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  font-size: 1rem;
  line-height: 1.5;
  resize: none;
  outline: none;
  font-family: inherit;
  background-color: var(--input-bg);
  color: var(--input-text);
}

.fullscreen-edit-textarea:focus {
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 3px rgba(0, 122, 255, 0.15);
}

.fullscreen-edit-footer {
  background-color: var(--bg-secondary);
  padding: 12px 16px;
  border-top: 1px solid var(--border-primary);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.fullscreen-edit-btn {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fullscreen-edit-btn.save {
  background-color: var(--accent-blue);
  color: white;
}

.fullscreen-edit-btn.save:hover {
  background-color: var(--button-primary-hover);
}

.fullscreen-edit-btn.cancel {
  background-color: var(--bg-quaternary);
  color: var(--text-primary);
}

.fullscreen-edit-btn.cancel:hover {
  background-color: var(--button-secondary-hover);
}


/* Dynamics Reply Input */
.dynamics-reply-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background-color: var(--bg-primary);
  border-top: 1px solid var(--border-tertiary);
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  transition: transform 0.3s ease-in-out;
  z-index: 1600;
  display: flex;
  align-items: flex-end;
}

.dynamics-reply-container.show {
  transform: translateY(0);
}

.dynamics-reply-container .input-wrapper {
  display: flex;
  align-items: flex-end;
  width: 100%;
  background-color: var(--input-bg);
  border: 1px solid var(--input-border);
  border-radius: 20px;
  padding: 6px 8px;
}

#dynamics-reply-input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1rem;
  font-family: inherit;
  padding: 6px 4px;
  background: transparent;
  color: var(--input-text);
  max-height: 100px;
  overflow-y: auto;
  resize: none;
}

#dynamics-reply-send {
  background-color: var(--accent-blue);
  color: white;
  border: none;
  border-radius: 15px;
  padding: 6px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  margin-left: 8px;
}

.comment .reply-indicator {
  color: #888;
  margin: 0 4px;
}

/* Visibility Options Styles */
.visibility-options {
  margin-top: 15px;
  display: flex;
  gap: 15px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border-secondary);
  border-bottom: 1px solid var(--border-secondary);
}

.visibility-label {
  font-weight: 600;
  color: var(--text-primary);
  margin-right: 5px;
  font-size: 0.9rem;
}

.visibility-options label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.visibility-options input[type="radio"] {
  accent-color: var(--accent-blue);
  width: 16px;
  height: 16px;
}

.contact-selection-list {
  margin-top: 10px;
  border: 1px solid var(--border-secondary);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  display: none;
  background-color: var(--bg-quaternary);
}

.contact-selection-list.show {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
  animation: fadeIn 0.3s ease;
}

.contact-checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  cursor: pointer;
  font-size: 0.9rem;
  background-color: var(--input-bg);
  border: 1px solid var(--border-secondary);
  border-radius: 6px;
  transition: all 0.2s ease;
}

.contact-checkbox-item:hover {
  background-color: var(--bg-tertiary);
  border-color: var(--accent-blue);
}

.contact-checkbox-item input[type="checkbox"] {
  accent-color: var(--accent-blue);
  width: 16px;
  height: 16px;
}

.contact-checkbox-item .avatar-small {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
}

.contact-checkbox-item span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Desktop/Widescreen Styles */
@media (min-width: 768px) {
    .dynamics-list {
        padding: 20px;
    }
}

/* 动态页面的用户资料卡片 */
.dynamic-user-profile {
  position: relative;
  width: 100%;
  height: 250px;
  /* overflow: hidden; */ /* Allow avatar to overflow */
  margin-bottom: 50px; /* Increased margin to make space for the avatar */
  background-color: var(--secondary-bg-color);
}

.dynamic-user-profile .profile-bg {
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  transition: background-image 0.3s ease;
  cursor: pointer;
}

/* Placeholder styles when no background is set */
.dynamic-user-profile .profile-bg:not([style*='background-image']) {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  color: var(--text-secondary);
  background-color: var(--bg-tertiary);
}

.dynamic-user-profile .profile-bg:not([style*='background-image'])::before {
  font-family: 'Font Awesome 5 Free';
  font-weight: 900;
  content: '\f03e'; /* fa-image icon */
  font-size: 40px;
  margin-bottom: 15px;
}

.dynamic-user-profile .profile-bg:not([style*='background-image'])::after {
  content: '点击设置背景图';
  font-size: 14px;
}

.dynamic-user-profile .profile-info {
  /* This container no longer controls positioning */
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none; /* Clicks should pass through to the background */
}

.dynamic-user-profile .profile-name {
  position: absolute;
  bottom: 2px; /* Position inside the background, aligned with avatar's top */
  right: 105px; /* Position to the left of the avatar */
  font-size: 20px;
  font-weight: bold;
  color: white;
  text-shadow: 1px 1px 5px rgba(0, 0, 0, 0.7);
}

.dynamic-user-profile .profile-avatar {
  position: absolute;
  bottom: -35px; /* Hangs halfway off the bottom edge */
  right: 20px;
  width: 70px;
  height: 70px;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.8);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  pointer-events: auto; /* Avatar can be interacted with if needed */
  cursor: default;
  object-fit: cover;
}

/* Dark Mode for Dynamics View */
body.dark-mode .dynamics-container {
    background-color: var(--bg-primary);
}

body.dark-mode .dynamic-card {
    border-bottom-color: var(--border-primary);
}

body.dark-mode .dynamic-header .username {
    color: var(--text-primary);
}

body.dark-mode .dynamic-meta,
body.dark-mode .more-actions-btn,
body.dark-mode .delete-dynamic-btn {
    color: var(--text-secondary);
}

body.dark-mode .comments-section.has-content {
    background-color: var(--bg-tertiary);
}

body.dark-mode .comment {
    color: var(--text-secondary);
}

body.dark-mode .comment .username {
    color: var(--text-primary);
}

body.dark-mode .comment-actions {
    background: rgba(30, 30, 30, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark-mode .comment-actions button:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

body.dark-mode .dynamics-reply-container {
    background-color: var(--bg-secondary);
    border-top-color: var(--border-primary);
}

body.dark-mode .dynamics-reply-container .input-wrapper {
    background-color: var(--bg-tertiary);
    border-color: var(--border-primary);
}

body.dark-mode #dynamics-reply-input {
    color: var(--text-primary);
}

body.dark-mode .visibility-options {
    border-top-color: var(--border-primary);
    border-bottom-color: var(--border-primary);
}

body.dark-mode .visibility-label,
body.dark-mode .visibility-options label {
    color: var(--text-primary);
}

body.dark-mode .contact-selection-list {
    border-color: var(--border-primary);
    background-color: var(--bg-secondary);
}

body.dark-mode .contact-checkbox-item {
    background-color: var(--bg-tertiary);
    border-color: var(--border-primary);
}

body.dark-mode .contact-checkbox-item:hover {
    background-color: var(--bg-quaternary);
    border-color: var(--accent-blue);
}

body.dark-mode .contact-checkbox-item span {
    color: var(--text-primary);
}

body.dark-mode .dynamic-user-profile .profile-bg:not([style*='background-image']) {
    color: var(--text-tertiary);
    background-color: var(--bg-tertiary);
}
