:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --secondary: #6366f1;
  --accent: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --border: #e2e8f0;
  
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --shadow-accent: 0 4px 14px rgba(14, 165, 233, 0.4);

  --radius-sm: 8px;
  --radius-md: 16px;
  --radius-lg: 24px;
  --radius-full: 9999px;

  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Mobile-first Container */
.app-container {
  width: 100%;
  max-width: 480px; /* Mobile width constraint for desktop view */
  margin: 0 auto;
  background-color: var(--bg-body);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: none;
}

@media (min-width: 481px) {
  .app-container {
    box-shadow: var(--shadow-lg);
    min-height: calc(100vh - 40px);
    margin: 20px auto;
    border-radius: var(--radius-lg);
    overflow: hidden;
    background: #fff;
  }
  body {
    background-color: #e0f2fe; /* Desktop background */
    align-items: center;
    justify-content: center;
  }
}

/* Header */
header {
  padding: 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  font-size: 1.5rem;
  font-weight: 800;
  background: linear-gradient(135deg, var(--primary) 0%, var(--secondary) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.02em;
}

.icon-btn {
  background: transparent;
  border: none;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-muted);
}
.icon-btn:hover {
  background-color: var(--bg-body);
  color: var(--primary);
}

/* Main Content */
main {
  flex: 1;
  padding: 0 20px 40px 20px;
  display: flex;
  flex-direction: column;
}

h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin: 0 0 8px 0;
  color: var(--text-main);
}

.subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
  font-size: 1rem;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  border: 1px solid var(--border);
}

.card.highlight {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border: none;
}

/* Forms */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-main);
  font-size: 0.95rem;
}

.input-group {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
}

.form-input {
  width: 100%;
  padding: 16px;
  font-size: 1.5rem;
  font-weight: 700;
  border: 2px solid transparent;
  border-radius: var(--radius-md);
  outline: none;
  transition: all 0.2s;
  background: #fff;
  text-align: center;
  box-shadow: var(--shadow-sm); /* Default input shadow if standalone */
}

/* Container specifically for inputs to give them the white box look */
.input-wrapper {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 4px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.form-input.clean {
  border: none;
  box-shadow: none;
  background: transparent;
  padding: 12px;
}

.form-input:focus {
  outline: none;
}

.input-wrapper:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.1);
}

.unit-toggle {
  display: flex;
  background: var(--border);
  padding: 4px;
  border-radius: var(--radius-md);
  width: 100%;
  margin-bottom: 24px;
}

.unit-option {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
}

.unit-option.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Gender Selector */
.gender-select {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.gender-option {
  background: #fff;
  border: 2px solid transparent;
  box-shadow: var(--shadow-sm);
  border-radius: var(--radius-md);
  padding: 32px 16px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.gender-option:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.gender-option.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.2);
  color: var(--primary);
}

.gender-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: color 0.2s;
}

.gender-option.active .gender-icon {
  color: var(--primary);
}

.gender-label {
  font-weight: 700;
  font-size: 1.1rem;
}

.gender-option.active .gender-icon {
  background: #fff;
  color: var(--primary);
}

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 18px;
  font-size: 1.1rem;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: var(--shadow-accent);
}

.btn-primary:active {
  transform: scale(0.98);
}

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

.btn-icon {
  width: 48px;
  height: 48px;
  padding: 0;
  border-radius: var(--radius-full);
}

.stepper-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-main);
  font-size: 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

.stepper-btn:hover {
  background: var(--bg-body);
  border-color: var(--primary);
  color: var(--primary);
}

.stepper-btn:active {
  transform: scale(0.95);
}

/* Range Slider Customization */
.range-container {
  padding: 10px 0;
}
input[type=range] {
  width: 100%;
  margin: 10px 0;
  background-color: transparent;
  -webkit-appearance: none;
}
input[type=range]:focus {
  outline: none;
}
input[type=range]::-webkit-slider-runnable-track {
  background: var(--border);
  border: 0;
  border-radius: 25px;
  width: 100%;
  height: 8px;
  cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  margin-top: -12px;
  width: 32px;
  height: 32px;
  background: var(--primary);
  border: 4px solid #fff;
  box-shadow: var(--shadow-md);
  border-radius: 50%;
  cursor: pointer;
  -webkit-appearance: none;
}

/* Result Gauge */
.gauge-container {
  position: relative;
  width: 200px;
  height: 100px; /* Half circle */
  margin: 0 auto 24px auto;
  overflow: hidden;
}

.gauge-arc {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: conic-gradient(
    from 180deg,
    var(--primary) 0deg,      /* Underweight start */
    var(--primary) 30deg,
    var(--accent) 30deg,      /* Normal start */
    var(--accent) 100deg,
    var(--warning) 100deg,    /* Overweight start */
    var(--warning) 140deg,
    var(--danger) 140deg,     /* Obese start */
    var(--danger) 180deg,
    transparent 180deg
  );
  transform: rotate(-90deg); /* Adjust starting position */
  position: absolute;
  top: 0;
  left: 0;
  clip-path: polygon(0 0, 100% 0, 100% 50%, 0 50%); /* Only show top half */
}

.gauge-inner {
  position: absolute;
  top: 20px;
  left: 20px;
  width: 160px;
  height: 160px;
  background: var(--bg-card);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
}

.gauge-value {
  font-size: 2.5rem;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1;
  margin-top: -40px; /* Adjust because it's a half circle */
}

.gauge-label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Result Stats */
.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.stat-item {
  background: #f8fafc;
  padding: 16px;
  border-radius: var(--radius-md);
  text-align: center;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}

.stat-val {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
}

.status-badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-weight: 700;
  font-size: 0.9rem;
  margin: 16px 0;
}

.status-normal { background: #dcfce7; color: #15803d; }
.status-warning { background: #fef3c7; color: #b45309; }
.status-danger { background: #fee2e2; color: #b91c1c; }

/* Placeholder Icons */
.placeholder-icon {
  width: 24px;
  height: 24px;
  background: currentColor;
  mask-size: contain;
  mask-position: center;
  mask-repeat: no-repeat;
  display: inline-block;
}

/* Simple visual placeholders for icons */
.icon-male::before { content: "♂"; }
.icon-female::before { content: "♀"; }
.icon-chevron-left::before { content: "←"; }
