@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@400;600;700&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --cream: #fff8f0;
  --peach: #ffe8d6;
  --coral: #ff8a5b;
  --coral-dark: #ea6a3d;
  --teal: #4ecdc4;
  --teal-dark: #2ba89f;
  --sunny: #ffd56b;
  --ink: #3d2f2a;
  --muted: #8a7870;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.55;
  min-height: 100vh;
  background-image:
    radial-gradient(circle at 10% 20%, rgba(255, 213, 107, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(78, 205, 196, 0.12) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(255, 138, 91, 0.08) 0%, transparent 50%);
}

.container {
  max-width: 1150px;
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  background: linear-gradient(135deg, #ff8a5b 0%, #ffd56b 60%, #4ecdc4 100%);
  color: white;
  padding: 56px 0 72px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.site-header::before,
.site-header::after {
  content: "🐾";
  position: absolute;
  font-size: 5rem;
  opacity: 0.18;
  pointer-events: none;
}
.site-header::before { top: 20px; left: 6%; transform: rotate(-18deg); }
.site-header::after  { bottom: 10px; right: 6%; transform: rotate(22deg); }

.site-header h1 {
  font-family: 'Fredoka', sans-serif;
  font-size: 3.2rem;
  font-weight: 700;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
  text-shadow: 0 3px 0 rgba(0,0,0,0.08);
}

/* Logo wrapper — clickable but keeps the white-on-gradient look */
.site-logo {
  display: inline-block;
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s;
}
.site-logo:hover { transform: scale(1.03); }
.site-logo:focus-visible {
  outline: 3px solid rgba(255,255,255,0.7);
  outline-offset: 6px;
  border-radius: 8px;
}

.site-header h1 .paw { display: inline-block; animation: wiggle 2.5s ease-in-out infinite; }

@keyframes wiggle {
  0%, 100% { transform: rotate(-6deg); }
  50% { transform: rotate(12deg); }
}

.tagline {
  font-size: 1.2rem;
  font-weight: 600;
  opacity: 0.98;
}

/* ---------- Search bar ---------- */
.search-bar {
  background: white;
  padding: 18px 0;
  box-shadow: 0 4px 20px rgba(61, 47, 42, 0.08);
  position: sticky;
  top: 0;
  z-index: 10;
  margin-top: -28px;
  border-radius: 28px 28px 0 0;
}

.search-bar .container {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: stretch;
}

.search-bar input,
.search-bar select {
  height: 46px;
  padding: 0 20px;
  border: 2px solid var(--peach);
  border-radius: 999px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--cream);
  color: var(--ink);
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

#search {
  flex: 1 1 240px;
  min-width: 200px;
}

.search-bar select {
  flex: 0 0 auto;
  min-width: 150px;
  padding-right: 38px;          /* room for the chevron */
  font-weight: 600;
  cursor: pointer;
  /* Strip native chrome so all browsers render the same pill */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  /* Custom chevron — coral, sits on the right */
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5l5 5 5-5' stroke='%23ea6a3d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 8px;
}

/* Make sure the cream background doesn't override the chevron image */
.search-bar select { background-color: var(--cream); }

.search-bar input:hover,
.search-bar select:hover {
  border-color: var(--coral);
}

.search-bar input:focus,
.search-bar select:focus {
  outline: none;
  border-color: var(--coral);
  background-color: white;
  box-shadow: 0 0 0 4px rgba(255, 138, 91, 0.18);
}

/* Style the option list (works in most browsers, ignored in some — harmless) */
.search-bar select option {
  background: white;
  color: var(--ink);
  padding: 8px;
}

#sort { min-width: 170px; }

/* Second filter row — ZIP, radius, open-now toggle */
.search-row-2 {
  margin-top: 8px;
  display: flex !important;
  gap: 10px;
  flex-wrap: wrap;
  align-items: stretch;
}
#filter-zip {
  width: 130px;
  flex: 0 0 auto;
  text-align: center;
  font-weight: 600;
  letter-spacing: 0.05em;
}
#filter-radius { min-width: 140px; }

/* Open-now checkbox styled as a toggle pill */
.open-now-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 16px;
  height: 46px;
  border: 2px solid var(--peach);
  border-radius: 999px;
  background: var(--cream);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.open-now-toggle:hover { border-color: var(--coral); }
.open-now-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--coral);
  cursor: pointer;
}
.open-now-toggle:has(input:checked) {
  background: var(--coral);
  border-color: var(--coral);
  color: white;
}

/* "More" toggle in the second filter row — only shown on mobile */
.more-filters-toggle {
  display: none;  /* hidden on desktop — all filters visible there */
}

/* "Cities" shortcut to /find/cities — sits next to the More toggle in the
 * directory filter bar so users can switch from list/map to city-browse
 * mode in one click. Same visual weight as the More toggle's pill. */
.browse-cities-link {
  display: inline-flex;
  align-items: center;
  height: 42px;
  padding: 0 16px;
  border: 2px solid var(--peach);
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  flex: 0 0 auto;
  transition: all 0.15s;
}
.browse-cities-link:hover {
  border-color: var(--coral);
  color: var(--coral-dark);
}

/* List / Map view toggle (segmented control on the right of search bar) */
.view-toggle {
  display: inline-flex;
  background: var(--cream);
  border-radius: 999px;
  padding: 3px;
  border: 1.5px solid var(--peach);
  margin-left: auto;  /* push to the right of the row */
}
.view-toggle-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  padding: 6px 16px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.view-toggle-btn:hover { color: var(--coral-dark); }
.view-toggle-btn.active {
  background: var(--coral);
  color: white;
}

/* Map view container */
.map-view {
  position: relative;
  margin-bottom: 24px;
}
/* Hidden-attribute respects: `display: grid` on .listings has higher
 * specificity than the browser's UA `[hidden]` rule, so `el.hidden = true`
 * silently fails. These overrides restore the expected behavior. */
.listings[hidden],
.map-view[hidden] {
  display: none !important;
}
.map {
  height: 600px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(61, 47, 42, 0.08);
  z-index: 0;       /* keep above background, below modals/auth bar */
}
.map .leaflet-container { font-family: inherit; }
/* Allow our hover tooltip on map popups to extend past the popup box. */
.leaflet-popup-content-wrapper,
.leaflet-popup-content { overflow: visible; }

/* "Search this area" — appears after a user-initiated pan/zoom */
.search-this-area {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  color: var(--coral-dark);
  border: 1.5px solid var(--coral);
  border-radius: 999px;
  padding: 8px 18px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(61, 47, 42, 0.18);
  z-index: 500;     /* over Leaflet panes (which max out at 400) */
  transition: background 0.15s, transform 0.15s;
}
.search-this-area:hover {
  background: var(--coral);
  color: white;
  transform: translateX(-50%) scale(1.03);
}

/* Marker popup styling */
.map-popup .map-popup-name {
  display: block;
  font-weight: 700;
  font-size: 1rem;
  color: var(--coral-dark);
  text-decoration: none;
  line-height: 1.25;
  margin-bottom: 4px;
}
.map-popup .map-popup-name:hover { text-decoration: underline; }
/* Button variant — same look as the link, no native button styling */
.map-popup .map-popup-name-btn {
  background: none;
  border: none;
  padding: 0;
  text-align: left;
  width: 100%;
  font: inherit;
  cursor: pointer;
}
.map-popup-summary-hint {
  display: inline-block;
  margin-left: 2px;
  font-size: 0.85em;
  opacity: 0.7;
}
.map-popup .map-popup-meta { color: var(--muted); font-size: 0.85rem; margin-bottom: 4px; }
.map-popup .map-popup-rating {
  color: var(--coral-dark);
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 6px;
}
.map-popup .map-popup-tags { margin-bottom: 8px; }
.map-popup .map-popup-tags .tag {
  font-size: 0.7rem;
  padding: 2px 8px;
  margin-right: 4px;
}
.map-popup .map-popup-link {
  display: inline-block;
  color: var(--coral-dark);
  font-weight: 700;
  text-decoration: none;
  font-size: 0.9rem;
}
.map-popup .map-popup-link:hover { text-decoration: underline; }

@media (max-width: 640px) {
  .map { height: 70vh; }
}

/* Distance badge on hospital cards (top-left of photo) */
.distance-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--coral-dark);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(61, 47, 42, 0.18);
  z-index: 2;
}

/* Save (heart) button — top-right of card photo on listings, inline with the
 * name on the detail page. Outline by default, filled coral when saved. */
