/* 云端记录弹窗样式 */
.moments-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.moments-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.moments-modal.closing {
  opacity: 0;
}

.moments-modal-content {
  position: relative;
  background: linear-gradient(145deg, #fff5f7, #ffeaee);
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  border-radius: 15px;
  padding: 30px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform 0.3s ease;
}

.moments-modal.open .moments-modal-content {
  transform: translateY(0);
}

.moments-modal .modal-header {
  padding-bottom: 15px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(231, 133, 153, 0.3);
  text-align: center;
}

.moments-modal .modal-header h2 {
  color: #e78599;
  font-size: 24px;
  margin: 0;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.05);
}

.moments-modal .modal-close-btn {
  position: absolute;
  top: 15px;
  right: 15px;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  padding: 0;
  z-index: 1;
}

.moments-modal .modal-close-btn:hover {
  opacity: 1;
}

.moments-modal .close-icon {
  width: 24px;
  height: 24px;
}

.moments-modal .modal-body {
  max-height: calc(80vh - 100px);
  overflow-y: auto;
  padding-right: 10px;
}

/* 为弹窗内的滚动条添加样式 */
.moments-modal .modal-body::-webkit-scrollbar {
  width: 8px;
}

.moments-modal .modal-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.5);
  border-radius: 10px;
}

.moments-modal .modal-body::-webkit-scrollbar-thumb {
  background: rgba(231, 133, 153, 0.5);
  border-radius: 10px;
}

.moments-modal .modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(231, 133, 153, 0.7);
}

/* 确保弹窗内的记录样式和原来一致 */
.moments-modal .moment-item {
  margin-bottom: 15px;
}

/* 移动设备适配 */
@media (max-width: 768px) {
  .moments-modal-content {
    padding: 20px;
    max-height: 70vh;
  }
  
  .moments-modal .modal-body {
    max-height: calc(70vh - 80px);
  }
}

.load-cloud-btn {
  background: linear-gradient(to right, #8bb3ff, #a3c2ff);
  border: none;
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  margin: 15px auto;
  display: block;
  transition: all 0.3s ease;
}

.load-cloud-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(139, 179, 255, 0.3);
}

.heart-moments-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.heart-moments-container.open {
  opacity: 1;
}

.heart-moments-content {
  position: relative;
  background: linear-gradient(145deg, #fff5f7, #ffeaee);
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  text-align: center;
}

.heart-moments-header {
  position: relative;
  margin: 30px 0 25px;
}

.heart-moments-header h2 {
  color: #e78599;
  font-size: 28px;
  margin: 0;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.05);
}

.heart-shine {
  position: absolute;
  top: -10px;
  left: 50%;
  width: 40px;
  height: 40px;
  background: radial-gradient(circle, rgba(255,150,180,0.4) 0%, rgba(255,150,180,0) 70%);
  transform: translateX(-50%);
  animation: pulse 2s infinite;
}

.heart-moments-form {
  margin: 0 auto 30px;
  width: 90%;
  max-width: 600px;
}

#new-moment {
  width: 100%;
  height: 80px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #ffd0d8;
  resize: none;
  font-size: 16px;
  margin-bottom: 10px;
  background-color: rgba(255, 255, 255, 0.95);
}

#save-moment-btn {
  background: linear-gradient(to right, #ff9bac, #ffaec2);
  border: none;
  color: white;
  padding: 8px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.3s ease;
}

#save-moment-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 155, 180, 0.3);
}

.heart-moments-list {
  text-align: left;
  margin: 0 auto;
  width: 90%;
  max-width: 600px;
  flex: 1;
  padding-bottom: 50px;
}

.heart-moments-list h3 {
  color: #e78599;
  margin-bottom: 15px;
  text-align: center;
  font-size: 20px;
}

.moment-item {
  background-color: rgba(255, 255, 255, 0.95);
  padding: 15px;
  border-radius: 10px;
  margin-bottom: 15px;
  position: relative;
  border-left: 4px solid #ffb5c5;
}

