/* EWGS User App — styles.css  v1.0.0
   Mobile-first. Offline-aware. Sky blue + slate.
   Designed for one-hand use on a phone screen.  */

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

:root {
  --bg:       #f0f7ff;
  --bg-card:  #ffffff;
  --bg-hover: #e8f4fd;
  --bg-input: #f0f7ff;
  --border:   #bfdbfe;
  --border-hi:#93c5fd;

  --text:     #1e3a5f;
  --text-sub: #4b7099;
  --text-dim: #93c5fd;

  --sky:      #0ea5e9;
  --sky-hi:   #38bdf8;
  --sky-bg:   rgba(14,165,233,0.10);

  --green:    #10b981;
  --green-bg: rgba(16,185,129,0.12);
  --amber:    #f59e0b;
  --amber-bg: rgba(245,158,11,0.12);
  --red:      #ef4444;
  --red-bg:   rgba(239,68,68,0.12);
  --blue:     #3b82f6;
  --blue-bg:  rgba(59,130,246,0.12);
  --gray-bg:  rgba(100,116,139,0.10);

  --mono: 'JetBrains Mono','Fira Code','Cascadia Code','SF Mono',Consolas,monospace;
  --ui:   -apple-system,BlinkMacSystemFont,'Segoe UI',system-ui,sans-serif;
  --r:    8px;
  --r-lg: 14px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);

  /* Safe area for notched phones */
  --safe-top:    env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html { height: 100%; }

body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#app { min-height: 100vh; }

/* ─── Offline banner ──────────────────────────────── */
.offline-banner {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--amber-bg);
  border-bottom: 1px solid rgba(245,158,11,.3);
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 8px 16px;
  letter-spacing: 0.02em;
}

/* ─── Login ───────────────────────────────────────── */
.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.login-screen {
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background:
    radial-gradient(ellipse 80% 50% at 50% -5%, rgba(14,165,233,0.15) 0%, transparent 60%),
    var(--bg);
}

.login-card {
  width: 100%;
  max-width: 360px;
}

.app-brand {
  text-align: center;
  margin-bottom: 36px;
}

.app-icon {
  font-size: 40px;
  color: var(--sky);
  margin-bottom: 8px;
  line-height: 1;
}

.app-title {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text);
}

.app-sub {
  font-size: 12px;
  color: var(--text-sub);
  font-family: var(--mono);
  margin-top: 4px;
}

/* ─── Dept select ─────────────────────────────────── */
.dept-btn {
  display: block;
  width: 100%;
  padding: 16px 20px;
  margin-bottom: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  transition: all .15s;
}

.dept-btn:hover, .dept-btn:active {
  border-color: var(--sky);
  background: var(--sky-bg);
}

/* ─── Forms ───────────────────────────────────────── */
.field { margin-bottom: 16px; }

label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-sub);
  letter-spacing: .06em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
select {
  width: 100%;
  padding: 13px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--r);
  color: var(--text);
  font: inherit;
  font-size: 16px; /* prevent iOS zoom */
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
}

input:focus, select:focus {
  border-color: var(--sky);
  box-shadow: 0 0 0 3px rgba(14,165,233,0.12);
}

select { cursor: pointer; }

/* ─── Buttons ─────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 20px;
  border-radius: var(--r);
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
}

.btn:disabled { opacity: .5; pointer-events: none; }
.btn:active   { transform: scale(0.97); }

.btn-primary {
  background: var(--sky);
  color: #000;
  font-weight: 700;
}
.btn-primary:hover { background: var(--sky-hi); }

.btn-ghost {
  background: none;
  border-color: var(--border-hi);
  color: var(--text-sub);
}
.btn-ghost:hover { background: var(--bg-hover); color: var(--text); }

.btn-sm  { padding: 8px 14px; font-size: 13px; }
.btn-full { width: 100%; }
.mb { margin-bottom: 14px; }

/* ─── App shell ───────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ─── Topbar ──────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 10px) 16px 10px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar-icon { font-size: 18px; color: var(--sky); }

.topbar-dept {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

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

.conn-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-on  { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot-off { background: var(--red); }

.sync-spin {
  color: var(--sky);
  font-size: 16px;
  animation: spin .8s linear infinite;
  display: inline-block;
}

.topbar-sync, .topbar-btn {
  background: none;
  border: none;
  color: var(--text-sub);
  cursor: pointer;
  font-size: 16px;
  padding: 4px 6px;
  border-radius: 6px;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s;
}
.topbar-sync:hover, .topbar-btn:hover { color: var(--text); }

/* ─── Screen content ──────────────────────────────── */
.screen-content {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  padding-bottom: calc(80px + var(--safe-bottom));
}