.save-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.92);
  border: none;
  border-radius: 50%;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--coral-dark);
  box-shadow: 0 2px 6px rgba(61, 47, 42, 0.18);
  z-index: 3;
  transition: transform 0.12s, background 0.12s, color 0.12s;
  padding: 0;
}
.save-btn:hover { transform: scale(1.1); }
.save-btn.saved { color: #fff; background: var(--coral); }
.save-btn.saved:hover { background: var(--coral-dark); }
.save-btn .save-icon { display: block; pointer-events: none; }
/* Press animation when toggled */
.save-btn.saved .save-icon { animation: heartPop 0.25s ease; }
@keyframes heartPop {
  0%   { transform: scale(0.8); }
  60%  { transform: scale(1.25); }
  100% { transform: scale(1); }
}

/* Detail-page heart sits inline next to the hospital name (not absolutely
 * positioned). Override the listings positioning. */
.hospital-detail-name-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.detail-save-btn {
  position: static;
  flex-shrink: 0;
  margin-top: 4px;  /* line up with first row of the name */
}

/* Upcoming care (vaccination reminders) section on the profile page */
.profile-upcoming-section {
  margin-bottom: 32px;
}
.upcoming-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.upcoming-item {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  border-radius: 14px;
  padding: 12px 16px;
  box-shadow: 0 2px 8px rgba(61, 47, 42, 0.06);
  border-left: 4px solid var(--peach);
  transition: transform 0.12s, box-shadow 0.12s;
}
.upcoming-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(61, 47, 42, 0.1);
}
.upcoming-overdue   { border-left-color: #d8573b; }   /* red — overdue */
.upcoming-due_soon  { border-left-color: #e89944; }   /* amber — within 14d */
.upcoming-upcoming  { border-left-color: #6cb27a; }   /* green — within 90d */

.upcoming-pet-avatar,
.upcoming-pet-placeholder {
  width: 40px; height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
  background: var(--peach);
  color: var(--coral-dark);
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.upcoming-body { flex: 1; min-width: 0; }
.upcoming-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px;
  margin-bottom: 2px;
}
.upcoming-status {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 999px;
  text-transform: uppercase;
}
.upcoming-overdue  .upcoming-status { background: #d8573b; color: white; }
.upcoming-due_soon .upcoming-status { background: #e89944; color: white; }
.upcoming-upcoming .upcoming-status { background: #6cb27a; color: white; }
.upcoming-name { color: var(--ink); }
.upcoming-pet { color: var(--muted); font-size: 0.9rem; }
.upcoming-due { color: var(--muted); font-size: 0.85rem; }
.upcoming-actions { display: flex; gap: 6px; flex-shrink: 0; }
.upcoming-actions button {
  width: 32px; height: 32px;
  border: 1.5px solid var(--peach);
  border-radius: 50%;
  background: var(--cream);
  color: var(--coral-dark);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.12s;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
}
.upcoming-actions button:hover {
  background: var(--coral);
  border-color: var(--coral);
  color: white;
  transform: scale(1.1);
}

/* Visit-log modal — wider than auth modal because we have many fields.
 * The form is taller than the viewport on mobile + short laptop screens,
 * so cap height at the visible area minus the backdrop's padding and let
 * the modal scroll internally. The flex layout keeps top + bottom anchored
 * naturally; users scroll to reach the Save/Cancel actions. */
.visit-modal {
  max-width: 540px;
  max-height: calc(100vh - 40px);  /* matches .modal-backdrop padding (20px × 2) */
  overflow-y: auto;
  gap: 14px;
}
.visit-modal h3 { margin: 0; }
.visit-field { display: flex; flex-direction: column; gap: 4px; }
.visit-field > span { font-weight: 600; font-size: 0.9rem; color: var(--ink); }
.visit-field input[type="text"],
.visit-field input[type="number"],
.visit-field input[type="date"],
.visit-field select,
.visit-field textarea {
  font: inherit;
  padding: 8px 12px;
  border: 1.5px solid var(--peach);
  border-radius: 10px;
  background: var(--cream);
  color: var(--ink);
}
.visit-field input:focus,
.visit-field select:focus,
.visit-field textarea:focus {
  outline: none;
  border-color: var(--coral);
}
.visit-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.visit-field small { font-weight: 400; color: var(--muted); }

/* Hospital typeahead inside the modal */
.hosp-picker { position: relative; }
.hosp-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: white;
  border: 1.5px solid var(--peach);
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(61, 47, 42, 0.12);
  z-index: 10;
  max-height: 220px;
  overflow-y: auto;
}
.hosp-result {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
  border-bottom: 1px solid var(--peach);
}
.hosp-result:last-child { border-bottom: none; }
.hosp-result:hover { background: var(--cream); }
.hosp-result-empty { padding: 10px 14px; }

/* Vaccination checklist */
.visit-vaccines {
  border-top: 1px dashed var(--peach);
  padding-top: 12px;
}
.visit-vaccines-head {
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
  color: var(--ink);
}
.visit-vaccines-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 8px;
}
.vacc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 6px;
}
.vacc-row:hover { background: var(--cream); }
.vacc-row .vacc-name { flex: 1; }
.vacc-row .vacc-interval { color: var(--muted); }
.vacc-row.vacc-custom input[type="text"] {
  flex: 1;
  padding: 5px 8px;
  border: 1.5px solid var(--peach);
  border-radius: 6px;
  background: white;
  font: inherit;
}
.vacc-row.vacc-custom input[type="number"] {
  width: 70px;
  padding: 5px 6px;
  border: 1.5px solid var(--peach);
  border-radius: 6px;
  background: white;
  font: inherit;
}
.btn-vacc-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  padding: 2px 6px;
}
.btn-vacc-remove:hover { color: #d8573b; }
.btn-add-custom-vacc {
  font-size: 0.85rem;
  padding: 6px 12px;
  background: var(--cream);
  border: 1.5px solid var(--peach);
  color: var(--coral-dark);
  border-radius: 999px;
  cursor: pointer;
}
.btn-add-custom-vacc:hover {
  background: var(--coral);
  border-color: var(--coral);
  color: white;
}
.muted.small { font-size: 0.85rem; }

/* Pet name on the user profile pet card now links to /pets/<id> */
.pet-card-name-link {
  color: inherit;
  text-decoration: none;
}
.pet-card-name-link:hover {
  color: var(--coral-dark);
  text-decoration: underline;
}

/* Pet-page hero "Log a visit" button — coral pill, slightly tighter than
 * the listing's filter buttons. */
.btn-pet-log-visit {
  background: var(--coral);
  color: white;
  border: none;
  border-radius: 999px;
  padding: 8px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.12s;
}
.btn-pet-log-visit:hover {
  background: var(--coral-dark);
  transform: translateY(-1px);
}

/* ---------- Pet idle animations: wag + nap ---------- */
/* Wag is a subtle tilt that runs once near the end of each cycle, so
 * pets feel alive but the page isn't constantly jittery. Nap (data-state
 * = "napping") is a slow breathing scale used for pets without recent
 * visits. Animations are applied to the inner <img>/placeholder so they
 * compose with any positioning transform on the parent. */
@keyframes pet-wag {
  0%, 88%, 100% { transform: rotate(0deg); }
  92%           { transform: rotate(-9deg); }
  96%           { transform: rotate(8deg); }
}
@keyframes pet-nap {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.05); }
}
.halo-pet img,
.halo-pet .halo-pet-placeholder,
.pet-card .avatar-wrap img,
.pet-card .avatar-placeholder,
.pet-tab .pet-tab-avatar {
  transform-origin: 50% 65%;
  animation: pet-wag 6s ease-in-out infinite;
  animation-delay: var(--idle-delay, 0s);
}
.halo-pet[data-state="napping"] img,
.halo-pet[data-state="napping"] .halo-pet-placeholder,
.pet-block[data-state="napping"] .pet-card .avatar-wrap img,
.pet-block[data-state="napping"] .pet-card .avatar-placeholder {
  animation: pet-nap 4s ease-in-out infinite;
}
@media (prefers-reduced-motion: reduce) {
  .halo-pet img,
  .halo-pet .halo-pet-placeholder,
  .pet-card .avatar-wrap img,
  .pet-card .avatar-placeholder,
  .pet-tab .pet-tab-avatar,
  .halo-pet[data-state="napping"] img,
  .pet-block[data-state="napping"] .pet-card .avatar-wrap img {
    animation: none;
  }
}

/* Pet halo — orbiting pet avatars around the user avatar on /profile.
 * The container is sized 220px square so the orbiting tiles (38px each
 * on a radius of 78px from center) never get clipped. */
.user-avatar-halo {
  position: relative;
  width: 220px;
  height: 220px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
.halo-pet {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  overflow: hidden;
  background: white;
  border: 2px solid white;
  box-shadow: 0 3px 10px rgba(61, 47, 42, 0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--coral-dark);
  font-weight: 700;
  text-decoration: none;
  transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px)));
  transition: transform 0.18s, box-shadow 0.18s;
  cursor: pointer;
}
.halo-pet:hover {
  transform: translate(calc(-50% + var(--tx, 0px)), calc(-50% + var(--ty, 0px))) scale(1.15);
  box-shadow: 0 6px 18px rgba(61, 47, 42, 0.25);
  z-index: 2;
}
.halo-pet img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.halo-pet-placeholder {
  width: 100%;
  height: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--peach);
  color: var(--coral-dark);
}
.halo-pet-empty,
.halo-pet-more {
  background: var(--peach);
  color: var(--coral-dark);
  font-size: 1rem;
  border: 2px dashed var(--coral);
}
.halo-pet-empty { font-size: 1.4rem; }
.halo-pet-more {
  background: var(--cream);
  border-style: solid;
  font-size: 0.85rem;
}

