/* R128 社区活动报名工具H5 · style.css */

:root {
  --primary-color: #FF8C42;
  --primary-hover: #E67A35;
  --bg-color: #FFF8F0;
  --card-bg: #FFFFFF;
  --text-primary: #2D2D2D;
  --text-secondary: #8B7355;
  --success-color: #4CAF50;
  --warning-color: #FF6B6B;
  --info-color: #5B9BD5;
  --border-color: #F0E6DC;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.14);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --contact-footer-h: 72px;
  --cta-bar-h: 56px;
  --font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-family);
  background: var(--bg-color);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}
body.has-contact-footer {
  padding-bottom: calc(var(--contact-footer-h) + env(safe-area-inset-bottom));
}
body.has-contact-footer.has-cta-bar {
  padding-bottom: calc(var(--contact-footer-h) + var(--cta-bar-h) + env(safe-area-inset-bottom));
}
body.has-contact-footer .zw-root .zw-fab {
  bottom: calc(var(--contact-footer-h) + 12px + env(safe-area-inset-bottom));
}
.hidden { display: none !important; }
button, input, select, textarea { font-family: inherit; }
a { color: inherit; text-decoration: none; }

/* Header */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
}
.app-header h1 { font-size: 1rem; font-weight: 700; }
.header-actions { display: flex; align-items: center; gap: 6px; }
.theme-select {
  font-size: 0.7rem;
  padding: 4px 6px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--card-bg);
  max-width: 88px;
}
.icon-btn {
  width: 34px; height: 34px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: var(--card-bg);
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.back-link { font-size: 0.9rem; color: var(--primary-color); font-weight: 600; }

/* Hero */
.hero {
  height: 52vh;
  min-height: 280px;
  max-height: 420px;
  position: relative;
  overflow: hidden;
}
.hero-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.72) 0%, rgba(0,0,0,0.15) 55%, transparent 100%);
}
.hero-content {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 1.5rem 1.25rem 2rem;
  color: #fff;
}
.hero-title { font-size: 1.6rem; font-weight: 700; margin-bottom: 0.35rem; }
.hero-meta { font-size: 0.88rem; opacity: 0.92; line-height: 1.5; }
.hero-cta {
  margin-top: 1rem;
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 0.7rem 1.6rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  animation: btnPulse 2s ease infinite;
}
.anim-hero { animation: heroFadeIn 0.6s ease both; }

/* Countdown */
.countdown { display: flex; gap: 0.5rem; margin-top: 1rem; flex-wrap: wrap; }
.countdown-item {
  background: rgba(255,255,255,0.22);
  backdrop-filter: blur(4px);
  border-radius: var(--radius-sm);
  padding: 0.45rem 0.65rem;
  text-align: center;
  min-width: 3rem;
}
.countdown-num { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.countdown-label { font-size: 0.65rem; opacity: 0.85; }
.countdown-live { font-size: 1.1rem; font-weight: 600; }

/* Calendar */
.card-section {
  margin: 12px 16px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}
.calendar { padding: 1rem; }
.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}
.cal-title { font-size: 1rem; font-weight: 600; }
.cal-nav {
  width: 36px; height: 36px;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  background: var(--bg-color);
  font-size: 1.2rem;
  cursor: pointer;
  color: var(--text-primary);
}
.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.calendar-day {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  cursor: pointer;
  position: relative;
  font-size: 0.82rem;
  border: none;
  background: transparent;
  color: var(--text-primary);
}
.calendar-day.today { border: 2px solid var(--primary-color); font-weight: 700; }
.calendar-day.has-event { background: rgba(255,140,66,0.08); }
.calendar-day.other-month { color: var(--text-secondary); opacity: 0.4; }
.cal-dots {
  display: flex;
  gap: 2px;
  position: absolute;
  bottom: 3px;
}
.cal-dots i { width: 5px; height: 5px; border-radius: 50%; display: block; }

