/**
 * static/css/owner-app.css — the pet-owner "my account" area shell: a
 * sidebar (desktop) / bottom tab bar (mobile) app shell with no marketing
 * footer, mirroring the structural lessons from the staff panel's own
 * shell (fixed nav, mobile-first, no footer competing with the content).
 * Deliberately NOT the staff panel's separate cool palette, though — this
 * reuses tokens.css's existing warm brand tokens directly, since a
 * customer should still feel like they're on the clinic's own site, just
 * with a cleaner, app-like structure instead of the full marketing chrome.
 *
 * Scope: only templates whose body carries the "owner-app" class (set by
 * templates/base_owner.html's body_class block) are affected — the rest
 * of the public site (marketing pages, public booking) is untouched.
 */

body.owner-app {
  background: var(--canvas);
}

/* ── Top bar — shown at every width for logged-out pages (login/OTP/
   register), and on narrow widths only once logged in (the sidebar takes
   over at the desktop breakpoint). ─────────────────────────────────────── */
.owner-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  min-block-size: var(--header-h);
  box-sizing: border-box;
  padding-inline: var(--sp-4);
  background: var(--surface-raised);
  border-block-end: 1px solid var(--c-border);
}
.owner-topbar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  text-decoration: none;
  color: inherit;
  min-inline-size: 0;
}
.owner-topbar__brand img {
  inline-size: 2rem;
  block-size: 2rem;
  flex: none;
}
.owner-topbar__brand span {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.owner-topbar__avatar {
  display: grid;
  place-items: center;
  inline-size: 2.25rem;
  block-size: 2.25rem;
  border-radius: var(--r-full);
  background: var(--brand-50);
  color: var(--brand-700);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
  text-decoration: none;
  flex: none;
}

/* ── Sidebar — desktop, logged-in only. ─────────────────────────────────── */
.owner-sidebar {
  display: none;
}

.owner-sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-5);
  border-block-end: 1px solid var(--c-border);
  text-decoration: none;
  color: inherit;
}
.owner-sidebar__brand img {
  inline-size: 2.25rem;
  block-size: 2.25rem;
}
.owner-sidebar__brand span {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  font-size: var(--fs-sm);
}
.owner-sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: var(--sp-4) var(--sp-3);
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}
.owner-sidebar__footer {
  padding: var(--sp-4);
  border-block-start: 1px solid var(--c-border);
}

.owner-nav-link {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3);
  border-radius: var(--r-md);
  text-decoration: none;
  color: var(--c-text-muted);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: background-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.owner-nav-link:hover {
  background: var(--surface-sunken);
  color: var(--c-text);
}
.owner-nav-link svg {
  flex: none;
}
.owner-nav-link[aria-current="page"] {
  background: var(--brand-50);
  color: var(--brand-700);
}

/* ── Bottom tab bar — mobile, logged-in only. ───────────────────────────── */
.owner-bottom-tabs {
  display: none;
}

.owner-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding-block: var(--sp-2);
  text-decoration: none;
  color: var(--c-text-subtle);
  font-size: var(--fs-xs);
  line-height: 1.1;
  text-align: center;
}
.owner-tab svg {
  flex: none;
}
.owner-tab[aria-current="page"] {
  color: var(--brand-700);
}

/* ── State: logged in ────────────────────────────────────────────────────
   Top bar stays (logo + account avatar) on mobile — only the desktop
   breakpoint below swaps it for the sidebar. Bottom tab bar fixed + #main
   gets bottom padding to clear it. ──────────────────────────────────────── */
body.owner-app--authed .owner-bottom-tabs {
  display: flex;
  position: fixed;
  inset-inline: 0;
  inset-block-end: 0;
  z-index: var(--z-header);
  background: var(--surface-raised);
  border-block-start: 1px solid var(--c-border);
  padding-block-end: env(safe-area-inset-bottom);
}
body.owner-app--authed #main {
  padding-block-end: calc(4.5rem + env(safe-area-inset-bottom));
}