@media (max-width: 640px) {
  .user-avatar-halo { width: 180px; height: 180px; }
  .halo-pet { width: 34px; height: 34px; }
}

/* Single-pet page hero card — compact, dense horizontal row */
.pet-hero-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: white;
  border-radius: 16px;
  padding: 14px 18px;
  margin: 18px 0 28px;
  box-shadow: 0 2px 10px rgba(61, 47, 42, 0.06);
}
.pet-hero-card .pet-avatar-wrap { flex: 0 0 auto; }
.pet-hero-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pet-hero-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.5rem;
  color: var(--coral-dark);
  margin: 0;
  line-height: 1.15;
}
.pet-hero-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.9rem;
}
.pet-hero-meta { color: var(--muted); }
.pet-hero-dot { color: var(--muted); }
.pet-hero-stats { font-weight: 700; color: var(--ink); }

.pet-hero-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 4px;
}
.pet-hero-actions .btn-pet-log-visit { white-space: nowrap; }

@media (max-width: 640px) {
  .pet-hero-card {
    flex-wrap: wrap;
    gap: 12px;
  }
  .pet-hero-actions { width: 100%; justify-content: space-between; }
  .pet-hero-actions .btn-pet-log-visit { flex: 1; }
}

.pet-visits-section { margin-bottom: 32px; }

/* Visit detail page (/visits/<id>) */
.visit-detail-card {
  background: white;
  border-radius: 18px;
  padding: 28px 32px;
  margin: 18px 0 32px;
  box-shadow: 0 4px 14px rgba(61, 47, 42, 0.08);
}
.visit-detail-head { margin-bottom: 14px; }
.visit-detail-hospital {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.6rem;
  color: var(--coral-dark);
  margin: 0 0 4px;
}
.visit-detail-hospital a {
  color: inherit;
  text-decoration: none;
}
.visit-detail-hospital a:hover { text-decoration: underline; }
.visit-detail-date {
  color: var(--muted);
  margin: 0;
  font-size: 0.95rem;
}
.visit-detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 22px;
}
.visit-detail-notes h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  color: var(--ink);
  margin: 0 0 6px;
}
.visit-detail-notes p {
  white-space: pre-wrap;
  margin: 0 0 22px;
  line-height: 1.5;
}
.visit-detail-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px dashed var(--peach);
  padding-top: 16px;
}
.visit-detail-actions button {
  padding: 8px 18px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.12s;
  background: var(--teal);
  color: white;
  margin: 0;
}
.visit-detail-actions button:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}
.visit-detail-actions button.secondary {
  background: var(--peach);
  color: var(--coral-dark);
}
.visit-detail-actions button.secondary:hover {
  background: var(--coral);
  color: white;
}
.visit-detail-edit-head {
  font-family: 'Fredoka', sans-serif;
  color: var(--coral-dark);
  margin: 0 0 14px;
}
.visit-detail-edit-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.visit-detail-edit-form .form-msg {
  font-size: 0.83rem;
  color: #c73939;
  font-weight: 600;
  min-height: 1em;
}

/* Pet tab strip — horizontal pill row, scrolls if it overflows */
.pet-tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.pet-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px 6px 6px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: white;
  box-shadow: 0 1px 4px rgba(61, 47, 42, 0.06);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  color: var(--ink);
  transition: border-color 0.12s, transform 0.12s, box-shadow 0.12s;
}
.pet-tab:hover {
  border-color: var(--peach);
  transform: translateY(-1px);
}
.pet-tab-active {
  border-color: var(--coral);
  box-shadow: 0 4px 14px rgba(255, 138, 91, 0.18);
}
.pet-tab-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
}
.pet-tab-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--peach);
  color: var(--coral-dark);
  font-weight: 700;
}
.pet-tab-name {
  font-size: 0.95rem;
}
.pet-tab-star {
  color: var(--coral);
  font-size: 0.95rem;
}

/* Pet "block" on the profile page — pet-card identity + that pet's visits */
.pet-block {
  background: white;
  border-radius: 18px;
  box-shadow: 0 2px 10px rgba(61, 47, 42, 0.06);
  padding: 16px;
}
.pet-block .pet-card {
  background: transparent;
  box-shadow: none;
  padding: 0 0 12px;
  border-bottom: 1px dashed var(--peach);
  margin-bottom: 14px;
}
.pet-block-visits-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--ink);
  font-size: 0.95rem;
}
.pet-block-visits-head-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.btn-pet-default {
  background: white;
  border: 1.5px solid var(--peach);
  color: var(--coral-dark);
  border-radius: 999px;
  padding: 4px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s;
}
.btn-pet-default:hover {
  border-color: var(--coral);
  background: var(--coral);
  color: white;
}
.btn-pet-default-on {
  background: var(--coral);
  border-color: var(--coral);
  color: white;
}
.btn-pet-default-on:hover {
  background: var(--coral-dark);
  border-color: var(--coral-dark);
}
.pet-block-no-visits {
  margin: 4px 0 0;
  font-size: 0.9rem;
}
.visits-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 10px;
}
.visit-card .visit-hospital-link {
  color: var(--coral-dark);
  text-decoration: none;
  font-weight: 700;
}
.visit-card .visit-hospital-link:hover { text-decoration: underline; }
.visit-reason-chip {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--peach);
  color: var(--coral-dark);
}
.visit-cost {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.btn-visit-delete {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.95rem;
  padding: 4px 8px;
  border-radius: 6px;
  transition: all 0.12s;
  margin-left: auto;
}
.btn-visit-delete:hover {
  background: rgba(216, 87, 59, 0.1);
  color: #d8573b;
}

/* New "Log a visit" button on pet cards (📝 icon) */
.btn-log-visit {
  background: var(--cream);
  border: 1.5px solid var(--peach);
  color: var(--coral-dark);
  border-radius: 50%;
  width: 28px; height: 28px;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all 0.12s;
}
.btn-log-visit:hover {
  background: var(--coral);
  border-color: var(--coral);
  color: white;
  transform: scale(1.1);
}

/* Top-level profile section spacing */
.profile-pets-section,
.profile-reviews-section,
.profile-saved-section {
  margin-bottom: 40px;
}
.profile-saved-section:last-child { margin-bottom: 0; }
.saved-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
}
.saved-card {
  position: relative;
  background: white;
  border-radius: 16px;
  padding: 14px 50px 14px 16px;
  box-shadow: 0 2px 8px rgba(61, 47, 42, 0.06);
  transition: transform 0.12s, box-shadow 0.12s;
}
.saved-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(61, 47, 42, 0.1);
}
.saved-card-body {
  display: block;
  text-decoration: none;
  color: inherit;
}
.saved-card-name {
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
  line-height: 1.25;
}
.saved-card-meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 4px;
}
.saved-card .prv-stars {
  font-size: 0.85rem;
  color: var(--coral-dark);
  font-weight: 600;
}
.saved-card .save-btn {
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  font-size: 1rem;
  box-shadow: none;
}

/* ---------- Main ---------- */
main { padding: 32px 0 60px; }

.results-count {
  margin-bottom: 20px;
  color: var(--muted);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
}
.results-count::before { content: "🦴 "; }

.listings {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 22px;
}

/* ---------- Card ---------- */
.card {
  background: white;
  border-radius: 22px;
  box-shadow: 0 4px 14px rgba(61, 47, 42, 0.07);
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  border: 2px solid transparent;
  display: flex;
  flex-direction: column;
}

.card-photo {
  height: 170px;
  background-size: cover;
  background-position: center;
  background-color: var(--peach);
  position: relative;
  overflow: hidden;
  border-radius: 20px 20px 0 0;
}

.card.has-summary:hover { z-index: 25; }

.card-photo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(61, 47, 42, 0.15) 100%);
}