/* Toolbar & tabs */
.toolbar-row { padding: 0 16px 8px; }
.search-input {
  width: 100%;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--card-bg);
  font-size: 0.95rem;
}
.category-tabs {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding: 0.25rem 16px 12px;
  -webkit-overflow-scrolling: touch;
}
.category-tab {
  padding: 0.4rem 1rem;
  border-radius: 2rem;
  font-size: 0.85rem;
  white-space: nowrap;
  border: 1px solid var(--border-color);
  background: var(--card-bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
.category-tab.active {
  background: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* Event list */
.event-list { padding: 0 16px calc(var(--cta-bar-h) + 24px); }
.event-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.event-list-mode { grid-template-columns: 1fr; }
.event-card {
  background: var(--card-bg);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: pointer;
}
.event-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.event-card-cover { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; }
.event-card-body { padding: 0.75rem; }
.event-card-title { font-size: 0.95rem; font-weight: 600; margin: 0.35rem 0 0.25rem; }
.event-card-meta { font-size: 0.75rem; color: var(--text-secondary); }
.event-card-progress { margin-top: 0.5rem; }
.progress-bar {
  height: 6px;
  background: var(--border-color);
  border-radius: 3px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--primary-color);
  border-radius: 3px;
  transition: width 0.8s ease-out;
}
.progress-text { font-size: 0.7rem; color: var(--text-secondary); }
.btn-register {
  width: 100%;
  margin-top: 0.6rem;
  padding: 0.5rem;
  background: var(--primary-color);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}
.btn-register:disabled { background: #ccc; cursor: not-allowed; }
.anim-card { animation: heroFadeIn 0.5s ease both; }

/* Status tags */
.status-tag {
  display: inline-block;
  padding: 0.12rem 0.5rem;
  border-radius: 1rem;
  font-size: 0.68rem;
  font-weight: 500;
}
.status-open, .status-upcoming { background: #FFF3E0; color: #FF8C42; }
.status-ongoing { background: #E3F2FD; color: #2196F3; }
.status-full { background: #FFEBEE; color: #FF6B6B; }
.status-ended { background: #F5F5F5; color: #9E9E9E; }

/* Form */
.form-step-indicator {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1.25rem;
}
.form-step-dot {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
}
.form-step-dot.active { background: var(--primary-color); color: #fff; }
.form-step-dot.done { background: var(--success-color); color: #fff; }
.form-field { margin-bottom: 1rem; }
.form-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0.25rem;
  display: block;
}
.form-input {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  background: var(--card-bg);
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--primary-color); outline: none; }
.anim-field { animation: heroFadeIn 0.4s ease both; }
.form-actions { display: flex; gap: 10px; }
.btn-outline {
  flex: 1;
  padding: 0.75rem;
  border: 1px solid var(--primary-color);
  color: var(--primary-color);
  background: var(--card-bg);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
}
.confirm-list { margin-bottom: 1rem; }
.confirm-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.9rem;
}
.success-panel { text-align: center; padding: 0.5rem 0; }
.success-check {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  background: var(--success-color);
  color: #fff;
  border-radius: 50%;
  font-size: 1.8rem;
  line-height: 56px;
}
.success-check.pop { animation: checkmarkPop 0.5s ease; }
.success-hint { margin: 8px 0 12px; font-size: 0.95rem; }
#reg-qr { margin: 0 auto 12px; display: block; border-radius: var(--radius-sm); }

/* Checkin */
.checkin-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.checkin-tab {
  flex: 1;
  padding: 8px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  background: var(--bg-color);
  cursor: pointer;
  font-size: 0.85rem;
}
.checkin-tab.active { background: var(--primary-color); color: #fff; border-color: var(--primary-color); }
.checkin-scanner {
  width: 100%;
  aspect-ratio: 1;
  max-height: 240px;
  background: #111;
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
}
.checkin-scanner video { width: 100%; height: 100%; object-fit: cover; }
.checkin-frame {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 70%; height: 70%;
  border: 2px solid rgba(255,140,66,0.85);
  border-radius: var(--radius-md);
}
.code-input { text-align: center; letter-spacing: 0.2em; font-size: 1.2rem; margin-bottom: 12px; }
.checkin-hint { font-size: 0.75rem; color: var(--text-secondary); text-align: center; margin-top: 8px; }
.checkin-list { max-height: 200px; overflow-y: auto; }
.checkin-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-color);
}
.checkin-item.new { animation: highlightNew 2s ease; }
.checkin-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
}
.checkin-ok { margin-left: auto; color: var(--success-color); font-weight: 700; }
.section-sub { font-size: 0.9rem; margin: 12px 0 8px; }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 200;
  padding: 0;
}
.modal-content {
  background: var(--card-bg);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 1.25rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
}
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  width: 32px; height: 32px;
  border: none;
  background: var(--bg-color);
  border-radius: 50%;
  font-size: 1.2rem;
  cursor: pointer;
}
.modal-title { font-size: 1.05rem; font-weight: 600; margin-bottom: 0.75rem; padding-right: 36px; }

/* CTA bar */
.cta-bar {
  position: fixed;
  left: 0; right: 0;
  bottom: calc(var(--contact-footer-h) + env(safe-area-inset-bottom));
  background: var(--card-bg);
  padding: 10px 16px;
  box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 90;
}
body.has-cta-bar:not(.hidden) .cta-bar:not(.hidden) ~ .contact-footer,
body:has(.cta-bar:not(.hidden)) { /* cta visible */ }
.cta-info { font-size: 0.82rem; color: var(--text-secondary); flex: 1; padding-right: 8px; }
.cta-btn {
  background: var(--primary-color);
  color: #fff;
  border: none;
  padding: 0.65rem 1.4rem;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}
.cta-btn:hover { background: var(--primary-hover); }
.btn-block { width: 100%; margin-top: 8px; }

/* Detail page */
.detail-main { padding-bottom: 16px; }
.detail-cover { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.detail-body { padding: 16px; }
.detail-body h1 { font-size: 1.35rem; margin: 8px 0; }
.detail-meta { font-size: 0.88rem; color: var(--text-secondary); margin-bottom: 4px; }
.detail-cat {
  margin-left: 8px;
  font-size: 0.75rem;
  color: var(--text-secondary);
}
.detail-desc {
  margin: 16px 0;
  padding: 12px;
  background: var(--card-bg);
  border-radius: var(--radius-md);
  font-size: 0.92rem;
  line-height: 1.7;
}

/* Contact footer */
.contact-footer {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 100;
  background: #fff;
  border-top: 1px solid #eee;
  padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
}
.contact-footer__btns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 88px));
  gap: 8px;
  max-width: 320px;
  margin: 0 auto;
  justify-content: center;
}
.contact-footer__cta,
.contact-footer__btn {
  text-align: center;
  padding: 0.48rem 0.2rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.contact-footer__cta {
  background: #c41e1e !important;
  color: #fff !important;
}
.contact-footer__btn {
  background: #f5f5f5;
  color: #333;
  border: none;
  cursor: pointer;
}
.contact-footer__brand {
  margin: 6px 0 0;
  text-align: center;
  font-size: 0.65rem;
  color: #999;
}

/* Misc */
.back-top {
  position: fixed;
  right: 16px;
  bottom: calc(var(--contact-footer-h) + var(--cta-bar-h) + 16px + env(safe-area-inset-bottom));
  width: 40px; height: 40px;
  border-radius: 50%;
  background: var(--primary-color);
  color: #fff;
  border: none;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 80;
  cursor: pointer;
}
.back-top.visible { opacity: 1; pointer-events: auto; }
.empty-state, .empty-tip {
  text-align: center;
  color: var(--text-secondary);
  padding: 32px 16px;
  grid-column: 1 / -1;
}
#toast-container {
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  pointer-events: none;
}
.toast-msg {
  background: rgba(45,45,45,0.92);
  color: #fff;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  margin-bottom: 8px;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.3s;
}
.toast-msg.show { opacity: 1; transform: translateY(0); }
.confetti-piece {
  position: fixed;
  top: -10px;
  width: 8px; height: 8px;
  border-radius: 2px;
  z-index: 250;
  animation: confettiFall linear forwards;
  pointer-events: none;
}