@media (min-width: 62rem) {
  body.owner-app--authed .owner-topbar {
    display: none;
  }
  body.owner-app--authed .owner-sidebar {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset-block: 0;
    inset-inline-start: 0;
    inline-size: 17rem;
    background: var(--surface-raised);
    border-inline-end: 1px solid var(--c-border);
    z-index: var(--z-header);
  }
  body.owner-app--authed .owner-bottom-tabs {
    display: none;
  }
  body.owner-app--authed #main {
    padding-inline-start: 17rem;
    padding-block-end: 0;
  }
}

/* ── Shared content components ───────────────────────────────────────────
   Every owner-facing page below uses these instead of one-off inline
   styles, so a card looks like a card everywhere (same radius, shadow,
   hover lift) rather than each page inventing its own. Built on the same
   tokens.css scale the rest of the (already-approved) public site uses —
   .card/.badge/.btn/.field from components.css cover the rest; these fill
   the few patterns this app shell needed that the marketing site didn't
   (avatars, list rows, empty states, a step progress bar). ───────────────── */

.owner-section {
  margin-block-end: var(--sp-7);
}
.owner-section:last-child {
  margin-block-end: 0;
}
.owner-section__title {
  font-family: var(--font-display);
  font-size: var(--fs-md);
  font-weight: var(--fw-semibold);
  color: var(--c-heading);
  margin-block-end: var(--sp-3);
}

