/* 基础重置与全局样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* 移动端适配核心：设置rem基准值 */
html {
  font-size: calc(100vw / 375 * 10);
  /* 以375px宽度为基准，1rem=10px */
  /* 限制最大/最小字体，避免大屏/小屏显示异常 */
  max-width: 750px;
  margin: 0 auto;
}

body {
  background: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
  min-height: 100vh;
  padding: 1.6rem;
}

/* 容器样式 */
.container {
  background: #ffffff;
  border-radius: 2rem;
  box-shadow: 0 0.8rem 3rem rgba(220, 198, 240, 0.2);
  padding: 2.4rem;
  margin: 0 auto;
}

/* 标题样式 */
h1 {
  text-align: center;
  color: #e86496;
  font-size: 2.8rem;
  margin-bottom: 3rem;
  font-weight: 600;
  position: relative;
  padding-bottom: 1rem;
}

h1::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 8rem;
  height: 0.2rem;
  background: linear-gradient(90deg, #ff9a9e 0%, #fad0c4 100%);
  border-radius: 0.1rem;
}

/* 表单容器 */
.form-container {
  margin-bottom: 4rem;
  padding-bottom: 2.4rem;
  border-bottom: 0.1rem solid #f8e0e7;
}

h3 {
  color: #ff7a9c;
  font-size: 2rem;
  margin-bottom: 1.8rem;
  font-weight: 500;
  display: flex;
  align-items: center;
}

h3::before {
  content: '💬';
  margin-right: 0.8rem;
  font-size: 2.2rem;
}

/* 表单组样式 */
.form-group {
  margin-bottom: 2rem;
}

label {
  display: block;
  margin-bottom: 0.8rem;
  color: #6a5acd;
  font-size: 1.5rem;
  font-weight: 500;
}

input,
textarea {
  width: 100%;
  padding: 1.4rem 1.6rem;
  border: 0.1rem solid #f0e1e8;
  border-radius: 1rem;
  font-size: 1.5rem;
  background-color: #fef9fb;
  transition: all 0.3s ease;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: #ff9a9e;
  box-shadow: 0 0 0 0.3rem rgba(255, 154, 158, 0.1);
  background-color: #ffffff;
}

textarea {
  resize: vertical;
  min-height: 12rem;
  line-height: 1.6;
}