.moment-content {
  margin-bottom: 8px;
  white-space: pre-wrap;
  word-break: break-word;
}

.moment-time {
  font-size: 12px;
  color: #aaa;
  text-align: left; /* 改为左对齐 */
}

.delete-moment-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: none;
  border: none;
  color: #ffaab9;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity 0.2s;
}

.delete-moment-btn:hover {
  opacity: 1;
}

.empty-moments {
  text-align: center;
  color: #aaa;
  font-style: italic;
  padding: 20px;
}

.cloud-moments-list {
  text-align: left;
  margin: 20px auto 0;
  width: 90%;
  max-width: 600px;
  padding-bottom: 50px;
}

.cloud-moments-list h3 {
  color: #e78599;
  margin-bottom: 15px;
  text-align: center;
  font-size: 20px;
}

.cloud-moment {
  border-left: 4px solid #b5c5ff;
}

.moment-meta {
  position: absolute;
  bottom: 10px;
  left: 15px;
  margin-top: 0;
  padding-right: 0;
  width: auto;
}


.moment-user {
  font-style: italic;
}

.loading-moments {
  text-align: center;
  color: #aaa;
  padding: 15px;
  font-style: italic;
}

@keyframes pulse {
  0% { transform: translateX(-50%) scale(1); opacity: 0.3; }
  50% { transform: translateX(-50%) scale(1.2); opacity: 0.5; }
  100% { transform: translateX(-50%) scale(1); opacity: 0.3; }
}

/* 修复返回按钮样式，移除背景图像 */
#heart-moments .back-btn {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 40px;
  height: 40px;
  background-image: none;
  background-color: transparent;
  border: none;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
  z-index: 10;
}

#heart-moments .back-btn:hover {
  opacity: 1;
}


.delete-cloud-moment-btn:hover {
  opacity: 1;
}

/* 编辑弹窗样式 */
.edit-modal .modal-body {
  padding: 15px;
}

#edit-moment-content {
  width: 100%;
  height: 120px;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ffd0d8;
  resize: none;
  font-size: 16px;
  margin-bottom: 15px;
  background-color: rgba(255, 255, 255, 0.95);
}

.modal-actions {
  display: flex;
  justify-content: center;
  gap: 15px;
  margin-top: 15px;
}

#update-moment-btn, #cancel-edit-btn {
  padding: 8px 20px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  transition: all 0.3s ease;
  border: none;
}

#update-moment-btn {
  background: linear-gradient(to right, #ff9bac, #ffaec2);
  color: white;
}

#cancel-edit-btn {
  background: #f1f1f1;
  color: #666;
}

#update-moment-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(255, 155, 180, 0.3);
}

#cancel-edit-btn:hover {
  background: #e5e5e5;
}

.moment-actions {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 5px; /* 按钮之间的间距 */
  width: auto; /* 确保容器宽度自适应内容 */
}