.card-photo-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 3rem;
  opacity: 0.35;
  z-index: -1;
}

.card-body { padding: 22px 26px 26px; }

.muted { color: var(--muted); font-style: italic; }

.card::before {
  content: "";
  position: absolute;
  top: -8px;
  right: 22px;
  width: 34px;
  height: 34px;
  background: var(--sunny);
  border-radius: 50%;
  z-index: 0;
  opacity: 0;
  transition: opacity 0.2s;
}

.card:hover {
  transform: translateY(-4px) rotate(-0.3deg);
  box-shadow: 0 12px 28px rgba(61, 47, 42, 0.12);
  border-color: var(--peach);
}
.card:hover::before { opacity: 1; }

.card h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--coral-dark);
  position: relative;
  z-index: 1;
  line-height: 1.25;
}

.card .location {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 14px;
}

.specialties {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tag {
  background: var(--peach);
  color: var(--coral-dark);
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
}

.tag.emergency { background: #ffd3d3; color: #c73939; }
.tag.exotic    { background: #e0f5d6; color: #4a8c2a; }
.tag.dental    { background: #d9efff; color: #2b7aba; }
.tag.surgery   { background: #f1e0ff; color: #7a4ab8; }

.card .details {
  border-top: 2px dashed var(--peach);
  padding-top: 14px;
  font-size: 0.93rem;
  color: var(--ink);
}

.card .details p { margin-bottom: 5px; }
.card .details a { color: var(--teal-dark); text-decoration: none; font-weight: 700; }
.card .details a:hover { text-decoration: underline; }

.rating {
  color: #e8a628;
  font-weight: 800;
}

.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 1.1rem;
  grid-column: 1 / -1;
}
.no-results::before {
  content: "🐶";
  display: block;
  font-size: 3.5rem;
  margin-bottom: 12px;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: var(--peach);
  padding: 28px 0;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
}
.site-footer .hearts { color: var(--coral); }
.site-footer .attribution { font-size: 0.8rem; font-weight: 500; opacity: 0.7; margin-top: 4px; }

/* Feedback button in the auth bar (top-right header) */
.feedback-bar-btn {
  /* inherits sizing/spacing from .auth-bar button */
  font-weight: 700;
}

/* Feedback modal */
.feedback-modal {
  max-width: 520px;
}
.feedback-modal .posting-as {
  font-size: 0.88rem;
  color: var(--muted);
}
.feedback-modal .posting-as strong { color: var(--ink); }

.feedback-category {
  padding: 10px 16px;
  border: 2px solid var(--peach);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  background: var(--cream);
  color: var(--ink);
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'><path d='M1 1.5l5 5 5-5' stroke='%23ea6a3d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 12px 8px;
}
.feedback-category:focus {
  outline: none;
  border-color: var(--coral);
  background-color: white;
}

.feedback-message {
  width: 100%;
  min-height: 130px;
  padding: 12px 16px;
  border: 2px solid var(--peach);
  border-radius: 18px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--cream);
  resize: vertical;
}
.feedback-message:focus {
  outline: none;
  border-color: var(--coral);
  background: white;
  box-shadow: 0 0 0 4px rgba(255, 138, 91, 0.18);
}

.feedback-thanks {
  text-align: center;
  padding: 18px 4px;
}
.feedback-thanks-emoji {
  font-size: 3rem;
  margin-bottom: 4px;
}
.feedback-thanks h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.5rem;
  color: var(--coral-dark);
  margin: 0 0 4px;
}

/* ---------- Auth bar + modal ---------- */
.auth-bar {
  position: absolute;
  top: 16px; right: 24px;
  display: flex; gap: 10px; align-items: center;
  font-size: 0.9rem;
  z-index: 2;
}
.auth-bar button {
  background: rgba(255,255,255,0.25);
  color: white;
  border: 1.5px solid rgba(255,255,255,0.5);
  padding: 6px 14px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.auth-bar button:hover { background: rgba(255,255,255,0.4); }
.auth-bar button.link { background: transparent; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(61, 47, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  /* Above Leaflet panes (max ~700) and our floating "Search this area"
   * button (z=500) so map UI doesn't poke through the modal. */
  z-index: 1000; padding: 20px;
}
.modal {
  background: white;
  border-radius: 20px;
  padding: 28px 28px 22px;
  width: 100%; max-width: 400px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
  display: flex; flex-direction: column; gap: 10px;
}
.modal h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  color: var(--coral-dark);
  margin-bottom: 6px;
}
.modal input {
  padding: 12px 16px;
  border: 2px solid var(--peach);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.95rem;
  background: var(--cream);
}
.modal input:focus { outline: none; border-color: var(--coral); background: white; }
/* OAuth (Google) button + divider in the auth modal. */
.oauth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid var(--peach);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
}
.oauth-btn:hover {
  border-color: var(--coral);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(61, 47, 42, 0.1);
}
.oauth-btn-icon { width: 20px; height: 20px; flex: 0 0 auto; }
.oauth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 4px 0 2px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.oauth-divider::before,
.oauth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--peach);
}

