:root {
  --pets-radius-sm: 10px;
  --pets-radius-md: 14px;
  --pets-shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06), 0 1px 3px rgba(16, 24, 40, 0.10);
  --pets-shadow-md: 0 6px 14px rgba(16, 24, 40, 0.10), 0 2px 6px rgba(16, 24, 40, 0.08);

  /* Focus ring tuned for WCAG contrast on light surfaces */
  --pets-focus-ring: 0 0 0 0.18rem rgba(37, 140, 251, 0.35);
}

html, body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

/* Bootstrap-compatible focus treatment */
.btn:focus,
.btn:active:focus,
.btn-link:focus,
.form-control:focus,
.form-select:focus,
.form-check-input:focus {
  box-shadow: var(--pets-focus-ring);
}

/* Make cards feel consistent across apps */
.card {
  border-radius: var(--pets-radius-md);
}

.card.shadow-sm {
  box-shadow: var(--pets-shadow-sm) !important;
}

.pets-alert-icon {
  line-height: 1.25;
}

.pets-empty {
  max-width: 42rem;
  margin: 0 auto;
}

.pets-max-w-md {
  max-width: 40rem;
}

.pets-min-w-sm {
  min-width: 12rem;
}

.pets-hero {
  border-radius: 20px;
  padding: 3rem 2rem;
  margin-bottom: 3rem;
  color: white;
  background: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
}

.pets-hover-card {
  border: none;
  border-radius: 15px;
  background: #ffffff;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.pets-hover-card:hover {
  transform: translateY(-5px);
  box-shadow: var(--pets-shadow-md) !important;
}

.pets-icon-box {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.5rem;
  margin-bottom: 1rem;
}

/* Chat widget (global styles so it works in WASM + Server apps without scoped CSS wiring) */
.pets-chat__stack {
  position: relative;
}

.pets-chat--dock {
  position: fixed;
  left: auto;
  top: auto;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1rem, env(safe-area-inset-bottom, 0px));
  z-index: 1080;
}

.pets-chat--dock .pets-chat__stack {
  width: max-content;
  max-width: min(24rem, calc(100vw - 2rem));
}

.pets-chat--dock .pets-chat__panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: min(24rem, calc(100vw - 2rem));
  max-height: min(28rem, calc(100dvh - 6rem));
  margin-top: 0;
  display: flex;
  flex-direction: column;
  transform-origin: bottom right;
  opacity: 0;
  transform: translateY(0.5rem) scale(0.96);
  pointer-events: none;
  transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1), opacity 200ms ease;
  box-shadow: var(--pets-shadow-md);
}

.pets-chat--dock .pets-chat__panel[data-open="True"] {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.pets-chat--embed {
  position: static;
  right: auto;
  bottom: auto;
  z-index: auto;
  width: 100%;
  max-width: 48rem;
  margin: 0 auto;
}

.pets-chat__stack--embed {
  width: 100%;
  max-width: 100%;
}

.pets-chat__stack--embed .pets-chat__panel {
  position: relative;
  right: auto;
  bottom: auto;
  width: 100%;
  max-height: none;
  margin-top: 0;
  opacity: 1;
  transform: none;
  pointer-events: auto;
  transition: none;
}

.pets-chat__fab {
  width: 3rem;
  height: 3rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
}

.pets-chat__icon {
  width: 1.25rem;
  height: 1.25rem;
}

.pets-chat__badge {
  position: absolute;
  top: -0.35rem;
  right: -0.35rem;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: #dc3545;
  color: white;
  font-size: 0.75rem;
  line-height: 1.25rem;
  font-weight: 700;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.pets-chat--dock .pets-chat__panel .card-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
}

.pets-chat__messages {
  max-height: min(22rem, calc(100dvh - 14rem));
  overflow: auto;
}

.pets-chat__stack--embed .pets-chat__messages {
  max-height: 22rem;
}

.pets-chat__author {
  font-weight: 600;
  color: rgba(33, 37, 41, 0.85);
}

.pets-chat__text {
  white-space: pre-wrap;
  word-break: break-word;
}

.pets-chat__msg {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.pets-chat__bubble {
  max-width: 90%;
  padding: 0.5rem 0.75rem;
  border-radius: 0.75rem;
  background: rgba(13, 110, 253, 0.08);
  border: 1px solid rgba(13, 110, 253, 0.18);
}

.pets-chat__msg--mine {
  align-items: flex-end;
}

.pets-chat__msg--mine .pets-chat__bubble {
  background: rgba(25, 135, 84, 0.10);
  border-color: rgba(25, 135, 84, 0.18);
}