.edit-cloud-moment-btn:hover {
  opacity: 1;
}
/* 移动端优化 */
@media (max-width: 768px) {
  /* 基础容器调整 */
  .heart-moments-content {
    background: linear-gradient(145deg, #fff8fa, #ffe6ec);
    padding-top: 10px;
  }
  
  /* 页头调整 */
  .heart-moments-header {
    margin: 20px 0 15px;
  }
  
  .heart-moments-header h2 {
    font-size: 24px;
  }
  
  /* 返回按钮优化 */
  #heart-moments .back-btn {
    top: 15px;
    left: 15px;
    width: 36px;
    height: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23e78599' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cline x1='19' y1='12' x2='5' y2='12'%3E%3C/line%3E%3Cpolyline points='12 19 5 12 12 5'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 24px;
  }

  /* 表单区域调整 */
  .heart-moments-form {
    margin: 0 auto 20px;
    width: 92%;
  }
  
  #new-moment {
    height: 70px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(255, 208, 216, 0.3);
    font-size: 15px;
  }
  
  #save-moment-btn {
    padding: 8px 18px;
    font-size: 15px;
  }
  
  /* 记录列表优化 */
  .heart-moments-list {
    width: 92%;
    padding-bottom: 30px;
  }
  
  .heart-moments-list h3, 
  .cloud-moments-list h3 {
    font-size: 18px;
    margin-bottom: 12px;
  }
  
  .moment-item {
    padding: 12px;
    border-radius: 15px;
    box-shadow: 0 2px 8px rgba(255, 208, 216, 0.15);
    border-left-width: 3px;
  }
  
  .moment-content {
    font-size: 15px;
    line-height: 1.5;
  }
  
  /* 云端记录区域 */
  .cloud-moments-list {
    width: 92%;
    margin: auto auto 0;
    padding-bottom: 30px;
  }
  
  .load-cloud-btn {
    padding: 8px 18px;
    border-radius: 18px;
    font-size: 15px;
    margin-top: 20px;
  }
  
  /* 弹窗优化 */
  .moments-modal-content {
    width: 92%;
    padding: 20px;
    border-radius: 18px;
  }
  
  .moments-modal .modal-header h2 {
    font-size: 20px;
  }
  
  .moments-modal .modal-close-btn {
    top: 12px;
    right: 12px;
  }
  
  .moments-modal .close-icon {
    width: 20px;
    height: 20px;
  }
  
  #edit-moment-content {
    border-radius: 12px;
  }
}

/* 添加可爱装饰元素 */
.moment-item {
  position: relative;
}

.moment-item::before {
  content: '❤️';
  position: absolute;
  left: -15px;
  top: 14px;
  font-size: 14px;
  opacity: 0.8;
}

.cloud-moment::before {
  content: '☁️';
}

/* 优化滚动体验 */
.heart-moments-content {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

/* 改善文本输入体验 */
#new-moment, #edit-moment-content {
  transition: border-color 0.2s ease;
}

#new-moment:focus, #edit-moment-content:focus {
  border-color: #ff9bac;
  box-shadow: 0 0 0 2px rgba(255, 155, 180, 0.25);
  outline: none;
}
/* 防止文本内容与操作按钮重叠 */
.moment-item {
  position: relative;
  padding-bottom: 40px; /* 增加底部空间，为按钮留出位置 */
}

.moment-meta {
  margin-top: 10px;
  padding-right: 75px; /* 为右侧按钮留出空间 */
}

.moment-actions {
  position: absolute;
  bottom: 10px;
  right: 10px;
  display: flex;
  gap: 8px; /* 按钮之间的间距 */
}

/* 进一步优化按钮样式，使其更小更紧凑 */
.edit-cloud-moment-btn,
.delete-cloud-moment-btn {
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #ffccd5;
  border-radius: 6px; /* 减小圆角 */
  padding: 0 4px; /* 减小水平内边距 */
  height: 20px; /* 固定高度 */
  line-height: 18px; /* 调整行高以垂直居中文本 */
  font-size: 10px; /* 小字体 */
  color: #e78599;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 0; /* 移除最小宽度限制 */
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.edit-cloud-moment-btn:hover,
.delete-cloud-moment-btn:hover {
  background: #ffebf0;
  color: #e05e7a;
}
/* 优化移动端体验 */
@media (max-width: 768px) {
  .moment-meta {
    bottom: 6px;
    left: 12px;
  }
  
  .moment-actions {
    bottom: 6px; 
    right: 6px;
  }
  
  /* 适当调整间距 */
  .moment-item {
    padding-bottom: 32px; /* 确保底部有足够空间放置时间和按钮 */
  }
  
  .moment-content {
    margin-bottom: 16px; /* 增加内容与底部元素间距 */
  }
}

/* 编辑按钮和删除按钮调整相同大小 */
.edit-cloud-moment-btn,
.delete-cloud-moment-btn {
  height: 20px;
  line-height: 18px;
  padding: 0 4px;
  font-size: 10px;
}
