/* ===== 全局重置 ===== */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: #f5f5f7;
  color: #1a1a1a;
  -webkit-font-smoothing: antialiased;
}

/* ===== 登录页 ===== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 100%);
  padding: 20px;
}

.login-card {
  background: #fff;
  border-radius: 20px;
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.login-header {
  margin-bottom: 32px;
}

.logo-icon {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}

.login-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
}

.subtitle {
  color: #888;
  font-size: 14px;
}

/* QR 码区域 */
.qr-wrapper {
  position: relative;
  display: inline-block;
  margin: 0 auto;
}

.qr-container {
  width: 280px;
  height: 280px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid #eee;
  border-radius: 12px;
  overflow: hidden;
}

.qr-image {
  width: 280px;
  height: 280px;
  border-radius: 12px;
  transition: transform 0.2s;
}

.qr-image:hover {
  transform: scale(1.02);
}

.qr-loading {
  text-align: center;
  color: #999;
}

.qr-loading p {
  font-size: 14px;
  margin-top: 12px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #eee;
  border-top-color: #07C160;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

.qr-mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 280px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.qr-expired p {
  color: #999;
  margin-bottom: 16px;
  font-size: 15px;
}

.refresh-btn {
  padding: 10px 28px;
  background: #07C160;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.2s;
}

.refresh-btn:hover {
  background: #06a551;
}

.qr-tip {
  margin-top: 24px;
  font-size: 15px;
  color: #333;
}

.wechat-text {
  color: #07C160;
  font-weight: 600;
}

.qr-hint {
  margin-top: 8px;
  font-size: 12px;
  color: #bbb;
}

.login-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 13px;
  color: #999;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #ddd;
}

.status-dot.waiting {
  background: #faad14;
  animation: pulse 1.5s ease-in-out infinite;
}

.status-dot.expired {
  background: #ff6b6b;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* 登录成功 */
.success-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
}

.success-icon {
  margin-bottom: 24px;
}

.success-view h2 {
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 8px;
}

.welcome-text {
  color: #888;
  font-size: 14px;
  margin-bottom: 24px;
}

.redirect-loader {
  width: 120px;
  height: 3px;
  background: #eee;
  border-radius: 2px;
  overflow: hidden;
  position: relative;
}

.redirect-loader::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 40%;
  height: 100%;
  background: #07C160;
  border-radius: 2px;
  animation: slide 1.5s ease-in-out infinite;
}

@keyframes slide {
  0% { left: -40%; }
  100% { left: 100%; }
}

.error-text {
  color: #ff6b6b;
  font-size: 14px;
}

/* ===== 投票页 ===== */
.vote-container {
  min-height: 100vh;
  background: #f5f5f7;
  padding: 20px;
}

.user-bar {
  max-width: 600px;
  margin: 0 auto 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fff;
  padding: 12px 20px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

#user-name {
  font-size: 14px;
  font-weight: 500;
}

.logout-btn {
  padding: 6px 16px;
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 13px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.logout-btn:hover {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

.vote-card {
  display: none;
  max-width: 600px;
  margin: 0 auto;
  background: #fff;
  border-radius: 20px;
  padding: 40px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.vote-header {
  text-align: center;
  margin-bottom: 32px;
}

.vote-badge {
  display: inline-block;
  padding: 4px 12px;
  background: #fff0e6;
  color: #fa8c16;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 12px;
}

.vote-header h1 {
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 8px;
}

.vote-desc {
  color: #888;
  font-size: 14px;
}

/* 投票选项 */
.vote-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
}

.vote-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: #f8f8fa;
  border: 2px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 16px;
  text-align: left;
  width: 100%;
  font-family: inherit;
}

.vote-option:hover {
  background: #f0f0f5;
  border-color: #07C160;
  transform: translateX(4px);
}

.vote-option.voted {
  cursor: default;
  background: #f8f8fa;
}

.vote-option.voted:hover {
  transform: none;
  border-color: transparent;
}

.vote-option.my-choice {
  background: #f0fff4;
  border-color: #07C160;
}

.option-emoji {
  font-size: 24px;
}

.option-label {
  flex: 1;
  font-weight: 500;
}

.option-arrow {
  color: #ccc;
  transition: transform 0.2s;
}

.vote-option:hover .option-arrow {
  color: #07C160;
  transform: translateX(4px);
}

.my-vote-tag {
  padding: 2px 10px;
  background: #07C160;
  color: #fff;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
}

/* 投票结果 */
.vote-results {
  border-top: 1px solid #eee;
  padding-top: 24px;
}

.results-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: #333;
}

