/* css/mobile.css - 用户手机端样式 */
body {
  padding-bottom: 60px; /* 底部导航留白 */
  max-width: 600px; /* 限制PC查看时的最大宽度 */
  margin: 0 auto;
  box-shadow: 0 0 20px rgba(0,0,0,0.05);
  background-color: var(--white);
  min-height: 100vh;
}

/* 顶部 Header */
.header-m {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background-color: var(--white);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--gray-border);
}

.header-logo img {
  height: 24px;
}

.header-title {
  font-size: 16px;
  font-weight: bold;
  color: var(--black);
  /* 相对整个标题栏居中，不受两侧内容宽度影响 */
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  white-space: nowrap;
}

.header-right {
  display: flex;
  gap: 12px;
  align-items: center;
}

.header-icon {
  width: 24px;
  height: 24px;
  fill: var(--black);
}

/* 标签筛选栏 */
.filter-tabs {
  display: flex;
  overflow-x: auto;
  padding: 10px 16px;
  background-color: var(--white);
  gap: 20px;
  position: sticky;
  top: 49px; /* header 高度之后 */
  z-index: 99;
}

.filter-tabs::-webkit-scrollbar {
  display: none; /* 隐藏滚动条 */
}

.tab-item {
  white-space: nowrap;
  font-size: 15px;
  color: var(--gray-medium);
  padding-bottom: 4px;
  position: relative;
  font-weight: 500;
  cursor: pointer;
}

.tab-item.active {
  color: var(--black);
  font-weight: bold;
}

.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 16px;
  height: 3px;
  background-color: var(--ricoh-red);
  border-radius: 2px;
}

.filter-tabs.sub-tabs { margin-top: -5px; margin-bottom: 5px; border-bottom: 1px solid var(--gray-border); }
.filter-tabs.sub-tabs .tab-item { font-size: 13px; color: var(--gray-medium); }
.filter-tabs.sub-tabs .tab-item.active { color: var(--ricoh-red); font-weight: 600; }
.filter-tabs.sub-tabs .tab-item.active::after { display: none; }

/* 瀑布流容器手机端适配 */
  .waterfall-container {
    background-color: var(--gray-light);
    min-height: calc(100vh - 100px);
  }
  
  body:has(> .header-m:not([style*="display: none"])) {
      background-color: var(--gray-light);
  }

/* 底部导航栏 */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  height: 56px;
  background-color: var(--white);
  display: flex;
  justify-content: space-around;
  align-items: center;
  border-top: 1px solid var(--gray-border);
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--gray-medium);
  font-size: 10px;
  flex: 1;
}

.nav-item.active {
  color: var(--black);
}

.nav-item svg {
  width: 24px;
  height: 24px;
  fill: currentColor;
}

/* --- 登录注册页面 --- */
.auth-page {
  padding: 40px 24px;
  background-color: var(--white);
  min-height: 100vh;
}

.auth-header {
  margin-bottom: 40px;
}

.auth-title {
  font-size: 28px;
  font-weight: bold;
  color: var(--black);
  margin-top: 16px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--gray-medium);
  margin-top: 8px;
}

.auth-switch {
  text-align: center;
  margin-top: 24px;
  font-size: 14px;
  color: var(--gray-medium);
}

.auth-switch a {
  color: var(--ricoh-red);
  font-weight: bold;
}

/* 头像上传组件 */
.avatar-upload-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 24px;
}

.avatar-preview-wrap {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background-color: var(--gray-light);
  border: 1px dashed var(--gray-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
  margin-bottom: 8px;
}

.avatar-preview-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.avatar-preview-wrap svg {
  width: 32px;
  height: 32px;
  fill: var(--gray-medium);
}

.avatar-input {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.avatar-tip {
  font-size: 12px;
  color: var(--gray-medium);
}

/* 验证码输入框 */
.input-with-btn {
  display: flex;
  gap: 12px;
}

.input-with-btn .form-input {
  flex: 1;
}

.btn-code {
  white-space: nowrap;
  padding: 0 16px;
  background-color: var(--black);
  color: var(--white);
  border: none;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

.btn-code:disabled {
  background-color: var(--gray-medium);
  cursor: not-allowed;
}

.auth-links {
  display: flex;
  justify-content: space-between;
  margin-top: 16px;
  font-size: 14px;
}

.auth-links a {
  color: var(--gray-medium);
}

.auth-links a:hover {
  color: var(--ricoh-red);
}

/* --- 我的页面 (Profile) --- */
.profile-page {
  padding: 0;
  background-color: var(--gray-light);
  min-height: 100vh;
}

.profile-header {
  background-color: var(--white);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 12px;
}

.profile-avatar-wrap {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  position: relative;
  margin-bottom: 16px;
  background-color: var(--gray-border);
}

.profile-avatar-wrap img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  object-fit: cover;
}

.profile-avatar-edit {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 24px;
  height: 24px;
  background-color: var(--black);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--white);
}

.profile-avatar-edit svg {
  width: 12px;
  height: 12px;
  fill: var(--white);
}

.profile-name {
  font-size: 20px;
  font-weight: bold;
}

.profile-phone {
  font-size: 14px;
  color: var(--gray-medium);
  margin-top: 4px;
}

.profile-menu {
  background-color: var(--white);
}

.menu-list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-border);
  color: var(--black);
  font-size: 15px;
}

