@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;1,9..40,400&family=Fredoka:wght@400;500;600&display=swap');

:root {
  --primary: #F72585;
  --primary-light: #7209B7;
  --primary-lighter: #3A0CA3;
  --primary-lightest: #4361EE;
  --bg: #4CC9F0;
  --bg-card: #ffffff;
  --bg-hover: #f0faf9;
  --text: #1a3a36;
  --text-secondary: #4a7a73;
  --text-muted: #7da8a1;
  --danger: #c0392b;
  --danger-light: #fce8e6;
  --warning: #e67e22;
  --success: #27ae60;
  --shadow-sm: 0 1px 3px rgba(0, 77, 64, 0.08);
  --shadow-md: 0 4px 12px rgba(0, 77, 64, 0.1);
  --shadow-lg: 0 8px 24px rgba(0, 77, 64, 0.12);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
}

::selection {
  background: var(--primary-lighter);
  color: var(--text);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ============ LOADING SCREEN ============ */
.loading-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  gap: 1rem;
}

.loading-paw {
  font-size: 3rem;
  animation: paw-bounce 1s ease-in-out infinite;
}

@keyframes paw-bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

.loading-screen p {
  color: var(--text-secondary);
  font-size: 1rem;
}

/* ============ APP HEADER ============ */
.app-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  padding: 1.25rem 1.5rem;
  color: white;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-md);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.back-btn {
  background: rgba(255,255,255,0.18);
  border: none;
  color: white;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.2s;
}

.back-btn:hover {
  background: rgba(255,255,255,0.28);
}

.app-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.app-subtitle {
  font-size: 0.85rem;
  opacity: 0.85;
  margin-top: 0.15rem;
  padding-left: 0.1rem;
}

/* ============ MAIN ============ */
.app-main {
  max-width: 800px;
  margin: 0 auto;
  padding: 1.25rem;
}

/* ============ PET LIST ============ */
.pet-list-view {
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.pets-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.pet-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
  animation: cardSlideIn 0.35s ease both;
}

.pet-card:nth-child(1) { animation-delay: 0s; }
.pet-card:nth-child(2) { animation-delay: 0.05s; }
.pet-card:nth-child(3) { animation-delay: 0.1s; }
.pet-card:nth-child(4) { animation-delay: 0.15s; }
.pet-card:nth-child(5) { animation-delay: 0.2s; }
.pet-card:nth-child(6) { animation-delay: 0.25s; }

@keyframes cardSlideIn {
  from { opacity: 0; transform: translateX(-12px); }
  to { opacity: 1; transform: translateX(0); }
}

.pet-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--primary-lighter);
  transform: translateY(-1px);
}

.pet-card-photo {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.pet-card-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pet-card-emoji {
  font-size: 1.75rem;
}

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

.pet-card-info h3 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  font-size: 1.125rem;
  color: var(--text);
}

.pet-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.2rem;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.age-badge {
  background: var(--primary-lightest);
  color: var(--primary);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-weight: 500;
  font-size: 0.75rem;
}

.upcoming-badge {
  display: inline-block;
  margin-top: 0.3rem;
  background: var(--primary);
  color: white;
  font-size: 0.7rem;
  padding: 0.15rem 0.5rem;
  border-radius: 10px;
  font-weight: 500;
}

.pet-card-arrow {
  color: var(--text-muted);
  font-size: 1.5rem;
  font-weight: 300;
}

/* ============ EMPTY STATE ============ */
.empty-state {
  text-align: center;
  padding: 4rem 1rem;
  animation: fadeIn 0.4s ease;
}

.empty-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  display: block;
}

.empty-state h2 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.empty-tab-state {
  text-align: center;
  padding: 2.5rem 1rem;
  animation: fadeIn 0.35s ease;
}

.empty-tab-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 0.75rem;
}

.empty-tab-state h3 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  margin-bottom: 0.35rem;
}

.empty-tab-state p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.add-inline-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.65rem 1.5rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.add-inline-btn:hover {
  background: var(--primary-light);
  transform: translateY(-1px);
}

/* ============ FAB BUTTON ============ */
.fab-btn {
  display: block;
  margin: 1.5rem auto 0;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.7rem 1.75rem;
  border-radius: 50px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
}

.fab-btn:hover {
  background: var(--primary-light);
  box-shadow: var(--shadow-lg);
  transform: translateY(-2px);
}

