/* /public/tpb/css/vote.css - 班级颜值人气投票样式 */

:root {
  --bg: #fff8e1;
  --primary: #5d4037;
  --primary-light: #efebe9;
  --primary-dark: #3e2723;
  --accent: #ffd54f;
  --gold: #ffd700;
  --silver: #c0c0c0;
  --bronze: #cd7f32;
  --text: #333;
  --text-light: #888;
  --card-bg: #fff;
  --shadow: 0 4px 15px rgba(0,0,0,0.06);
  --shadow-hover: 0 8px 25px rgba(0,0,0,0.12);
  --radius: 16px;
  --border: #f0e0d6;
}

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

/* 去除蓝色高亮，改为适配主题色 */
* {
  -webkit-tap-highlight-color: rgba(93, 64, 55, 0.15);
}

a, button, input, textarea, select, [onclick], [role="button"] {
  -webkit-tap-highlight-color: rgba(93, 64, 55, 0.15);
  outline: none;
}

button:focus, a:focus, input:focus, textarea:focus, select:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(93, 64, 55, 0.2);
}

body {
  background: var(--bg);
  font-family: "Segoe UI", "PingFang SC", sans-serif;
  color: var(--text);
  min-height: 100vh;
}

/* 侧边栏 - 与common.css保持一致 */
.sidebar-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.3);
  z-index: 998;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s;
}
.sidebar-overlay.show { opacity: 1; visibility: visible; }
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 280px;
  height: 100vh;
  background: var(--card-bg);
  box-shadow: 0 0 20px rgba(0,0,0,0.1);
  z-index: 999;
  transition: transform 0.3s ease;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  transform: translateX(-100%);
}
.sidebar.open { transform: translateX(0); }
.sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem; border-bottom: 1px solid var(--border); }
.sidebar-title { color: var(--primary); font-weight: 600; font-size: 1.1rem; }
.sidebar-close { background: none; border: none; font-size: 1.5rem; color: var(--text-secondary, #999); cursor: pointer; }
.sidebar-menu { padding: 1rem 0; }
.sidebar-item { display: flex; align-items: center; gap: 0.6rem; padding: 1rem 1.5rem; color: var(--text); text-decoration: none; transition: all 0.2s; font-size: 1rem; }
.sidebar-item:hover { background: #f8f4ed; color: var(--primary); padding-left: 1.8rem; }
.sidebar-item.active { background: #fff8e1; color: var(--primary); font-weight: 600; border-left: 3px solid var(--accent); }
.sidebar-item .nav-icon { width: 22px; height: 22px; object-fit: contain; flex-shrink: 0; opacity: 0.7; }
.sidebar-item.active .nav-icon, .sidebar-item:hover .nav-icon { opacity: 1; }
.nav-icon { width: 20px; height: 20px; vertical-align: middle; }

/* 主页面 */
.tpb-page { max-width: 800px; margin: 0 auto; padding: 0 1rem; }

/* 顶部 */
.tpb-header { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; margin-bottom: 1rem; }
.tpb-title { font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.menu-toggle { background: none; border: none; font-size: 1.6rem; cursor: pointer; color: var(--text); }
.tpb-header-actions { display: flex; gap: 0.5rem; }
.tpb-btn-submit { padding: 0.5rem 1.2rem; background: var(--primary); color: #fff; border: none; border-radius: 20px; font-size: 0.9rem; cursor: pointer; transition: all 0.2s; }
.tpb-btn-submit:hover { background: #d4445a; transform: translateY(-1px); }
.tpb-btn-login { padding: 0.5rem 1.2rem; background: var(--primary); color: #fff; border-radius: 20px; font-size: 0.9rem; text-decoration: none; display: inline-block; }

/* 分类按钮 - 2x2网格卡片 */
.tpb-cat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.tpb-cat-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 0.6rem;
  background: #fffef9;
  border: 2px solid rgba(200,180,150,0.25);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.25s ease;
  box-shadow: 0 2px 8px rgba(93,64,55,0.05);
  -webkit-tap-highlight-color: transparent;
}

.tpb-cat-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(93,64,55,0.12);
  border-color: rgba(161,136,127,0.4);
}

/* 图标 */
.cat-icon {
  width: 26px;
  height: 26px;
  object-fit: contain;
  flex-shrink: 0;
  transition: transform 0.25s;
  opacity: 0.85;
}

.tpb-cat-btn:hover .cat-icon {
  opacity: 1;
  transform: scale(1.06);
}

.tpb-cat-btn.active .cat-icon {
  opacity: 1;
}

/* 文字 */
.cat-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: #5d4037;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

/* 选中激活状态：浅暖底色 + 主题色边框 */
.tpb-cat-btn.active {
  background: rgba(255,213,79,0.15);
  border-color: #8d6e63;
  border-width: 2.5px;
  box-shadow: 0 2px 12px rgba(141,110,99,0.15);
}

.tpb-cat-btn.active .cat-name {
  font-weight: 700;
  color: #4e342e;
}

/* 投票提示 */
.tpb-vote-tip { text-align: center; padding: 0.6rem; background: var(--primary-light); border-radius: 10px; margin-bottom: 1.5rem; font-size: 0.9rem; color: var(--primary); }
.tpb-vote-tip a { color: var(--primary); font-weight: 600; }

/* 总人数 */
.tpb-total { text-align: center; color: var(--text-light); font-size: 0.9rem; margin-bottom: 1rem; }

/* 卡片列表 */
.tpb-cards { display: flex; flex-direction: column; gap: 1.2rem; }

/* 选手卡片 */
.tpb-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 1rem;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  border: 1px solid var(--border);
}
.tpb-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }

/* 排名数字 */
.tpb-rank-num { font-size: 1.4rem; font-weight: 700; color: #bbb; min-width: 30px; text-align: center; }

/* 皇冠标识 */
.tpb-crown { position: absolute; top: -8px; right: 15px; width: 30px; height: 30px; }
.tpb-crown-1 { background: var(--gold); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 0 12px rgba(255,215,0,0.6); }
.tpb-crown-2 { background: var(--silver); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 0 8px rgba(192,192,192,0.4); }
.tpb-crown-3 { background: var(--bronze); border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 0 6px rgba(205,127,50,0.3); }

/* 前三名专属样式 */
.tpb-rank-1 { border: 2px solid var(--gold); background: linear-gradient(135deg, #fff9e6 0%, #fff 50%); }
.tpb-rank-1 .tpb-rank-num { color: var(--gold); font-size: 1.8rem; }
.tpb-rank-1 .tpb-vote-count { color: var(--gold); font-weight: 700; }

.tpb-rank-2 { border: 2px solid var(--silver); background: linear-gradient(135deg, #f5f5f5 0%, #fff 50%); }
.tpb-rank-2 .tpb-rank-num { color: var(--silver); font-size: 1.6rem; }

.tpb-rank-3 { border: 2px solid var(--bronze); background: linear-gradient(135deg, #fef0e0 0%, #fff 50%); }
.tpb-rank-3 .tpb-rank-num { color: var(--bronze); }

/* 照片 */
.tpb-photo { width: 70px; height: 70px; border-radius: 50%; overflow: hidden; flex-shrink: 0; border: 2px solid var(--border); }
.tpb-rank-1 .tpb-photo { border-color: var(--gold); }
.tpb-rank-2 .tpb-photo { border-color: var(--silver); }
.tpb-rank-3 .tpb-photo { border-color: var(--bronze); }
.tpb-photo img { width: 100%; height: 100%; object-fit: cover; }
.tpb-photo-empty { background: var(--primary-light); display: flex; align-items: center; justify-content: center; }
.tpb-photo-empty img { width: 30px; height: 30px; }

/* 信息区 */
.tpb-info { flex: 1; min-width: 0; }
.tpb-name { font-size: 1.1rem; font-weight: 600; color: var(--text); margin-bottom: 0.3rem; }
.tpb-badge { display: inline-block; padding: 0.15rem 0.5rem; border-radius: 10px; font-size: 0.75rem; margin-left: 0.3rem; }
.tpb-badge-gold { background: linear-gradient(135deg, #ffd700, #ffaa00); color: #fff; }
.tpb-bio { font-size: 0.85rem; color: var(--text-light); margin-bottom: 0.3rem; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tpb-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.tpb-tag { padding: 0.15rem 0.5rem; background: var(--primary-light); color: var(--primary); border-radius: 8px; font-size: 0.75rem; }

/* 票数 & 进度条 */
.tpb-vote-area { min-width: 100px; text-align: center; }
.tpb-vote-count { font-size: 1rem; font-weight: 600; color: var(--primary); margin-bottom: 0.4rem; }
.tpb-progress { height: 6px; background: #eee; border-radius: 3px; margin-bottom: 0.5rem; overflow: hidden; }
.tpb-progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), #8d6e63); border-radius: 3px; transition: width 0.5s; }
.tpb-rank-1 .tpb-progress-bar { background: linear-gradient(90deg, var(--gold), #ffaa00); }

/* 投票按钮 */
.tpb-btn-vote {
  padding: 0.4rem 1rem;
  background: var(--primary);
  color: #fff;
  border: none;
  border-radius: 15px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
}
.tpb-btn-vote:hover:not(:disabled) { background: #d4445a; transform: translateY(-1px); }
.tpb-btn-vote:disabled { background: #ccc; cursor: not-allowed; }
.tpb-voted { background: #4caf50; }
.tpb-btn-disabled { background: #bbb; }

/* 弹窗 */
.tpb-modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.tpb-modal-content { background: var(--card-bg); border-radius: var(--radius); padding: 1.5rem; max-width: 500px; width: 90%; max-height: 90vh; overflow-y: auto; }
.tpb-modal-small { max-width: 300px; }
.tpb-modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-size: 1.2rem; font-weight: 700; }
.tpb-modal-close { background: none; border: none; font-size: 1.4rem; cursor: pointer; color: #999; }

/* 表单 */
.tpb-form-group { margin-bottom: 1rem; }
.tpb-form-group label { display: block; font-weight: 600; margin-bottom: 0.3rem; font-size: 0.9rem; }
.tpb-form-group input, .tpb-form-group select, .tpb-form-group textarea {
  width: 100%; padding: 0.6rem 0.8rem; border: 1px solid var(--border); border-radius: 8px; font-size: 0.9rem; transition: border 0.2s;
}
.tpb-form-group input:focus, .tpb-form-group select:focus, .tpb-form-group textarea:focus { border-color: var(--primary); outline: none; }
.tpb-form-group textarea { resize: vertical; min-height: 60px; }

/* 上传区 */
.tpb-upload-area { border: 2px dashed var(--border); border-radius: 10px; padding: 1rem; text-align: center; cursor: pointer; transition: border 0.2s; }
.tpb-upload-area:hover { border-color: var(--primary); }
.tpb-upload-hint { display: flex; align-items: center; justify-content: center; gap: 0.5rem; color: var(--text-light); font-size: 0.9rem; }

/* 提交按钮 */
.tpb-btn-submit-final { width: 100%; padding: 0.8rem; background: var(--primary); color: #fff; border: none; border-radius: 10px; font-size: 1rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.tpb-btn-submit-final:hover { background: #d4445a; }
.tpb-btn-submit-final:disabled { background: #ccc; cursor: not-allowed; }

/* 登录引导 */
.tpb-login-hint { text-align: center; padding: 1rem; }
.tpb-login-hint p { margin-bottom: 1rem; color: var(--text-light); }

/* 加载 & 空状态 */
.tpb-loading { text-align: center; padding: 3rem; color: var(--text-light); }
.spinner { width: 30px; height: 30px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 0 auto 1rem; }
@keyframes spin { to { transform: rotate(360deg); } }
.tpb-empty { text-align: center; padding: 3rem; color: var(--text-light); }
.tpb-empty img { width: 40px; height: 40px; margin-bottom: 0.5rem; }

/* Toast */
.tpb-toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); padding: 10px 20px; border-radius: 8px; color: #fff; font-size: 0.9rem; z-index: 9999; transition: opacity 0.3s; }
.tpb-toast-success { background: #4caf50; }
.tpb-toast-error { background: #e53935; }

/* 响应式 */
@media (max-width: 600px) {
  .tpb-title { font-size: 1.3rem; }
  .tpb-cat-grid { gap: 0.6rem; }
  .tpb-cat-btn { padding: 0.8rem 0.5rem; gap: 0.4rem; }
  .cat-icon { width: 24px; height: 24px; }
  .cat-name { font-size: 0.82rem; }
  .tpb-card { padding: 0.8rem; gap: 0.6rem; }
  .tpb-photo { width: 55px; height: 55px; }
  .tpb-vote-area { min-width: 80px; }
  .tpb-name { font-size: 1rem; }
  .tpb-bio { font-size: 0.8rem; }
}