/* global.css - H5全局样式（从app.wxss转换，rpx→vw换算：1rpx≈0.1333vw） */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary: #FF6B9D;
  --primary-light: #FF8FB3;
  --primary-dark: #E8527F;
  --secondary: #7C5CFC;
  --secondary-light: #9B82FF;
  --accent: #FFD93D;
  --accent-dark: #F5C518;
  --success: #4ECDC4;
  --danger: #FF6B6B;
  --info: #45B7D1;
  --gold: #FFD700;
  --silver: #C0C0C0;

  --bg-page: transparent;
  --bg-card: rgba(255, 255, 255, 0.12);
  --bg-input: rgba(255, 255, 255, 0.15);

  --text-primary: #FFFFFF;
  --text-secondary: rgba(255, 255, 255, 0.75);
  --text-placeholder: rgba(255, 255, 255, 0.45);

  --border-color: rgba(255, 255, 255, 0.2);
  --shadow-color: rgba(0, 0, 0, 0.3);
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: var(--text-primary);
  background: linear-gradient(180deg, #0a0612 0%, #12082a 40%, #0d0520 70%, #06020e 100%);
  background-size: cover;
  background-attachment: fixed;
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, button, select { font-family: inherit; font-size: inherit; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

/* ============ 容器 ============ */
.app-container { min-height: 100vh; }
.page-container { min-height: 100vh; background: transparent; padding-bottom: 70px; position: relative; }
.page-container--no-tab { padding-bottom: 20px; }

/* ============ 卡片 ============ */
.card {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 12px;
  padding: 16px;
  margin: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.2);
  position: relative;
  overflow: hidden;
}
.card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--secondary), var(--accent));
  border-radius: 12px 12px 0 0;
}

/* ============ 按钮 ============ */
.btn-primary {
  width: 100%;
  height: 48px;
  line-height: 48px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 700;
  border-radius: 24px;
  text-align: center;
  border: none;
  position: relative;
  overflow: hidden;
  letter-spacing: 2px;
  cursor: pointer;
  -webkit-appearance: none;
}
.btn-primary::after {
  content: '';
  position: absolute;
  top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: linear-gradient(45deg, transparent 40%, rgba(255,255,255,0.15) 50%, transparent 60%);
  animation: btnShine 3s infinite;
}
@keyframes btnShine { 0% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }

.btn-primary.disabled, .btn-primary:disabled {
  background: #DDD;
  color: #999;
  pointer-events: none;
}
.btn-primary.disabled::after, .btn-primary:disabled::after { display: none; }

.btn-secondary {
  width: 100%;
  height: 48px;
  line-height: 48px;
  background: linear-gradient(135deg, var(--secondary), var(--secondary-light));
  color: #FFFFFF;
  font-size: 16px;
  font-weight: 700;
  border-radius: 24px;
  text-align: center;
  border: none;
  cursor: pointer;
  -webkit-appearance: none;
}

/* ============ 表单 ============ */
.form-group { margin-bottom: 14px; }
.form-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
}
.form-label .required { color: var(--danger); margin-left: 3px; font-size: 14px; }

.form-input {
  width: 100%;
  height: 44px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
  color: #FFFFFF;
  box-sizing: border-box;
  transition: border-color 0.3s;
  -webkit-appearance: none;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(255, 107, 157, 0.2);
  outline: none;
}
.form-input::placeholder { color: var(--text-placeholder); }

.form-textarea {
  width: 100%;
  min-height: 80px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  color: #FFFFFF;
  box-sizing: border-box;
  resize: vertical;
}
.form-textarea::placeholder { color: var(--text-placeholder); }

/* ============ 性别选择 ============ */
.gender-picker { display: flex; gap: 12px; }
.gender-option {
  flex: 1;
  height: 40px;
  line-height: 40px;
  text-align: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  font-size: 14px;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.3s;
  cursor: pointer;
}
.gender-option.active {
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  border-color: var(--primary);
  color: #FFFFFF;
  font-weight: 700;
  transform: scale(1.05);
}

