/* ==========================================================================
   Daily weigh-in: the dashboard capsule, the Log weight sheet and its toast
   (Components/WeightTracking/Daily). Design "2A final" + "Log weight sheet".
   ⚠️ Every rule sits under .wl: App.razor loads Bootstrap AFTER this file, so a bare single-class
   rule loses to .btn and friends at equal specificity (see profile-modal.css).
   Blue = something to do, grey = done today. Change values are always neutral grey: direction is
   not a verdict. Nothing here is red.
   ========================================================================== */

/* --- Capsule --------------------------------------------------------------- */

.wl.wl-capsule {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin: 0 0 12px;
  border: 1px solid transparent;
  border-radius: var(--fs-radius-pill);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.wl.wl-capsule.wl-todo {
  min-height: 60px;
  padding: 8px 8px 8px 18px;
  border-color: var(--fs-primary-bg);
  background: var(--fs-bg-selected);
}

.wl.wl-capsule.wl-done {
  min-height: 52px;
  padding: 0 14px 0 16px;
  background: var(--fs-bg-tertiary);
}

.wl.wl-capsule:focus-visible {
  outline: 2px solid var(--fs-primary);
  outline-offset: 2px;
}

.wl .wl-capsule-main {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.wl .wl-capsule-text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.wl .wl-capsule-label {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wl.wl-todo .wl-capsule-label {
  color: var(--fs-primary-active);
}
.wl.wl-done .wl-capsule-label {
  color: var(--fs-text-primary);
}

.wl .wl-capsule-reason {
  font-size: 13px;
  color: var(--fs-macro-kcal);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wl .wl-capsule-check {
  font-size: 16px;
  color: var(--fs-text-primary);
}

.wl .wl-capsule-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 17px;
  font-weight: 700;
  color: var(--fs-text-primary);
}

.wl .wl-capsule-change {
  font-size: 13px;
  font-weight: 600;
  color: var(--fs-macro-kcal);
}

.wl .wl-capsule-chevron {
  font-size: 13px;
  color: var(--fs-text-secondary);
}

.wl .wl-capsule-action {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--fs-primary);
}

.wl .wl-capsule-plus {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--fs-primary);
  color: var(--fs-text-inverse);
  font-size: 16px;
}

/* The dot, and its pulse: a halo behind it, three beats when the dashboard opens, then still.
   Only from the overdue day. Reduced motion gets the still dot. */
.wl .wl-dot {
  position: relative;
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fs-primary);
}

.wl .wl-dot.wl-pulse::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--fs-primary);
  opacity: 0;
  animation: wl-dot-pulse 1.4s cubic-bezier(0, 0, 0.2, 1) 3;
}

@keyframes wl-dot-pulse {
  0% {
    transform: scale(1);
    opacity: 0.55;
  }
  70% {
    transform: scale(3);
    opacity: 0;
  }
  100% {
    transform: scale(3);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .wl .wl-dot.wl-pulse::before {
    animation: none;
  }
}

/* --- Sheet ----------------------------------------------------------------- */

.wl.wl-sheet-layer {
  position: fixed;
  inset: 0;
  z-index: 1060;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(30, 27, 22, 0.34);
}

.wl .wl-sheet {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  max-height: calc(100% - 24px);
  overflow-y: auto;
  /* The safe area keeps the Log button clear of the iPhone home indicator. */
  padding: 16px 20px calc(20px + env(safe-area-inset-bottom, 0px));
  border-radius: 20px 20px 0 0;
  background: var(--fs-bg-primary);
  color: var(--fs-text-primary);
  box-shadow: var(--fs-shadow-lg);
}

.wl .wl-sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.wl .wl-sheet-title {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--fs-text-primary);
}

.wl .wl-sheet-date {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--fs-text-secondary);
}

.wl .wl-close {
  width: 44px;
  height: 44px;
  margin: -8px -10px 0 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--fs-text-secondary);
  font-size: 20px;
}

