/* ============================================================
   עיצוב נגיש לחולי פרקינסון
   עקרונות: טקסט גדול, ניגודיות גבוהה, כפתורים גדולים (≥64px),
   מרווחים נדיבים, משוב ויזואלי ברור, ידידותי לרעד.
   ============================================================ */

:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --ink: #15233b;
  --ink-soft: #4a5b75;
  --line: #dbe4f0;

  --brand: #1565c0;        /* כחול רגוע, ניגודיות גבוהה */
  --brand-dark: #0d47a1;
  --brand-soft: #e3f0ff;

  --teal: #00897b;
  --teal-soft: #d6f3ef;
  --amber: #ef6c00;
  --amber-soft: #ffecd9;
  --green: #2e7d32;
  --green-soft: #d9f2da;
  --red: #c62828;
  --red-soft: #fde3e3;

  --radius: 18px;
  --shadow: 0 6px 22px rgba(21,101,192,.10);
  --font-scale: 1; /* נשלט ע"י כפתור הגדלת טקסט */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { font-size: calc(18px * var(--font-scale)); }

body {
  margin: 0;
  font-family: "Segoe UI", "Assistant", "Rubik", system-ui, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  direction: rtl;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 96px; /* מקום לסרגל התחתון */
}

h1,h2,h3 { line-height: 1.25; margin: 0 0 .4em; }
p { margin: 0 0 .8em; }
button { font-family: inherit; cursor: pointer; }

/* ---------- כותרת עליונה ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--brand);
  color: #fff;
  padding: 14px 18px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,.12);
}
.topbar .logo { font-size: 1.7rem; }
.topbar h1 { font-size: 1.25rem; margin: 0; font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar .icon-btn {
  background: rgba(255,255,255,.18);
  border: none; color: #fff;
  width: 48px; height: 48px; border-radius: 12px;
  font-size: 1.3rem; display: grid; place-items: center;
}
.topbar .icon-btn:active { background: rgba(255,255,255,.32); }

/* ---------- מבנה כללי ---------- */
.screen { display: none; padding: 18px 16px 8px; max-width: 760px; margin: 0 auto; }
.screen.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to {opacity:1;transform:none;} }

.section-title { font-size: 1.35rem; font-weight: 800; margin: 6px 2px 14px; display:flex; align-items:center; gap:8px; }
.muted { color: var(--ink-soft); }
.center { text-align: center; }

/* ---------- כרטיסים ---------- */
.card {
  background: var(--card);
  border: 2px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h3 { font-size: 1.2rem; }

.hello {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  color: #fff; border: none;
}
.hello h2 { font-size: 1.5rem; margin: 0 0 4px; }
.hello p { margin: 0; opacity: .95; }

/* ---------- כרטיס תזכורת הבאה ---------- */
.next-dose {
  display:flex; align-items:center; gap:16px;
  background: var(--amber-soft); border-color: #ffd2a8;
}
.next-dose .big-emoji { font-size: 2.6rem; }
.next-dose .info { flex:1; }
.next-dose .time { font-size: 2rem; font-weight: 800; color: var(--amber); }

/* ---------- מדדים מהירים ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.stat {
  background: var(--card); border:2px solid var(--line);
  border-radius: var(--radius); padding: 16px; text-align: center;
  box-shadow: var(--shadow);
}
.stat .num { font-size: 2.1rem; font-weight: 800; }
.stat .label { color: var(--ink-soft); font-weight: 600; }
.stat.water .num { color: var(--brand); }
.stat.activity .num { color: var(--teal); }

/* ---------- כפתורים גדולים ---------- */
.btn {
  display:inline-flex; align-items:center; justify-content:center; gap:10px;
  min-height: 64px; padding: 0 22px;
  font-size: 1.15rem; font-weight: 700;
  border: none; border-radius: 16px;
  background: var(--brand); color:#fff;
  width: 100%;
  transition: transform .06s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); }
