:root {
  --bg-app: #0c101d;
  --bg-panel: #131929;
  --bg-input: #182035;
  --bg-input-focus: #1f2a47;
  --border-color: #232f4e;
  --border-focus: #38bdf8;
  --text-main: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-active: #0284c7;
  --success: #10b981;
  --radius-panel: 16px;
  --radius-item: 10px;
  --radius-input: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  background: var(--bg-app);
  color: var(--text-main);
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  user-select: none;
}

/* Base Viewport & Screens */
.screen {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: flex;
  opacity: 0;
  visibility: hidden;
  transform: scale(0.99);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.3s;
  z-index: 10;
}

.screen.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

/* ================= AUTH / REGISTRATION SCREEN ================= */
#auth-screen {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, #151f38 0%, #0c101d 75%);
  padding: 24px;
}

.auth-container {
  width: 100%;
  max-width: 520px;
  background: rgba(19, 25, 41, 0.95);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-panel);
  padding: 42px 46px;
  box-shadow: 0 30px 60px -15px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 189, 248, 0.05);
}

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

.brand-label {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #38bdf8;
  margin-bottom: 8px;
}

.auth-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-main);
  margin-bottom: 6px;
}

.auth-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.auth-segmented-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-item);
  padding: 4px;
  margin-bottom: 28px;
}

.switch-btn {
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.switch-btn.active {
  background: var(--bg-panel);
  color: var(--text-main);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.text-input {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-input);
  padding: 13px 16px;
  font-size: 14px;
  color: var(--text-main);
  outline: none;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.text-input:focus {
  border-color: var(--border-focus);
  background: var(--bg-input-focus);
}

.text-input::placeholder {
  color: var(--text-muted);
}

.btn-primary-action {
  width: 100%;
  padding: 14px;
  margin-top: 10px;
  border-radius: var(--radius-input);
  border: none;
  background: #38bdf8;
  color: #0c101d;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.1s ease;
}

.btn-primary-action:hover {
  background: #7dd3fc;
}

.btn-primary-action:active {
  background: #0284c7;
  transform: translateY(1px);
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ================= MAP SCREEN ================= */
#map-screen {
  position: relative;
  width: 100vw;
  height: 100vh;
}

#map {
  width: 100%;
  height: 100%;
  background: #12172b;
}

/* Custom CSS Shader Overlay to turn OSM tiles into pure Blink/Zenly Navy Dark style */
.maplibregl-canvas-container canvas {
  filter: brightness(0.7) contrast(1.25) saturate(1.2) hue-rotate(205deg) invert(1) hue-rotate(180deg) brightness(0.85);
}

/* Left Sidebar Navigation */
.app-sidebar {
  position: absolute;
  top: 18px;
  left: 18px;
  bottom: 18px;
  width: 68px;
  background: rgba(19, 25, 41, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 0;
  z-index: 100;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
}

.sidebar-brand-icon {
  font-size: 22px;
  margin-bottom: 24px;
}

.sidebar-nav-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  align-items: center;
}

.nav-item-btn {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-item);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.nav-item-btn .nav-icon {
  font-size: 16px;
  margin-bottom: 2px;
}

.nav-item-btn .nav-text {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.nav-item-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-main);
}

.nav-item-btn.active {
  background: rgba(56, 189, 248, 0.15);
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
}

.sidebar-profile {
  margin-top: auto;
  cursor: pointer;
}

.profile-avatar-badge {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  color: #0c101d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  border: 2px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 16px rgba(56, 189, 248, 0.4);
}

/* Top Stats */
.top-status-bar {
  position: absolute;
  top: 18px;
  left: 98px;
  display: flex;
  gap: 12px;
  z-index: 100;
}

.status-badge {
  background: rgba(19, 25, 41, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Map Controls */
.map-controls {
  position: absolute;
  right: 20px;
  bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
}

.map-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-item);
  background: rgba(19, 25, 41, 0.88);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
  transition: all 0.15s ease;
}

.map-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: #38bdf8;
}

/* Blink / Zenly Pin Styles */
.map-user-pin {
  cursor: pointer;
  transform: translate(-50%, -100%);
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.map-user-pin:hover {
  transform: translate(-50%, -105%) scale(1.08);
  z-index: 999 !important;
}

.pin-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

.pin-label {
  background: rgba(19, 25, 41, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  margin-bottom: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.6);
}

.pin-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #1e293b;
  color: #fff;
  border: 2.5px solid #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 800;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.8);
  position: relative;
}

.pin-avatar.self {
  border-color: #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.6), 0 8px 24px rgba(0, 0, 0, 0.8);
}

.pin-battery {
  position: absolute;
  bottom: -4px;
  right: -4px;
  background: #0f172a;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 1px 6px;
  font-size: 9px;
  font-weight: 700;
  color: var(--success);
}

/* Toast Messages */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast-item {
  background: rgba(19, 25, 41, 0.95);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 11px 22px;
  border-radius: 999px;
  color: var(--text-main);
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
