/* Goals Styles */

.goals-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── List header: the running total across every goal ─────────────── */
.goals-total {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 1.375rem 1.5rem;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.goals-total__label {
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.goals-total__amount {
  margin-top: 0.25rem;
  font-size: var(--font-size-hero);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--text-dark);
  font-variant-numeric: tabular-nums;
}

.goals-total__side {
  flex-shrink: 0;
  text-align: right;
}

.goals-total__of,
.goals-total__count {
  font-size: var(--font-size-body);
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── Goal card: saved (bold) vs target, bar, rhythm + status ───────── */
.goal-card {
  display: block;
  padding: 1rem 1.125rem;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  text-decoration: none;
}

.goal-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.goal-card__name {
  min-width: 0;
  font-weight: var(--font-weight-semibold);
  color: var(--text-dark);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goal-card__amount {
  flex-shrink: 0;
  font-size: var(--font-size-title);
  font-weight: 700;
  color: var(--text-dark);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.goal-card__target {
  font-weight: var(--font-weight-regular);
  color: var(--text-muted);
}

.goal-card__bar {
  display: block;
  height: 6px;
  margin-top: 0.75rem;
  border-radius: var(--radius-full);
  background: var(--color-primary-20);
  overflow: hidden;
}

.goal-card__bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  transition: width 0.3s ease;
}

.goal-card__bar-fill--settled {
  background: var(--color-success);
}

.goal-card__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 0.7rem;
  font-size: var(--font-size-label);
  color: var(--text-muted);
}

.goal-card__rhythm {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.goal-card__pct {
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.goal-card__meta--muted {
  display: block;
  font-style: italic;
}

/* ── Status chip: tinted pill in the list, plain colour in the hero ── */
.goal-chip {
  flex-shrink: 0;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-semibold);
}

.goal-chip--on-track,
.goal-chip--reached {
  background: var(--color-success-20);
  color: var(--color-success-dark);
}

.goal-chip--behind {
  background: var(--color-warning-20);
  color: var(--color-warning-dark);
}

/* In the hero the status reads as plain coloured text, not a filled pill. */
.goal-hero__meta .goal-chip {
  padding: 0;
  background: transparent;
}

/* ── First-day empty state: a few starters ─────────────────────────── */
.goals-empty {
  padding-top: 0.5rem;
}

.goals-empty__title {
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-bold);
  color: var(--text-dark);
  text-align: center;
}

.goals-empty__lead {
  margin: 0.3rem 0 1.25rem;
  font-size: var(--font-size-body);
  color: var(--text-muted);
  text-align: center;
}

.goals-starters {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.goal-starter {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 1rem 1.125rem;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  text-decoration: none;
}

.goal-starter__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-full);
  background: var(--color-primary-20);
  color: var(--color-primary);
}

.goal-starter__icon svg {
  width: 1.25rem;
  height: 1.25rem;
}

.goal-starter__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.goal-starter__label {
  font-weight: var(--font-weight-semibold);
  color: var(--text-dark);
}

.goal-starter__hint {
  font-size: var(--font-size-label);
  color: var(--text-muted);
}

.goal-starter__chevron {
  flex-shrink: 0;
  color: var(--text-muted);
}

.goal-starter__chevron svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* ── All goals reached: a celebration in place of the total ────────── */
.goals-reached {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 1.75rem 1.5rem;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  text-align: center;
}

.goals-reached__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-full);
  background: var(--color-success-20);
  color: var(--color-success-dark);
}

.goals-reached__icon svg {
  width: 1.5rem;
  height: 1.5rem;
}

.goals-reached__title {
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-bold);
  color: var(--text-dark);
}

.goals-reached__message {
  font-size: var(--font-size-body);
  color: var(--text-muted);
}

/* ── Detail hero: saved vs target, bar, one-line verdict ───────────── */
.goal-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1.75rem 1.5rem;
  background: var(--bg-surface);
  border-radius: var(--radius-xl);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  text-align: center;
}

.goal-hero__amount {
  font-size: var(--font-size-hero);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  color: var(--color-primary);
  font-variant-numeric: tabular-nums;
}

.goal-hero__target,
.goal-hero__label {
  font-size: var(--font-size-body);
  color: var(--text-muted);
}

.goal-hero__bar {
  width: 100%;
  height: 8px;
  margin-top: 0.85rem;
  border-radius: var(--radius-full);
  background: var(--color-primary-20);
  overflow: hidden;
}

.goal-hero__bar-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  transition: width 0.3s ease;
}

.goal-hero__bar-fill--settled {
  background: var(--color-success);
}

.goal-hero__meta {
  margin-top: 0.65rem;
  font-size: var(--font-size-body);
  color: var(--text-muted);
}

/* ── Rhythm card: the monthly pace the deadline implies ────────────── */
.goal-rhythm {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  padding: 1.125rem 1.25rem;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.goal-rhythm__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: var(--radius-full);
  background: var(--color-primary-20);
  color: var(--color-primary);
}

.goal-rhythm__icon svg {
  width: 1.125rem;
  height: 1.125rem;
}

.goal-rhythm__monthly {
  font-size: var(--font-size-title);
  font-weight: 700;
  color: var(--text-dark);
}

.goal-rhythm__sub {
  margin-top: 0.15rem;
  font-size: var(--font-size-body);
  color: var(--text-muted);
}

/* Goal Form Styles */

.goal-form__container {
  display: flex;
  flex-direction: column;
  gap: 0.875rem;
}

.goal-form__container .form-field {
  margin-bottom: 0.5rem !important;
}

.goal-form__field {
  width: 100%;
}

.goal-form__actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-top: 1.25rem;
}

.goal-form__header {
  text-align: center;
}

.goal-form__title {
  font-size: var(--font-size-title);
  font-weight: var(--font-weight-bold);
  color: var(--text-dark);
}

.goal-form__subtitle {
  margin-top: 0.2rem;
  font-size: var(--font-size-body);
  color: var(--text-muted);
}

/* The deadline field, revealed when "A date" is chosen. */
.goal-form__date {
  margin-top: 0.625rem;
}

/* The live rhythm the deadline implies, under the pills. */
.goal-form__rhythm {
  margin-top: 0.625rem;
  font-size: var(--font-size-label);
  font-weight: var(--font-weight-medium);
  color: var(--color-primary);
}

/* Responsive - Tablet */
@media (max-width: 768px) {

  .goals-container,
  .goal-form-container,
  .goal-detail-container {
    max-width: 100%;
    padding: 1.5rem 1rem;
  }

  .goals-list {
    grid-template-columns: 1fr;
  }

  .goal-form__container {
    gap: 1.25rem;
  }
}

/* Responsive - Mobile */
@media (max-width: 640px) {
  .empty-state__icon {
    width: 3rem;
    height: 3rem;
  }

  .goal-form__container {
    gap: 1rem;
  }
}

/* Responsive - Small Mobile */
@media (max-width: 480px) {
  .goal-form__container {
    gap: 0.875rem;
  }
}