.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.modal-actions button {
  padding: 10px 20px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  background: var(--coral); color: white;
}
.modal-actions button.secondary { background: var(--peach); color: var(--coral-dark); }
.modal .form-msg { min-height: 1.2em; color: #c73939; font-weight: 600; font-size: 0.9rem; }
.modal .switch-mode { font-size: 0.85rem; color: var(--muted); text-align: center; margin-top: 4px; }
.modal .switch-mode button.link {
  background: none; border: none; color: var(--teal-dark); font-weight: 700; cursor: pointer;
  font-family: inherit; font-size: inherit; padding: 0;
}

/* Email-verification step */
.verify-blurb {
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
  margin-top: -4px;
}
.verify-blurb strong { color: var(--ink); }

.code-input {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: 0.4em;
  text-align: center;
  padding: 14px 16px !important;
  background: var(--cream);
}
.code-input::placeholder { letter-spacing: 0.2em; opacity: 0.4; }
.code-input:focus { letter-spacing: 0.4em; }

.login-prompt {
  background: var(--cream);
  padding: 16px;
  border-radius: 14px;
  text-align: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}
.login-prompt button.link {
  background: none; border: none; color: var(--coral-dark); font-weight: 700;
  cursor: pointer; font-family: inherit; font-size: inherit; padding: 0;
  text-decoration: underline;
}
.posting-as { font-size: 0.85rem; color: var(--muted); margin-bottom: 6px; }

/* ---------- Ratings + reviews ---------- */
.ratings {
  font-size: 0.9rem;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
}
.rating.google { color: #1a73e8; }
.rating.user { color: #e8a628; }
.rating.overall {
  background: linear-gradient(135deg, var(--coral), var(--sunny));
  color: white;
  padding: 2px 12px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.95rem;
  box-shadow: 0 2px 6px rgba(255, 138, 91, 0.25);
}
.rating.overall small {
  color: rgba(255,255,255,0.92);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.66rem;
  margin-left: 2px;
}
.rating small { color: var(--muted); font-weight: 600; }

.reviews-toggle {
  margin-top: 14px;
  background: var(--peach);
  color: var(--coral-dark);
  border: none;
  padding: 10px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  width: 100%;
  transition: background 0.15s;
}
.reviews-toggle:hover { background: #ffd9b8; }

.reviews-panel {
  margin-top: 14px;
  border-top: 2px dashed var(--peach);
  padding-top: 14px;
}

.reviews-list { margin-bottom: 14px; }
.review {
  padding: 10px 0;
  border-bottom: 1px dashed var(--peach);
}
.review:last-child { border-bottom: none; }
.review-head { display: flex; gap: 8px; align-items: center; font-size: 0.9rem; margin-bottom: 4px; flex-wrap: wrap; }
.review-head .stars { color: #e8a628; letter-spacing: 1px; }
.review p { font-size: 0.92rem; margin: 0; }

.review-form {
  background: var(--cream);
  padding: 14px;
  border-radius: 14px;
  margin-top: 10px;
}
.review-form .row { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.review-form input[type=text] {
  flex: 1; min-width: 150px;
  padding: 8px 14px;
  border: 2px solid var(--peach);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.92rem;
  background: white;
}
.review-form textarea {
  width: 100%;
  min-height: 70px;
  padding: 10px 14px;
  border: 2px solid var(--peach);
  border-radius: 14px;
  font-family: inherit;
  font-size: 0.92rem;
  resize: vertical;
  background: white;
}
.review-form button {
  margin-top: 8px;
  background: var(--coral);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.15s;
}
.review-form button:hover { background: var(--coral-dark); }
.form-msg { font-size: 0.9rem; color: var(--teal-dark); margin-top: 6px; font-weight: 600; }

.star-picker {
  display: inline-flex;
  direction: rtl;
  background: white;
  border: 2px solid var(--peach);
  border-radius: 999px;
  padding: 4px 10px;
  align-items: center;
}
.star-picker input { display: none; }
.star-picker label { cursor: pointer; font-size: 1.2rem; color: #ddd; padding: 0 2px; }
.star-picker label:hover,
.star-picker label:hover ~ label,
.star-picker input:checked ~ label { color: #e8a628; }

/* ---------- Pagination ---------- */
.pagination {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 28px 0 8px;
}
.pagination .page-btn {
  min-width: 40px;
  padding: 8px 12px;
  background: white;
  color: var(--ink);
  border: 2px solid var(--peach);
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.pagination .page-btn:hover:not(:disabled) {
  border-color: var(--coral);
  color: var(--coral-dark);
}
.pagination .page-btn.active {
  background: var(--coral);
  border-color: var(--coral);
  color: white;
}
.pagination .page-btn:disabled {
  opacity: 0.4;
  cursor: default;
}
.pagination .page-ellipsis {
  padding: 8px 4px;
  color: var(--muted);
}

/* ---------- AI summary popover ---------- */
.sparkle-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--coral-dark);
  font-size: 1rem;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 6px rgba(61, 47, 42, 0.18);
  z-index: 2;
}

.card.clickable { cursor: pointer; }
.card.clickable:hover { transform: translateY(-3px); box-shadow: 0 10px 24px rgba(61, 47, 42, 0.12); }
.card.clickable:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }

.summary-modal,
.reviews-modal {
  max-width: 560px;
  padding: 24px 26px 22px;
  position: relative;
}

.reviews-modal { max-height: 80vh; overflow-y: auto; }
.reviews-modal .reviews-list { margin-bottom: 18px; }

.modal-header {
  display: flex !important;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
}
.modal-header h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  color: var(--coral-dark);
  margin: 0;
  line-height: 1.25;
  flex: 1;
}
.modal-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 50%;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  margin-top: 2px;
}
.modal-close:hover {
  color: var(--ink);
  background: var(--cream);
}

.summary-modal .summary-section + .summary-section { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--peach); }

.summary-modal .summary-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--coral-dark);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.summary-modal .modal-header h3 {
  color: var(--ink);
}

.summary-modal .summary-text {
  margin-bottom: 14px;
  line-height: 1.55;
}

.summary-modal .summary-list {
  margin: 0 0 14px 18px;
  color: var(--ink);
}
.summary-modal .summary-list li { margin: 5px 0; line-height: 1.4; }

.summary-modal .summary-link a {
  color: var(--coral-dark);
  font-weight: 600;
  text-decoration: none;
}
.summary-modal .summary-link a:hover { text-decoration: underline; }

/* ---------- Review footer + upvote ---------- */
.review-footer {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.upvote-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px;
  border: 1.5px solid var(--peach);
  border-radius: 999px;
  background: none;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
  line-height: 1.6;
}
.upvote-btn:hover:not(:disabled) {
  border-color: var(--teal);
  color: var(--teal-dark);
  background: rgba(78,205,196,0.08);
}
.upvote-btn.upvoted {
  border-color: var(--teal);
  background: rgba(78,205,196,0.13);
  color: var(--teal-dark);
}
.upvote-btn:disabled { cursor: default; opacity: 0.65; }

/* Pet avatar inline in reviews */
.review-pet-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  flex-shrink: 0;
}
.review-pet-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--peach);
  color: var(--coral-dark);
  font-family: 'Fredoka', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
}
.review-pet-label {
  font-size: 0.82rem;
  color: var(--muted);
  font-style: italic;
}

/* Pet selector in review form */
.review-form-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 4px;
}
.pet-select-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 600;
}
.pet-select {
  padding: 4px 12px;
  border: 2px solid var(--peach);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  background: white;
  cursor: pointer;
  color: var(--ink);
}
.pet-select:focus { outline: none; border-color: var(--teal); }

/* ---------- Auth bar avatar ---------- */
.auth-avatar-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.25);
  color: white;
  border: 1.5px solid rgba(255,255,255,0.5);
  padding: 5px 14px 5px 6px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}
.auth-avatar-btn:hover { background: rgba(255,255,255,0.4); }
.auth-avatar-img {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.auth-avatar-initial {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: rgba(255,255,255,0.35);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
}

/* ---------- Profile modal ---------- */
.profile-modal {
  max-width: 520px;
  max-height: 88vh;
  overflow-y: auto;
}

.profile-user {
  display: flex;
  align-items: center;
  gap: 22px;
  padding-bottom: 22px;
  border-bottom: 2px dashed var(--peach);
  margin-bottom: 4px;
}

/* ---------- Avatar widget (shared by user + pets) ---------- */
.avatar-wrap,
.pet-avatar-wrap {
  position: relative;
  cursor: pointer;
  flex-shrink: 0;
  border-radius: 50%;
}
.avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  opacity: 0;
  transition: opacity 0.18s;
  pointer-events: none;
}
.avatar-wrap:hover .avatar-overlay,
.pet-avatar-wrap:hover .avatar-overlay { opacity: 1; }

.avatar-placeholder {
  border-radius: 50%;
  background: var(--peach);
  color: var(--coral-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
}

.profile-info {
  flex: 1;
  min-width: 0;
}
.profile-username {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--coral-dark);
  line-height: 1.2;
}
.profile-email {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 4px;
  word-break: break-all;
}

/* ---------- Pets section ---------- */
.pets-section { margin-top: 6px; }

.pets-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.pets-header h4 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.btn-add-pet {
  background: var(--teal);
  color: white;
  border: none;
  padding: 7px 16px;
  border-radius: 999px;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-add-pet:hover { background: var(--teal-dark); }

.no-pets { font-size: 0.95rem; }

.pets-list { display: flex; flex-direction: column; gap: 2px; }

.pet-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 6px;
  border-radius: 12px;
  transition: background 0.15s;
}
.pet-item:hover { background: var(--cream); }

.pet-info { flex: 1; min-width: 0; }
.pet-name {
  font-weight: 700;
  color: var(--ink);
  font-size: 0.97rem;
}
.pet-meta {
  font-size: 0.83rem;
  color: var(--muted);
  margin-top: 2px;
}

.pet-card-actions {
  display: flex;
  flex-direction: row;
  gap: 8px;
  flex-shrink: 0;
}
/* Pet card on /profile and pet hero card on /pets/<id> both use the
 * larger 38px pill button size for tappability. */
.pet-card .btn-log-visit,
.pet-card .btn-edit-pet,
.pet-card .btn-delete-pet,
.pet-hero-card .btn-edit-pet,
.pet-hero-card .btn-delete-pet {
  width: 38px;
  height: 38px;
  font-size: 1.05rem;
}
.btn-edit-pet,
.btn-delete-pet {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--cream);
  border: 1.5px solid var(--peach);
  color: var(--coral-dark);
  cursor: pointer;
  font-size: 0.85rem;
  line-height: 1;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.12s;
}
.btn-edit-pet:hover {
  background: var(--teal);
  border-color: var(--teal);
  color: white;
  transform: scale(1.1);
}
.btn-delete-pet:hover {
  background: #d8573b;
  border-color: #d8573b;
  color: white;
  transform: scale(1.1);
}

