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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #edf2f7;
  color: #1a202c;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── View switching ────────────────────────────────────────── */
.view { width: 100%; }
.hidden { display: none !important; }

/* ── Card (entry & lobby) ──────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 18px;
  padding: 2rem 1.75rem;
  max-width: 420px;
  margin: 1rem auto;
  box-shadow: 0 4px 28px rgba(0, 0, 0, 0.09);
}

h1 { font-size: 2.2rem; font-weight: 800; color: #2b6cb0; margin-bottom: 0.2rem; }
h2 { font-size: 1.35rem; font-weight: 700; margin-bottom: 0.2rem; }

.tagline { color: #718096; margin-bottom: 1.75rem; }
.hint    { color: #718096; font-size: 0.875rem; margin-bottom: 1.1rem; }
.expires { font-size: 0.78rem; color: #a0aec0; margin-bottom: 1.1rem; }

/* ── Inputs ────────────────────────────────────────────────── */
input[type="text"] {
  width: 100%;
  padding: 0.8rem 1rem;
  border: 2px solid #e2e8f0;
  border-radius: 11px;
  font-size: 1rem;
  margin-bottom: 1rem;
  outline: none;
  transition: border-color 0.18s;
}
input[type="text"]:focus { border-color: #2b6cb0; }

/* ── Buttons ───────────────────────────────────────────────── */
.btn-row { display: flex; gap: 0.75rem; margin-bottom: 1rem; }

.btn {
  flex: 1;
  padding: 0.78rem 1rem;
  border: none;
  border-radius: 11px;
  font-size: 0.97rem;
  font-weight: 700;
  cursor: pointer;
  transition: filter 0.15s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:not(:disabled):hover { filter: brightness(0.92); }

.btn-primary   { background: #2b6cb0; color: #fff; }
.btn-secondary { background: #e2e8f0; color: #2d3748; }
.btn-danger    { background: #e53e3e; color: #fff; }
.btn-sm        { flex: 0 0 auto; padding: 0.5rem 1rem; font-size: 0.875rem; }

.error {
  color: #c53030;
  font-size: 0.875rem;
  margin-top: 0.25rem;
  min-height: 1.25em;
}

/* ── Code badge ────────────────────────────────────────────── */
.code-badge {
  font-family: 'Courier New', monospace;
  font-size: 1.05em;
  font-weight: 800;
  color: #2b6cb0;
  background: #ebf8ff;
  border: 1px solid #bee3f8;
  border-radius: 6px;
  padding: 1px 8px;
  letter-spacing: 0.06em;
}

/* ── QR code ───────────────────────────────────────────────── */
.qr-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

.qr-img {
  width: 160px;
  height: 160px;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 8px;
  background: #fff;
  display: block;
}

/* ── Member list ───────────────────────────────────────────── */
#member-list { margin-bottom: 1rem; }

.member-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid #f7fafc;
  font-size: 0.95rem;
}
.member-item:last-child { border-bottom: none; }

.member-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #48bb78;
  flex-shrink: 0;
}

/* ── Map view ──────────────────────────────────────────────── */
#view-map {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
}

#map { flex: 1; }

#map-bar {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  background: rgba(255, 255, 255, 0.95);
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.13);
}

/* ── Connection indicator ──────────────────────────────────── */
#conn-indicator {
  position: absolute;
  bottom: 24px;
  left: 12px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 0.78rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  pointer-events: none;
}

#conn-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

#conn-indicator.state-connected    #conn-dot { background: #48bb78; animation: pulse-green 2s infinite; }
#conn-indicator.state-reconnecting #conn-dot { background: #f6ad55; animation: pulse-amber 1s infinite; }
#conn-indicator.state-disconnected #conn-dot { background: #fc8181; }

@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(72, 187, 120, 0.6); }
  50%       { box-shadow: 0 0 0 5px rgba(72, 187, 120, 0); }
}
@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 rgba(246, 173, 85, 0.7); }
  50%       { box-shadow: 0 0 0 5px rgba(246, 173, 85, 0); }
}

/* ── Geolocation status ────────────────────────────────────── */
#geo-status {
  display: none;
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 0.8rem;
  padding: 0.35rem 0.85rem;
  border-radius: 20px;
  pointer-events: none;
  white-space: nowrap;
}

/* ── Leaflet pin label ─────────────────────────────────────── */
.pin-label {
  background: rgba(255, 255, 255, 0.92) !important;
  border: 1.5px solid #2b6cb0 !important;
  border-radius: 5px !important;
  font-weight: 700 !important;
  font-size: 0.78rem !important;
  color: #2b6cb0 !important;
  padding: 1px 6px !important;
  white-space: nowrap;
  box-shadow: 0 1px 6px rgba(0,0,0,0.1);
}
