/* Shared components. Feature styles live in screens.css (sign-in, onboarding),
   dates.css (introductions, dates, booking, chat) and account.css (tables, profile, settings). */

/* ------------------------------------------------------------------ Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 52px;
  padding: 0 24px;
  border-radius: var(--r-pill);
  border: 1.5px solid transparent;
  font-weight: 700;
  font-size: 16px;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background-color 0.2s var(--ease), opacity 0.2s;
  user-select: none;
  -webkit-user-select: none;
}
.btn:active:not(:disabled) {
  transform: scale(0.97);
}
.btn:disabled {
  cursor: default;
  background: var(--cloud);
  color: var(--muted);
  border-color: transparent;
}
.btn-block {
  width: 100%;
}
.btn-primary {
  background: var(--ember);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--ember-dark);
}
.btn-ink {
  background: var(--ink);
  color: #fff;
}
.btn-secondary {
  background: transparent;
  border-color: color-mix(in srgb, var(--ink) 85%, transparent);
  color: var(--ink);
}
.btn-quiet {
  background: var(--paper-chip);
  color: var(--ink);
}
.btn-link {
  min-height: 44px;
  padding: 0 12px;
  background: none;
  color: var(--ember);
  font-weight: 700;
}
.btn-link.danger {
  color: var(--ember-dark);
}
.btn-sm {
  min-height: 40px;
  padding: 0 16px;
  font-size: 14px;
}
.btn.loading {
  color: transparent !important;
  position: relative;
  pointer-events: none;
}
.btn.loading::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2.5px solid #fff;
  border-right-color: transparent;
  animation: spin 0.7s linear infinite;
}
.btn-secondary.loading::after,
.btn-quiet.loading::after {
  border-color: var(--ink);
  border-right-color: transparent;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
  position: relative;
}
.icon-btn:active {
  background: var(--paper-chip);
}
.icon-btn .badge-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ember);
  border: 2px solid var(--shell);
}

/* ------------------------------------------------------------------ Cards, banners, pills */

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.card-title {
  font: 600 20px/1.25 var(--font-serif);
}
.card.tight {
  padding: 14px 16px;
}
.card.clickable {
  cursor: pointer;
  transition: transform 0.15s var(--ease);
  text-decoration: none;
  color: inherit;
}
.card.clickable:active {
  transform: scale(0.985);
}

.banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--indigo-soft);
  color: var(--ink);
}
.banner .icon {
  color: var(--indigo);
  margin-top: 1px;
}
.banner-title {
  font-weight: 700;
}
.banner-body {
  font-size: 14px;
  color: var(--ink-soft);
}
.banner.warning {
  background: var(--saffron-soft);
}
.banner.warning .icon {
  color: var(--saffron-ink);
}
.banner.danger {
  background: var(--ember-soft);
}
.banner.danger .icon {
  color: var(--ember);
}
.banner.success {
  background: var(--palm-soft);
}
.banner.success .icon {
  color: var(--palm);
}
.banner-action {
  margin-top: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 11px;
  border-radius: var(--r-pill);
  background: var(--paper-chip);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.pill .icon {
  width: 15px;
  height: 15px;
}
.pill.ember {
  background: var(--ember-soft);
  color: var(--ember-dark);
}
.pill.indigo {
  background: var(--indigo-soft);
  color: var(--indigo);
}
.pill.palm {
  background: var(--palm-soft);
  color: var(--palm);
}
.pill.saffron {
  background: var(--saffron-soft);
  color: var(--saffron-ink);
}
.pill.ink {
  background: var(--ink);
  color: #fff;
}

/* ------------------------------------------------------------------ Menu rows and lists */

.menu {
  display: flex;
  flex-direction: column;
}
.menu-row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 56px;
  padding: 8px 2px;
  border: 0;
  background: none;
  text-align: left;
  width: 100%;
  border-radius: var(--r-sm);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.menu-row:active {
  background: var(--paper-chip);
}
.menu-row + .menu-row {
  border-top: 1px solid var(--line);
}
.menu-tile {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: var(--r-sm);
  background: var(--ember-soft);
  color: var(--ember);
  flex: none;
}
.menu-tile.indigo {
  background: var(--indigo-soft);
  color: var(--indigo);
}
.menu-tile.palm {
  background: var(--palm-soft);
  color: var(--palm);
}
.menu-tile.ink {
  background: var(--paper-chip);
  color: var(--ink-soft);
}
.menu-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.menu-title {
  font-weight: 600;
}
.menu-sub {
  font-size: 13px;
  color: var(--muted);
}
.menu-row .chev {
  color: var(--muted);
}

/* ------------------------------------------------------------------ Forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field > label,
.field-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}
.input,
.select,
.textarea {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  background: var(--paper);
  font-size: 16px; /* 16px stops iOS zooming into inputs */
  transition: border-color 0.2s var(--ease);
}
.textarea {
  min-height: 96px;
  resize: vertical;
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--ink);
}
.input[aria-invalid="true"] {
  border-color: var(--ember);
}
.field-hint {
  font-size: 13px;
  color: var(--muted);
}
.field-error {
  font-size: 13px;
  color: var(--ember-dark);
  font-weight: 600;
}
.input-prefix {
  display: flex;
  align-items: stretch;
}
.input-prefix > span {
  display: grid;
  place-items: center;
  padding: 0 14px;
  border: 1.5px solid var(--line);
  border-right: 0;
  border-radius: var(--r-md) 0 0 var(--r-md);
  background: var(--paper-chip);
  font-weight: 600;
}
.input-prefix > .input {
  border-radius: 0 var(--r-md) var(--r-md) 0;
}

