/* ============================================================
   TBIU MedTrack — Navy & Grey Design System
   ============================================================ */
:root {
  --navy: #1B2A4A;
  --navy-dark: #0F1A2E;
  --navy-mid: #243B63;
  --navy-light: #2E4A7A;
  --accent: #3B82F6;
  --grey-50: #F8FAFC;
  --grey-100: #F1F5F9;
  --grey-200: #E2E8F0;
  --grey-300: #CBD5E1;
  --grey-400: #94A3B8;
  --grey-500: #64748B;
  --grey-600: #475569;
  --grey-700: #334155;
  --grey-800: #1E293B;
  --success: #059669;
  --warning: #D97706;
  --danger: #DC2626;
  --info: #2563EB;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(15,26,46,0.06), 0 1px 2px rgba(15,26,46,0.04);
  --shadow-md: 0 4px 12px rgba(15,26,46,0.08);
  --shadow-lg: 0 12px 24px rgba(15,26,46,0.1);
  --font: 'Inter', system-ui, -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--grey-50);
  color: var(--grey-800);
  margin: 0;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* ---- Public Nav ---- */
.pub-nav {
  background: rgba(15,26,46,0.92);
  backdrop-filter: blur(14px);
  position: sticky; top: 0; z-index: 1000;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.pub-nav .navbar-brand {
  font-weight: 700; color: #fff !important;
  display: flex; align-items: center; gap: 0.6rem;
  letter-spacing: -0.02em;
}
.pub-nav .navbar-brand img { height: 36px; width: auto; }
.pub-nav .nav-link {
  color: rgba(255,255,255,0.75) !important;
  font-weight: 500; font-size: 0.92rem;
  transition: color 0.2s;
}
.pub-nav .nav-link:hover { color: #fff !important; }

/* ---- Hero ---- */
.hero {
  background: linear-gradient(145deg, var(--navy-dark) 0%, var(--navy) 45%, var(--navy-mid) 100%);
  color: #fff;
  min-height: 92vh;
  display: flex; align-items: center;
  position: relative; overflow: hidden;
}
.hero::before {
  content: '';
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(59,130,246,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59,130,246,0.04) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.7;
}
.hero::after {
  content: '';
  position: absolute;
  width: 500px; height: 500px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%);
  top: -100px; right: -100px;
  animation: pulse-glow 8s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.08); }
}
.hero-content { position: relative; z-index: 2; }
.hero h1 {
  font-size: clamp(2.1rem, 5vw, 3.4rem);
  font-weight: 800; letter-spacing: -0.03em; line-height: 1.12;
}
.hero .lead { font-size: 1.15rem; opacity: 0.88; max-width: 520px; }

.hero-scene {
  position: relative; z-index: 2;
  min-height: 500px;
  display: flex; align-items: center; justify-content: center;
}
.hero-slides {
  position: relative; width: min(100%, 520px); height: 440px; border-radius: 28px; overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.45);
  border: 1px solid rgba(255,255,255,0.12);
}
.hero-slide {
  position: absolute; inset: 0; opacity: 0; transition: opacity 1.1s ease-in-out;
  background-size: cover; background-position: center; transform: scale(1.06);
}
.hero-slide.active { opacity: 1; }
.hero-slide::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(15,26,46,0.15), rgba(15,26,46,0.72));
}
.hero-panel {
  position: absolute; inset: auto 28px 24px 28px; z-index: 2;
  background: rgba(11,17,28,0.62); border: 1px solid rgba(255,255,255,0.1); border-radius: 18px; backdrop-filter: blur(10px);
  padding: 1rem 1.1rem; color: #fff; box-shadow: 0 18px 40px rgba(1,10,22,0.28);
}
.hero-panel .label { font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(255,255,255,0.72); }
.hero-panel .value { font-size: 1.3rem; font-weight: 700; letter-spacing: -0.03em; }

.stat-block {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 14px; padding: 1rem;
  color: #fff; backdrop-filter: blur(8px);
}
.stat-block strong { display: block; font-size: 1.6rem; }

/* Device card animation */
.device-preview {
  background: rgba(255,255,255,0.07);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--shadow-lg);
  animation: float-card 7s ease-in-out infinite;
  position: relative; z-index: 2;
}
@keyframes float-card {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-14px); }
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #34D399; display: inline-block;
  box-shadow: 0 0 8px #34D399; margin-right: 5px;
}