.add-pet-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  border-radius: 50px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s;
}

.add-pet-btn:hover {
  background: var(--primary-light);
  transform: translateY(-2px);
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 48, 40, 0.45);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  animation: fadeOverlay 0.2s ease;
}

@keyframes fadeOverlay {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: modalSlide 0.25s ease;
}

@keyframes modalSlide {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
}

.modal-header h2 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  font-size: 1.25rem;
}

.close-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.close-btn:hover {
  color: var(--text);
}

/* ============ FORMS ============ */
.pet-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.form-group input,
.form-group textarea,
.form-group select {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--primary-lightest);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(77, 182, 172, 0.2);
}

.form-group textarea {
  resize: vertical;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.submit-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 0.5rem;
}

.submit-btn:hover {
  background: var(--primary-light);
}

.submit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ============ PHOTO UPLOAD ============ */
.photo-upload-area {
  text-align: center;
  margin-bottom: 0.5rem;
}

.photo-preview {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--primary-lighter);
}

.photo-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px dashed var(--primary-lighter);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.photo-placeholder span {
  font-size: 1.5rem;
}

.file-input {
  display: none;
}

.photo-label {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--primary);
  cursor: pointer;
  font-weight: 500;
}

.photo-label:hover {
  text-decoration: underline;
}

/* ============ SPECIES GRID ============ */
.species-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 0.5rem;
}

.species-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 0.5rem;
  border: 1.5px solid var(--primary-lightest);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.species-btn.active {
  border-color: var(--primary);
  background: var(--primary-lightest);
}

.species-btn:hover {
  border-color: var(--primary-light);
}

.species-emoji {
  font-size: 1.25rem;
}

.species-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-secondary);
}

/* ============ PET DETAIL ============ */
.pet-detail-view {
  animation: fadeIn 0.3s ease;
}

.pet-profile-card {
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  border-left: 4px solid var(--primary);
}

.profile-photo {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.profile-emoji {
  font-size: 2.25rem;
}

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

.profile-info h2 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
  font-size: 1.3rem;
}

.profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.4rem;
}

.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 500;
  background: var(--primary-lightest);
  color: var(--primary);
}

.breed-tag {
  background: var(--bg);
  color: var(--text-secondary);
}

.bday-tag {
  background: #fff3e0;
  color: #e65100;
}

.delete-pet-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  font-size: 1rem;
  cursor: pointer;
  opacity: 0.4;
  transition: opacity 0.2s;
  padding: 0.25rem;
}

.delete-pet-btn:hover {
  opacity: 1;
}

/* ============ DETAIL TABS ============ */
.detail-tabs {
  display: flex;
  gap: 0.25rem;
  margin-top: 1rem;
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 0.3rem;
  box-shadow: var(--shadow-sm);
  overflow-x: auto;
}

.detail-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.6rem 0.5rem;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  min-width: 0;
}

.detail-tab.active {
  background: var(--primary);
  color: white;
  box-shadow: var(--shadow-sm);
}

.detail-tab:not(.active):hover {
  background: var(--bg);
}

.tab-icon {
  font-size: 1.15rem;
}

.tab-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  white-space: nowrap;
}

.tab-content {
  margin-top: 1rem;
}

/* ============ CONFIRM MODAL ============ */
.confirm-modal {
  text-align: center;
}

.confirm-modal h3 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  margin-bottom: 0.75rem;
}

.confirm-modal p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
}

.confirm-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
}

.cancel-btn {
  background: var(--bg);
  border: 1px solid var(--primary-lightest);
  color: var(--text-secondary);
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
}

.cancel-btn:hover {
  background: var(--primary-lightest);
}

.danger-btn {
  background: var(--danger);
  border: none;
  color: white;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.danger-btn:hover {
  background: #a93226;
}

/* ============ VET VISITS ============ */
.visit-group {
  margin-bottom: 1.5rem;
}

.group-title {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.group-icon {
  font-size: 1rem;
}

.visit-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-sm);
  border-left: 3px solid var(--primary-light);
  position: relative;
  animation: cardFadeIn 0.3s ease both;
}

.visit-card:nth-child(2) { animation-delay: 0.03s; }
.visit-card:nth-child(3) { animation-delay: 0.06s; }
.visit-card:nth-child(4) { animation-delay: 0.09s; }