/* ─── Tab bar ─────────────────────────────────────── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0; right: 0;
  display: flex;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding-bottom: var(--safe-bottom);
  z-index: 100;
}

.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 10px 4px;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  color: var(--text-sub);
  transition: color .15s;
}

.tab:active { transform: scale(0.92); }

.tab.active { color: var(--sky); }

.tab-icon  { font-size: 18px; line-height: 1; }
.tab-label { font-size: 10px; font-weight: 600; letter-spacing: .03em; }

/* ─── Banners ─────────────────────────────────────── */
.queue-banner {
  background: var(--amber-bg);
  border: 1px solid rgba(245,158,11,.25);
  border-radius: var(--r);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--amber);
  margin-bottom: 14px;
}

.offline-note {
  text-align: center;
  font-size: 12px;
  color: var(--text-sub);
  padding: 10px;
  margin-top: 8px;
}

/* ─── Section titles ──────────────────────────────── */
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-sub);
  margin-bottom: 10px;
}
.section-title.mt { margin-top: 24px; }

/* ─── Shift cards ─────────────────────────────────── */
.shift-card {
  display: flex;
  align-items: stretch;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  overflow: hidden;
  margin-bottom: 10px;
}

.shift-left {
  background: var(--sky-bg);
  border-right: 2px solid var(--sky);
  padding: 14px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 110px;
}

.shift-date {
  font-size: 13px;
  font-weight: 700;
  color: var(--sky-hi);
}

.shift-right {
  padding: 14px 16px;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
}

.shift-name {
  font-size: 14px;
  font-weight: 600;
  font-family: var(--mono);
}

.shift-id {
  font-size: 11px;
  color: var(--text-sub);
}

/* ─── Check-in screen ─────────────────────────────── */
.checkin-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
  gap: 20px;
}

.checkin-state-card {
  width: 100%;
  max-width: 300px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 20px;
  text-align: center;
}

.state-ok   { border-color: var(--green); background: var(--green-bg); }
.state-bad  { border-color: var(--red);   background: var(--red-bg); }
.state-warn { border-color: var(--amber); background: var(--amber-bg); }
.state-neutral { border-color: var(--border-hi); }

.checkin-icon {
  font-size: 40px;
  margin-bottom: 10px;
}

.state-ok .checkin-icon    { color: var(--green); }
.state-bad .checkin-icon   { color: var(--red); }
.state-warn .checkin-icon  { color: var(--amber); }
.state-neutral .checkin-icon { color: var(--text-sub); }

.checkin-state {
  font-size: 18px;
  font-weight: 700;
  text-transform: capitalize;
}

.state-ok .checkin-state    { color: var(--green); }
.state-bad .checkin-state   { color: var(--red); }
.state-warn .checkin-state  { color: var(--amber); }
.state-neutral .checkin-state { color: var(--text-sub); }

.checkin-time {
  font-size: 12px;
  font-family: var(--mono);
  color: var(--text-sub);
  margin-top: 6px;
}

.btn-checkin {
  width: 100%;
  max-width: 300px;
  padding: 18px;
  background: var(--sky);
  border: none;
  border-radius: var(--r-lg);
  color: #000;
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: 0.04em;
  transition: all .15s;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 4px 20px rgba(14,165,233,0.25);
}

.btn-checkin:hover { background: var(--sky-hi); }
.btn-checkin:active { transform: scale(0.96); box-shadow: none; }

.checkin-result {
  width: 100%;
  max-width: 300px;
  padding: 12px 16px;
  border-radius: var(--r);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.result-ok     { background: var(--green-bg); color: var(--green); border: 1px solid rgba(16,185,129,.3); }
.result-queued { background: var(--amber-bg); color: var(--amber); border: 1px solid rgba(245,158,11,.3); }

/* ─── Swap cards ──────────────────────────────────── */
.swap-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.swap-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.swap-dir {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-sub);
}

.swap-meta {
  font-size: 11px;
  color: var(--text-dim);
}

.swap-note {
  font-size: 13px;
  font-style: italic;
  color: var(--text-sub);
  padding: 8px 10px;
  background: var(--bg-hover);
  border-radius: 6px;
}

