:root {
  --background: 0 0% 100%;
  --foreground: 222.2 84% 4.9%;
  --primary: 346.8 77.2% 49.8%;
  --primary-foreground: 210 40% 98%;
  --card: 0 0% 100%;
  --card-foreground: 222.2 84% 4.9%;
  --muted: 210 40% 96.1%;
  --muted-foreground: 215.4 16.3% 46.9%;
  --radius: 0.5rem;
  --border: 214.3 31.8% 91.4%;
  --input: 214.3 31.8% 91.4%;
}

.dark {
  --background: 222.2 84% 4.9%;
  --foreground: 210 40% 98%;
  --card: 222.2 84% 4.9%;
  --card-foreground: 210 40% 98%;
  --primary: 346.8 77.2% 49.8%;
  --primary-foreground: 222.2 47.4% 11.2%;
  --muted: 217.2 32.6% 17.5%;
  --muted-foreground: 215 20.2% 65.1%;
  --border: 217.2 32.6% 17.5%;
  --input: 217.2 32.6% 17.5%;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  transition: background-color 0.2s, color 0.2s;
  line-height: 1.5;
}

/* Layout */
.app-container {
  max-width: 480px;
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  position: relative;
}

.main-container {
  flex: 1;
  padding: 1.5rem 1rem 6rem;
  width: 100%;
  max-width: 100%;
  margin: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  position: relative;
}

.page {
  display: none;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.app-header {
  padding: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: hsl(var(--card));
  position: sticky;
  top: 0;
  z-index: 10;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.app-title {
  font-size: 1.25rem;
  font-weight: 700;
  color: hsl(var(--primary));
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  background: none;
  border: none;
  color: hsl(var(--muted-foreground));
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.theme-toggle:hover {
  background: hsl(var(--muted));
  color: hsl(var(--foreground));
}

/* Cards */
.card {
  background: hsl(var(--card));
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid hsl(var(--border));
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.9375rem;
  line-height: 1.5;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 0.75rem;
}

.btn-primary {
  background: hsl(var(--primary));
  color: white;
}

.btn-primary:hover {
  background: hsl(var(--primary) / 0.9);
  transform: translateY(-1px);
}

.btn-outline {
  background: transparent;
  border: 1px solid hsl(var(--border));
  color: hsl(var(--foreground));
}

.btn-outline:hover {
  background: hsl(var(--muted));
}

.btn-danger {
  background: hsl(0, 84.2%, 60.2%);
  color: white;
}

.btn-danger:hover {
  background: hsl(0, 72.2%, 50.6%);
}

/* Form Elements */
.form-group {
  margin-bottom: 1.25rem;
}

.form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: hsl(var(--foreground));
}

.form-input {
  width: 100%;
  padding: 0.625rem 1rem;
  border: 1px solid hsl(var(--border));
  border-radius: var(--radius);
  background: hsl(var(--input));
  color: hsl(var(--foreground));
  font-size: 0.9375rem;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: hsl(var(--primary));
  box-shadow: 0 0 0 2px hsl(var(--primary) / 0.1);
}

/* Navigation */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: hsl(var(--card));
  display: flex;
  justify-content: space-around;
  padding: 0.75rem 0;
  box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
  z-index: 50;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  color: hsl(var(--muted-foreground));
  text-decoration: none;
  font-size: 0.75rem;
  padding: 0.5rem;
  border-radius: var(--radius);
  transition: all 0.2s;
}

.nav-item i {
  font-size: 1.25rem;
  margin-bottom: 0.25rem;
}

.nav-item.active {
  color: hsl(var(--primary));
}

.nav-item:hover {
  background: hsl(var(--muted));
}

/* Emergency Button */
.emergency-btn {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: linear-gradient(135deg, hsl(0, 84.2%, 60.2%), hsl(0, 72%, 51%));
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2rem auto;
  box-shadow: 0 4px 20px rgba(220, 38, 38, 0.4);
  cursor: pointer;
  transition: all 0.3s ease;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.7); }
  70% { box-shadow: 0 0 0 15px rgba(220, 38, 38, 0); }
  100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0); }
}

/* Siren flash */
@keyframes flash-bg {
  0% { background-color: #ffffff; }
  50% { background-color: #ff0000; }
  100% { background-color: #ffffff; }
}

body.flash {
  animation: flash-bg 0.5s infinite;
}

/* Responsive */
@media (max-width: 480px) {
  .app-header {
    padding: 0.75rem 1rem;
  }
  
  .app-title {
    font-size: 1.1rem;
  }
  
  .main-container {
    padding: 1rem 0.75rem 6rem;
  }
  
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  
  .btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
  }
  
  .emergency-btn {
    width: 70px;
    height: 70px;
  }
}
