/* ==========================================================
   Patient Dashboard
   Shared shell (bottom tab bar on mobile, side rail from tablet up)
   plus onboarding, home overview, and sub-pages.
   Built entirely from design tokens.
   ========================================================== */

:root {
  --dash-nav-h: 64px;
  --dash-rail-w: 232px;
}

/* ===== Shell =========================================================== */
.patient-dashboard {
  min-height: 100dvh;
  background: var(--color-bg-soft);
}

.patient-dashboard__content {
  padding: var(--space-6) var(--space-5)
    calc(var(--dash-nav-h) + env(safe-area-inset-bottom, 0px) + var(--space-6));
  max-width: 960px;
  margin-inline: auto;
  animation: dash-fade-in var(--duration-medium) var(--ease-out);
}

.dashboard-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  font-family: var(--font-body);
  font-size: var(--step-lead);
  color: var(--color-ink-faint);
}

@keyframes dash-fade-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ===== Bottom tab bar (mobile, default) ================================ */
.patient-bottom-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 50;
  display: flex;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(180%) blur(10px);
  border-top: 1px solid var(--color-line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

.patient-bottom-nav__item {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  height: var(--dash-nav-h);
  padding: 0;
  background: transparent;
  border: none;
  color: var(--color-ink-faint);
  cursor: pointer;
  transition: color var(--duration-fast) var(--ease-out);
}

.patient-bottom-nav__item::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 28px;
  height: 3px;
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  background: var(--color-primary);
  transform: translateX(-50%) scaleX(0);
  transition: transform var(--duration-fast) var(--ease-out);
}

.patient-bottom-nav__item--active {
  color: var(--color-primary);
}

.patient-bottom-nav__item--active::before {
  transform: translateX(-50%) scaleX(1);
}

.patient-bottom-nav__item:hover {
  color: var(--color-primary-dark);
}

.patient-bottom-nav__icon {
  width: 21px;
  height: 21px;
  background-color: currentColor;
  mask-repeat: no-repeat;
  mask-position: center;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
  flex: none;
}

.patient-bottom-nav__label {
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

/* ===== Icon glyphs (CSS mask, tint via currentColor) ==================== */
.icon-house {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 11.5 12 4l8 7.5'/%3E%3Cpath d='M6 10.5V19a1 1 0 0 0 1 1h4v-6h2v6h4a1 1 0 0 0 1-1v-8.5'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 11.5 12 4l8 7.5'/%3E%3Cpath d='M6 10.5V19a1 1 0 0 0 1 1h4v-6h2v6h4a1 1 0 0 0 1-1v-8.5'/%3E%3C/svg%3E");
}

.icon-search {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
}

.icon-heart {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l8.72-8.72 1.06-1.06a5.5 5.5 0 0 0 0-7.78z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l8.72-8.72 1.06-1.06a5.5 5.5 0 0 0 0-7.78z'/%3E%3C/svg%3E");
}

.icon-chat {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5.5h14a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-8.5l-4.2 3.6v-3.6H5a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 5.5h14a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1h-8.5l-4.2 3.6v-3.6H5a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z'/%3E%3C/svg%3E");
}

.icon-person {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
  mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
}

/* ===== Side rail (tablet and up) ======================================= */
@media (min-width: 900px) {
  .patient-dashboard {
    display: grid;
    grid-template-columns: var(--dash-rail-w) 1fr;
  }

  .patient-dashboard__content {
    grid-column: 2;
    padding: var(--space-8) var(--space-7);
    max-width: 880px;
    margin-inline: 0;
  }

  .patient-bottom-nav {
    position: sticky;
    top: 0;
    inset: auto;
    grid-column: 1;
    grid-row: 1 / -1;
    height: 100dvh;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    gap: var(--space-1);
    padding: var(--space-6) var(--space-3);
    border-top: none;
    border-right: 1px solid var(--color-line);
    background: var(--color-white);
  }

  .patient-bottom-nav__item {
    flex-direction: row;
    justify-content: flex-start;
    gap: var(--space-3);
    height: auto;
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
  }

  .patient-bottom-nav__item:hover {
    background: var(--color-primary-soft);
  }

  .patient-bottom-nav__item--active {
    background: var(--color-primary-soft);
  }

  .patient-bottom-nav__item::before {
    top: 50%;
    left: 0;
    width: 3px;
    height: 22px;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    transform: translateY(-50%) scaleY(0);
  }

  .patient-bottom-nav__item--active::before {
    transform: translateY(-50%) scaleY(1);
  }

  .patient-bottom-nav__label {
    font-size: var(--step-small);
  }
}

/* ===== Dashboard Pages & Components ==================================== */
.dashboard-page {
  animation: dash-fade-in var(--duration-medium) var(--ease-out);
}

.dashboard-header {
  background: linear-gradient(
    135deg,
    var(--color-primary),
    var(--color-primary-dark)
  );
  border-radius: var(--radius-xl);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-card);
  color: var(--color-white);
}

.dashboard-greeting {
  margin: 0 0 var(--space-2);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
}

.dashboard-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 5vw, 2rem);
  font-weight: 700;
  line-height: 1.2;
  color: var(--color-white);
}

.dashboard-subtitle {
  margin-top: var(--space-2);
  font-size: var(--step-small);
  color: rgba(255, 255, 255, 0.85);
}

.dashboard-card {
  background: var(--color-white);
  border: 1px solid var(--color-line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: var(--space-5);
  margin-bottom: var(--space-4);
}

.dashboard-muted {
  color: var(--color-ink-faint) !important;
  font-size: var(--step-small);
}

.text-center {
  text-align: center;
}

.py-4 {
  padding-top: var(--space-6);
  padding-bottom: var(--space-6);
}

/* ===== Form Controls & Buttons ========================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.95rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--duration-fast),
    transform var(--duration-fast),
    opacity var(--duration-fast);
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-white);
}

.btn-primary:hover {
  background: var(--color-primary-dark);
}