/* ---------- Add pet form ---------- */
.add-pet-form {
  margin-top: 14px;
  background: var(--cream);
  padding: 16px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.add-pet-form input {
  padding: 10px 16px;
  border: 2px solid var(--peach);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.92rem;
  background: white;
  width: 100%;
}
.add-pet-form input:focus {
  outline: none;
  border-color: var(--teal);
  background: white;
}
.pet-form-row {
  display: flex;
  gap: 8px;
}
.pet-form-row input { flex: 1; }

.pet-birthday-field {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.88rem;
  color: var(--muted);
  font-weight: 600;
}
.pet-birthday-field > span { flex-shrink: 0; }
.pet-birthday-field small { font-weight: 500; opacity: 0.75; }
.pet-birthday-field input[type="date"] {
  flex: 1;
  /* let .add-pet-form input rules above style this — no overrides needed */
}
.pet-form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
}
.pet-form-actions button {
  padding: 9px 20px;
  border-radius: 999px;
  border: none;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--teal);
  color: white;
  transition: background 0.15s;
}
.pet-form-actions button:hover { background: var(--teal-dark); }
.pet-form-actions button.secondary {
  background: var(--peach);
  color: var(--coral-dark);
}
.pet-form-actions button.secondary:hover { background: #ffd9b8; }
.add-pet-form .form-msg {
  font-size: 0.88rem;
  color: #c73939;
  font-weight: 600;
  min-height: 1em;
}

/* ---------- Full profile page ---------- */
#profile-page { min-height: 70vh; }

.profile-hero {
  background: linear-gradient(135deg,
    rgba(255,138,91,0.42) 0%,
    rgba(255,213,107,0.48) 55%,
    rgba(78,205,196,0.40) 100%);
  border-bottom: 2px dashed var(--peach);
  padding: 44px 0 36px;
  box-shadow: 0 4px 14px rgba(61, 47, 42, 0.08);
}
.profile-hero-inner {
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.profile-hero-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}

/* "← Back to directory" sits above the avatar row, left-aligned */
.back-to-directory {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 14px;
  border: 2px solid var(--peach);
  border-radius: 999px;
  background: white;
  color: var(--coral-dark);
  font-family: inherit;
  font-weight: 700;
  font-size: 0.85rem;
  text-decoration: none;
  transition: all 0.15s;
}
.back-to-directory:hover {
  border-color: var(--coral);
  background: var(--coral);
  color: white;
  transform: translateX(-2px);
}
.profile-hero-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 2rem;
  color: var(--coral-dark);
  margin: 0 0 4px;
}
.profile-hero-email {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0 0 6px;
}
.profile-hero-stats {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  margin: 0;
}
.profile-hero-greeting {
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  color: var(--coral-dark);
  font-weight: 600;
  margin: 0 0 4px;
  opacity: 0.85;
}

/* Drifting paw-print backdrop in the profile hero. Pure CSS animation;
 * paws float gently and rotate. */
.profile-hero { position: relative; overflow: hidden; }
.profile-hero-paws {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.profile-hero-paws .paw {
  position: absolute;
  font-size: 1.6rem;
  opacity: 0.18;
  filter: saturate(0.5);
  animation: paw-drift 14s ease-in-out infinite;
}
@keyframes paw-drift {
  0%, 100% { transform: translateY(0) rotate(var(--rot, 0deg)); }
  50%      { transform: translateY(-12px) rotate(calc(var(--rot, 0deg) + 8deg)); }
}
.profile-hero-paws .paw-1 { top: 12%;  left:  6%; --rot: -22deg; animation-delay: 0s;   }
.profile-hero-paws .paw-2 { top: 22%;  left: 28%; --rot:  18deg; animation-delay: 1.6s; font-size: 1.1rem; }
.profile-hero-paws .paw-3 { top: 70%;  left: 14%; --rot: -10deg; animation-delay: 3.2s; font-size: 2rem;   }
.profile-hero-paws .paw-4 { top: 16%;  right: 8%; --rot:  24deg; animation-delay: 0.8s; font-size: 1.8rem; }
.profile-hero-paws .paw-5 { top: 58%;  right:22%; --rot: -16deg; animation-delay: 2.4s; }
.profile-hero-paws .paw-6 { top: 80%;  right: 6%; --rot:  12deg; animation-delay: 4.0s; font-size: 1.3rem; }
@media (prefers-reduced-motion: reduce) {
  .profile-hero-paws .paw { animation: none; }
}

/* Hero stat-card chips on /profile — pets / reviews / saved. */
.profile-hero-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 6px 0 0;
}
.hero-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: white;
  box-shadow: 0 2px 8px rgba(61, 47, 42, 0.08);
  border: 2px solid transparent;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.hero-chip:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(61, 47, 42, 0.12);
}
.hero-chip-icon { font-size: 1.05rem; line-height: 1; }
.hero-chip-count {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}
.hero-chip-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.hero-chip-pets    { border-color: rgba(255, 138, 91, 0.5); }
.hero-chip-pets:hover    { border-color: var(--coral); }
.hero-chip-reviews { border-color: rgba(78, 205, 196, 0.55); }
.hero-chip-reviews:hover { border-color: var(--teal); }
.hero-chip-saved   { border-color: rgba(255, 213, 107, 0.7); }
.hero-chip-saved:hover   { border-color: #e9b94a; }

.profile-body {
  padding: 36px 0 64px;
  max-width: 960px;
}

.profile-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.profile-section-head h2,
h2.profile-section-head {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

/* Pet cards on profile page */
.pet-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: white;
  border: 2px solid transparent;
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: 0 2px 10px rgba(61,47,42,0.07);
  transition: border-color 0.15s;
}
.pet-card:hover { border-color: var(--peach); }
.pet-card-info { flex: 1; min-width: 0; }
.pet-card-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}
.pet-card-meta {
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 2px;
}
.pet-card-reviews {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(78,205,196,0.13);
  color: var(--teal-dark);
  font-size: 0.76rem;
  font-weight: 700;
}

/* Edit-mode card: same flex layout, but the form replaces the info column. */
.pet-card-editing {
  align-items: flex-start;
  border-color: var(--peach);
  background: var(--cream);
}
.pet-edit-form,
.pet-hero-edit-form {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pet-edit-form input[type="text"],
.pet-edit-form input[type="date"],
.pet-hero-edit-form input[type="text"],
.pet-hero-edit-form input[type="date"] {
  padding: 8px 14px;
  border: 2px solid var(--peach);
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.88rem;
  background: white;
  width: 100%;
}
.pet-edit-form input:focus,
.pet-hero-edit-form input:focus {
  outline: none;
  border-color: var(--teal);
}
.pet-edit-form .form-msg,
.pet-hero-edit-form .form-msg {
  font-size: 0.83rem;
  color: #c73939;
  font-weight: 600;
  min-height: 1em;
}
.pet-edit-form .pet-form-actions button,
.pet-hero-edit-form .pet-form-actions button {
  padding: 7px 16px;
  font-size: 0.85rem;
}

/* Profile reviews */
.prv-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.prv-card {
  display: block;
  background: white;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 2px 10px rgba(61,47,42,0.07);
  border: 2px solid transparent;
  transition: border-color 0.15s, transform 0.12s, box-shadow 0.15s;
  color: inherit;
  text-decoration: none;
}
a.prv-card:hover {
  border-color: var(--peach);
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(61,47,42,0.1);
}
.prv-card:hover { border-color: var(--peach); }
.prv-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.prv-hospital {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--coral-dark);
}
.prv-stars { color: #e8a628; letter-spacing: 1px; }
.prv-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 10px;
}
.prv-pet-avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.prv-pet-placeholder {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--peach);
  color: var(--coral-dark);
  display: flex; align-items: center; justify-content: center;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.6rem;
  font-weight: 700;
  flex-shrink: 0;
}
.prv-pet-name { font-weight: 700; color: var(--ink); }
.prv-comment {
  color: var(--ink);
  font-size: 0.93rem;
  line-height: 1.55;
  margin: 0 0 12px;
}
.prv-footer { font-size: 0.83rem; color: var(--muted); }
.upvote-info { display: inline-flex; align-items: center; gap: 4px; }

/* ====================================================================
 * Mobile responsive layer
 * Two breakpoints:
 *   ≤ 640px — phones (portrait)
 *   ≤ 380px — extremely narrow phones, last-resort tweaks
 * ==================================================================== */

