/* VITA Rainer — Mobile First Styles */

:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-input: #334155;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --border: #475569;
  --radius: 12px;
  --shadow: 0 4px 6px -1px rgba(0,0,0,0.3);
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  padding-bottom: env(safe-area-inset-bottom, 20px);
}

/* Layout */
.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px;
  padding-top: env(safe-area-inset-top, 16px);
}

/* Header */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  margin-bottom: 16px;
}

.header h1 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--primary), #38bdf8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header .avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

/* Cards */
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
}

.card-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Grid */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Medication list */
.med-list {
  list-style: none;
}

.med-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.med-item:last-child {
  border-bottom: none;
}

.med-check {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid var(--border);
  cursor: pointer;
  flex-shrink: 0;
}

.med-check.checked {
  background: var(--success);
  border-color: var(--success);
}

.med-name {
  font-size: 14px;
  font-weight: 500;
}

.med-dose {
  font-size: 12px;
  color: var(--text-muted);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  width: 100%;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

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

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

/* Input */
.input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text);
  font-size: 16px;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus {
  border-color: var(--primary);
}

.input-group {
  margin-bottom: 12px;
}

.input-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 6px;
}

/* Navigation (Bottom Tab Bar) */
.nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: calc(8px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 4px 12px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 10px;
  transition: color 0.15s;
}

.nav-item.active {
  color: var(--primary);
}

.nav-icon {
  font-size: 22px;
}

/* Status indicators */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-success { background: rgba(34,197,94,0.15); color: var(--success); }
.badge-warning { background: rgba(245,158,11,0.15); color: var(--warning); }
.badge-danger { background: rgba(239,68,68,0.15); color: var(--danger); }

/* Progress bar */
.progress {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-input);
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar {
  height: 100%;
  border-radius: 3px;
  background: var(--primary);
  transition: width 0.3s;
}

.progress-bar.over { background: var(--danger); }
.progress-bar.good { background: var(--success); }

/* Login screen */
.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100dvh;
  padding: 24px;
  text-align: center;
}

.login-logo {
  font-size: 64px;
  margin-bottom: 16px;
}

.login-title {
  font-size: 28px;
  font-weight: 700;
  margin-bottom: 8px;
}

.login-subtitle {
  color: var(--text-muted);
  margin-bottom: 32px;
}

/* Quick input */
.quick-input {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.quick-input .input {
  flex: 1;
}

.quick-input .btn {
  width: auto;
  padding: 12px 16px;
}

/* Voice button */
.voice-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  position: fixed;
  bottom: 80px;
  right: 20px;
  box-shadow: 0 4px 12px rgba(14,165,233,0.4);
  z-index: 90;
  transition: transform 0.15s;
}

.voice-btn:active {
  transform: scale(0.9);
}

.voice-btn.recording {
  background: var(--danger);
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

/* Trend indicator */
.trend-up { color: var(--danger); }
.trend-down { color: var(--success); }
.trend-stable { color: var(--text-muted); }

/* Charts placeholder */
.chart-container {
  height: 160px;
  border-radius: 8px;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 13px;
}

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Hide elements */
.hidden { display: none !important; }

/* Scrollable content (above nav) */
.content {
  padding-bottom: 80px;
}

/* --- Responsive (Tablet+) --- */
@media (min-width: 768px) {
  .app {
    max-width: 600px;
    padding: 24px;
  }

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

  .card-value {
    font-size: 32px;
  }
}

@media (min-width: 1024px) {
  .app {
    max-width: 800px;
  }
}
