/* ============================================================
   CareConnect — Design System
   Clinical Precision & Care
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:wght,FILL@100..700,0..1&display=swap');

/* ─── Tokens ─────────────────────────────────────────────── */
:root {
  --primary:            #00288e;
  --on-primary:         #ffffff;
  --primary-container:  #1e40af;
  --on-primary-container: #a8b8ff;
  --primary-fixed:      #dde1ff;
  --primary-fixed-dim:  #b8c4ff;
  --on-primary-fixed:   #001453;
  --on-primary-fixed-v: #173bab;

  --secondary:          #006c49;
  --on-secondary:       #ffffff;
  --secondary-container:#6cf8bb;
  --on-secondary-cont:  #00714d;

  --tertiary:           #170cae;
  --tertiary-container: #3433c3;
  --on-tertiary-cont:   #b3b5ff;

  --error:              #ba1a1a;
  --on-error:           #ffffff;
  --error-container:    #ffdad6;
  --on-error-container: #93000a;

  --warning:            #f59e0b;
  --warning-container:  #fef3c7;

  --surface:            #f8f9fb;
  --surface-low:        #f3f4f6;
  --surface-container:  #edeef0;
  --surface-high:       #e7e8ea;
  --surface-highest:    #e1e2e4;
  --surface-white:      #ffffff;

  --on-surface:         #191c1e;
  --on-surface-var:     #444653;
  --outline:            #757684;
  --outline-var:        #c4c5d5;

  --shadow-1: 0 2px 4px rgba(0,0,0,.05);
  --shadow-2: 0 10px 25px rgba(0,0,0,.10);

  --r-sm:  4px;
  --r-md:  8px;
  --r-lg:  12px;
  --r-xl:  16px;
  --r-full:9999px;
}

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

html { font-family: 'Inter', system-ui, sans-serif; -webkit-font-smoothing: antialiased; }

body {
  background: var(--surface-low);
  color: var(--on-surface);
  font-size: 14px;
  line-height: 20px;
  min-height: 100dvh;
}

/* ─── Material Symbols ───────────────────────────────────── */
.icon {
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 0,'wght' 400,'GRAD' 0,'opsz' 24;
  display: inline-flex;
  user-select: none;
  line-height: 1;
}
.icon.filled { font-variation-settings: 'FILL' 1,'wght' 400,'GRAD' 0,'opsz' 24; }

/* ─── Elevation ──────────────────────────────────────────── */
.card {
  background: var(--surface-white);
  border: 1px solid var(--outline-var);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
}
.card-inner { padding: 16px; }

/* ─── TopBar ─────────────────────────────────────────────── */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--outline-var);
  box-shadow: var(--shadow-1);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; height: 56px;
}
.topbar-title {
  font-size: 20px; font-weight: 700; color: var(--primary);
}

/* ─── Bottom Nav ─────────────────────────────────────────── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  background: var(--surface-white);
  border-top: 1px solid var(--outline-var);
  box-shadow: 0 -2px 10px rgba(0,0,0,.06);
  display: flex; justify-content: space-around; align-items: center;
  height: 64px; padding: 0 8px;
}
.nav-item {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 2px;
  padding: 4px 16px; border-radius: var(--r-full);
  text-decoration: none; color: var(--on-surface-var);
  font-size: 10px; font-weight: 600;
  transition: all .15s ease;
}
.nav-item.active {
  background: var(--primary-fixed);
  color: var(--primary-container);
}
.nav-item:hover { color: var(--primary); }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 12px 24px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 600; border: none; cursor: pointer;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  text-decoration: none;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary-container); color: var(--on-primary); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-secondary { background: var(--secondary-container); color: var(--on-secondary-cont); }
.btn-error { background: var(--error-container); color: var(--on-error-container); }
.btn-ghost { background: transparent; color: var(--primary); }
.btn-full { width: 100%; }
.btn-lg { padding: 16px 24px; font-size: 16px; border-radius: var(--r-lg); }

/* ─── Form Inputs ────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-label {
  font-size: 11px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--on-surface-var);
}
.input-wrap { position: relative; }
.input-icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--outline); pointer-events: none;
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 0,'wght' 400,'GRAD' 0,'opsz' 24;
}
.form-input {
  width: 100%; height: 48px;
  padding: 0 16px 0 44px;
  background: var(--surface-low);
  border: 1px solid var(--outline-var);
  border-radius: var(--r-md);
  font-size: 14px; color: var(--on-surface);
  font-family: inherit;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0,40,142,.15);
}
.form-input::placeholder { color: var(--outline); }
.input-toggle {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  background: none; border: none; cursor: pointer;
  color: var(--on-surface-var);
  font-family: 'Material Symbols Outlined';
  font-variation-settings: 'FILL' 0,'wght' 400,'GRAD' 0,'opsz' 24;
  font-size: 20px;
}

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 10px; border-radius: var(--r-full);
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-ok      { background: rgba(108,248,187,.25); color: var(--on-secondary-cont); }
.badge-pending { background: var(--warning-container); color: #92400e; }
.badge-error   { background: var(--error-container); color: var(--on-error-container); }
.badge-inactive{ background: var(--surface-highest); color: var(--on-surface-var); }
.badge-active  { background: rgba(108,248,187,.2); color: var(--on-secondary-cont); border: 1px solid rgba(0,108,73,.2); }
.badge-live    { background: rgba(108,248,187,.3); color: var(--secondary); }

/* ─── Status dot ─────────────────────────────────────────── */
.dot { width:8px; height:8px; border-radius:50%; display:inline-block; }
.dot-green  { background: var(--secondary); }
.dot-blue   { background: var(--tertiary); }
.dot-gray   { background: var(--outline); }
.dot-red    { background: var(--error); }
.dot-pulse  { animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.4} }