@keyframes cardFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.visit-card.upcoming {
  border-left-color: var(--primary);
  background: linear-gradient(135deg, var(--bg-card) 0%, rgba(178, 223, 219, 0.15) 100%);
}

.visit-card.past {
  border-left-color: var(--primary-lightest);
}

.visit-date-badge {
  background: var(--primary);
  color: white;
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.5rem;
  text-align: center;
  min-width: 48px;
  flex-shrink: 0;
}

.visit-date-badge.past-badge {
  background: var(--primary-lightest);
  color: var(--primary);
}

.badge-month {
  display: block;
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-day {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
}

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

.visit-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.visit-vet {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.visit-notes {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-style: italic;
}

.visit-cost {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--primary);
  margin-top: 0.2rem;
}

.remove-item-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.2rem;
  transition: color 0.2s;
  flex-shrink: 0;
  line-height: 1;
}

.remove-item-btn:hover {
  color: var(--danger);
}

/* ============ MEDICATIONS ============ */
.med-group {
  margin-bottom: 1.5rem;
}

.med-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-sm);
  animation: cardFadeIn 0.3s ease both;
}

.med-card:nth-child(2) { animation-delay: 0.03s; }
.med-card:nth-child(3) { animation-delay: 0.06s; }

.active-med {
  border-left: 3px solid var(--success);
}

.inactive-med {
  border-left: 3px solid var(--text-muted);
  opacity: 0.7;
}

.med-icon {
  font-size: 1.5rem;
  flex-shrink: 0;
}

.med-icon.faded {
  opacity: 0.4;
}

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

.med-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.med-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.med-tag {
  background: var(--bg);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.freq-tag {
  background: var(--primary-lightest);
  color: var(--primary);
}

.med-dates {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.med-notes {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
  font-style: italic;
}

.med-actions {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex-shrink: 0;
}

.toggle-btn {
  background: var(--bg);
  border: 1px solid var(--primary-lightest);
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  cursor: pointer;
  font-size: 0.75rem;
  transition: all 0.2s;
}

.toggle-btn:hover {
  background: var(--primary-lightest);
}

/* ============ FEEDING SCHEDULE ============ */
.feeding-timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.feeding-card {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
  box-shadow: var(--shadow-sm);
  animation: cardFadeIn 0.3s ease both;
}

.feeding-card:nth-child(2) { animation-delay: 0.04s; }
.feeding-card:nth-child(3) { animation-delay: 0.08s; }

.feeding-time-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  min-width: 56px;
  position: relative;
  flex-shrink: 0;
}

.feeding-icon {
  font-size: 1.25rem;
}

.feeding-time {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--primary);
  text-align: center;
}

.timeline-line {
  position: absolute;
  bottom: -1.25rem;
  width: 2px;
  height: 1rem;
  background: var(--primary-lightest);
}

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