.btn.big { min-height: 78px; font-size: 1.3rem; }
.btn.teal { background: var(--teal); }
.btn.amber { background: var(--amber); }
.btn.green { background: var(--green); }
.btn.red { background: var(--red); }
.btn.ghost { background: var(--brand-soft); color: var(--brand-dark); border:2px solid #b9d6f7; }
.btn.outline { background:#fff; color:var(--brand); border:2px solid var(--brand); }
.btn:disabled { filter: grayscale(.6) opacity(.6); }
.btn-row { display:flex; gap:12px; }
.btn-row .btn { flex:1; }

/* ---------- רשימת תרופות ---------- */
.med-item {
  display:flex; align-items:center; gap:14px;
  background: var(--card); border:2px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px;
}
.med-item.taken { background: var(--green-soft); border-color:#a9deab; }
.med-item .pill { font-size:2rem; }
.med-item .m-info { flex:1; }
.med-item .m-name { font-size:1.2rem; font-weight:800; }
.med-item .m-time { color: var(--ink-soft); font-weight:700; font-size:1.05rem; }
.med-item .take-btn {
  min-width: 96px; min-height: 56px; border:none; border-radius:14px;
  background: var(--green); color:#fff; font-weight:800; font-size:1rem;
}
.med-item.taken .take-btn { background:#7cb87f; }
.med-item .del { background:none;border:none;color:var(--red);font-size:1.4rem;width:44px;height:44px; }

/* ---------- מים ---------- */
.water-track { text-align:center; }
.water-cups { font-size: 2.4rem; letter-spacing: 4px; margin: 10px 0; min-height: 2.6rem; }
.water-big-num { font-size: 3.2rem; font-weight: 800; color: var(--brand); }

/* ---------- תרגילים / מדריכים — אקורדיון ---------- */
.acc-item { background:var(--card); border:2px solid var(--line); border-radius:var(--radius); margin-bottom:14px; overflow:hidden; }
.acc-head {
  display:flex; align-items:center; gap:14px; width:100%;
  padding:16px 18px; background:none; border:none; text-align:right;
  font-size:1.15rem; font-weight:800; color:var(--ink);
}
.acc-head .a-icon { font-size:1.9rem; }
.acc-head .a-meta { font-size:.85rem; color:var(--ink-soft); font-weight:600; display:block; margin-top:2px;}
.acc-head .chev { margin-inline-start:auto; font-size:1.3rem; color:var(--brand); transition:transform .2s; }
.acc-item.open .chev { transform: rotate(180deg); }
.acc-body { display:none; padding: 0 18px 18px; }
.acc-item.open .acc-body { display:block; }
.acc-body h4 { font-size:1.05rem; color:var(--brand-dark); margin:14px 0 4px; }
.acc-body p, .acc-body li { font-size:1.05rem; white-space:pre-line; }
.acc-body ol { padding-inline-start: 22px; }
.acc-body ol li { margin-bottom:8px; }
.badge { display:inline-block; padding:3px 10px; border-radius:999px; font-size:.8rem; font-weight:700; background:var(--brand-soft); color:var(--brand-dark); }

/* ---------- טיפ יומי ---------- */
.tip { background: var(--teal-soft); border-color:#a7e6dd; display:flex; gap:14px; align-items:flex-start; }
.tip .t-emoji { font-size:2rem; }
.tip .t-text { font-size:1.15rem; font-weight:600; }

/* ---------- מטפל ---------- */
.summary-row { display:flex; justify-content:space-between; align-items:center; padding:14px 0; border-bottom:1px solid var(--line); }
.summary-row:last-child { border-bottom:none; }
.summary-row .s-label { font-weight:700; }
.summary-row .s-val { font-weight:800; font-size:1.2rem; }
.ok { color: var(--green);} .warn{color:var(--amber);} .bad{color:var(--red);}

.emergency-item { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 0; border-bottom:1px solid var(--line); }
.emergency-item:last-child{border:none;}
.emergency-item a { background:var(--red); color:#fff; text-decoration:none; padding:10px 18px; border-radius:12px; font-weight:800; font-size:1.1rem; min-width:90px; text-align:center; }

/* ---------- סרגל ניווט תחתון ---------- */
.tabbar {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 60;
  background: #fff; border-top: 2px solid var(--line);
  display: flex; padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  box-shadow: 0 -4px 18px rgba(0,0,0,.06);
}
.tab {
  flex:1; background:none; border:none; padding:8px 2px;
  display:flex; flex-direction:column; align-items:center; gap:3px;
  color: var(--ink-soft); font-size:.78rem; font-weight:700; border-radius:12px;
}
.tab .t-ic { font-size:1.6rem; }
.tab.active { color: var(--brand); background: var(--brand-soft); }

/* ---------- מודאל ---------- */
.modal-bg {
  position: fixed; inset:0; background: rgba(10,20,40,.5);
  display:none; align-items:center; justify-content:center; padding:18px; z-index:100;
}
.modal-bg.show { display:flex; }
.modal {
  background:#fff; border-radius:22px; padding:22px; width:100%; max-width:460px;
  max-height: 90vh; overflow:auto;
}
.modal h3 { font-size:1.3rem; }
.field { margin-bottom:16px; }
.field label { display:block; font-weight:700; margin-bottom:6px; font-size:1.05rem; }
.field input, .field select {
  width:100%; min-height:58px; font-size:1.15rem; padding:0 14px;
  border:2px solid var(--line); border-radius:14px; font-family:inherit;
}
.field input:focus, .field select:focus { outline:3px solid var(--brand-soft); border-color:var(--brand); }

/* ---------- טוסט ---------- */
.toast {
  position: fixed; bottom: 110px; right:50%; transform: translateX(50%) translateY(20px);
  background: var(--ink); color:#fff; padding:14px 22px; border-radius:14px;
  font-weight:700; font-size:1.05rem; opacity:0; pointer-events:none;
  transition: all .25s ease; z-index:200; box-shadow:var(--shadow); max-width:90%;
}
.toast.show { opacity:1; transform: translateX(50%) translateY(0); }

/* ---------- כלי נגישות צף ---------- */
.banner-note { font-size:.92rem; background:#fff8e1; border:2px solid #ffe082; color:#6b5300; padding:12px 14px; border-radius:14px; margin-top:8px; }

@media (min-width:600px){
  .stat-grid{ grid-template-columns: repeat(4,1fr);}
}
