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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  height: 100vh;
  overflow: hidden;
}

#app { height: 100vh; display: flex; flex-direction: column; }

/* Header */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: #16213e;
  border-bottom: 1px solid #0f3460;
  z-index: 1000;
}
.header-left { display: flex; align-items: center; gap: 8px; }
.header-left h1 { font-size: 1.1rem; font-weight: 600; color: #e0e0e0; }
.logo { font-size: 1.4rem; }
.header-right { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }

.status-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.status-dot.connected { background: #4ade80; }
.status-dot.disconnected { background: #f87171; }

/* Map */
#map {
  flex: 1;
  z-index: 1;
}

/* Sidebar */
.sidebar {
  position: absolute;
  top: 44px;
  left: 0;
  bottom: 0;
  width: 280px;
  background: #16213eee;
  backdrop-filter: blur(10px);
  z-index: 500;
  overflow-y: auto;
  padding: 12px;
  border-right: 1px solid #0f3460;
  transition: transform 0.3s ease;
}
.sidebar.hidden { transform: translateX(-100%); }

.sidebar-section {
  margin-bottom: 16px;
}
.sidebar-section h3 {
  font-size: 0.8rem;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}

.sidebar-toggle {
  position: absolute;
  top: 52px;
  left: 8px;
  z-index: 501;
  background: #16213ecc;
  color: #e0e0e0;
  border: 1px solid #0f3460;
  border-radius: 4px;
  padding: 6px 10px;
  cursor: pointer;
  display: none;
  font-size: 1.1rem;
}

/* Club list */
.club-list { display: flex; flex-direction: column; gap: 4px; }
.club-item {
  padding: 8px 10px;
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.2s;
}
.club-item:hover { background: #0f3460; }
.club-item.active { background: #0f3460; border-color: #4ade80; }
.club-item .club-name { font-size: 0.9rem; font-weight: 500; }
.club-item .club-meta { font-size: 0.75rem; color: #888; margin-top: 2px; }

/* Search */
#club-search {
  width: 100%;
  padding: 6px 10px;
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 4px;
  color: #e0e0e0;
  margin-bottom: 8px;
  font-size: 0.85rem;
}
#club-search:focus { outline: none; border-color: #4ade80; }

/* Auth */
#auth-section {
  border-top: 1px solid #0f3460;
  padding-top: 12px;
}
#display-name {
  width: 100%;
  padding: 6px 10px;
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 4px;
  color: #e0e0e0;
  margin-bottom: 6px;
  font-size: 0.85rem;
}
#display-name:focus { outline: none; border-color: #4ade80; }
#user-name { font-size: 0.9rem; }

/* Member panel */
.member-panel {
  position: absolute;
  top: 52px;
  right: 8px;
  width: 220px;
  max-height: 60vh;
  overflow-y: auto;
  background: #16213eee;
  backdrop-filter: blur(10px);
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 12px;
  z-index: 500;
}
.member-panel h3 { font-size: 0.85rem; margin-bottom: 8px; color: #4ade80; }

.member-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #0f346033;
  font-size: 0.85rem;
}
.member-dot {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0;
}
.member-dot.active { background: #4ade80; }
.member-dot.stale { background: #fbbf24; }
.member-dot.offline { background: #666; }
.member-sport { font-size: 0.7rem; color: #888; }

/* Buttons */
.btn {
  padding: 6px 14px;
  border: 1px solid #0f3460;
  border-radius: 4px;
  background: #1a1a2e;
  color: #e0e0e0;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.2s;
}
.btn:hover { background: #0f3460; }
.btn-primary { background: #0f3460; border-color: #4ade80; color: #4ade80; }
.btn-primary:hover { background: #4ade8022; }
.btn-small { padding: 3px 8px; font-size: 0.75rem; }

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  background: #000000aa;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-content {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 10px;
  padding: 24px;
  width: 90%;
  max-width: 400px;
}
.modal-content h2 { margin-bottom: 16px; font-size: 1.1rem; }
.modal-content label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: #aaa;
}
.modal-content input, .modal-content select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 6px 10px;
  background: #1a1a2e;
  border: 1px solid #0f3460;
  border-radius: 4px;
  color: #e0e0e0;
  font-size: 0.85rem;
}
.modal-content input:focus, .modal-content select:focus {
  outline: none; border-color: #4ade80;
}
.modal-actions { display: flex; gap: 8px; margin-top: 16px; }

.sport-checks { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 4px; }
.sport-checks label {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.8rem; color: #e0e0e0; margin-bottom: 0;
}

/* Sport icons */
.sport-icon { font-size: 0.85rem; }

/* Avatar markers */
.avatar-marker {
  background: none !important;
  border: none !important;
  text-align: center;
}
.avatar-ring {
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 3px solid;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
}
.avatar-circle {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #1a1a2e;
  line-height: 1;
}
.avatar-name {
  font-size: 10px;
  font-weight: 600;
  color: #e0e0e0;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  white-space: nowrap;
  text-align: center;
  margin-top: 1px;
}

/* Lift markers */
.lift-marker {
  background: none !important;
  border: none !important;
}
.lift-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 10px;
  border-radius: 11px;
  white-space: nowrap;
}
.lift-badge-text {
  font-size: 11px;
  font-weight: 700;
  color: #1a1a2e;
  letter-spacing: 0.3px;
}
.lift-highlight .lift-badge {
  border: 2px solid #facc15;
}

/* Lift legend */
.lift-legend {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #0f346066;
}
.lift-legend h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: #888;
  margin-bottom: 6px;
  letter-spacing: 0.5px;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  padding: 2px 0;
}
.legend-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Layer control dark theme */
.leaflet-control-layers {
  background: #16213eee !important;
  color: #e0e0e0 !important;
  border: 1px solid #0f3460 !important;
  border-radius: 6px !important;
}
.leaflet-control-layers-expanded {
  padding: 8px 12px !important;
}
.leaflet-control-layers label {
  color: #e0e0e0 !important;
}
.leaflet-control-layers-separator {
  border-top-color: #0f3460 !important;
}

/* Pair watch modal */
.pair-modal-content {
  text-align: center;
}
.pair-code-display {
  margin: 20px 0 12px;
}
#pair-code-digits {
  font-family: 'SF Mono', 'Fira Code', 'Courier New', monospace;
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: 0.3em;
  color: #4ade80;
  background: #1a1a2e;
  padding: 12px 24px;
  border-radius: 8px;
  border: 2px solid #0f3460;
  display: inline-block;
}
.pair-timer {
  font-size: 0.9rem;
  color: #888;
  margin-bottom: 16px;
}
#pair-countdown {
  color: #fbbf24;
  font-weight: 600;
}
.pair-instructions {
  font-size: 0.8rem;
  color: #aaa;
  line-height: 1.5;
  margin-bottom: 0;
}
.pair-modal-content .modal-actions {
  justify-content: center;
}

/* Responsive */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.visible { transform: translateX(0); }
  .sidebar-toggle { display: block; top: 52px; left: 8px; z-index: 700; }
  .member-panel { width: 180px; top: 48px; right: 4px; padding: 8px; max-height: 40vh; }
  .member-panel h3 { font-size: 0.8rem; }
  /* Push Leaflet zoom below sidebar toggle on mobile */
  .leaflet-control-zoom { margin-top: 42px !important; }
}
