/* =========================================================
   专属定制工具 - 统一UI框架样式
   根据提供的应用截图高仿还原
   ========================================================= */

:root {
  --primary: #5c52eb;      /* 主色调：蓝紫色 */
  --bg-gray: #f2f3f5;      /* 整体浅灰背景 */
  --bg-white: #ffffff;     /* 卡片白底 */
  --text-main: #333333;    /* 主文字 */
  --text-sub: #999999;     /* 辅助文字 */
  
  --color-green: #2ecc71;  /* 预览效果按钮底色 */
  --color-green-light: #e8f5e9; 
  --color-orange: #f59e0b; /* 增加次数按钮底色 */
  --color-red: #ef4444;    /* 标签红 */
  --color-blue: #3b82f6;   /* 标签蓝 */
  --color-purple: #8b5cf6; /* 标签紫 */
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  background-color: var(--bg-gray);
  -webkit-tap-highlight-color: transparent;
  line-height: 1.5;
}
.bg-gray { background-color: var(--bg-gray); }
a { text-decoration: none; color: inherit; }
button { border: none; outline: none; cursor: pointer; font-family: inherit; }
input, textarea { outline: none; border: none; font-family: inherit; }

.mt-5 { margin-top: 5px; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }

/* =============================================
   1. 浏览器顶部模拟Header (图2/4/11)
   ============================================= */