@media (max-width: 640px) {
  .container { padding: 0 16px; }

  /* --- Header --- */
  .site-header { padding: 48px 0 56px; }
  .site-header h1 {
    font-size: 2.2rem;
    margin-bottom: 6px;
    padding: 0 16px;
  }
  .site-header::before,
  .site-header::after { font-size: 3rem; opacity: 0.14; }
  .site-header::before { top: 14px; left: 4%; }
  .site-header::after  { bottom: 6px; right: 4%; }
  .tagline { font-size: 0.95rem; padding: 0 16px; }

  /* --- Auth bar --- */
  .auth-bar {
    top: 12px;
    right: 12px;
    gap: 6px;
    font-size: 0.78rem;
  }
  .auth-bar button {
    padding: 5px 10px;
    font-size: 0.76rem;
  }
  .auth-avatar-btn {
    padding: 3px 10px 3px 3px;
    gap: 5px;
  }
  .auth-avatar-img,
  .auth-avatar-initial { width: 22px; height: 22px; }
  /* Truncate long usernames so the bar can't push off-screen */
  .auth-avatar-btn span {
    max-width: 90px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* --- Search bar --- */
  .search-bar {
    padding: 12px 0;
    margin-top: -22px;
    border-radius: 22px 22px 0 0;
  }
  .search-bar .container { gap: 8px; }
  .search-bar input,
  .search-bar select {
    height: 42px;
    padding: 0 16px;
    font-size: 0.9rem;
  }
  /* Drop the desktop min-widths on selects — they were forcing 3 selects
   * to claim 450px of horizontal space, which on a 360px screen meant
   * each select wrapped to its own line with weird empty space. */
  .search-bar select {
    min-width: 0;
    flex: 1 1 calc(50% - 4px);
    padding-right: 34px;
    background-position: right 12px center;
  }
  #search {
    flex: 1 1 100%;
    min-width: 0;
  }
  #sort { min-width: 0; }

  /* Hide cities/specialty/sort on mobile by default — toggled by the
   * "More" button in the second filter row. Keeps the visible filters down
   * to: search, ZIP+radius, Open now. Common case, less visual noise. */
  .search-bar:not(.filters-open) .optional-on-mobile { display: none; }

  .more-filters-toggle {
    display: inline-flex;
    align-items: center;
    height: 42px;
    padding: 0 16px;
    border: 2px solid var(--peach);
    border-radius: 999px;
    background: var(--cream);
    color: var(--ink);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    flex: 0 0 auto;
  }
  .more-filters-toggle:hover { border-color: var(--coral); }
  .search-bar.filters-open .more-filters-toggle {
    background: var(--coral);
    border-color: var(--coral);
    color: white;
  }

  /* --- Main / listings --- */
  main { padding: 24px 0 40px; }
  .results-count { font-size: 0.95rem; margin-bottom: 16px; }
  /* Force a single column — `minmax(320px, 1fr)` overflows below 320px viewport */
  .listings { grid-template-columns: 1fr; gap: 16px; }

  /* --- Card --- */
  .card { border-radius: 20px; }
  .card-photo {
    height: 160px;
    border-radius: 18px 18px 0 0;
  }
  .card-body { padding: 18px 20px 20px; }
  .card h2 { font-size: 1.15rem; }
  .card .location { font-size: 0.9rem; }

  /* --- Pagination --- */
  .pagination { gap: 4px; margin: 22px 0 6px; }
  .pagination .page-btn {
    min-width: 36px;
    padding: 7px 10px;
    font-size: 0.85rem;
  }

  /* --- Modals (auth, reviews, summary) --- */
  .modal-backdrop { padding: 12px; }
  .modal { padding: 22px 20px 18px; gap: 8px; }
  .modal h3 { font-size: 1.2rem; }
  .summary-modal,
  .reviews-modal { padding: 20px 18px 18px; }
  .reviews-modal { max-height: 86vh; }

  /* Compact review row so author + stars + date fit on narrow screens */
  .review-head { gap: 6px 8px; font-size: 0.85rem; }
  .review p { font-size: 0.88rem; }

  /* Star picker scales down */
  .star-picker label { font-size: 1.1rem; padding: 0 1px; }

  /* Review form — keep posting-as and pet selector readable */
  .review-form-meta { gap: 8px; }
  .pet-select-label { font-size: 0.8rem; }

  /* --- Profile page --- */
  .profile-hero { padding: 32px 0 26px; }
  .profile-hero-inner { gap: 18px; }
  .profile-hero-name { font-size: 1.55rem; }
  .profile-hero-email { font-size: 0.85rem; }
  .profile-body { padding: 26px 0 50px; }

  /* Pet cards — slightly smaller avatar + inputs */
  .pet-card { padding: 10px 12px; gap: 12px; }
  .pet-form-actions button { padding: 7px 14px; font-size: 0.85rem; }

  /* Add-pet form: stack species/breed on the smallest screens */
  .add-pet-form input { font-size: 0.88rem; padding: 9px 14px; }

  /* --- Footer --- */
  .site-footer { padding: 22px 0; font-size: 0.88rem; }
  .site-footer .attribution { font-size: 0.72rem; }
}

@media (max-width: 380px) {
  .site-header h1 { font-size: 1.9rem; }
  /* On tiny screens, hide the username — the avatar is enough to identify the user */
  .auth-avatar-btn span { display: none; }
  .auth-avatar-btn { padding: 3px; }
  /* Two-up species/breed gets too tight; let them stack */
  .pet-form-row { flex-direction: column; gap: 8px; }
}

/* ====================================================================
 * Hospital detail page (/vets/<slug>/<type>/<id>)
 * Server-rendered for SEO; same header/footer as the rest of the site.
 * ==================================================================== */

.hospital-page { padding-bottom: 48px; }

.hospital-detail {
  background: white;
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(61, 47, 42, 0.08);
  overflow: hidden;
  margin-bottom: 28px;
}

.hospital-detail-body {
  padding: 28px 32px 32px;
}

.hospital-detail-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 2.2rem;
  font-weight: 600;
  color: var(--coral-dark);
  margin: 0 0 6px;
  line-height: 1.2;
}
.hospital-detail-location {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 16px;
}

.hospital-detail-ratings {
  margin: 16px 0;
  font-size: 0.95rem;
}

/* Re-use .specialties + .details from card styles — they look right here too */
.hospital-detail .details {
  border-top: 2px dashed var(--peach);
  padding-top: 16px;
  margin-top: 18px;
  font-size: 0.95rem;
}
.hospital-detail .details p { margin-bottom: 7px; }

/* AI-summary section on the detail page (re-uses .summary-* from modal) */
.hospital-summaries {
  background: white;
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(61, 47, 42, 0.08);
  padding: 24px 32px;
  margin-bottom: 28px;
}
.hospital-summaries .summary-label {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  color: var(--coral-dark);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}
.hospital-summaries .summary-text {
  margin-bottom: 14px;
  line-height: 1.55;
}
.hospital-summaries .summary-list { margin: 0 0 4px 18px; }
.hospital-summaries .summary-list li { margin: 6px 0; line-height: 1.4; }

/* Reviews section on detail page */
.hospital-reviews {
  background: white;
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(61, 47, 42, 0.08);
  padding: 28px 32px;
}
.hospital-reviews h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  margin: 0 0 18px;
}
.hospital-reviews .reviews-list { margin-bottom: 20px; }

/* Card title becomes a link → keep the original look (no underline, same color) */
.card-title-link {
  color: inherit;
  text-decoration: none;
}
.card-title-link:hover { text-decoration: underline; }

/* The "Reviews & details →" CTA at the bottom of each card is now an <a> */
a.reviews-toggle-link {
  display: block;
  text-align: center;
  text-decoration: none;
}

/* Mobile tweaks for the detail page */
@media (max-width: 640px) {
  .hospital-detail-body { padding: 22px 22px 24px; }
  .hospital-detail-name { font-size: 1.7rem; }
  .hospital-summaries,
  .hospital-reviews { padding: 22px; }
}

/* ====================================================================
 * Per-category review ratings — collapsible block in the review form,
 * inline chips on each rendered review, breakdown table on hospital pages.
 * ==================================================================== */

/* Collapsible "How was each part?" section in the review form */
.cat-ratings {
  margin-top: 8px;
  border-top: 1px dashed var(--peach);
  padding-top: 10px;
}
.cat-ratings summary {
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
  padding: 4px 0;
  list-style: none;
  user-select: none;
}
.cat-ratings summary::-webkit-details-marker { display: none; }
.cat-ratings summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform 0.15s;
}
.cat-ratings[open] summary::before { transform: rotate(90deg); }
.cat-ratings summary small { color: var(--muted); font-weight: 500; }

.cat-ratings-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.cat-rating-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 0;
}
.cat-rating-label {
  flex: 0 0 auto;
  width: 130px;
  font-size: 0.85rem;
  color: var(--ink);
  font-weight: 600;
}

/* Mini variant of the star picker — smaller stars, no big pill background */
.star-picker.mini {
  background: transparent;
  border: none;
  padding: 0;
  position: relative;
}
.star-picker.mini label {
  font-size: 0.95rem;
  padding: 0 1px;
}

/* Clear (✕) button next to each mini picker. Specificity bump and !important
   so the generic `.review-form button` rule (coral pill) doesn't capture it. */
.review-form .cat-rating-clear,
.cat-rating-clear {
  background: none !important;
  border: none !important;
  color: var(--muted) !important;
  font-size: 0.7rem !important;
  padding: 2px 5px !important;
  margin: 0 4px 0 0 !important;
  cursor: pointer;
  border-radius: 50% !important;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
}
.review-form .cat-rating-clear:hover,
.cat-rating-clear:hover { opacity: 1; color: var(--ink) !important; }