.owner-list {
  background: var(--surface-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.owner-list-row {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
}
.owner-list-row + .owner-list-row {
  border-block-start: 1px solid var(--c-border);
}
a.owner-list-row {
  text-decoration: none;
  color: inherit;
  transition: background-color var(--dur-fast) var(--ease-out);
}
a.owner-list-row:hover {
  background: var(--surface-sunken);
}

.owner-icon-tile {
  inline-size: 2.75rem;
  block-size: 2.75rem;
  border-radius: var(--r-md);
  background: var(--brand-50);
  color: var(--brand-600);
  display: grid;
  place-items: center;
  flex: none;
}
.owner-icon-tile--lg {
  inline-size: 3.5rem;
  block-size: 3.5rem;
  border-radius: var(--r-lg);
}

.owner-avatar {
  border-radius: var(--r-full);
  object-fit: cover;
  flex: none;
  display: block;
}
.owner-avatar-fallback {
  border-radius: var(--r-full);
  background: var(--grad-brand);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  flex: none;
}

.owner-empty {
  text-align: center;
  padding: var(--sp-7) var(--sp-5);
  color: var(--c-text-muted);
  background: var(--surface-sunken);
  border-radius: var(--r-lg);
}
.owner-empty svg {
  color: var(--ink-300);
  margin-inline: auto;
  margin-block-end: var(--sp-3);
}
.owner-empty__title {
  font-weight: var(--fw-medium);
  color: var(--c-text);
  margin-block-end: var(--sp-1);
}

.owner-callout {
  border-radius: var(--r-xl);
  padding: var(--sp-5);
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  text-decoration: none;
  color: inherit;
  transition: transform var(--dur-base) var(--ease-out), box-shadow var(--dur-base) var(--ease-out);
}
.owner-callout--accent {
  background: linear-gradient(135deg, var(--brand-50), var(--accent-50) 140%);
  border: 1px solid var(--brand-200);
}
.owner-callout--dashed {
  background: var(--surface-sunken);
  border: 1.5px dashed var(--c-border-strong);
}
.owner-callout:hover {
  transform: translateY(-2px);
  box-shadow: var(--sh-md);
}

.owner-pet-strip {
  display: flex;
  gap: var(--sp-4);
  overflow-x: auto;
  padding-block: var(--sp-1);
  padding-inline-end: var(--sp-1);
  -webkit-overflow-scrolling: touch;
}
.owner-pet-chip {
  flex: none;
  inline-size: 5.5rem;
  text-align: center;
  text-decoration: none;
  color: inherit;
}
.owner-pet-chip img,
.owner-pet-chip .owner-avatar-fallback {
  inline-size: 4rem;
  block-size: 4rem;
  margin-inline: auto;
  font-size: var(--fs-lg);
}
.owner-pet-chip p {
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  margin-block-start: var(--sp-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Step wizard (registration, booking) ─────────────────────────────────── */
.owner-stepper {
  display: flex;
  gap: var(--sp-1);
  justify-content: center;
  margin-block: var(--sp-3);
}
.owner-stepper__dot {
  inline-size: 2rem;
  block-size: 0.3rem;
  border-radius: var(--r-full);
  background: var(--c-border);
}
.owner-stepper__dot--done {
  background: var(--brand-600);
}
.owner-step-label {
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  color: var(--c-text-subtle);
  text-transform: uppercase;
  letter-spacing: var(--tracking-wide);
}

/* ── Selectable option cards (pet picker, visit-type picker) ────────────── */
.owner-option {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding: var(--sp-4);
  border: 1.5px solid var(--c-border);
  border-radius: var(--r-lg);
  background: var(--surface-raised);
  text-align: start;
  cursor: pointer;
  transition: border-color var(--dur-fast) var(--ease-out), background-color var(--dur-fast) var(--ease-out);
}
.owner-option:hover {
  border-color: var(--brand-300);
}
.owner-option[aria-pressed="true"] {
  border-color: var(--brand-600);
  background: var(--brand-50);
}
.owner-option input[type="radio"] {
  accent-color: var(--brand-600);
  inline-size: 1.15rem;
  block-size: 1.15rem;
  flex: none;
}

/* ── Notification bell and the updates feed ─────────────────────────────
   The bell sits in the top bar, which only exists at mobile widths — the
   sidebar takes over at 62rem and carries its own "Updates" link instead.
   Both wear the same badge. ─────────────────────────────────────────── */
.owner-topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  flex: none;
}
.owner-bell {
  position: relative;
  display: grid;
  place-items: center;
  /* 2.75rem, not the icon's 20px: a tap target has to be reachable, and
     this one sits next to another one. */
  inline-size: 2.75rem;
  block-size: 2.75rem;
  border-radius: var(--r-full);
  color: var(--c-text);
  text-decoration: none;
}
.owner-bell:hover { background: var(--surface-sunken); }
.owner-bell__badge,
.owner-nav-link__badge {
  min-inline-size: 1.1rem;
  block-size: 1.1rem;
  padding-inline: 0.3rem;
  border-radius: var(--r-full);
  background: var(--danger-600);
  color: #fff;
  font-size: 0.7rem;
  font-weight: var(--fw-semibold);
  line-height: 1.1rem;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.owner-bell__badge {
  position: absolute;
  inset-block-start: 0.4rem;
  inset-inline-end: 0.35rem;
}
.owner-nav-link__badge { margin-inline-start: auto; }

.feed {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
}
.feed__item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--surface-raised);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
}
/* The unread marker is a border, not a background tint: a tinted row that
   turns plain on the next page load reads as a bug, while a rule at the
   edge reads as a marker. */
.feed__item--new { border-inline-start: 3px solid var(--accent-400); }
.feed__body { flex: 1 1 14rem; min-inline-size: 0; }
.feed__title {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
  margin-block-end: var(--sp-1);
}
.feed__meta {
  font-size: var(--fs-xs);
  color: var(--c-text-muted);
  margin-block-start: var(--sp-2);
}
.feed__item .btn { flex: none; }

/* ── "Needs your attention" strip above the pet list ─────────────────── */
.due-strip {
  display: flex;
  flex-direction: column;
  gap: var(--sp-3);
  margin-block-end: var(--sp-5);
}
.due-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-4);
  background: var(--accent-50);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
}
.due-card__title {
  font-family: var(--font-display);
  font-weight: var(--fw-semibold);
}
.due-card .btn { flex: none; }

/* ── "Booking as: <name>" on the owner booking wizard's first step ───────
   The name itself is always visible; the field that edits it sits behind a
   disclosure, so a signed-in owner sees what the clinic will call them
   without being re-asked a question their account already answers. */
.owner-booking-as {
  background: var(--surface-sunken);
  border: 1px solid var(--c-border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  margin-block-end: var(--sp-5);
}
.owner-booking-as__toggle {
  /* 2.75rem, not the text's own line box: this is a tap target on a phone,
     and the same 44px floor the bottom tabs and footer links already use. */
  display: inline-flex;
  align-items: center;
  min-block-size: 2.75rem;
  cursor: pointer;
  font-size: var(--fs-sm);
  color: var(--brand-700);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.owner-booking-as__toggle:focus-visible {
  outline: 3px solid var(--accent-400);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