/* ============ 等级选择 ============ */
.level-picker { display: flex; gap: 10px; }
.level-option {
  flex: 1;
  height: 40px;
  line-height: 40px;
  text-align: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  transition: all 0.3s;
  cursor: pointer;
}
.level-option.active--normal { background: linear-gradient(135deg, #B0BEC5, #90A4AE); border-color: #90A4AE; color: #FFFFFF; font-weight: 700; }
.level-option.active--silver { background: linear-gradient(135deg, #E0E0E0, #BDBDBD); border-color: #BDBDBD; color: #424242; font-weight: 700; }
.level-option.active--gold { background: linear-gradient(135deg, var(--accent), var(--gold)); border-color: var(--gold); color: #5D4037; font-weight: 700; }

/* ============ 头像上传 ============ */
.avatar-upload {
  width: 80px; height: 80px;
  border-radius: 50%;
  border: 2px dashed var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  overflow: hidden;
  margin: 0 auto;
  transition: border-color 0.3s;
  cursor: pointer;
}
.avatar-upload:active { border-color: var(--primary); }
.avatar-upload img { width: 100%; height: 100%; object-fit: cover; }
.avatar-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-placeholder);
  font-size: 11px;
}
.avatar-placeholder .icon { font-size: 24px; margin-bottom: 3px; }

/* ============ 图片上传 ============ */
.upload-area { display: flex; flex-wrap: wrap; gap: 8px; }
.upload-item {
  width: 80px; height: 80px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
}
.upload-item img { width: 100%; height: 100%; object-fit: cover; }
.upload-add {
  width: 80px; height: 80px;
  border-radius: 8px;
  border: 1px dashed var(--border-color);
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-placeholder);
  font-size: 24px;
  cursor: pointer;
}

/* ============ 装饰/标题 ============ */
.section-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  padding: 12px 16px 4px;
  display: flex;
  align-items: center;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 4px; height: 14px;
  background: var(--primary);
  border-radius: 2px;
  margin-right: 6px;
}

/* ============ 空状态 ============ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}
.empty-icon { font-size: 60px; margin-bottom: 10px; }
.empty-text { font-size: 14px; color: var(--text-secondary); }

/* ============ 链接 ============ */
.link-text {
  color: var(--primary);
  font-size: 14px;
  text-align: center;
  padding: 10px;
  cursor: pointer;
}
.link-text:active { opacity: 0.7; }

/* ============ Tab标签 ============ */
.tag-tabs { display: flex; gap: 8px; padding: 0 12px; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
.tag-tabs::-webkit-scrollbar { display: none; }
.tag-tab {
  height: 32px;
  line-height: 32px;
  padding: 0 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.7);
  font-size: 13px;
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s;
  cursor: pointer;
}
.tag-tab.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #FFFFFF;
  font-weight: 700;
  border-color: var(--primary);
  transform: scale(1.05);
}

/* ============ 动画 ============ */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}
.animate-in { animation: fadeInUp 0.4s ease-out; }

/* ============ 主题系统 ============ */
.theme-dark { background: #0f0f1a !important; }
.theme-purple { background: #f3f0ff !important; }
.theme-emerald { background: #f0fdf4 !important; }

/* ============ Splash/Loading ============ */
.splash-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, #0a0612 0%, #12082a 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
}
.splash-logo {
  font-size: 28px;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: 4px;
}
.splash-loading {
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.page-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
}
.page-loading-spinner {
  width: 36px; height: 36px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.page-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  padding: 20px;
}
.page-error-icon { font-size: 48px; margin-bottom: 12px; }
.page-error-text { font-size: 14px; color: var(--text-secondary); margin-bottom: 16px; }
.page-error-btn {
  padding: 8px 24px;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
}

/* ============ 安全区域适配 ============ */
.safe-area-bottom { padding-bottom: env(safe-area-inset-bottom); }

/* ============ PC端响应式适配 ============ */
@media screen and (min-width: 768px) {
  html { font-size: 18px; }
  body {
    max-width: 480px;
    margin: 0 auto;
    box-shadow: 0 0 40px rgba(0,0,0,0.5);
    min-height: 100vh;
    position: relative;
  }
  .app-container {
    max-width: 480px;
    margin: 0 auto;
  }
  .tabbar {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
  .toast-container {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
  .modal-overlay {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
  .actionsheet-overlay {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
  .image-preview-overlay {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
  .splash-screen {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
  /* 页面容器 */
  .page-container {
    max-width: 480px;
    margin: 0 auto;
  }
  /* 固定头部 */
  .fixed-header {
    max-width: 480px;
    left: 50%;
    transform: translateX(-50%);
  }
}

/* 超宽屏也保持同样宽度 */
@media screen and (min-width: 1200px) {
  body { max-width: 480px; }
  .app-container { max-width: 480px; }
}

/* ============ ICP备案底部 ============ */
.icp-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  text-align: center;
  padding: 8px 0;
  background: rgba(10, 6, 18, 0.9);
  z-index: 998;
  font-size: 12px;
}
.icp-footer a {
  color: rgba(255, 255, 255, 0.45);
  text-decoration: none;
}
.icp-footer a:hover {
  color: rgba(255, 255, 255, 0.7);
}