/* ─── Notification cards ──────────────────────────── */
.notif-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.notif-card.notif-read { opacity: .7; }

.notif-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.notif-type {
  font-size: 12px;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--text);
}

.notif-body {
  font-size: 13px;
  color: var(--text-sub);
  line-height: 1.5;
  margin-bottom: 6px;
}

.notif-ts {
  font-size: 10px;
  color: var(--text-dim);
}

/* ─── Pills / badges ──────────────────────────────── */
.pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 10px;
  font-weight: 700;
  font-family: var(--mono);
  letter-spacing: .04em;
}

.bg-green  { background: var(--green-bg); color: var(--green);  border: 1px solid rgba(16,185,129,.3); }
.bg-red    { background: var(--red-bg);   color: var(--red);    border: 1px solid rgba(239,68,68,.3); }
.bg-amber  { background: var(--amber-bg); color: var(--amber);  border: 1px solid rgba(245,158,11,.3); }
.bg-blue   { background: var(--blue-bg);  color: var(--blue);   border: 1px solid rgba(59,130,246,.3); }
.bg-sky    { background: var(--sky-bg);   color: var(--sky);    border: 1px solid rgba(14,165,233,.3); }
.bg-gray   { background: var(--gray-bg);  color: var(--text-sub); border: 1px solid var(--border); }

/* ─── Alerts ──────────────────────────────────────── */
.alert {
  padding: 12px 14px;
  border-radius: var(--r);
  font-size: 13px;
  margin-bottom: 14px;
}
.alert-error {
  background: var(--red-bg);
  border: 1px solid rgba(239,68,68,.3);
  color: var(--red);
}

.toast {
  position: fixed;
  bottom: calc(72px + var(--safe-bottom) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 11px 18px;
  border-radius: 24px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: slideUp .2s ease;
  white-space: nowrap;
  max-width: calc(100vw - 40px);
  text-overflow: ellipsis;
  overflow: hidden;
}

.toast-success { background: var(--green-bg); border: 1px solid var(--green); color: var(--green); }
.toast-error   { background: var(--red-bg);   border: 1px solid var(--red);   color: var(--red); }
.toast-warn    { background: var(--amber-bg);  border: 1px solid var(--amber);  color: var(--amber); }
.toast-info    { background: var(--sky-bg);    border: 1px solid var(--sky);    color: var(--sky); }

@keyframes slideUp {
  from { transform: translateX(-50%) translateY(10px); opacity: 0; }
  to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

/* ─── Modal sheet ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
}

.modal-sheet {
  width: 100%;
  background: var(--bg-card);
  border-top: 1px solid var(--border-hi);
  border-radius: 20px 20px 0 0;
  padding: 12px 20px calc(24px + var(--safe-bottom));
  animation: sheetUp .22s ease;
  max-height: 85vh;
  overflow-y: auto;
}

@keyframes sheetUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 40px; height: 4px;
  background: var(--border-hi);
  border-radius: 2px;
  margin: 0 auto 18px;
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 18px;
}

.modal-btns {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* ─── Loading ─────────────────────────────────────── */
.loading-bar {
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--sky), transparent);
  margin-bottom: 14px;
  animation: shimmer 1.2s infinite;
  background-size: 200%;
  border-radius: 1px;
}

@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(0,0,0,.25);
  border-top-color: #000;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}

.spinner.lg { width: 22px; height: 22px; border-width: 3px; }

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

/* ─── Misc ────────────────────────────────────────── */
.empty-card {
  padding: 28px;
  text-align: center;
  color: var(--text-dim);
  font-size: 13px;
  background: var(--bg-card);
  border: 1px dashed var(--border);
  border-radius: var(--r-lg);
  margin-bottom: 10px;
}

.mono { font-family: var(--mono); }

/* ─── Desktop adjustments ─────────────────────────── */
@media (min-width: 480px) {
  .screen-content { max-width: 420px; margin: 0 auto; }
  .tab-bar        { max-width: 420px; left: 50%; transform: translateX(-50%); border-radius: 16px 16px 0 0; }
  .topbar         { justify-content: center; gap: 20px; }
}

/* ─── Logo images ─────────────────────────────────── */
.app-logo {
  width: 56px; height: 56px;
  border-radius: 12px;
  object-fit: contain;
  margin-bottom: 8px;
}
.topbar-logo {
  width: 26px; height: 26px;
  border-radius: 5px;
  object-fit: contain;
}
