/* Tech.Care Patient Dashboard — design tokens from Adobe XD */

:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --ink: #072635;
  --ink-muted: #707070;
  --accent: #01f0d0;
  --systolic: #e66fd2;
  --diastolic: #8c6fe6;
  --chart-bg: #f4f0fe;
  --respiratory-bg: #e0f3fa;
  --temperature-bg: #ffe6e9;
  --heart-bg: #ffe6f1;
  --table-head: #f6f7f8;
  --radius-lg: 16px;
  --radius-pill: 41px;
  --shadow-soft: 0 0 0 1px rgba(7, 38, 53, 0.02);
  --font: "Manrope", system-ui, sans-serif;
}

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

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button,
a {
  font: inherit;
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.hidden {
  display: none !important;
}

/* —— App shell —— */

.app {
  min-height: 100vh;
  padding: 18px 18px 32px;
}

.loading-state,
.error-state {
  min-height: 70vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 16px;
  text-align: center;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(7, 38, 53, 0.12);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* —— Top navigation —— */

.top-nav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: 16px;
  background: var(--surface);
  border-radius: var(--radius-pill);
  padding: 12px 32px;
  margin-bottom: 32px;
  box-shadow: var(--shadow-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  justify-self: start;
}

.brand-logo {
  width: 211px;
  height: 48px;
  object-fit: contain;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-self: center;
  flex-wrap: nowrap;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 11px 16px;
  border-radius: var(--radius-pill);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.nav-link img {
  height: 17px;
  width: auto;
  max-width: 24px;
  object-fit: contain;
  flex-shrink: 0;
}

.nav-link.is-active {
  background: var(--accent);
}

.doctor-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: end;
}

.doctor-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.doctor-meta {
  line-height: 1.2;
}

.doctor-name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
}

.doctor-role {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 500;
}

.icon-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 6px;
  border-radius: 8px;
  cursor: default;
  display: inline-grid;
  place-items: center;
}

.icon-btn img {
  width: 19px;
  height: 20px;
  object-fit: contain;
}

/* —— Layout —— */

.layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr) 340px;
  gap: 24px;
  align-items: start;
}

.panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.panel-header h2 {
  margin: 0;
}

.center-column,
.right-column {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

/* —— Patients list —— */

.patients-panel {
  padding: 20px 12px 12px;
  max-height: calc(100vh - 140px);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 18px;
}

.patients-panel .panel-header {
  padding: 0 8px;
}

.patient-list {
  list-style: none;
  margin: 0;
  padding: 0 4px 0 0;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: #072635 transparent;
}

.patient-list::-webkit-scrollbar {
  width: 6px;
}

.patient-list::-webkit-scrollbar-track {
  background: transparent;
  margin: 8px 0;
}

.patient-list::-webkit-scrollbar-thumb {
  background: #072635;
  border-radius: 3px;
}

.patient-list::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.patient-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 10px;
  border-radius: 8px;
}

.patient-item.is-active {
  background: var(--accent);
}

.patient-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.patient-info {
  min-width: 0;
  flex: 1;
}

.patient-name {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.patient-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--ink-muted);
  font-weight: 500;
}

.patient-item .more-btn img {
  width: 18px;
  height: 18px;
  object-fit: contain;
}

/* —— Diagnosis / chart —— */

.diagnosis-panel {
  padding: 20px;
}

.bp-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 180px;
  gap: 20px;
  background: var(--chart-bg);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
}

.bp-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.bp-chart-header h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
}