.app-header {
  background: var(--bg-white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid #eaeaea;
}
.app-header .close-btn { font-size: 18px; color: #333; font-weight: bold; cursor: pointer; width: 30px; }
.app-header .more-btn { font-size: 20px; color: #333; font-weight: bold; cursor: pointer; text-align: right; width: 30px; letter-spacing: 2px; }
.app-header .title-center { text-align: center; flex: 1; }
.app-header .title-center .title { font-size: 16px; font-weight: 600; color: #111; display: block; }
.app-header .title-center .subtitle { font-size: 11px; color: var(--text-sub); display: block; margin-top: 2px;}

/* =============================================
   2. 主页：模板大厅 (index.html, 图1)
   ============================================= */
.banner-container { padding: 10px 15px; }
.banner {
  background: linear-gradient(135deg, #1e3a8a, #312e81);
  border-radius: 12px;
  padding: 20px;
  color: #fff;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.banner h2 { font-size: 18px; margin-bottom: 6px; }
.banner p { font-size: 12px; opacity: 0.8; }

.tabs-container {
  background: var(--bg-white);
  padding: 0 15px;
  border-bottom: 1px solid #eee;
  overflow-x: auto;
  white-space: nowrap;
}
.tabs-container::-webkit-scrollbar { display: none; }
.tabs { display: flex; gap: 24px; }
.tab {
  font-size: 15px;
  color: #666;
  padding: 12px 0;
  position: relative;
  cursor: pointer;
}
.tab.active {
  color: var(--text-main);
  font-weight: bold;
}
.tab.active::after {
  content: '';
  position: absolute;
  bottom: 0; left: 50%; transform: translateX(-50%);
  width: 20px; height: 3px;
  background: var(--primary);
  border-radius: 2px;
}

.template-list { padding: 15px; padding-bottom: 80px; }
.date-group { margin-bottom: 24px; }
.group-title {
  font-size: 15px;
  font-weight: bold;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.group-title .more-link { font-size: 12px; font-weight: normal; color: var(--text-sub); }

.template-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.tpl-item { cursor: pointer; }
.tpl-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1; /* 1:1 正方形 */
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.tpl-img { font-size: 32px; }
.tpl-tag-tr {
  position: absolute;
  top: 0; right: 0;
  font-size: 10px; color: #fff;
  padding: 2px 6px;
  border-radius: 0 12px 0 8px;
  font-weight: bold;
}
.tpl-tag-tr.pink { background: #ec4899; }
.tpl-tag-tr.blue { background: #3b82f6; }
.tpl-tag-tr.orange { background: #f59e0b; }

.tpl-tag-bc {
  position: absolute;
  bottom: 4px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: #fff;
  background: rgba(0,0,0,0.4);
  padding: 2px 8px;
  border-radius: 10px;
  white-space: nowrap;
}
.tpl-name {
  font-size: 12px;
  color: var(--text-main);
  text-align: center;
  margin-top: 8px;
  font-weight: 500;
}

/* 底部制作记录悬浮球 */
.bottom-float-btn {
  position: fixed;
  bottom: 24px; left: 50%; transform: translateX(-50%);
  background: var(--bg-white);
  border: 1px solid #eee;
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  padding: 10px 24px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: bold;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 50;
  cursor: pointer;
}

/* =============================================
   3. 编辑页：定制表单 (edit.html, 图4/5)
   ============================================= */
.edit-container {
  padding: 20px 15px 100px;
  position: relative;
}

/* 悬浮金币标签 */
.coins-badge {
  position: absolute;
  top: 10px; right: 20px;
  background: #fffdf5;
  border: 1px solid #fcd34d;
  color: #b45309;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.15);
  cursor: pointer;
}
.coins-badge .plus-icon {
  background: #f59e0b;
  color: #fff;
  border-radius: 50%;
  width: 14px; height: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: bold;
}

/* 编辑白底卡片 */
.edit-card {
  background: var(--bg-white);
  border-radius: 16px;
  padding: 24px 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.02);
}

.form-group { position: relative; }
.label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.label-row label { font-size: 15px; font-weight: bold; color: #111; }
.tag-outline-blue {
  font-size: 10px; color: var(--primary);
  border: 1px solid rgba(92, 82, 235, 0.3);
  padding: 1px 6px; border-radius: 4px; background: rgba(92, 82, 235, 0.05);
}

/* 输入框 */
.input-wrap, .textarea-wrap {
  background: #f7f8fa;
  border: 1px solid #f0f0f0;
  border-radius: 8px;
  padding: 12px 14px;
  transition: border 0.3s;
}
.input-wrap:focus-within, .textarea-wrap:focus-within { border-color: var(--primary); }
.input-wrap input { width: 100%; background: transparent; font-size: 15px; color: #333; }
.textarea-wrap textarea { width: 100%; background: transparent; font-size: 15px; color: #333; resize: none; }
.help-text { font-size: 11px; color: var(--text-sub); margin-top: 8px; }

/* 插入工具栏 */
.toolbar { display: flex; gap: 12px; margin-top: 12px; }
.tool-btn {
  flex: 1;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 10px 0;
  font-size: 13px;
  color: #475569;
  display: flex; justify-content: center; align-items: center; gap: 6px;
}
.tool-btn .blue { color: var(--primary); }

.dashed-divider {
  height: 1px;
  border-top: 1px dashed #e2e8f0;
  margin: 24px 0;
}

/* 设置区 */
.settings-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.sh-title { font-size: 13px; color: var(--text-sub); }
.sh-restore { font-size: 12px; color: #f59e0b; cursor: pointer; display: flex; align-items: center; gap: 4px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.setting-item {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  cursor: pointer;
}
.si-label { font-size: 13px; font-weight: bold; margin-bottom: 10px; color: #333; }
.si-box {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px;
}
.si-preview {
  width: 48px; height: 48px;
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: #fff;
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.bg-gray-light { background: #e5e7eb; }
.si-text { font-size: 12px; }
.si-text.blue { color: var(--primary); }

/* 操作按钮网格 */
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.col-span-2 { grid-column: span 2; }

.btn {
  padding: 14px 0;
  border-radius: 8px;
  font-size: 14px;
  font-weight: bold;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  cursor: pointer;
  transition: transform 0.1s;
}
.btn:active { transform: scale(0.98); }

.btn-green { background: #e2f3e8; color: #2e8b57; }
.btn-purple { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(92,82,235,0.3); }
.btn-gray { background: #e5e7eb; color: #4b5563; }
.btn-orange { background: #f59e0b; color: #fff; box-shadow: 0 4px 12px rgba(245,158,11,0.3); }
.btn-outline { background: transparent; border: 1px solid var(--primary); color: var(--primary); }
.btn-block { width: 100%; }

/* 客服悬浮 */
.customer-service {
  position: fixed;
  bottom: 30px; right: 15px;
  display: flex; flex-direction: column; align-items: center;
  font-size: 10px; color: var(--text-sub);
  z-index: 50;
  cursor: pointer;
}
.cs-icon {
  width: 40px; height: 40px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  margin-bottom: 4px;
}
.copyright {
  text-align: center; font-size: 11px; color: #bbb;
  margin-top: 30px; margin-bottom: 10px;
}


/* =============================================
   4. 假手机预览页 (preview.html, 图2/3)
   ============================================= */
.fake-phone-wrapper {
  background: #111; /* 背景变黑 */
  height: calc(100vh - 50px);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 15px;
}

.fake-phone-screen {
  width: 92%;
  max-width: 360px;
  height: 75vh;
  background: #000;
  border: 2px solid #333;
  border-radius: 40px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
  display: flex;
  flex-direction: column;
}

/* 状态栏 */
.fp-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 24px;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
  z-index: 10;
}
.fp-notch-title { font-size: 14px; }
.fp-icons { display: flex; gap: 4px; font-size: 14px; }

/* 屏幕内容区 */
.fp-content-area {
  flex: 1;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.fp-heart-pulse {
  font-size: 40px;
  margin-top: 60px;
  animation: pulse 1.5s infinite ease-in-out;
}
@keyframes pulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

/* 微信通知卡片 */
.fp-wechat-msg {
  background: rgba(255,255,255,0.95);
  width: 90%;
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}
.fp-wm-body { flex: 1; }
.fp-wm-title { font-size: 13px; font-weight: bold; color: #333; margin-bottom: 2px; }
.fp-wm-desc { font-size: 11px; color: #666; }
.fp-wm-action { font-size: 10px; color: #999; text-align: center; border-left: 1px solid #eee; padding-left: 10px; }

/* 吐司提示 */
.fp-toast {
  position: absolute;
  top: 50%; left: 50%; transform: translate(-50%, -50%);
  background: rgba(40,40,40,0.95);
  color: #fff;
  padding: 20px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.3s;
}
.fp-toast-icon { font-size: 24px; color: #2ecc71; }

/* 底部功能坞 */
.fp-dock {
  display: flex;
  gap: 30px;
  margin-top: 25px;
}
.dock-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.dock-icon {
  width: 50px; height: 50px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; color: white;
}
.dock-text { font-size: 12px; color: #999; }

.bg-wechat { background: #07c160; }
.bg-red { background: #ef4444; }
.bg-blue { background: #3b82f6; }


/* =============================================
   5. 弹窗模块 (Modals)
   ============================================= */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.6);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s;
}
.modal-overlay.show { display: flex; }
@keyframes fadeIn { from{opacity:0;} to{opacity:1;} }

.modal-box {
  background: #fff;
  width: 85%;
  max-width: 320px;
  border-radius: 16px;
  padding: 24px 20px;
  position: relative;
  text-align: center;
}
.modal-close {
  position: absolute;
  top: 15px; right: 15px;
  font-size: 18px; color: #999; cursor: pointer;
}
.modal-header { font-size: 18px; font-weight: bold; color: #111; margin-bottom: 8px; }

/* 支付弹窗 (图8) */
.modal-sub { font-size: 13px; color: #666; margin-bottom: 20px; }
.modal-sub .blue { color: var(--primary); font-size: 16px; }

.pay-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 16px;
}
.pay-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px 0;
  position: relative;
  cursor: pointer;
  transition: all 0.2s;
}
.pay-card.active { border-color: var(--primary); background: rgba(92,82,235,0.05); }
.pay-tag {
  position: absolute;
  top: 0; right: 0;
  color: #fff; font-size: 10px;
  padding: 2px 6px;
  border-radius: 0 10px 0 8px;
}
.bg-blue { background: #3b82f6; }
.bg-purple { background: #8b5cf6; }
.bg-orange { background: #f59e0b; }
.bg-red { background: #ef4444; }

.pay-times { font-size: 18px; font-weight: bold; color: #111; margin-top: 6px; margin-bottom: 4px; }
.pay-price { font-size: 13px; color: var(--primary); }
.pay-hint { font-size: 11px; color: #999; margin-bottom: 10px; }

/* 无记录弹窗 (图10) */
.modal-text { font-size: 14px; color: #666; margin-top: 10px; }

/* 功能说明弹窗 (图12/13) */
.func-preview {
  border-radius: 12px;
  overflow: hidden;
  margin: 16px 0;
  height: 140px;
  display: flex; align-items: center; justify-content: center;
}
.func-desc { text-align: left; font-size: 13px; color: #333; line-height: 1.6; }
.func-desc .red { color: #ef4444; }
.func-desc .gray { color: #999; }
.func-desc .small { font-size: 11px; }
.func-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 20px; }


/* 全屏弹窗 (图6/7) */
.modal-full {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg-gray);
  z-index: 1000;
  display: none;
  flex-direction: column;
}
.modal-full.show { display: flex; }
.modal-full-header {
  background: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid #eee;
}
.modal-full-header .close-btn { font-size: 18px; cursor: pointer; color: #666;}
.modal-full-header .title { font-size: 16px; font-weight: bold; }
.modal-full-header .placeholder { width: 18px; }

.modal-full-body { flex: 1; overflow-y: auto; padding: 15px; background: #fff; }
.upload-btn-bar {
  text-align: center; font-size: 14px; margin-bottom: 20px; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.upload-btn-bar .blue { color: var(--color-blue); }

.resource-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.resource-item {
  aspect-ratio: 9/16;
  border-radius: 8px;
  border: 2px solid transparent;
}
.resource-item.active { border-color: var(--primary); }

.music-list { display: flex; flex-direction: column; gap: 16px; }
.music-item {
  display: flex; align-items: center; gap: 12px; border-bottom: 1px solid #f0f0f0; padding-bottom: 12px;
}
.music-icon { font-size: 18px; }
.music-name { flex: 1; font-size: 14px; color: #333; }
.music-tag { font-size: 12px; border: 1px solid; border-radius: 4px; padding: 2px 8px; }
.music-item.active .music-name { color: var(--primary); font-weight: bold;}
.music-item.active .music-tag.blue { border-color: var(--primary); color: var(--primary); }
.music-item .music-tag.gray { border-color: #ccc; color: #999; }