.menu-list-item:last-child {
  border-bottom: none;
}

.menu-list-item svg {
  width: 20px;
  height: 20px;
  fill: var(--gray-medium);
}

.btn-logout {
  display: block;
  width: calc(100% - 48px);
  margin: 32px auto;
  padding: 14px;
  background-color: var(--white);
  color: var(--ricoh-red);
  text-align: center;
  font-size: 16px;
  font-weight: bold;
  border-radius: 6px;
  border: 1px solid var(--gray-border);
}
.upload-page {
  padding: 16px;
  background-color: var(--white);
  min-height: 100vh;
}

.upload-area {
  width: 100%;
  height: 200px;
  border: 2px dashed var(--gray-border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray-medium);
  background-color: var(--gray-light);
  margin-bottom: 24px;
  position: relative;
  overflow: hidden;
}

.upload-area input[type="file"] {
  position: absolute;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-area svg {
  width: 48px;
  height: 48px;
  fill: var(--gray-medium);
  margin-bottom: 12px;
}

.preview-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 移动端查看大图弹窗 */
.mobile-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: rgba(0, 0, 0, 0.9);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.mobile-modal.show {
  opacity: 1;
  pointer-events: auto;
}

.mobile-modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  z-index: 10;
}

.mobile-modal-close svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.mobile-modal-img {
  max-width: 100%;
  max-height: 70vh;
  object-fit: contain;
  transition: transform 0.2s ease-out;
  flex-shrink: 1;
  min-height: 0;
}

.mobile-modal-info {
  width: 100%;
  padding: 0 20px;
  color: white;
  text-align: center;
  margin-top: 20px;
  box-sizing: border-box;
  flex-shrink: 0;
}

.mobile-modal-title {
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 8px;
}

.mobile-modal-author {
  font-size: 14px;
  color: #ccc;
  margin-bottom: 8px;
}

.mobile-modal-desc {
  font-size: 14px;
  color: #eee;
  line-height: 1.5;
  text-align: left;
  max-height: 100px;
  overflow-y: auto;
  padding: 10px;
  background: rgba(0, 0, 0, 0.5);
  border-radius: 8px;
  margin-top: 10px;
}

/* 我的作品 - 下载预览弹窗（微信内长按保存场景） */
.download-preview-modal {
  /* iOS 微信 WKWebView 兼容：不用 100vh（可能为 0），用 inset:0；
     不用 opacity transition（首帧可能不生效），用 display 硬切换 */
  position: fixed;
  inset: 0;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(0, 0, 0, 0.92);
  z-index: 2000;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  box-sizing: border-box;
}

.download-preview-modal.show {
  display: flex;
}

.download-preview-modal .dp-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  background-color: rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  z-index: 10;
}

.download-preview-modal .dp-close svg {
  width: 24px;
  height: 24px;
  fill: white;
}

.download-preview-modal .dp-tip {
  color: #fff;
  font-size: 14px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  margin-bottom: 16px;
  text-align: center;
}

.download-preview-modal .dp-stage {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  box-sizing: border-box;
}

.download-preview-modal .dp-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  /* 允许 iOS Safari / 微信 WebView 长按弹出保存到相册 */
  -webkit-touch-callout: default;
  touch-callout: default;
  user-select: none;
}

.download-preview-modal .dp-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  color: #fff;
}

.download-preview-modal .dp-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: #fff;
  border-radius: 50%;
  animation: dp-spin 0.8s linear infinite;
}

.download-preview-modal .dp-loading-text {
  font-size: 13px;
  color: #ddd;
}

@keyframes dp-spin {
  to { transform: rotate(360deg); }
}