.time-range {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.time-range img {
  width: 10px;
  height: 5.5px;
  object-fit: contain;
}

.chart-canvas-wrap {
  position: relative;
  height: 230px;
}

.bp-legend {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding-top: 8px;
}

.bp-legend hr {
  border: 0;
  border-top: 1px solid rgba(7, 38, 53, 0.12);
  margin: 8px 0;
}

.bp-stat-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 500;
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.dot-systolic {
  background: var(--systolic);
}

.dot-diastolic {
  background: var(--diastolic);
}

.bp-stat-value {
  margin: 8px 0 4px;
  font-size: 22px;
  font-weight: 700;
}

.bp-stat-level {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}

.bp-stat-level img,
.vital-level img {
  width: 10px;
  height: 6px;
}

/* —— Vitals —— */

.vitals-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.vital-card {
  border-radius: 12px;
  padding: 16px;
  min-height: 220px;
}

.vital-respiratory {
  background: var(--respiratory-bg);
}

.vital-temperature {
  background: var(--temperature-bg);
}

.vital-heart {
  background: var(--heart-bg);
}

.vital-icon {
  width: 84px;
  height: 84px;
  margin-bottom: 12px;
}

.vital-label {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 500;
}

.vital-value {
  margin: 0 0 12px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.vital-level {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
}

/* —— Diagnostic table —— */

.diagnostic-panel {
  padding: 20px;
}

.table-wrap {
  max-height: 220px;
  overflow: auto;
  border-radius: 12px;
  scrollbar-width: thin;
  scrollbar-color: #072635 transparent;
}

.table-wrap::-webkit-scrollbar {
  width: 6px;
}

.table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: #072635;
  border-radius: 3px;
}

.table-wrap::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.diagnostic-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

.diagnostic-table thead th {
  position: sticky;
  top: 0;
  background: var(--table-head);
  text-align: left;
  font-weight: 700;
  padding: 14px 16px;
}

.diagnostic-table thead th:first-child {
  border-radius: 24px 0 0 24px;
}

.diagnostic-table thead th:last-child {
  border-radius: 0 24px 24px 0;
}

.diagnostic-table tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid #f0f0f0;
  vertical-align: top;
  font-weight: 500;
}

.diagnostic-table tbody tr:last-child td {
  border-bottom: 0;
}

/* —— Profile —— */

.profile-panel {
  text-align: center;
  padding: 28px 24px 24px;
}

.profile-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  margin: 0 auto 16px;
  image-rendering: auto;
}

.profile-name {
  margin: 0 0 24px;
  font-size: 24px;
  font-weight: 800;
}

.profile-details {
  list-style: none;
  margin: 0 0 28px;
  padding: 0;
  text-align: left;
  display: grid;
  gap: 20px;
}

.profile-details li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.profile-details img {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
}

.detail-label,
.detail-value {
  display: block;
}

.detail-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 2px;
}

.detail-value {
  font-size: 14px;
  font-weight: 700;
}

.btn-primary {
  appearance: none;
  border: 0;
  background: var(--accent);
  color: var(--ink);
  font-weight: 700;
  font-size: 14px;
  padding: 11px 28px;
  border-radius: var(--radius-pill);
  cursor: default;
}

.profile-cta {
  width: auto;
  min-width: 220px;
}

/* —— Lab results —— */

.labs-panel {
  padding: 20px;
}

.lab-list {
  list-style: none;
  margin: 0;
  padding: 0 4px 0 0;
  max-height: 240px;
  overflow-y: auto;
  display: grid;
  gap: 6px;
  scrollbar-width: thin;
  scrollbar-color: #072635 transparent;
}

.lab-list::-webkit-scrollbar {
  width: 6px;
}

.lab-list::-webkit-scrollbar-track {
  background: transparent;
}

.lab-list::-webkit-scrollbar-thumb {
  background: #072635;
  border-radius: 3px;
}

.lab-list::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.lab-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

.lab-item:nth-child(odd) {
  background: var(--table-head);
}

.lab-item img {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

/* —— Responsive —— */

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 280px minmax(0, 1fr);
  }

  .right-column {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .top-nav {
    grid-template-columns: 1fr auto;
    border-radius: 24px;
    padding: 16px;
    row-gap: 12px;
  }

  .main-nav {
    grid-column: 1 / -1;
    justify-self: start;
    flex-wrap: wrap;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .patients-panel {
    position: static;
    max-height: 360px;
  }

  .right-column {
    grid-template-columns: 1fr;
  }

  .bp-card {
    grid-template-columns: 1fr;
  }

  .vitals-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 600px) {
  .app {
    padding: 12px;
  }

  .brand-logo {
    width: 140px;
    height: auto;
  }

  .nav-link span {
    display: none;
  }

  .nav-link {
    padding: 10px;
  }
}