/* Low perf */
.low-perf .event-card { transition: none; }
.low-perf .event-card:hover { transform: none; }
.low-perf .hero-cta { animation: none; }

/* Animations */
@keyframes heroFadeIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes btnPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255,140,66,0.4); }
  50% { box-shadow: 0 0 0 10px rgba(255,140,66,0); }
}
@keyframes highlightNew {
  0% { background: #FFF8E1; }
  100% { background: transparent; }
}
@keyframes checkmarkPop {
  0% { transform: scale(0); }
  60% { transform: scale(1.15); }
  100% { transform: scale(1); }
}
@keyframes confettiFall {
  0% { transform: translateY(0) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@media (max-width: 480px) {
  .event-grid { grid-template-columns: 1fr; }
  .hero { height: 45vh; }
  .hero-title { font-size: 1.3rem; }
}
@media (min-width: 768px) {
  .event-list, .toolbar-row, .category-tabs { max-width: 720px; margin-left: auto; margin-right: auto; }
  .card-section { max-width: 720px; margin-left: auto; margin-right: auto; }
}

/* Share page */
.share-page .share-main { max-width: 480px; margin: 0 auto; padding: 20px 16px 24px; }
.share-hero {
  text-align: center;
  padding: 28px 20px;
  border-radius: var(--radius-lg);
  color: #fff;
  margin-bottom: 20px;
}
.share-eyebrow { font-size: 0.85rem; opacity: 0.9; margin-bottom: 8px; }
.share-hero h1 { font-size: 1.4rem; margin-bottom: 8px; }
.share-featured { margin-top: 12px; font-size: 0.9rem; opacity: 0.95; }
.share-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.share-card #share-qr { margin: 0 auto 12px; display: block; border-radius: var(--radius-sm); }
.share-hint { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 12px; }
.share-open-btn {
  display: block;
  margin-top: 12px;
  padding: 12px;
  background: var(--primary-color);
  color: #fff !important;
  border-radius: var(--radius-md);
  font-weight: 700;
}

/* P1 Gallery */
.section-title { font-size: 1rem; font-weight: 700; padding: 16px 16px 8px; margin: 0; }
.gallery-section { margin: 12px 16px 16px; padding-bottom: 12px; }
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 0 16px 12px;
}
.gallery-item {
  margin: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: var(--shadow-sm);
  animation: heroFadeIn 0.4s ease both;
}
.gallery-item img { width: 100%; aspect-ratio: 1; object-fit: cover; display: block; }
.gallery-item figcaption { font-size: 0.65rem; padding: 4px 6px; color: var(--text-secondary); }
.gallery-upload {
  display: block;
  margin: 0 16px;
  padding: 12px;
  text-align: center;
  border: 1px dashed var(--border-color);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  color: var(--text-secondary);
  cursor: pointer;
}

/* P1 Profile / Admin */
.profile-modal .profile-list { max-height: 240px; overflow-y: auto; }
.profile-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.88rem;
}
.profile-item p { margin: 4px 0 0; color: var(--text-secondary); font-size: 0.8rem; }
.profile-code { font-family: monospace; color: var(--primary-color) !important; }
.modal-hint { font-size: 0.75rem; color: var(--text-secondary); margin-top: 8px; text-align: center; }

.admin-panel {
  position: fixed;
  top: 0; right: -100%;
  width: min(320px, 90vw);
  height: 100%;
  background: var(--card-bg);
  box-shadow: var(--shadow-lg);
  z-index: 220;
  transition: right 0.3s ease;
  padding: 16px;
  overflow-y: auto;
}
.admin-panel.open { right: 0; }
.admin-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.admin-header h3 { font-size: 1rem; }
.admin-kpi {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.admin-kpi div {
  text-align: center;
  padding: 12px 8px;
  background: var(--bg-color);
  border-radius: var(--radius-sm);
}
.admin-kpi strong { display: block; font-size: 1.2rem; color: var(--primary-color); }
.admin-kpi span { font-size: 0.7rem; color: var(--text-secondary); }
.admin-event-list { list-style: none; margin-bottom: 16px; }
.admin-event-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color);
  font-size: 0.85rem;
}
.poster-modal canvas { width: 100%; border-radius: var(--radius-md); margin-bottom: 12px; }

/* Invite page */
.invite-page .invite-main { max-width: 480px; margin: 0 auto; padding: 24px 16px; }
.invite-card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow-md);
  text-align: center;
}
.invite-from { color: var(--primary-color); font-weight: 600; margin-bottom: 8px; }
.invite-card h1 { font-size: 1.3rem; margin-bottom: 12px; }
.invite-meta { font-size: 0.9rem; color: var(--text-secondary); line-height: 1.6; margin-bottom: 16px; }
.invite-card canvas { margin: 0 auto 16px; display: block; border-radius: var(--radius-sm); }