/* Choice chips (single or multi select). State is shown by a check too, not colour alone. */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r-pill);
  border: 1.5px solid var(--line);
  background: var(--paper);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.chip[aria-pressed="true"],
.chip[aria-checked="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chip .icon {
  width: 16px;
  height: 16px;
}

/* Switch */
.switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.switch {
  position: relative;
  width: 52px;
  height: 32px;
  flex: none;
  border-radius: 32px;
  border: 1.5px solid var(--line);
  background: var(--cloud);
  cursor: pointer;
  transition: background-color 0.2s var(--ease);
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 23px;
  height: 23px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform 0.25s var(--spring), background-color 0.2s;
}
.switch[aria-checked="true"] {
  background: var(--ember);
  border-color: var(--ember);
}
.switch[aria-checked="true"]::after {
  background: #fff;
  transform: translateX(20px);
}
.switch:disabled {
  opacity: 0.5;
}

/* ------------------------------------------------------------------ Feedback */

.toast-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--tabbar-h) + 18px + var(--safe-bottom));
  z-index: 60;
  display: flex;
  justify-content: center;
  pointer-events: none;
  padding: 0 16px;
}
.toast {
  max-width: 520px;
  padding: 13px 18px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: #fff;
  font-size: 15px;
  box-shadow: 0 10px 30px rgb(31 26 43 / 0.25);
  animation: toast-in 0.3s var(--spring);
  pointer-events: auto;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.98);
  }
}

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 48px 24px;
}
.state .state-title {
  font: 600 22px/1.25 var(--font-serif);
}
.state .state-body {
  color: var(--muted);
  max-width: 340px;
}

.skeleton {
  border-radius: var(--r-md);
  background: linear-gradient(90deg, var(--cloud) 25%, var(--paper-chip) 50%, var(--cloud) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

/* ------------------------------------------------------------------ Sheets and dialogs */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgb(31 26 43 / 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.2s var(--ease);
}
.scrim.center {
  align-items: center;
  padding: 24px;
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
}
.sheet {
  width: 100%;
  max-width: var(--content-max);
  max-height: 88dvh;
  overflow: auto;
  background: var(--paper);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 10px 20px calc(20px + var(--safe-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: sheet-in 0.32s var(--spring);
}
.sheet::before {
  content: "";
  align-self: center;
  width: 40px;
  height: 5px;
  border-radius: 5px;
  background: var(--line);
}
@keyframes sheet-in {
  from {
    transform: translateY(40px);
    opacity: 0;
  }
}
.dialog {
  width: 100%;
  max-width: 400px;
  background: var(--paper);
  border-radius: var(--r-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: sheet-in 0.25s var(--spring);
}
.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

/* ------------------------------------------------------------------ Photos */

.photo {
  background: var(--cloud);
  border-radius: var(--r-md);
  overflow: hidden;
  position: relative;
}
.photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--cloud);
  flex: none;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 4px 0;
}
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 16px;
  margin: 0;
}
.kv dt {
  color: var(--muted);
  font-size: 14px;
}
.kv dd {
  margin: 0;
  font-weight: 600;
}

.progress-dots {
  display: flex;
  gap: 6px;
  justify-content: center;
}
.progress-dots span {
  width: 8px;
  height: 8px;
  border-radius: 8px;
  background: var(--line);
  transition: width 0.3s var(--spring), background-color 0.2s;
}
.progress-dots span.on {
  width: 22px;
  background: var(--ember);
}

.steps {
  display: flex;
  gap: 6px;
}
.steps span {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--line);
}
.steps span.on {
  background: var(--ember);
}