.feeding-info h4 {
  font-size: 0.95rem;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.feeding-details {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.feed-tag {
  background: var(--bg);
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--text-secondary);
}

.amount-tag {
  background: var(--primary-lightest);
  color: var(--primary);
}

.feeding-notes {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  font-style: italic;
}

/* ============ WEIGHT TRACKER ============ */
.weight-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.weight-stat {
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 0.85rem;
  text-align: center;
  box-shadow: var(--shadow-sm);
  animation: cardFadeIn 0.3s ease both;
}

.weight-stat:nth-child(1) { animation-delay: 0s; }
.weight-stat:nth-child(2) { animation-delay: 0.05s; }
.weight-stat:nth-child(3) { animation-delay: 0.1s; }

.weight-stat.current {
  border-top: 3px solid var(--primary);
}

.weight-stat.up {
  border-top: 3px solid var(--warning);
}

.weight-stat.down {
  border-top: 3px solid var(--success);
}

.weight-stat.same {
  border-top: 3px solid var(--text-muted);
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.stat-value {
  display: block;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--text);
}

.stat-date {
  display: block;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.unit-toggle-row {
  display: flex;
  gap: 0.35rem;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.unit-toggle-row.compact {
  margin-top: 0.4rem;
  margin-bottom: 0;
}

.unit-btn {
  background: var(--bg);
  border: 1.5px solid var(--primary-lightest);
  color: var(--text-secondary);
  padding: 0.3rem 0.75rem;
  border-radius: 6px;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

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

.chart-container {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  height: 220px;
  margin-bottom: 1rem;
}

.weight-log-list {
  margin-top: 0.5rem;
}

.weight-entry {
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.85rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.4rem;
  box-shadow: var(--shadow-sm);
  animation: cardFadeIn 0.25s ease both;
}

.weight-entry:nth-child(2) { animation-delay: 0.02s; }
.weight-entry:nth-child(3) { animation-delay: 0.04s; }
.weight-entry:nth-child(4) { animation-delay: 0.06s; }

.weight-entry-date {
  font-size: 0.8rem;
  color: var(--text-secondary);
  min-width: 90px;
}

.weight-entry-value {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary);
  flex: 1;
}

.weight-entry-notes {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
  flex: 1;
  text-align: right;
}

/* ============ SKELETON LOADING ============ */
.section-loading {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 0;
}

.skeleton-card {
  background: linear-gradient(90deg, var(--primary-lightest) 25%, var(--bg) 50%, var(--primary-lightest) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-md);
  height: 72px;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 640px) {
  .app-main {
    padding: 0.85rem;
  }

  .app-title {
    font-size: 1.25rem;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .species-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .detail-tab {
    padding: 0.5rem 0.35rem;
  }

  .tab-label {
    font-size: 0.58rem;
  }

  .weight-summary {
    grid-template-columns: 1fr 1fr;
  }

  .profile-tags {
    gap: 0.25rem;
  }

  .pet-profile-card {
    padding: 1rem;
  }

  .profile-photo {
    width: 56px;
    height: 56px;
  }

  .modal-content {
    padding: 1.25rem;
    border-radius: var(--radius-lg);
  }
}

@media (max-width: 380px) {
  .species-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .weight-summary {
    grid-template-columns: 1fr;
  }
}
```

<!-- WALKTHROUGH_SCRIPT:
[
  {"step": 1, "narration": "Welcome to PetCare! This is your personal pet health companion. Let's add your first pet.", "view": "user", "highlight_selector": ".empty-state .add-pet-btn", "wait_for": "tap_to_continue"},
  {"step": 2, "narration": "Tap 'Add Your First Pet' to open the form. You can upload a photo, pick the species, and enter their name, breed, and birthday.", "view": "user", "highlight_selector": ".add-pet-btn", "wait_for": "user_interaction"},
  {"step": 3, "narration": "Great! Your pet now appears as a card. Tap on them to see their detailed care dashboard.", "view": "user", "highlight_selector": ".pet-card", "wait_for": "user_interaction"},
  {"step": 4, "narration": "Inside, you'll see four tabs: Vet Visits, Medications, Feeding, and Weight. Let's start by adding a vet appointment.", "view": "user", "highlight_selector": ".detail-tabs", "wait_for": "tap_to_continue"},
  {"step": 5, "narration": "The Vet Visits tab shows upcoming and past appointments. Add a visit with the date, reason, veterinarian, and optional cost.", "view": "user", "highlight_selector": ".detail-tab:first-child", "wait_for": "user_interaction"},
  {"step": 6, "narration": "Switch to Medications to track your pet's prescriptions with dosage, frequency, and start/end dates. You can pause and reactivate meds.", "view": "user", "highlight_selector": ".detail-tab:nth-child(2)", "wait_for": "user_interaction"},
  {"step": 7, "narration": "The Feeding tab lets you set up daily meals with times, food types, and portions — displayed as a visual timeline.", "view": "user", "highlight_selector": ".detail-tab:nth-child(3)", "wait_for": "user_interaction"},
  {"step": 8, "narration": "Finally, Weight tracking shows a chart of your pet's weight over time with trend indicators. Toggle between lbs and kg.", "view": "user", "highlight_selector": ".detail-tab:nth-child(4)", "wait_for": "user_interaction"},
  {"step": 9, "narration": "Use the back button to return to your pet list anytime. Add as many pets as you like — all data syncs across your devices!", "view": "user", "highlight_selector": ".back-btn", "wait_for": "tap_to_continue"}
]
-->

.family-switcher {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 0.85rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}

.family-switcher-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.family-switcher-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.family-switcher-loading {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.family-switcher-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.family-switcher-add {
  margin-top: 0.5rem;
}

.family-select,
.family-input {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--primary-lightest);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  outline: none;
}

.family-select {
  flex: 1;
}

.family-input {
  flex: 1;
}

.family-add-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.65rem 0.95rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.family-add-btn:hover {
  background: var(--primary-light);
}

.owner-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-lightest);
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
}

.ai-insights-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}

.ai-insights-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.ai-insights-subtitle {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-top: 0.15rem;
}

.ai-insights-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.ai-insights-btn:hover {
  background: var(--primary-light);
}

.ai-insights-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.ai-insights-summary {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.ai-insights-summary > div {
  background: var(--bg);
  border: 1px solid var(--primary-lightest);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.75rem;
}

.ai-summary-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.15rem;
}

.ai-summary-value {
  display: block;
  font-size: 0.9rem;
  color: var(--text);
}

.ai-insights-result,
.ai-insights-placeholder,
.ai-insights-error {
  border-radius: var(--radius-sm);
  padding: 0.85rem;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
}

.ai-insights-result {
  background: rgba(77, 182, 172, 0.08);
  border: 1px solid rgba(0, 121, 107, 0.15);
}

.ai-insights-placeholder {
  background: var(--bg);
  color: var(--text-secondary);
  border: 1px dashed var(--primary-lightest);
}

.ai-insights-error {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid rgba(192, 57, 43, 0.2);
}

@media (max-width: 640px) {
  .ai-insights-header {
    flex-direction: column;
    align-items: stretch;
  }

  .ai-insights-btn {
    width: 100%;
  }
}

.vet-history-export-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1rem;
}

.vet-history-export-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.vet-history-export-card h3 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.vet-history-export-card p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.vet-export-btn {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.vet-export-btn:hover {
  background: var(--primary-light);
}

.vet-export-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.vet-pdf-report {
  position: absolute;
  left: 0;
  top: 0;
  width: 800px;
  opacity: 0;
  pointer-events: none;
  background: white;
  color: #000;
  padding: 24px;
}

.vet-pdf-report h1 {
  font-size: 24px;
  margin-bottom: 12px;
}

.vet-pdf-report p {
  font-size: 14px;
  color: #222;
  margin-bottom: 6px;
}

.vet-pdf-list {
  margin-top: 16px;
  display: grid;
  gap: 14px;
}

.vet-pdf-item {
  border: 1px solid #d9e7e5;
  border-radius: 10px;
  padding: 12px;
}

.vet-pdf-item h2 {
  font-size: 18px;
  margin-bottom: 8px;
}

.vet-pdf-item p {
  font-size: 13px;
  margin-bottom: 4px;
}

@media (max-width: 640px) {
  .vet-history-export-header {
    flex-direction: column;
    align-items: stretch;
  }

  .vet-export-btn {
    width: 100%;
  }
}

.pet-share-card {
  background: var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 0.95rem;
  box-shadow: var(--shadow-sm);
  margin-top: 1rem;
  margin-bottom: 1rem;
}

.pet-share-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.pet-share-header h3 {
  font-family: 'Fredoka', sans-serif;
  font-weight: 500;
  margin-bottom: 0.15rem;
}

.pet-share-header p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.pet-share-toggle {
  flex-shrink: 0;
}

.pet-share-sheet {
  display: grid;
  gap: 0.9rem;
}

.pet-share-controls {
  display: grid;
  gap: 0.75rem;
}

.pet-share-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.pet-share-result {
  display: grid;
  gap: 0.75rem;
}

.pet-share-url-box {
  display: grid;
  gap: 0.35rem;
}

.pet-share-url-box label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.pet-share-url-box input {
  font-family: inherit;
  font-size: 0.9rem;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--primary-lightest);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
}

.pet-share-preview {
  background: var(--bg);
  border: 1px solid var(--primary-lightest);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.pet-share-preview p {
  margin-top: 0.45rem;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.45;
}

.pet-share-help {
  background: rgba(77, 182, 172, 0.08);
  border: 1px solid rgba(0, 121, 107, 0.12);
  border-radius: var(--radius-sm);
  padding: 0.8rem;
}

.pet-share-help p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.5;
}

@media (max-width: 640px) {
  .pet-share-header {
    flex-direction: column;
    align-items: stretch;
  }

  .pet-share-actions {
    flex-direction: column;
  }

  .pet-share-actions > button {
    width: 100%;
  }
}
