/* ══════════════════════════════
   NABADI CARE — style.css
   ══════════════════════════════ */

:root {
  --teal:   #00b894;
  --teal2:  #00a381;
  --teal3:  #007a61;
  --navy:   #0d2137;
  --navy2:  #162d46;
  --gold:   #f9c74f;
  --red:    #e63946;
  --blue:   #457b9d;
  --purple: #7b2d8b;
  --bg:     #eef2f7;
  --card:   #ffffff;
  --text:   #0d2137;
  --text2:  #506070;
  --border: #dde4ee;
  --shadow: 0 2px 18px rgba(13,33,55,.08);
  --r:      14px;
  --f:      'IBM Plex Sans Arabic', sans-serif;
}

[data-dark] {
  --bg:     #0a111a;
  --card:   #101d2b;
  --text:   #dde8f5;
  --text2:  #6b8499;
  --border: #1a2d40;
  --shadow: 0 2px 18px rgba(0,0,0,.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; font-family: var(--f); }
body { background: var(--bg); color: var(--text); min-height: 100vh; }

::-webkit-scrollbar       { width: 4px; height: 4px; }
::-webkit-scrollbar-thumb { background: var(--teal); border-radius: 2px; }

/* ── AUTH ─────────────────────── */
#authWrap {
  position: fixed; inset: 0; z-index: 9000;
  display: flex;
  background: linear-gradient(145deg, #0d2137 0%, #0a3d56 50%, #063345 100%);
  align-items: center; justify-content: center; padding: 16px;
}

.auth-card {
  background: var(--card); border-radius: 22px;
  width: 100%; max-width: 420px;
  padding: 32px 28px;
  box-shadow: 0 32px 80px rgba(0,0,0,.45);
  position: relative; overflow: hidden;
}

.auth-card::before {
  content: '';
  position: absolute; top: -60px; left: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(0,184,148,.15), transparent 70%);
  pointer-events: none;
}

.auth-logo { text-align: center; margin-bottom: 20px; }
.auth-logo img { width: 180px; height: auto; display: block; margin: 0 auto; }

.a-tabs {
  display: flex; background: var(--bg); border-radius: 10px;
  padding: 3px; gap: 3px; margin-bottom: 18px;
}

.a-tab {
  flex: 1; padding: 8px; border: none; background: none;
  border-radius: 8px; font-family: var(--f); font-size: .85rem;
  font-weight: 600; cursor: pointer; color: var(--text2); transition: .2s;
}
.a-tab.on { background: var(--card); color: var(--teal); box-shadow: 0 1px 6px rgba(0,0,0,.1); }

.f-g { margin-bottom: 12px; }
.f-g label { display: block; font-size: .77rem; font-weight: 600; color: var(--text2); margin-bottom: 4px; }

.inp {
  width: 100%; padding: 10px 13px;
  border: 1.5px solid var(--border); border-radius: 9px;
  font-family: var(--f); font-size: .88rem;
  background: var(--bg); color: var(--text); outline: none; transition: .2s;
}
.inp:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,184,148,.12); }

.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.btn-main {
  width: 100%; padding: 11px; border: none; border-radius: 10px;
  background: linear-gradient(135deg, var(--teal), var(--teal3));
  color: #fff; font-family: var(--f); font-size: .93rem; font-weight: 700;
  cursor: pointer; transition: .3s;
}
.btn-main:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,184,148,.35); }

.divider { display: flex; align-items: center; gap: 10px; margin: 12px 0; }
.divider span { font-size: .75rem; color: var(--text2); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

.btn-guest {
  width: 100%; padding: 10px;
  border: 2px dashed var(--border); border-radius: 10px;
  background: transparent; font-family: var(--f); font-size: .88rem;
  font-weight: 600; color: var(--text2); cursor: pointer; transition: .25s;
}
.btn-guest:hover { border-color: var(--teal); color: var(--teal); background: rgba(0,184,148,.05); }

.err {
  background: #fff0f2; border: 1px solid #fca5a5; border-radius: 8px;
  padding: 9px 12px; font-size: .8rem; color: #c0392b;
  margin-bottom: 11px; display: none;
}
.ok-msg {
  background: #f0fdf4; border: 1px solid #86efac; border-radius: 8px;
  padding: 9px 12px; font-size: .8rem; color: #16a34a;
  margin-bottom: 11px; display: none;
}

#dbLoadBanner {
  background: rgba(69,123,157,.12); border: 1px solid rgba(69,123,157,.25);
  border-radius: 8px; padding: 8px 12px; font-size: .78rem;
  color: var(--blue); margin-bottom: 12px; text-align: center; transition: opacity .4s;
}