/* 按钮样式 */
.btn {
  background: linear-gradient(90deg, #ff9a9e 0%, #fad0c4 100%);
  color: white;
  border: none;
  padding: 1.4rem 3rem;
  border-radius: 1rem;
  cursor: pointer;
  font-size: 1.6rem;
  font-weight: 500;
  transition: all 0.3s ease;
  width: 100%;
  box-shadow: 0 0.4rem 1rem rgba(255, 154, 158, 0.2);
}

.btn:hover {
  transform: translateY(-0.2rem);
  box-shadow: 0 0.6rem 1.5rem rgba(255, 154, 158, 0.3);
  background: linear-gradient(90deg, #ff8a8e 0%, #fac0b4 100%);
}

.btn:active {
  transform: translateY(0);
}

/* 留言列表样式 */
.messages-container {
  margin-top: 1rem;
}

.message-list {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
}

/* 留言卡片样式 */
.message-item {
  padding: 2rem;
  border: 0.1rem solid #f8e0e7;
  border-radius: 1.2rem;
  background-color: #fff9fc;
  position: relative;
  transition: all 0.3s ease;
  box-shadow: 0 0.2rem 0.8rem rgba(248, 224, 231, 0.1);
}

.message-item:hover {
  transform: translateY(-0.3rem);
  box-shadow: 0 0.5rem 1.5rem rgba(248, 224, 231, 0.2);
}

.message-item .username {
  font-weight: 600;
  color: #e86496;
  margin-bottom: 0.8rem;
  font-size: 1.6rem;
  display: flex;
  align-items: center;
}

.message-item .username::after {
  content: '✨';
  margin-left: 0.8rem;
  font-size: 1.4rem;
}

.message-item .time {
  font-size: 1.2rem;
  color: #b39ddb;
  margin-bottom: 1.2rem;
  display: block;
}

.message-item .content {
  color: #4a4a4a;
  line-height: 1.8;
  font-size: 1.5rem;
  padding-right: 4rem;
  /* 给删除按钮留空间 */
}

/* 删除按钮样式 */
.message-item .delete-btn {
  position: absolute;
  top: 1.6rem;
  right: 1.6rem;
  background: linear-gradient(90deg, #f48fb1 0%, #ce93d8 100%);
  color: white;
  border: none;
  padding: 0.8rem 1.2rem;
  border-radius: 0.8rem;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.3s ease;
  box-shadow: 0 0.2rem 0.5rem rgba(244, 143, 177, 0.2);
}

.message-item .delete-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 0.3rem 0.8rem rgba(244, 143, 177, 0.3);
  background: linear-gradient(90deg, #f06292 0%, #ba68c8 100%);
}

/* 空状态提示 */
.empty-tip {
  text-align: center;
  color: #b39ddb;
  padding: 4rem 2rem;
  font-size: 1.6rem;
  line-height: 1.8;
}

.empty-tip::before {
  content: '💖';
  display: block;
  font-size: 4rem;
  margin-bottom: 1.6rem;
}

/* 媒体查询：适配不同尺寸手机 */
@media (max-width: 375px) {
  html {
    font-size: calc(100vw / 320 * 10);
  }

  .container {
    padding: 1.8rem;
  }

  .message-item {
    padding: 1.6rem;
  }
}

/* 适配平板/电脑端 */
@media (min-width: 750px) {
  html {
    font-size: 20px;
    /* 大屏固定字体大小 */
  }

  .container {
    max-width: 600px;
  }
}

/* 隐藏类 */
.hidden {
  display: none;
}

/* 加号按钮样式 */
.add-btn {
  width: 100%;
  margin-bottom: 2rem;
  background: linear-gradient(90deg, #a18cd1 0%, #fbc2eb 100%);
}

.add-btn:hover {
  background: linear-gradient(90deg, #917cd0 0%, #fab2ea 100%);
}

/* 单选框组样式 */
.radio-group {
  display: flex;
  gap: 2rem;
  padding: 1rem 0;
}

.radio-label {
  display: flex;
  align-items: center;
  cursor: pointer;
  font-size: 1.6rem;
  color: #6a5acd;
}

.radio-label input {
  width: 1.8rem;
  height: 1.8rem;
  margin-right: 0.8rem;
  accent-color: #ff9a9e;
}

/* 按钮组样式 */
.btn-group {
  display: flex;
  gap: 1.2rem;
}

.submit-btn {
  flex: 2;
}

.cancel-btn {
  flex: 1;
  background: linear-gradient(90deg, #e0c3fc 0%, #8ec5fc 100%);
}

.cancel-btn:hover {
  background: linear-gradient(90deg, #d0b3fb 0%, #7eb5fc 100%);
}

/* 自定义确认弹窗 */
.custom-confirm {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.custom-confirm.hidden {
  display: none;
}

.confirm-content {
  background: white;
  padding: 2.4rem;
  border-radius: 1.2rem;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.2);
}

.confirm-content p {
  font-size: 1.6rem;
  color: #4a4a4a;
  margin-bottom: 2rem;
  text-align: center;
}

.confirm-btns {
  display: flex;
  gap: 1.2rem;
  justify-content: center;
}

.confirm-ok {
  background: linear-gradient(90deg, #ff9a9e 0%, #fad0c4 100%);
}

.confirm-cancel {
  background: linear-gradient(90deg, #e0c3fc 0%, #8ec5fc 100%);
}

/* 超可爱的成功提示弹窗 */
.success-toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(120deg, #fff9fb 0%, #fef0f5 100%);
  padding: 1.5rem 2rem;
  border-radius: 1.6rem;
  border: 0.2rem solid #ffd6e0;
  box-shadow: 0 0.8rem 2rem rgba(255, 154, 158, 0.2);
  z-index: 9999;
  width: 80%; /* 新增：基础宽度85% */
  max-width: 450px; /* 原来无，新增最大宽度480px */
  animation: bounceIn 0.5s ease, fadeOutSoft 0.5s ease 3s forwards;
}

/* 弹跳进入动画 */
@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.8);
  }

  70% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.05);
  }

  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

/* 柔和淡出动画 */
@keyframes fadeOutSoft {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -55%) scale(0.95);
  }
}

.success-toast.hidden {
  display: none;
}

.toast-content {
  font-size: 1.8rem;
  color: #e86496;
  text-align: center;
  display: flex;
  align-items: center;
  gap: 1rem;
  font-weight: 500;
}

/* 可爱的表情装饰 */
.toast-content::before {
  content: '🌸';
  font-size: 2.2rem;
  animation: heartBeat 1.5s infinite;
}

/* 心跳动画 */
@keyframes heartBeat {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.2);
  }

  100% {
    transform: scale(1);
  }
}

/* 登录页面样式（修改这部分） */
.login-page {
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(120deg, #fdfbfb 0%, #ebedee 100%);
  padding: 1.6rem;
  position: fixed;
  /* 新增：固定定位，覆盖整个屏幕 */
  top: 0;
  /* 新增：置顶 */
  left: 0;
  /* 新增：靠左 */
  z-index: 999;
  /* 新增：层级高于留言板 */
}

/* 新增：隐藏后完全不显示，不占空间 */
.login-page.hidden {
  display: none;
}

.login-card {
  background: #ffffff;
  border-radius: 2rem;
  box-shadow: 0 0.8rem 3rem rgba(220, 198, 240, 0.2);
  padding: 3rem 2.4rem;
  width: 100%;
  max-width: 400px;
}

.login-card h2 {
  text-align: center;
  color: #e86496;
  font-size: 2.2rem;
  margin-bottom: 2.4rem;
  font-weight: 600;
}

.login-form {
  width: 100%;
}

.login-btn {
  width: 100%;
  margin-top: 1rem;
  background: linear-gradient(90deg, #a18cd1 0%, #fbc2eb 100%);
}

.login-btn:hover {
  background: linear-gradient(90deg, #917cd0 0%, #fab2ea 100%);
}

/* 退出登录按钮样式 */
/* 退出登录按钮样式（固定在屏幕底部） */
.logout-btn {
  position: fixed;
  /* 固定在屏幕底部，不随页面滚动 */
  bottom: 2rem;
  /* 距离底部2rem */
  left: 50%;
  /* 水平居中 */
  transform: translateX(-50%);
  /* 精准居中 */
  padding: 1rem 2.4rem;
  font-size: 1.6rem;
  background: linear-gradient(90deg, #fbc2eb 0%, #a6c1ee 100%);
  border-radius: 10px;
  /* 圆角更可爱 */
  z-index: 99;
  /* 层级高于留言板，但低于弹窗 */
  box-shadow: 0 0.4rem 1.2rem rgba(220, 198, 240, 0.3);
}

.logout-btn:hover {
  background: linear-gradient(90deg, #fab2ea 0%, #96b1de 100%);
}

/* 给留言板底部加padding，避免内容被按钮遮挡 */
.messages-container {
  padding-bottom: 8rem;
  /* 留出按钮空间 */
}

/* 容器样式还原（删除之前加的position: relative） */
.container {
  padding: 2rem;
  max-width: 800px;
  margin: 0 auto;
}

/* 通用提示弹窗样式（按类型区分） */
/* 错误提示（密码错误/接口失败） */
.customTips.error {
  background: linear-gradient(120deg, #fff5f5 0%, #ffe5e5 100%);
  border-color: #ffb3b3;
}

.customTips.error .toast-content {
  color: #e64545;
}

.customTips.error .toast-content::before {
  content: '❌';
  animation: pulse 1.5s infinite;
}

/* 普通提示（请选择身份/请输入密码） */
.customTips.info {
  background: linear-gradient(120deg, #f0f9ff 0%, #e6f7ff 100%);
  border-color: #91d5ff;
}

.customTips.info .toast-content {
  color: #40a9ff;
}

.customTips.info .toast-content::before {
  content: '💡';
  animation: pulse 1.5s infinite;
}

/* 成功提示（退出成功/登录成功） */
.customTips.success {
  background: linear-gradient(120deg, #fff9fb 0%, #fef0f5 100%);
  border-color: #ffd6e0;
}

.customTips.success .toast-content {
  color: #e86496;
}

.customTips.success .toast-content::before {
  content: '✅';
  animation: pulse 1.5s infinite;
}

/* 轻缩放动画（适配非爱心图标） */
@keyframes pulse {
  0% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.1);
  }

  100% {
    transform: scale(1);
  }
}

/* 当前身份提示文字样式 */
.form-group label[style*="当前身份"] {
  font-size: 1.7rem;
  color: #e86496;
  font-weight: 500;
  display: block;
  margin-bottom: 1rem;
}

/* 图片上传区域样式 */
.image-upload-area {
  border: 0.2rem dashed #f0e1e8;
  border-radius: 1rem;
  padding: 3rem 2rem;
  text-align: center;
  cursor: pointer;
  background-color: #fef9fb;
  transition: all 0.3s ease;
}

.image-upload-area:hover {
  border-color: #ff9a9e;
  background-color: #fff9fc;
}

.image-upload-area.drag-over {
  border-color: #ff9a9e;
  background-color: #fff0f5;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.upload-icon {
  font-size: 3rem;
}

.upload-text {
  color: #b39ddb;
  font-size: 1.4rem;
}

/* 图片预览样式 */
.image-preview {
  position: relative;
  margin-top: 1rem;
  border-radius: 1rem;
  overflow: hidden;
  border: 0.1rem solid #f0e1e8;
}

.image-preview img {
  width: 100%;
  max-height: 30rem;
  object-fit: contain;
  display: block;
  background-color: #fef9fb;
}

.remove-image-btn {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  background: rgba(255, 255, 255, 0.9);
  border: none;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.8rem;
  color: #e86496;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  box-shadow: 0 0.2rem 0.5rem rgba(0, 0, 0, 0.2);
}

.remove-image-btn:hover {
  background: rgba(255, 255, 255, 1);
  transform: scale(1.1);
}

/* 留言中的图片样式 */
.message-image {
  margin: 1.2rem 0;
  border-radius: 1rem;
  overflow: hidden;
  border: 0.1rem solid #f8e0e7;
  cursor: pointer;
  transition: all 0.3s ease;
}

.message-image:hover {
  transform: scale(1.02);
  box-shadow: 0 0.4rem 1rem rgba(232, 100, 150, 0.2);
}

.message-image img {
  width: 100%;
  max-height: 40rem;
  object-fit: contain;
  display: block;
  background-color: #fef9fb;
}

/* 大图预览模态框 */
.image-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 2rem;
}

.image-modal-content {
  position: relative;
  max-width: 90%;
  max-height: 90%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.image-modal-content img {
  max-width: 100%;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 0.8rem;
}

.image-modal-close {
  position: absolute;
  top: -4rem;
  right: 0;
  color: white;
  font-size: 4rem;
  font-weight: bold;
  cursor: pointer;
  line-height: 1;
  transition: all 0.3s ease;
}

.image-modal-close:hover {
  transform: scale(1.2);
  color: #ff9a9e;
}