/* ─── Metric Card ────────────────────────────────────────── */
.metric-card {
  background: var(--surface-white);
  border: 1px solid var(--outline-var);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; justify-content: space-between;
  height: 128px;
}
.metric-value { font-size: 36px; font-weight: 700; line-height: 1; }
.metric-label { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing:.05em; color: var(--on-surface-var); margin-top: 4px; }

/* ─── Employee Card ──────────────────────────────────────── */
.emp-card {
  background: var(--surface-white);
  border: 1px solid var(--outline-var);
  border-radius: var(--r-lg);
  padding: 16px;
  box-shadow: var(--shadow-1);
  display: flex; align-items: center; gap: 16px;
}
.emp-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 18px; position: relative; flex-shrink: 0;
  background: var(--primary-fixed); color: var(--on-primary-fixed);
}
.emp-status-dot {
  position: absolute; bottom: -2px; right: -2px;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--surface-white);
}

/* ─── Table ──────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: var(--surface-low); padding: 12px 16px;
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .05em; color: var(--on-surface-var);
  border-bottom: 1px solid var(--outline-var); text-align: left;
}
.data-table td { padding: 14px 16px; border-bottom: 1px solid var(--outline-var); }
.data-table tr:hover td { background: var(--surface-low); }
.data-table tr:last-child td { border-bottom: none; }

/* ─── Alert Banner ───────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: var(--r-md); margin-bottom: 16px; display: flex; gap: 10px; align-items: flex-start; }
.alert-error { background: var(--error-container); color: var(--on-error-container); border: 1px solid var(--error); }
.alert-success { background: rgba(108,248,187,.2); color: var(--on-secondary-cont); }
.alert-info   { background: var(--primary-fixed); color: var(--on-primary-fixed); }

/* ─── Security Badge ─────────────────────────────────────── */
.security-badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(108,248,187,.15); color: var(--on-secondary-cont);
  padding: 6px 16px; border-radius: var(--r-full);
  font-size: 11px; font-weight: 600;
}

/* ─── Quick Actions ──────────────────────────────────────── */
.quick-action {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 8px;
  width: 112px; height: 112px; flex-shrink: 0;
  background: var(--surface-white);
  border: 1px solid var(--outline-var);
  border-radius: var(--r-lg); box-shadow: var(--shadow-1);
  cursor: pointer; transition: all .15s;
  font-size: 11px; font-weight: 600; color: var(--on-surface);
  text-decoration: none;
}
.quick-action:active { transform: scale(.96); }
.qa-icon {
  width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Activity Feed ──────────────────────────────────────── */
.activity-item {
  background: var(--surface-white);
  border: 1px solid var(--outline-var);
  border-radius: var(--r-md); padding: 16px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-1);
}
.activity-icon {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}

/* ─── Utility ────────────────────────────────────────────── */
.main-content { padding-bottom: 80px; padding-top: 24px; }
.container { max-width: 480px; margin: 0 auto; padding: 0 16px; }
.container-lg { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.mb-6 { margin-bottom: 24px; }
.text-primary { color: var(--primary); }
.text-muted { color: var(--on-surface-var); }
.text-error { color: var(--error); }
.text-sm { font-size: 12px; }
.text-xs { font-size: 11px; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.scroll-x { display: flex; overflow-x: auto; }
.animate-in { animation: fadeUp .35s ease forwards; }
@keyframes fadeUp {
  from { opacity:0; transform:translateY(12px); }
  to   { opacity:1; transform:translateY(0); }
}

/* ─── FAB ────────────────────────────────────────────────── */
.fab {
  position: fixed; bottom: 80px; right: 20px; z-index: 40;
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--primary); color: var(--on-primary);
  border: none; cursor: pointer; box-shadow: var(--shadow-2);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; transition: all .15s;
  text-decoration: none;
}
.fab:active { transform: scale(.92); }

/* ─── Login page ─────────────────────────────────────────── */
.login-page {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: var(--surface-low);
}
.login-card {
  background: var(--surface-white);
  border: 1px solid var(--outline-var);
  border-radius: var(--r-xl);
  padding: 24px;
  box-shadow: var(--shadow-1);
}

/* ─── Checkbox ───────────────────────────────────────────── */
input[type=checkbox] { accent-color: var(--primary); width:16px; height:16px; }

/* ─── Responsive ─────────────────────────────────────────── */
@media(min-width:1024px){
  .mobile-only { display:none !important; }
  .sidebar-desktop {
    position:fixed; left:0; top:0; bottom:0; width:25%;
    background:var(--primary); display:flex; flex-direction:column;
    justify-content:space-between; padding:40px;
  }
  .main-with-sidebar { margin-left:25%; }
}
@media(max-width:1023px){
  .desktop-only { display:none !important; }
}
