/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --primary:    #1a237e;
  --primary-l:  #534bae;
  --secondary:  #0288d1;
  --surface:    #ffffff;
  --surface2:   #f5f5f5;
  --border:     #e0e0e0;
  --text:       #1a1a2e;
  --text-muted: #666;
  --green:      #2e7d32;
  --orange:     #e65100;
  --red:        #c62828;
  --radius:     12px;
  --shadow:     0 2px 12px rgba(0,0,0,.10);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans TC',
               'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, #e8eaf6 0%, #e1f5fe 100%);
  min-height: 100vh;
  color: var(--text);
  font-size: 15px;
}

/* ─── Screen routing ───────────────────────────────────────────────────────── */
.screen { display: none; }
.screen.active { display: block; }

/* ─── Home screen ──────────────────────────────────────────────────────────── */
#screen-home {
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
#screen-home.active {
  display: flex;
}

.center-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 48px 40px;
  text-align: center;
  max-width: 380px;
  width: 90%;
}

.logo { font-size: 56px; margin-bottom: 12px; }

.title {
  font-size: 22px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 28px;
}

/* ─── Meeting screen ───────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  background: var(--primary);
  color: white;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}

.topbar-title {
  flex: 1;
  font-size: 18px;
  font-weight: 700;
  color: white;
}

.content {
  display: flex;
  gap: 20px;
  padding: 20px 24px;
  max-width: 1100px;
  margin: 0 auto;
}

.left-panel  { display: flex; flex-direction: column; gap: 16px; min-width: 280px; }
.right-panel { flex: 1; }

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}

/* QR card */
.qr-card { text-align: center; }
#qrcode  { display: inline-block; margin-bottom: 12px; }
#qrcode img, #qrcode canvas { border-radius: 8px; }
.scan-hint { font-size: 12px; color: var(--text-muted); line-height: 1.4; }

/* Info card */
.info-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.info-row:last-child { border-bottom: none; }
.info-label  { font-size: 12px; color: var(--text-muted); min-width: 90px; }
.info-value  { font-weight: 700; flex: 1; }
.meeting-id  { font-size: 22px; letter-spacing: 4px; color: var(--primary); }
.leader-code { font-size: 18px; letter-spacing: 3px; color: var(--secondary); }

/* Stats card */
.stats-card { display: flex; gap: 0; overflow: hidden; }
.stat-item {
  flex: 1;
  text-align: center;
  padding: 14px 8px;
  border-right: 1px solid var(--border);
}
.stat-item:last-child { border-right: none; }
.stat-value { font-size: 26px; font-weight: 800; color: var(--primary); }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* Members card */
.members-card { height: calc(100vh - 200px); display: flex; flex-direction: column; }
.section-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 12px;
  color: var(--text);
}
.member-list  { flex: 1; overflow-y: auto; }
.empty-hint   { color: var(--text-muted); font-size: 13px; padding: 16px 0; text-align: center; }

/* Member item */
.member-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 8px;
  border-radius: 8px;
  margin-bottom: 4px;
  transition: background 0.15s;
}
.member-item:hover { background: var(--surface2); }
.member-item.offline { opacity: 0.5; }

.member-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.member-item.online  .member-dot { background: var(--green); }
.member-item.offline .member-dot { background: #bbb; }

.member-info { flex: 1; display: flex; flex-direction: column; }
.member-name { font-weight: 600; font-size: 14px; }
.member-role { font-size: 11px; color: var(--text-muted); }

.member-right { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.member-status { font-size: 11px; color: var(--text-muted); }

.member-online-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  font-weight: 600;
}
.badge-online  { background: #e8f5e9; color: var(--green); }
.badge-offline { background: #f5f5f5; color: #999; }

/* Warning banner */
.warning-banner {
  background: #fff3e0;
  border-left: 4px solid #ff9800;
  padding: 10px 16px;
  font-size: 12px;
  color: #e65100;
  margin-bottom: 16px;
  border-radius: 0 8px 8px 0;
}

/* ─── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  font-family: inherit;
  padding: 10px 18px;
}
.btn:hover:not(:disabled) { opacity: 0.85; }
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-primary { background: var(--primary); color: white; }
.btn-danger  { background: var(--red);     color: white; }
.btn-ghost   { background: rgba(255,255,255,0.15); color: white; border: 1px solid rgba(255,255,255,0.3); }
.btn-ghost-dark { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-large   { padding: 14px 32px; font-size: 16px; width: 100%; margin-bottom: 12px; }
.btn-sm      { padding: 6px 14px; font-size: 13px; }
.btn-xs      { padding: 4px 10px; font-size: 11px; }

/* ─── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .content { flex-direction: column; padding: 12px 14px; }
  .left-panel { min-width: unset; }
  .members-card { height: auto; min-height: 300px; }
  .topbar { padding: 10px 14px; }
}