/* ---- Sections ---- */
.section { padding: 5rem 0; }
.section-title {
  font-weight: 700; letter-spacing: -0.02em;
  color: var(--navy-dark); margin-bottom: 0.4rem;
}
.section-sub { color: var(--grey-500); max-width: 560px; }

.feature-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 1.6rem;
  border: 1px solid var(--grey-200);
  box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s;
  height: 100%;
}
.feature-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.feature-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--grey-100);
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 1rem;
}
.feature-icon svg { width: 22px; height: 22px; }

/* Buttons */
.btn-navy {
  background: var(--navy); border: none; color: #fff;
  font-weight: 600; padding: 0.7rem 1.4rem;
  border-radius: 8px; transition: background 0.2s, transform 0.15s;
}
.btn-navy:hover { background: var(--navy-dark); color: #fff; transform: translateY(-1px); }
.btn-navy-outline {
  background: transparent; border: 1.5px solid rgba(255,255,255,0.45);
  color: #fff; font-weight: 600; padding: 0.65rem 1.3rem; border-radius: 8px;
}
.btn-navy-outline:hover { background: rgba(255,255,255,0.1); color: #fff; border-color: #fff; }
.btn-ghost {
  background: #fff; border: 1px solid var(--grey-200);
  color: var(--grey-700); font-weight: 500; border-radius: 8px;
}
.btn-ghost:hover { background: var(--grey-100); color: var(--navy); }

/* ---- App Shell ---- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 248px; background: linear-gradient(180deg, var(--navy-dark) 0%, #101d35 100%);
  color: #fff; flex-shrink: 0; position: fixed; top: 0; left: 0; bottom: 0;
  overflow-y: auto; z-index: 200; transition: transform 0.3s;
  display: flex; flex-direction: column; box-shadow: 18px 0 40px rgba(15,26,46,0.18);
}
.sidebar .brand {
  padding: 1.1rem 1.25rem 0.9rem; font-weight: 700; font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,0.06); display: flex; align-items: center; gap: 0.55rem;
}
.sidebar .brand img { height: 30px; width: auto; }
.user-mini {
  margin: 0.85rem 1rem 0.5rem; padding: 0.75rem 0.85rem; border-radius: 12px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.06);
  display: flex; align-items: center; gap: 0.7rem;
}
.user-mini-avatar, .user-pill-avatar {
  width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 700; background: linear-gradient(135deg, rgba(59,130,246,0.9), rgba(96,165,250,0.55));
  color: #fff; box-shadow: inset 0 1px 10px rgba(255,255,255,0.2);
}
.user-mini-name { font-size: 0.82rem; font-weight: 600; color: #fff; }
.user-mini-role { font-size: 0.68rem; color: rgba(255,255,255,0.65); }
.sidebar .nav-label {
  padding: 1rem 1.25rem 0.3rem; font-size: 0.68rem; text-transform: uppercase;
  letter-spacing: 0.07em; color: rgba(255,255,255,0.35);
}
.sidebar a {
  display: flex; align-items: center; gap: 0.7rem; padding: 0.6rem 1.25rem;
  color: rgba(255,255,255,0.7); text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: all 0.15s;
}
.sidebar a:hover, .sidebar a.active {
  background: rgba(59,130,246,0.12); color: #fff; border-left: 3px solid var(--accent);
  padding-left: calc(1.25rem - 3px); box-shadow: inset 0 0 0 1px rgba(59,130,246,0.08);
}
.sidebar a svg { width: 18px; height: 18px; opacity: 0.8; flex-shrink: 0; }
.sidebar .sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,0.06); padding: 0.75rem 0; }

.main-content { margin-left: 248px; flex: 1; min-width: 0; }
.topbar {
  background: rgba(255,255,255,0.9); backdrop-filter: blur(10px); border-bottom: 1px solid var(--grey-200);
  padding: 0.82rem 1.5rem; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100;
  box-shadow: 0 10px 25px rgba(15,26,46,0.04);
}
.page-kicker { font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--grey-500); margin-bottom: 0.1rem; }
.topbar-user { background: var(--grey-50); border: 1px solid var(--grey-200); }
.topbar-user:hover { background: var(--grey-100); }
.content-area { padding: 1.5rem; }

/* KPI */
.kpi {
  background: #fff; border-radius: var(--radius);
  padding: 1.15rem 1.3rem; border: 1px solid var(--grey-200);
  box-shadow: var(--shadow); height: 100%;
}
.report-kpi { background: linear-gradient(180deg, #ffffff, #f8fbff); }
.kpi-value {
  font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; color: var(--navy-dark);
}
.kpi-label { font-size: 0.82rem; color: var(--grey-500); font-weight: 500; }
.kpi-icon {
  width: 36px; height: 36px; border-radius: 8px; display: flex; align-items: center; justify-content: center;
  background: var(--grey-100); color: var(--navy);
}
.kpi-icon svg { width: 18px; height: 18px; }
.mini-pill {
  display: inline-flex; align-items: center; padding: 0.28rem 0.55rem; border-radius: 999px; background: rgba(59,130,246,0.08);
  color: var(--navy); font-size: 0.68rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.mini-pill.success { background: rgba(5,150,105,0.08); color: var(--success); }
.mini-pill.warning { background: rgba(217,119,6,0.08); color: var(--warning); }
.mini-pill.info { background: rgba(37,99,235,0.08); color: var(--info); }

/* Cards */
.card-clean {
  background: #fff; border-radius: var(--radius); border: 1px solid var(--grey-200); box-shadow: var(--shadow); overflow: hidden;
}
.card-clean .card-head {
  background: linear-gradient(180deg, #ffffff, #fafcff); border-bottom: 1px solid var(--grey-200);
  padding: 0.9rem 1.2rem; font-weight: 600; font-size: 0.95rem; display: flex; align-items: center; justify-content: space-between;
}
.report-card { border-color: rgba(27,42,74,0.08); }
.admin-metric-link { color: inherit; text-decoration: none; }
.admin-metric-link .kpi { transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s; }
.admin-metric-link:hover .kpi { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: rgba(59,130,246,0.35); }

/* Equipment card */
.eq-card {
  background: #fff; border-radius: var(--radius);
  border: 1px solid var(--grey-200); overflow: hidden;
  transition: box-shadow 0.2s, transform 0.2s; height: 100%;
}
.eq-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.eq-card .eq-thumb {
  height: 110px; background: linear-gradient(135deg, var(--grey-100), var(--grey-200));
  display: flex; align-items: center; justify-content: center;
  color: var(--navy); opacity: 0.5;
}
.eq-card .eq-thumb svg { width: 36px; height: 36px; }
.eq-card .eq-body { padding: 1rem; }
.technician-card { transition: transform 0.18s, box-shadow 0.18s; }
.technician-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.technician-avatar { width: 58px; height: 58px; flex: 0 0 58px; border-radius: 50%; object-fit: cover; }
.technician-profile-photo { width: min(100%, 210px); aspect-ratio: 1; object-fit: cover; border-radius: 1rem; }
.technician-avatar-placeholder { display: flex; align-items: center; justify-content: center; color: var(--navy); background: linear-gradient(135deg, var(--grey-100), var(--grey-200)); font-size: 1.5rem; font-weight: 700; }

/* Badges */
.badge {
  font-weight: 600; font-size: 0.72rem; padding: 0.3em 0.6em;
  border-radius: 6px; letter-spacing: 0.01em;
}
.badge-success { background: #ECFDF5; color: #047857; }
.badge-warning { background: #FFFBEB; color: #B45309; }
.badge-danger { background: #FEF2F2; color: #B91C1C; }
.badge-info { background: #EFF6FF; color: #1D4ED8; }
.badge-primary { background: #EEF2FF; color: #3730A3; }
.badge-secondary { background: var(--grey-100); color: var(--grey-600); }
.badge-dark { background: var(--grey-800); color: #fff; }

/* Forms */
.form-control, .form-select {
  border-radius: 8px; border-color: var(--grey-300);
  padding: 0.55rem 0.85rem; font-size: 0.92rem;
}
.form-control:focus, .form-select:focus {
  border-color: var(--navy-light);
  box-shadow: 0 0 0 3px rgba(27,42,74,0.12);
}
.form-label { font-weight: 500; font-size: 0.88rem; color: var(--grey-700); }

/* Empty */
.empty-state {
  text-align: center; padding: 3rem 1.5rem; color: var(--grey-500);
}
.empty-state svg { width: 48px; height: 48px; opacity: 0.35; margin-bottom: 0.75rem; }

/* Tables */
.table { font-size: 0.9rem; }
.table thead th {
  font-weight: 600; font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--grey-500);
  background: var(--grey-50) !important; border-bottom: 1px solid var(--grey-200);
}

/* Mobile */
@media (max-width: 991.98px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.show { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .mobile-toggle { display: inline-flex !important; }
}
.mobile-toggle { display: none; }

/* Scan FAB */
.scan-fab {
  position: fixed; bottom: 1.4rem; right: 1.4rem;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--navy); color: #fff; border: none;
  box-shadow: 0 4px 16px rgba(27,42,74,0.35);
  z-index: 500; display: flex; align-items: center; justify-content: center;
  transition: transform 0.2s, background 0.2s; text-decoration: none;
}
.scan-fab:hover { background: var(--navy-dark); transform: scale(1.06); color: #fff; }
.scan-fab svg { width: 24px; height: 24px; }

/* Footer public */
.pub-footer {
  background: var(--navy-dark); color: rgba(255,255,255,0.55);
  padding: 3.5rem 0 1.5rem;
}
.pub-footer h5, .pub-footer h6 { color: #fff; }
.pub-footer a { color: rgba(255,255,255,0.55); text-decoration: none; }
.pub-footer a:hover { color: #fff; }

.pub-site {
  background: #0b1220;
  color: #e2e8f0;
}
.pub-site .audience-strip,
.pub-site .how-section {
  background: #101a2b !important;
  border-color: rgba(255,255,255,0.08) !important;
}
.pub-site .section-title,
.pub-site .feature-card h5,
.pub-site .how-section h6 {
  color: #f8fafc;
}
.pub-site .section-sub,
.pub-site .feature-card p,
.pub-site .how-section p,
.pub-site .audience-strip p,
.pub-site .audience-strip .text-muted {
  color: #a8b6ca !important;
}
.pub-site .feature-card {
  background: linear-gradient(145deg, #111d30, #0d1728);
  border-color: rgba(148,163,184,0.16);
  box-shadow: 0 18px 38px rgba(0,0,0,0.2);
}
.pub-site .feature-card:hover {
  border-color: rgba(59,130,246,0.4);
  box-shadow: 0 24px 48px rgba(0,0,0,0.3);
}
.pub-site .feature-icon {
  color: #93c5fd;
  background: rgba(59,130,246,0.13);
}
.pub-site .accordion-item {
  background: #111d30;
  border: 1px solid rgba(148,163,184,0.14) !important;
}
.pub-site .accordion-button {
  background: #111d30;
  color: #f8fafc;
}
.pub-site .accordion-button:not(.collapsed) {
  color: #bfdbfe;
  box-shadow: none;
}
.pub-site .accordion-button::after {
  filter: invert(1);
}
.pub-site .accordion-body,
.pub-site .text-muted {
  color: #a8b6ca !important;
}
.pub-site .card-clean {
  background: #fff;
  color: var(--grey-800);
}
.auth-page {
  min-height: 100vh;
  background: radial-gradient(circle at 15% 5%, rgba(59,130,246,0.2), transparent 35%), #0b1220;
  color: #f8fafc;
}
.auth-page h1,
.auth-page h2,
.auth-page .text-muted {
  color: #d7e0ed !important;
}
.auth-page .card-clean {
  background: #fff;
  color: var(--grey-800);
  box-shadow: 0 28px 70px rgba(0,0,0,0.28);
}
.auth-page .card-clean .form-label {
  color: var(--grey-700);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  @page { margin: 12mm; }
  body { background: #fff !important; color: #111827 !important; }
  .sidebar, .topbar, .scan-fab, .d-print-none { display: none !important; }
  .main-content { margin: 0 !important; }
  .content-area { padding: 0 !important; }
  .card-clean, .kpi { box-shadow: none !important; break-inside: avoid; }
  .report-card { border-color: #cbd5e1 !important; }
  canvas { max-height: 250px !important; }
  .table { font-size: 10pt; }
}