/* Inline chips shown on each review when categories were rated */
.review-category-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 6px;
}
.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  background: var(--peach);
  color: var(--coral-dark);
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.cat-chip strong {
  background: white;
  color: var(--coral-dark);
  padding: 0 5px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

/* Per-hospital breakdown table on detail page */
.category-breakdown {
  background: white;
  border-radius: 24px;
  box-shadow: 0 4px 20px rgba(61, 47, 42, 0.08);
  padding: 24px 32px;
  margin-bottom: 28px;
}
.category-breakdown h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.25rem;
  color: var(--ink);
  margin: 0 0 14px;
}
.category-breakdown table {
  width: 100%;
  border-collapse: collapse;
}
.category-breakdown td {
  padding: 8px 0;
  border-bottom: 1px dashed var(--peach);
  font-size: 0.95rem;
}
.category-breakdown tr:last-child td { border-bottom: none; }
.cat-label  { color: var(--ink); font-weight: 600; }
.cat-stars  { color: #e8a628; letter-spacing: 1px; white-space: nowrap; }
.cat-stars .cat-avg {
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0;
  margin-left: 6px;
  font-size: 0.9rem;
}
.cat-count  { text-align: right; font-size: 0.85rem; }

@media (max-width: 640px) {
  .cat-rating-label { width: 110px; font-size: 0.8rem; }
  .category-breakdown { padding: 22px; }
  .category-breakdown td { font-size: 0.88rem; }
}

/* ====================================================================
 * Programmatic SEO pages — /find/cities, /find/<city>, /find/<city>/<spec>
 * ==================================================================== */
.city-page { padding: 32px 0 56px; }

.seo-breadcrumb {
  font-size: 0.85rem;
  color: var(--muted);
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.seo-breadcrumb a {
  color: var(--coral-dark);
  text-decoration: none;
}
.seo-breadcrumb a:hover { text-decoration: underline; }
.seo-breadcrumb span:not(:has(a)) { color: var(--muted); }

.seo-h1 {
  font-family: 'Fredoka', sans-serif;
  font-size: 2.2rem;
  color: var(--coral-dark);
  margin: 0 0 12px;
  font-weight: 600;
  line-height: 1.2;
}
.seo-intro {
  color: var(--ink);
  max-width: 720px;
  line-height: 1.55;
  margin: 0 0 24px;
}

/* Specialty filter chips — small pill row, active state in coral */
.seo-specialty-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 28px;
}
.seo-chip {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: white;
  color: var(--coral-dark);
  border: 1.5px solid var(--peach);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
  transition: all 0.12s;
}
.seo-chip:hover { border-color: var(--coral); transform: translateY(-1px); }
.seo-chip.active {
  background: var(--coral);
  color: white;
  border-color: var(--coral);
}

/* Numbered hospital list. <ol> for semantics + a11y; visual rank is a
 * coral circle next to each entry. */
.seo-hospital-list {
  list-style: none;
  padding: 0;
  margin: 0 0 32px;
  counter-reset: none;
}
.seo-hospital-item {
  display: flex;
  gap: 16px;
  background: white;
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(61, 47, 42, 0.06);
  transition: transform 0.12s, box-shadow 0.12s;
}
.seo-hospital-item:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(61, 47, 42, 0.1);
}
.seo-hospital-rank {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--peach);
  color: var(--coral-dark);
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
}
.seo-hospital-body { flex: 1; min-width: 0; }
.seo-hospital-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  margin: 0 0 6px;
  font-weight: 600;
}
.seo-hospital-name a {
  color: var(--coral-dark);
  text-decoration: none;
}
.seo-hospital-name a:hover { text-decoration: underline; }
.seo-hospital-tags { margin-bottom: 6px; }
.seo-hospital-meta {
  font-size: 0.9rem;
  color: var(--ink);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}
.seo-rating {
  color: var(--coral-dark);
  font-weight: 700;
}
.seo-hospital-summary {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0;
  line-height: 1.5;
}

/* Footer interlinking block */
.seo-footer-links {
  margin-top: 40px;
  padding: 28px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 10px rgba(61, 47, 42, 0.05);
}
.seo-footer-links h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.4rem;
  color: var(--coral-dark);
  margin: 0 0 8px;
  font-weight: 600;
}
.seo-cta-link {
  color: var(--coral-dark);
  font-weight: 700;
  text-decoration: none;
}
.seo-cta-link:hover { text-decoration: underline; }

/* Cities index — grid of city cards */
.cities-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.cities-card {
  display: block;
  padding: 18px 20px;
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 8px rgba(61, 47, 42, 0.06);
  text-decoration: none;
  color: inherit;
  transition: transform 0.12s, box-shadow 0.12s;
}
.cities-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(61, 47, 42, 0.1);
}
.cities-card-name {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--coral-dark);
  margin-bottom: 4px;
}
.cities-card-count {
  font-size: 0.85rem;
  color: var(--muted);
}

@media (max-width: 640px) {
  .seo-h1 { font-size: 1.7rem; }
  .seo-hospital-item { padding: 16px; gap: 12px; }
  .seo-hospital-rank { width: 32px; height: 32px; font-size: 0.9rem; }
}

/* ====================================================================
 * About page — marketing / feature showcase. Server-rendered for SEO.
 * Reuses the site header + footer; everything else is custom layout
 * scoped under .about-page so it can't leak into other pages.
 * ==================================================================== */
.about-page { padding: 0 0 60px; }

/* Auth-bar link (sits next to Feedback) */
.auth-bar-link {
  color: var(--coral-dark);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  transition: background 0.12s;
}
.auth-bar-link:hover { background: white; }

/* Hero — big tagline + CTAs against the cream backdrop */
.about-hero {
  padding: 56px 0 40px;
  text-align: center;
}
.about-hero-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 2.6rem;
  line-height: 1.15;
  color: var(--coral-dark);
  margin: 0 0 16px;
  font-weight: 600;
}
.about-hero-sub {
  font-size: 1.1rem;
  color: var(--ink);
  max-width: 640px;
  margin: 0 auto 28px;
  line-height: 1.55;
}
.about-hero-ctas {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  justify-content: center;
  margin-bottom: 18px;
}
.about-cta {
  display: inline-block;
  padding: 12px 26px;
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
  transition: all 0.15s;
  font-size: 1rem;
}
.about-cta.primary {
  background: var(--coral);
  color: white;
  box-shadow: 0 4px 14px rgba(255, 138, 91, 0.35);
}
.about-cta.primary:hover {
  background: var(--coral-dark);
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(255, 138, 91, 0.4);
}
.about-cta.secondary {
  background: white;
  color: var(--coral-dark);
  border: 2px solid var(--peach);
}
.about-cta.secondary:hover { border-color: var(--coral); }
.about-cta.large {
  font-size: 1.1rem;
  padding: 14px 32px;
}
.about-hero-trust {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 12px;
}

/* Section heading style — used in both Features and Trust */
.about-section-head {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.8rem;
  color: var(--coral-dark);
  text-align: center;
  margin: 0 0 32px;
  font-weight: 600;
}

/* Features grid — 3-column on desktop, 1-column on mobile */
.about-features { padding: 24px 0 56px; }
.about-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 22px;
}
.about-feature {
  background: white;
  border-radius: 20px;
  padding: 28px 24px 24px;
  box-shadow: 0 2px 10px rgba(61, 47, 42, 0.06);
  transition: transform 0.15s, box-shadow 0.15s;
}
.about-feature:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(61, 47, 42, 0.12);
}
.about-feature-icon {
  font-size: 2.4rem;
  margin-bottom: 12px;
  line-height: 1;
}
.about-feature h4 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  color: var(--coral-dark);
  margin: 0 0 8px;
  font-weight: 600;
}
.about-feature p {
  color: var(--ink);
  margin: 0;
  line-height: 1.55;
  font-size: 0.96rem;
}

/* Trust section — softer background, 3-column "where data comes from" */
.about-trust {
  background: white;
  padding: 56px 0;
  margin: 24px 0;
  border-top: 1px solid var(--peach);
  border-bottom: 1px solid var(--peach);
}
.about-trust-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}
.about-trust-item h4 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.15rem;
  color: var(--coral-dark);
  margin: 0 0 8px;
  font-weight: 600;
}
.about-trust-item p {
  color: var(--ink);
  margin: 0;
  line-height: 1.55;
  font-size: 0.96rem;
}

/* Final CTA — centered, big call-to-action */
.about-final-cta {
  padding: 48px 0 24px;
  text-align: center;
}
.about-final-cta h3 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.8rem;
  color: var(--coral-dark);
  margin: 0 0 12px;
  font-weight: 600;
}
.about-final-cta p {
  color: var(--ink);
  max-width: 520px;
  margin: 0 auto 24px;
  line-height: 1.55;
}

@media (max-width: 640px) {
  .about-hero { padding: 36px 0 28px; }
  .about-hero-title { font-size: 2rem; }
  .about-hero-sub { font-size: 1rem; }
  .about-section-head { font-size: 1.5rem; }
  .about-feature { padding: 22px 20px 20px; }
}