.results-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 20px;
}

.result-item {
  position: relative;
}

.result-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.result-emoji {
  font-size: 18px;
}

.result-label {
  font-size: 14px;
  font-weight: 500;
  flex: 1;
}

.my-tag {
  padding: 1px 8px;
  background: #07C160;
  color: #fff;
  border-radius: 8px;
  font-size: 11px;
}

.result-count {
  font-size: 13px;
  color: #888;
}

.result-bar-container {
  width: 100%;
  height: 8px;
  background: #f0f0f5;
  border-radius: 4px;
  overflow: hidden;
}

.result-bar {
  height: 100%;
  background: linear-gradient(90deg, #07C160, #5BABFB);
  border-radius: 4px;
  transition: width 0.5s ease;
}

.result-item.my-choice .result-bar {
  background: linear-gradient(90deg, #07C160, #faad14);
}

.result-percentage {
  font-size: 12px;
  color: #aaa;
  margin-top: 2px;
  display: block;
}

.results-total {
  text-align: center;
  font-size: 14px;
  color: #888;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

#total-votes {
  font-weight: 700;
  color: #07C160;
  font-size: 18px;
}

.refresh-results-btn {
  padding: 4px 12px;
  background: transparent;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  transition: all 0.2s;
}

.refresh-results-btn:hover {
  border-color: #07C160;
  color: #07C160;
}

/* 未登录提示 */
.auth-required {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 400px;
  max-width: 600px;
  margin: 0 auto;
  background: #fff;
  border-radius: 20px;
  padding: 60px 40px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.06);
}

.auth-icon {
  margin-bottom: 20px;
}

.auth-required h2 {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.auth-required p {
  color: #888;
  font-size: 14px;
  margin-bottom: 24px;
}

.login-link {
  display: inline-block;
  padding: 12px 32px;
  background: #07C160;
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  transition: background 0.2s;
}

.login-link:hover {
  background: #06a551;
}

/* ===== Mock 微信确认页 ===== */
.mock-wechat-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ededed 0%, #f5f5f7 100%);
  padding: 20px;
}

.mock-wechat-card {
  background: #fff;
  border-radius: 16px;
  padding: 40px 32px;
  width: 100%;
  max-width: 360px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.mw-header {
  margin-bottom: 32px;
}

.mw-logo {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.mw-header h2 {
  font-size: 18px;
  font-weight: 600;
  color: #333;
}

.mw-confirm-view,
.mw-success-view,
.mw-error-view {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.mw-site-info {
  margin-bottom: 24px;
}

.mw-site-icon {
  width: 64px;
  height: 64px;
  background: #f0fff4;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}

.mw-site-name {
  font-size: 16px;
  font-weight: 600;
  color: #333;
}

.mw-warning {
  margin-bottom: 32px;
}

.mw-warning p {
  font-size: 16px;
  color: #333;
  font-weight: 500;
  margin-bottom: 4px;
}

.mw-sub-text {
  font-size: 13px;
  color: #999;
  font-weight: 400;
}

.mw-buttons {
  display: flex;
  gap: 12px;
  width: 100%;
  margin-bottom: 24px;
}

.mw-cancel-btn {
  flex: 1;
  padding: 12px;
  background: #f5f5f7;
  color: #666;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.mw-cancel-btn:hover {
  background: #e8e8ed;
}

.mw-confirm-btn {
  flex: 1;
  padding: 12px;
  background: #07C160;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  font-family: inherit;
}

.mw-confirm-btn:hover {
  background: #06a551;
}

.mw-confirm-btn:disabled {
  background: #a0d8b9;
  cursor: not-allowed;
}

.mw-tip {
  font-size: 12px;
  color: #ccc;
}

/* 成功状态 */
.mw-success-icon {
  margin-bottom: 16px;
}

.mw-success-text {
  font-size: 18px;
  font-weight: 600;
  color: #07C160;
  margin-bottom: 8px;
}

.mw-success-hint {
  font-size: 14px;
  color: #888;
}

/* 错误状态 */
.mw-error-icon {
  margin-bottom: 16px;
}

.mw-error-text {
  font-size: 18px;
  font-weight: 600;
  color: #ff6b6b;
  margin-bottom: 8px;
}

.mw-error-hint {
  font-size: 14px;
  color: #888;
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
  .login-card {
    padding: 32px 24px;
  }

  .vote-card {
    padding: 28px 20px;
  }

  .qr-container {
    width: 240px;
    height: 240px;
  }

  .qr-image {
    width: 240px;
    height: 240px;
  }

  .qr-mask {
    height: 240px;
  }
}
