/* ========================================
   my.health — Dark Glassmorphism Dashboard
   Mobile-first, iPhone safe-area
   ======================================== */

:root {
  --bg: #0b0c10;
  --card-bg: rgba(255,255,255,0.06);
  --card-border: rgba(255,255,255,0.10);
  --text: #e6e6e6;
  --text-dim: #9aa0a6;
  --accent: #00d4aa;
  --accent-2: #ff6b6b;
  --accent-3: #ffd166;
  --glass-blur: 20px;
  --radius: 22px;
  --shadow: 0 8px 32px rgba(0,0,0,0.35);
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* iPhone safe-area */
body {
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

/* Screens */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.hidden { display: none !important; }

/* Glass */
.glass {
  background: var(--card-bg);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* Login */
#login-screen {
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 32px 24px;
  text-align: center;
}

.logo {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 6px;
  background: linear-gradient(90deg, var(--accent), #00a8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 24px;
}

#master-password {
  width: 100%;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04);
  color: var(--text);
  font-size: 16px;
  outline: none;
  margin-bottom: 14px;
}

#master-password::placeholder { color: var(--text-dim); }

.btn-primary {
  width: 100%;
  padding: 14px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, var(--accent), #00a8ff);
  color: #000;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}

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

.error-msg {
  color: var(--accent-2);
  font-size: 13px;
  margin-top: 10px;
  min-height: 18px;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  margin: 8px 12px 6px;
  border-radius: 18px;
}

.app-header h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  background: linear-gradient(90deg, var(--accent), #00a8ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.header-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.glass-select {
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  color: var(--text);
  padding: 8px 10px;
  font-size: 13px;
  outline: none;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.btn-icon {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

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

/* Dashboard */
.dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 8px 14px 28px;
}

@media (min-width: 768px) {
  .dashboard { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 1200px) {
  .dashboard { grid-template-columns: repeat(3, 1fr); }
}

/* Card */
.card {
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.card-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(255,255,255,0.08);
  color: var(--accent);
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Ring */
.ring-wrap {
  position: relative;
  width: 160px;
  height: 160px;
  margin: 0 auto;
}

.ring-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.ring-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.5px;
  line-height: 1;
}

.ring-label {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Stats row */
.stats-row {
  display: flex;
  justify-content: space-around;
  gap: 8px;
}

.stat {
  text-align: center;
}

.stat-value {
  font-size: 16px;
  font-weight: 700;
}

.stat-label {
  font-size: 11px;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Chart wrap */
.chart-wrap {
  position: relative;
  height: 160px;
  width: 100%;
}

/* Activity list */
.activity-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.activity-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--card-border);
}

.activity-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.activity-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(0,212,170,0.12);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.activity-name {
  font-size: 14px;
  font-weight: 600;
}

.activity-meta {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 2px;
}

.activity-right {
  text-align: right;
}

.activity-cal {
  font-size: 14px;
  font-weight: 700;
}

.activity-dur {
  font-size: 12px;
  color: var(--text-dim);
}

/* Empty state */
.empty-state {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 50;
}

.empty-card {
  max-width: 320px;
  width: 100%;
  padding: 28px 24px;
  text-align: center;
}

.empty-card p {
  font-size: 16px;
  margin-bottom: 18px;
  color: var(--text);
}

/* Toasts */
#toast-container {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(92vw, 400px);
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border-radius: 14px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  animation: toastIn .35s ease, toastOut .35s ease 2.8s forwards;
  pointer-events: auto;
}

.toast.info { background: rgba(0,168,255,0.85); }
.toast.success { background: rgba(0,212,170,0.85); }
.toast.warn { background: rgba(255,209,102,0.85); color: #1a1a1a; }
.toast.error { background: rgba(255,107,107,0.85); }

@keyframes toastIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-12px); }
}