.wl .wl-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-top: 4px;
}

.wl .wl-step {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 52px;
  height: 52px;
  border: 1px solid var(--fs-border-default);
  border-radius: 50%;
  background: var(--fs-bg-primary);
  color: var(--fs-text-primary);
  font-size: 18px;
}

.wl .wl-step:disabled {
  opacity: 0.4;
}

.wl .wl-value {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0;
}

.wl .wl-input {
  /* 5.4ch: room for "181.7" — lb weights are nearly always three digits before the point. */
  width: 5.4ch;
  padding: 0;
  font-variant-numeric: tabular-nums;
  border: none;
  border-bottom: 2px solid var(--fs-border-default);
  background: none;
  font-size: 44px;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  color: var(--fs-text-primary);
}

.wl .wl-input:focus {
  outline: none;
  border-bottom-color: var(--fs-primary);
}

.wl .wl-unit {
  font-size: 17px;
  font-weight: 600;
  color: var(--fs-macro-kcal);
}

.wl .wl-hint {
  min-height: 18px;
  margin: 0;
  font-size: 13px;
  text-align: center;
  color: var(--fs-text-secondary);
}

.wl .wl-units {
  display: flex;
  align-self: center;
  padding: 3px;
  border-radius: var(--fs-radius-pill);
  background: var(--fs-bg-tertiary);
}

.wl .wl-unit-option {
  min-width: 64px;
  min-height: 44px;
  border: none;
  border-radius: var(--fs-radius-pill);
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--fs-macro-kcal);
}

.wl .wl-unit-option.wl-selected {
  background: var(--fs-bg-primary);
  color: var(--fs-text-primary);
  box-shadow: var(--fs-shadow-xs);
}

.wl .wl-tip {
  margin: 0;
  font-size: 13px;
  text-align: center;
  color: var(--fs-text-secondary);
}

.wl .wl-bodyfat-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  align-self: center;
  min-height: 44px;
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 600;
  color: var(--fs-macro-kcal);
}

.wl .wl-optional {
  font-weight: 400;
  color: var(--fs-text-secondary);
}

.wl .wl-bodyfat {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.wl .wl-bodyfat-label {
  font-size: 14px;
  font-weight: 600;
}

.wl .wl-bodyfat-field {
  display: flex;
  align-items: center;
  gap: 8px;
}

.wl .wl-bodyfat-input {
  flex: 1;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--fs-border-default);
  border-radius: var(--fs-radius-md);
  font-size: 16px;
}

.wl .wl-bodyfat-clear {
  width: 44px;
  height: 44px;
  border: none;
  background: none;
  color: var(--fs-text-secondary);
}

.wl .wl-error {
  margin: 0;
  font-size: 13px;
  text-align: center;
  color: var(--fs-macro-kcal);
}

.wl .wl-save {
  min-height: 52px;
  font-size: 17px;
  font-weight: 700;
}

@media (min-width: 576px) {
  .wl.wl-sheet-layer {
    align-items: center;
  }

  .wl .wl-sheet {
    max-width: 420px;
    border-radius: var(--fs-radius-xl);
  }
}

/* --- Toast: "Saved · 82.4 kg today · Undo" ------------------------------------ */

.wl.wl-toast {
  /* Inset on both sides, not left:50% + translate: that caps a shrink-to-fit box at half the
     screen, and at 360px "Saved · 82.4 kg today · Undo" wrapped with Undo alone on line two. */
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px));
  z-index: 1080;
  width: fit-content;
  max-width: 520px;
  margin-inline: auto;
  opacity: 0;
  pointer-events: none;
  transition: opacity 150ms ease;
}

.wl.wl-toast.wl-toast-active {
  padding: 0.6rem 1rem;
  border: 1px solid var(--fs-border-default);
  border-radius: var(--fs-radius-md);
  background: var(--fs-bg-primary);
  color: var(--fs-text-primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.15);
  opacity: 1;
  pointer-events: auto;
}
