:root {
  /* Colors - Dark Mode Default */
  --bg-app: #09090b;
  --bg-card: #18181b;
  --bg-card-hover: #27272a;
  --bg-overlay: rgba(24, 24, 27, 0.8);
  
  --text-main: #fafafa;
  --text-muted: #a1a1aa;
  --text-faint: #52525b;
  
  --border: #27272a;
  
  /* Accents */
  --accent-primary: #8b5cf6; /* Violet */
  --accent-calm: #06b6d4; /* Cyan */
  --accent-alert: #e11d48; /* Rose */
  --accent-warn: #f59e0b; /* Amber */
  --accent-safe: #10b981; /* Emerald */
  
  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;
  
  /* Radius */
  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;
  
  /* Shadows */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.15);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  min-height: 100vh;
  /* Mobile app feel */
  max-width: 100%; 
  overflow-x: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
  margin-top: 0;
  font-weight: 700;
  letter-spacing: -0.02em;
}

h1 { font-size: 28px; margin-bottom: var(--space-md); }
h2 { font-size: 20px; margin-bottom: var(--space-sm); }
h3 { font-size: 16px; margin-bottom: var(--space-xs); text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }

p {
  margin: 0 0 var(--space-md) 0;
  line-height: 1.5;
  color: var(--text-muted);
}

.text-sm { font-size: 14px; }
.text-xs { font-size: 12px; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-accent { color: var(--accent-primary); }
.text-success { color: var(--accent-safe); }
.text-danger { color: var(--accent-alert); }
.text-warning { color: var(--accent-warn); }

/* Layout Helpers */
.container {
  max-width: 480px; /* Mobile app max width on desktop */
  margin: 0 auto;
  min-height: 100vh;
  padding: var(--space-md);
  padding-bottom: 100px; /* Space for bottom fixed nav */
  position: relative;
  background-color: var(--bg-app);
}

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }
.gap-lg { gap: var(--space-lg); }

.grid { display: grid; }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-3 { grid-template-columns: 1fr 1fr 1fr; }

/* Components */

/* Top Bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  margin-bottom: var(--space-md);
}

.dog-status {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

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

/* Cards */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-md);
  position: relative;
  overflow: hidden;
  transition: transform 0.2s, background-color 0.2s;
  box-shadow: var(--shadow-md);
}

.card:hover {
  border-color: #3f3f46;
}

.card-primary {
  background: linear-gradient(145deg, var(--bg-card) 0%, rgba(139, 92, 246, 0.1) 100%);
  border: 1px solid rgba(139, 92, 246, 0.2);
}

.card-sm {
  padding: var(--space-md);
}

/* Horizontal Scroll */
.scroll-snap-x {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  gap: var(--space-md);
  padding-bottom: var(--space-md);
  -ms-overflow-style: none;
  scrollbar-width: none;
}
.scroll-snap-x::-webkit-scrollbar { display: none; }

.scroll-item {
  flex: 0 0 85%; /* Shows part of next card */
  scroll-snap-align: start;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: var(--radius-md);
  font-weight: 600;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.btn-primary {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.6);
}

.btn-secondary {
  background: var(--bg-card-hover);
  color: var(--text-main);
  border: 1px solid var(--border);
}
.btn-secondary:hover {
  background: #3f3f46;
}

.btn-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}

.btn-block {
  width: 100%;
}

.btn-group {
  display: flex;
  gap: var(--space-sm);
}

/* Bottom Actions Fixed */
.bottom-fixed {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(9, 9, 11, 0.9);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: var(--space-md);
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: var(--space-sm);
  max-width: 480px;
  margin: 0 auto;
}

.action-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 10px;
  gap: 4px;
  cursor: pointer;
}

.action-btn .icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  background: var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  border: 1px solid var(--border);
  color: var(--text-main);
}

.action-btn.active .icon {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: white;
}

/* Map specific */
.map-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #1c1c1e;
  background-image: 
    radial-gradient(#27272a 1px, transparent 1px),
    radial-gradient(#27272a 1px, transparent 1px);
  background-size: 20px 20px;
  background-position: 0 0, 10px 10px;
  z-index: 0;
}

.map-route {
  position: absolute;
  top: 30%;
  left: 20%;
  width: 60%;
  height: 40%;
  border: 4px solid var(--accent-safe);
  border-radius: 30% 70% 70% 30% / 30% 30% 70% 70%;
  filter: drop-shadow(0 0 8px rgba(16, 185, 129, 0.5));
  z-index: 1;
}

.overlay-ui {
  position: relative;
  z-index: 10;
  height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-md);
}

/* Floating Widgets */
.widget {
  background: rgba(24, 24, 27, 0.7);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  color: var(--text-main);
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 13px;
  box-shadow: var(--shadow-lg);
}

/* Graphs */
.graph-container {
  height: 150px;
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 4px;
  margin-top: var(--space-md);
}
.bar {
  width: 100%;
  background: var(--bg-card-hover);
  border-radius: 4px;
  position: relative;
}
.bar.active { background: var(--accent-primary); }

/* List Items */
.list-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }

/* Placeholder Icons */
.icon-box {
  width: 32px;
  height: 32px;
  background: var(--bg-card-hover);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Utility */
.badge {
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge-neutral { background: var(--border); color: var(--text-muted); }
.badge-success { background: rgba(16, 185, 129, 0.2); color: var(--accent-safe); }
.badge-warning { background: rgba(245, 158, 11, 0.2); color: var(--accent-warn); }
.badge-alert { background: rgba(225, 29, 72, 0.2); color: var(--accent-alert); }

/* Navigation Grid */
.nav-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-md);
}

.nav-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text-muted);
  font-size: 11px;
  padding: var(--space-sm);
  border-radius: var(--radius-md);
  transition: background 0.2s;
}

.nav-grid-item:hover {
  background: var(--bg-card-hover);
  color: var(--text-main);
}

.nav-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-main);
}