/* ── APP SHELL ────────────────── */
#app { display: none; }

.sidebar {
  width: 230px; position: fixed; top: 0; right: 0; bottom: 0;
  background: var(--navy); display: flex; flex-direction: column;
  z-index: 100; transition: transform .3s;
}

.s-logo {
  padding: 16px 14px; border-bottom: 1px solid rgba(255,255,255,.07);
  display: flex; flex-direction: column; align-items: center;
}
.s-logo img  { width: 140px; height: auto; display: block; }
.s-logo small, #sideRole { color: rgba(255,255,255,.4); font-size: .62rem; margin-top: 4px; }

.ni {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 14px; border-radius: 9px; margin: 2px 7px;
  cursor: pointer; color: rgba(255,255,255,.5);
  font-size: .85rem; font-weight: 500;
  border: none; background: none; width: calc(100% - 14px);
  text-align: right; transition: .2s;
}
.ni:hover  { background: rgba(255,255,255,.06); color: rgba(255,255,255,.9); }
.ni.on     { background: rgba(0,184,148,.18); color: var(--teal); }
.ni .ic    { font-size: 1.05rem; width: 20px; text-align: center; flex-shrink: 0; }

.s-bottom  { margin-top: auto; padding: 12px; }
.user-chip {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 11px; background: rgba(255,255,255,.06); border-radius: 10px;
}
.u-av {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--teal), var(--teal3));
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: .88rem; color: #fff;
}
.u-name { color: #fff; font-size: .8rem; font-weight: 600; }
.u-role { color: var(--teal); font-size: .67rem; }

.topbar {
  position: fixed; top: 0; right: 230px; left: 0; height: 56px;
  background: var(--card); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; padding: 0 20px; gap: 10px;
  z-index: 90; box-shadow: var(--shadow);
}
.tb-title { font-size: .98rem; font-weight: 700; flex: 1; }

.tb-btn {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1.5px solid var(--border); background: none; cursor: pointer;
  font-size: .92rem; color: var(--text2);
  display: flex; align-items: center; justify-content: center;
  transition: .2s; position: relative;
}
.tb-btn:hover { background: var(--bg); color: var(--text); }

.n-badge {
  position: absolute; top: -4px; right: -4px;
  width: 16px; height: 16px; background: var(--red); border-radius: 50%;
  font-size: .6rem; color: #fff; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.guest-bar {
  position: sticky; top: 56px; z-index: 88;
  background: linear-gradient(135deg, #e6830a, #c97008);
  color: #fff; padding: 7px 20px;
  display: flex; align-items: center; justify-content: center;
  gap: 12px; font-size: .8rem; font-weight: 600;
}
.guest-bar a { color: #fff; text-decoration: underline; cursor: pointer; }

/* ── CONTENT ──────────────────── */
.content { margin-right: 230px; padding-top: 56px; min-height: 100vh; }
.pi      { padding: 22px 24px; max-width: 1180px; }

.page    { display: none; animation: fu .3s ease; }
.page.on { display: block; }

@keyframes fu {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── CARDS ────────────────────── */
.card {
  background: var(--card); border-radius: var(--r); padding: 20px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.ct {
  font-size: .93rem; font-weight: 700; margin-bottom: 14px;
  display: flex; align-items: center; gap: 7px;
}

.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.g3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.g4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }

.stat-c {
  background: var(--card); border-radius: var(--r); padding: 18px 16px;
  border: 1px solid var(--border); box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.s-num { font-size: 1.9rem; font-weight: 800; line-height: 1; }
.s-lbl { font-size: .74rem; color: var(--text2); margin-top: 4px; }
.s-ico { position: absolute; top: 14px; left: 14px; font-size: 1.4rem; opacity: .3; }

/* ── ALERTS ───────────────────── */
.alert {
  padding: 11px 13px; border-radius: 10px; font-size: .82rem;
  display: flex; gap: 9px; margin-bottom: 10px;
}
.a-red    { background: #fff0f2; border: 1px solid #fca5a5; color: #7f1d1d; }
.a-yellow { background: #fffbeb; border: 1px solid #fcd34d; color: #78350f; }
.a-green  { background: #f0fdf4; border: 1px solid #86efac; color: #14532d; }
.a-blue   { background: #eff6ff; border: 1px solid #93c5fd; color: #1e3a8a; }
.a-teal   { background: rgba(0,184,148,.08); border: 1px solid rgba(0,184,148,.25); color: #065040; }
[data-dark] .a-teal { color: #a7f3d0; }

/* ── BUTTONS ──────────────────── */
.btn {
  padding: 8px 16px; border-radius: 8px; border: none;
  font-family: var(--f); font-size: .83rem; font-weight: 600;
  cursor: pointer; transition: .2s;
  display: inline-flex; align-items: center; gap: 5px;
}
.btn:hover { opacity: .88; transform: translateY(-1px); }
.bt  { background: linear-gradient(135deg, var(--teal), var(--teal3)); color: #fff; }
.bo  { background: none; border: 1.5px solid var(--border); color: var(--text); }
.bo:hover { border-color: var(--teal); color: var(--teal); }
.br  { background: var(--red); color: #fff; }
.bbl { width: 100%; justify-content: center; }
.bs  { padding: 6px 11px; font-size: .77rem; }

/* ── BADGES ───────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 9px; border-radius: 20px; font-size: .71rem; font-weight: 700;
}
.bg  { background: #dcfce7; color: #16a34a; }
.bb  { background: #dbeafe; color: #1d4ed8; }
.by  { background: #fef9c3; color: #854d0e; }
.br2 { background: #fee2e2; color: #dc2626; }
.bp  { background: #ede9fe; color: #6d28d9; }

/* ── TABLE ────────────────────── */
.tbl                   { width: 100%; border-collapse: collapse; }
.tbl th {
  padding: 9px 11px; text-align: right; font-size: .73rem;
  color: var(--text2); font-weight: 600;
  border-bottom: 2px solid var(--border); background: var(--bg);
}
.tbl td                { padding: 10px 11px; border-bottom: 1px solid var(--border); font-size: .82rem; }
.tbl tr:hover td       { background: var(--bg); }

/* ── DOSE CARD ────────────────── */
.dose-c {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--bg);
  border-radius: 11px; border: 1px solid var(--border); margin-bottom: 9px;
}
.dose-t { font-size: .78rem; font-weight: 700; color: var(--teal); min-width: 44px; }

/* ── VITAL BOX ────────────────── */
.v-box   { background: var(--bg); border-radius: 11px; padding: 14px; border: 1px solid var(--border); text-align: center; }
.v-val   { font-size: 1.5rem; font-weight: 800; line-height: 1.1; }
.v-unit  { font-size: .7rem; color: var(--text2); }
.v-name  { font-size: .75rem; color: var(--text2); margin-top: 3px; }

/* ── CHAT ─────────────────────── */
.chat-box {
  background: var(--bg); border-radius: 12px; padding: 14px;
  border: 1px solid var(--border); min-height: 160px; max-height: 380px;
  overflow-y: auto; margin-bottom: 10px;
}
.msg {
  padding: 10px 13px; border-radius: 11px; margin-bottom: 9px;
  font-size: .83rem; line-height: 1.65; max-width: 88%;
}
.mu { background: linear-gradient(135deg, var(--teal), var(--teal3)); color: #fff; margin-right: auto; }
.ma { background: var(--card); border: 1px solid var(--border); }

.ai-row { display: flex; gap: 7px; }

.v-btn {
  background: linear-gradient(135deg, var(--purple), #5b1f6e);
  color: #fff; border-radius: 50%; width: 36px; height: 36px;
  border: none; cursor: pointer; font-size: .9rem;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: .2s;
}
.v-btn:hover { transform: scale(1.1); }
.v-btn.sp    { animation: pulse .9s infinite; }

@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(123,45,139,.4); }
  50%      { box-shadow: 0 0 0 9px rgba(123,45,139,0); }
}

/* ── CHECKUP CARD ─────────────── */
.chk-c {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px; background: var(--bg);
  border-radius: 11px; border: 1px solid var(--border); margin-bottom: 8px;
}

/* ── MODALS ───────────────────── */
.m-ov {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.55); z-index: 4000;
  align-items: center; justify-content: center; padding: 16px;
}
.m-ov.open { display: flex; }

.modal {
  background: var(--card); border-radius: 18px; padding: 24px;
  max-width: 480px; width: 100%;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  animation: mIn .3s ease; max-height: 90vh; overflow-y: auto;
}
@keyframes mIn {
  from { opacity: 0; transform: scale(.93); }
  to   { opacity: 1; transform: scale(1); }
}

.m-hdr { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.m-ttl { font-size: 1rem; font-weight: 700; }
.bx    { background: none; border: none; cursor: pointer; font-size: 1.1rem; color: var(--text2); }

/* ── UPLOAD ZONE ──────────────── */
.upz {
  border: 2px dashed var(--border); border-radius: 11px;
  padding: 28px; text-align: center; cursor: pointer; transition: .2s;
}
.upz:hover  { border-color: var(--teal); background: rgba(0,184,148,.04); }
.upz input  { display: none; }

/* ── SCAN RESULT ──────────────── */
.scan-r {
  background: rgba(0,184,148,.07); border: 1px solid rgba(0,184,148,.2);
  border-radius: 12px; padding: 16px; margin-top: 12px;
}

/* ── NOTIF PANEL ──────────────── */
.n-panel {
  position: fixed; top: 56px; left: 16px; width: 320px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 13px; box-shadow: 0 8px 32px rgba(0,0,0,.15);
  z-index: 200; max-height: 460px; overflow-y: auto; display: none;
}
.n-panel.open { display: block; }

.n-item     { padding: 12px 14px; border-bottom: 1px solid var(--border); display: flex; gap: 10px; }
.n-item.unr { background: rgba(0,184,148,.05); }
.n-dot      { width: 7px; height: 7px; border-radius: 50%; background: var(--teal); flex-shrink: 0; margin-top: 5px; }

/* ── SPINNER ──────────────────── */
.spin {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff;
  border-radius: 50%; animation: sp .7s linear infinite; display: inline-block;
}
@keyframes sp { to { transform: rotate(360deg); } }

/* ── CAMERA ───────────────────── */
.cam-wrap {
  position: relative; border-radius: 14px; overflow: hidden;
  background: #000; aspect-ratio: 4/3; max-width: 400px; margin: 0 auto;
}
#camVideo { width: 100%; height: 100%; object-fit: cover; }

.cam-overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; padding: 16px;
  background: linear-gradient(transparent, rgba(0,0,0,.5));
}

.cam-status {
  position: absolute; top: 12px; right: 12px;
  padding: 5px 12px; border-radius: 20px; font-size: .78rem; font-weight: 700;
  backdrop-filter: blur(4px);
}
.cam-good { background: rgba(0,184,148,.8);  color: #fff; }
.cam-warn { background: rgba(249,199,79,.85); color: #1a1a1a; }
.cam-bad  { background: rgba(230,57,70,.85);  color: #fff; }

/* ── RESPONSIVE ───────────────── */
@media (max-width: 860px) {
  .sidebar          { transform: translateX(100%); }
  .sidebar.open     { transform: translateX(0); }
  .content          { margin-right: 0; }
  .topbar           { right: 0; }
  .g4, .g3         { grid-template-columns: 1fr 1fr; }
  .g2               { grid-template-columns: 1fr; }
}
