/**
 * Baby Growth Percentile Calculator — calculator section.
 * Shared below-section styles: height-predictor.css
 */

/* ==========================================================================
   Hero
   ========================================================================== */

.pregnancy-calendar.growth-percentile {
  --gpc-accent: #ff6ca0;
  display: flex;
  flex-direction: column;
  gap: 32px;
  margin: 0;
  padding: 24px 16px;
  padding-bottom: 24px;
  background-color: #fff;
  background-image: url('../../img/growth-percentile-calculator/growth-percentile-pink.svg');
  background-size: cover;
  background-position: center top;
  background-repeat: no-repeat;
}

.pregnancy-calendar.growth-percentile.is-sex-boy {
  --gpc-accent: #00a7e8;
  background-image: url('../../img/growth-percentile-calculator/growth-percentile-blue.svg');
}

@media (min-width: 992px) {
  body.mamaspedia-burger-desktop .growth-percentile-page .pregnancy-calendar-page__intro .container,
  body.mamaspedia-burger-desktop .growth-percentile-page .height-predictor-below .container {
    margin-left: max(var(--spacing-6), calc((100vw - var(--container-2xl)) / 2 - var(--spacing-24)));
    margin-right: auto;
  }
}

@media (min-width: 992px) {
  .pregnancy-calendar.growth-percentile {
    padding: 32px;
    border-radius: 16px;
  }
}

/* ==========================================================================
   Unit toggle — reuse height-predictor markup, GPC accent
   ========================================================================== */

.growth-percentile-page .height-predictor__units {
  border-color: var(--gpc-accent, #ff6ca0);
}

.growth-percentile-page .height-predictor__unit-btn {
  color: var(--gpc-accent, #ff6ca0);
}

.growth-percentile-page .height-predictor__unit-btn.is-active {
  background: var(--gpc-accent, #ff6ca0);
  color: #fff;
}

/* ==========================================================================
   Header
   ========================================================================== */

.gpc__header {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-bottom: 0;
}

@media (min-width: 992px) {
  .gpc__header {
    flex-direction: row;
    align-items: flex-start;
    justify-content: space-between;
    gap: 32px;
  }
}

.gpc__header-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gpc__header-heading {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.gpc__header-aside {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 100%;
}

@media (min-width: 992px) {
  .gpc__header-aside {
    justify-content: flex-end;
    width: auto;
    max-width: 300px;
    text-align: right;
  }
}

.gpc__badge {
  display: block;
  margin: 0;
  padding: 0;
  background: none;
  color: #303030;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 500;
  line-height: 14px;
}

.gpc__title {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 26px;
  font-weight: 500;
  line-height: 32px;
  color: #303030;
}

.gpc__subtitle {
  margin: 0;
  max-width: 640px;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 18px;
  color: #4d4d4d;
}

/* ==========================================================================
   Cards grid
   ========================================================================== */

.gpc__cards {
  display: grid;
  gap: 32px;
}

@media (min-width: 992px) {
  .gpc__cards {
    grid-template-columns: minmax(280px, 380px) 1fr;
    gap: 24px;
    align-items: stretch;
  }
}

/* ==========================================================================
   Form card
   ========================================================================== */

.gpc__form-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  padding: 32px;
  border-radius: 10px;
  background: #fff;
}

.gpc__form-title {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 22px;
  font-weight: 500;
  line-height: 22px;
  color: #303030;
}

.gpc__field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.gpc__label {
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 500;
  line-height: 26px;
  color: #303030;
}

.gpc__field-error {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 13px;
  line-height: 18px;
  color: #c0392b;
}

.gpc__date-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid rgba(77, 77, 77, 0.2);
  border-radius: 8px;
  background: #fff;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: #303030;
  outline: none;
}

.gpc__date-input::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}

.gpc__date-input:focus {
  border-color: rgba(80, 59, 104, 0.45);
}

.gpc__input-group {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 0 12px;
  min-height: 44px;
  border: 1px solid rgba(77, 77, 77, 0.2);
  border-radius: 8px;
  background: #fff;
}

.gpc__input {
  flex: 1;
  min-width: 0;
  padding: 10px 0;
  border: none;
  background: transparent;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: #303030;
  outline: none;
}

.gpc__unit-label {
  flex-shrink: 0;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: #4d4d4d;
}

.gpc__select {
  width: 100%;
  min-height: 44px;
  background-color: #fff;
  border: 1px solid var(--color-border);
  color: var(--color-text-muted);
}

.growth-percentile .custom-dropdown__trigger {
  height: auto;
  min-height: 44px;
  padding: 11px 14px;
  border: 1px solid rgba(77, 77, 77, 0.2);
  border-radius: 8px;
  background: transparent;
  color: #4d4d4d;
  gap: 8px;
}

.growth-percentile .custom-dropdown__trigger:hover,
.growth-percentile .custom-dropdown.is-open .custom-dropdown__trigger,
.growth-percentile .custom-dropdown.has-value .custom-dropdown__trigger {
  background: transparent;
  border-color: rgba(77, 77, 77, 0.2);
  color: #4d4d4d;
}

.growth-percentile .custom-dropdown__trigger:focus {
  border-color: rgba(77, 77, 77, 0.2);
  outline: none;
}

.growth-percentile .custom-dropdown__value {
  font-weight: 400;
  font-size: 16px;
  line-height: 22px;
  color: #4d4d4d;
}

.growth-percentile .custom-dropdown__arrow {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  margin: 0;
}

.growth-percentile .custom-dropdown__arrow svg {
  display: block;
  width: 24px;
  height: 24px;
}

.growth-percentile .custom-dropdown__arrow svg path {
  stroke: #4d4d4d;
}

.growth-percentile .custom-dropdown.has-value .custom-dropdown__arrow svg path {
  stroke: #4d4d4d;
}

.gpc__actions {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 6px;
}

.gpc__actions .pregnancy-calendar__submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 11px 24px;
  background-color: #60a54a;
  color: #fff;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 500;
  line-height: 16px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color 0.2s ease;
  margin-top: 0;
}

.gpc__actions .pregnancy-calendar__submit:hover {
  background-color: #559642;
}

.gpc__actions .pregnancy-calendar__clear {
  width: 100%;
  flex: 0 0 auto;
  border: 1px solid #b1a8f6;
  border-radius: 8px;
  color: var(--color-text);
}

.gpc__form-note {
  margin-top: 20px;
}

.gpc__form-note-title {
  margin: 0 0 10px;
  font-family: var(--font-primary);
  font-size: 22px;
  font-weight: 500;
  line-height: 22px;
  color: #303030;
}

.gpc__form-note-text {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: #4d4d4d;
}

.gpc__form-errors {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 12px;
  background: #fdecea;
  color: #c0392b;
  font-family: var(--font-primary);
  font-size: 14px;
  line-height: 1.4;
}

.gpc__form-errors p {
  margin: 0 0 4px;
}

.gpc__form-errors p:last-child {
  margin-bottom: 0;
}

/* Unit visibility */
.gpc__form-card[data-unit-system="metric"] .js-gpc-weight-imperial,
.gpc__form-card[data-unit-system="metric"] .js-gpc-length-imperial,
.gpc__form-card[data-unit-system="metric"] .js-gpc-head-imperial {
  display: none !important;
}

.gpc__form-card[data-unit-system="imperial"] .js-gpc-weight-metric,
.gpc__form-card[data-unit-system="imperial"] .js-gpc-length-metric,
.gpc__form-card[data-unit-system="imperial"] .js-gpc-head-metric {
  display: none !important;
}

/* ==========================================================================
   Result card
   ========================================================================== */

.gpc__result-card {
  display: flex;
  flex-direction: column;
  gap: 0;
  width: 100%;
  min-height: 100%;
  padding: 32px;
  border-radius: 10px;
  background: #fff;
}

.gpc__result-empty {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 14px;
  text-align: center;
}

.gpc__result-visual {
  display: flex;
  justify-content: center;
  margin: 0;
}

.gpc__result-visual img {
  display: block;
  width: min(100%, 280px);
  height: auto;
  object-fit: contain;
}

.gpc__result-heading,
.gpc__result-title {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 22px;
  font-weight: 500;
  line-height: 22px;
  color: #303030;
}

.gpc__result-lead,
.gpc__result-filled-lead {
  margin: 0;
  max-width: 420px;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: #4d4d4d;
}

.gpc__guide {
  width: 100%;
  margin-top: 6px;
  padding: 14px 32px;
  border: 1px solid #503b68;
  border-radius: 10px;
  background: #fff;
  text-align: center;
}

.gpc__guide-title {
  margin: 0 0 14px;
  font-family: var(--font-primary);
  font-size: 22px;
  font-weight: 500;
  line-height: 22px;
  color: #303030;
}

.gpc__guide-lead {
  max-width: 448px;
  margin: 0 auto 14px;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: #4d4d4d;
  text-align: center;
}

.gpc__guide-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.gpc__guide-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 9px 14px;
  border: 1px solid #4d4d4d33;
  border-radius: 8px;
  background: #fff;
  text-align: left;
}

.gpc__guide-range {
  flex-shrink: 0;
  min-width: 88px;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 26px;
  color: #6e4f95;
}

.gpc__guide-label {
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: #4d4d4d;
}

.gpc__guide-note {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 8px;
  margin: 0;
  font-family: var(--font-primary);
  font-size: 14px;
  font-weight: 400;
  line-height: 18px;
  color: #4d4d4d;
  text-align: left;
}

.gpc__guide-note-icon {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.gpc__result-filled {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 14px;
  text-align: center;
}

.gpc__age-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 24px 14px;
  border: 1px solid #dbdbdb;
  border-radius: 10px;
  background: #fff;
}

.gpc__age-key {
  font-family: var(--font-primary);
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #4d4d4d;
}

.gpc__age-value {
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #6e4f95;
  text-align: right;
}

.gpc__results-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gpc__metric-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  padding: 14px;
  border: 1px solid #503b68;
  border-radius: 10px;
  background: #fff;
  text-align: left;
}

.gpc__metric-icon {
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  object-fit: contain;
}

.gpc__metric-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.gpc__metric-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.gpc__metric-label {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 500;
  line-height: 26px;
  color: #4d4d4d;
  text-transform: uppercase;
}

.gpc__metric-pct {
  margin-left: 14px;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 600;
  line-height: 26px;
  color: #6e4f95;
}

.gpc__status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  max-width: 48%;
  padding: 5px 10px;
  border-radius: 10px;
  background: #60a54a33;
  color: #60a54a;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  text-align: center;
}

.gpc__metric-message {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: #4d4d4d;
}

.gpc__metric-message.js-gpc-msg-weight {
  max-width: 292px;
}

.gpc__metric-message.js-gpc-msg-length {
  max-width: 335px;
}

.gpc__metric-message.js-gpc-msg-head {
  max-width: 399px;
}

.gpc__result-footer {
  width: 100%;
  margin-top: 4px;
  text-align: center;
}

.gpc__result-footer-title {
  margin: 0 0 8px;
  font-family: var(--font-primary);
  font-size: 18px;
  font-weight: 600;
  line-height: 22px;
  color: #303030;
}

.gpc__result-disclaimer {
  margin: 0;
  font-family: var(--font-primary);
  font-size: 16px;
  font-weight: 400;
  line-height: 22px;
  color: #4d4d4d;
}

/* ==========================================================================
   Loading skeleton
   ========================================================================== */

@keyframes gpc-shimmer {
  0% {
    background-position: -468px 0;
  }

  100% {
    background-position: 468px 0;
  }
}

.gpc__loading {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  width: 100%;
  min-height: 280px;
}

.gpc__loading-bar {
  height: 18px;
  border-radius: 8px;
  background: linear-gradient(90deg, #ececec 0%, #f6f6f6 50%, #ececec 100%);
  background-size: 468px 100%;
  animation: gpc-shimmer 1.2s ease-in-out infinite;
}

.gpc__loading-bar--short {
  width: 60%;
  align-self: center;
}

.gpc__loading-bar--medium {
  width: 80%;
  align-self: center;
}

.gpc__loading-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid rgba(77, 77, 77, 0.12);
  border-radius: 10px;
}

.gpc__loading-row .gpc__loading-bar:last-child {
  width: 100%;
  align-self: stretch;
}

/* ==========================================================================
   Mobile & tablet (max-width 991px)
   ========================================================================== */

@media (max-width: 991px) {
  .gpc__cards {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .gpc__result-card {
    order: 1;
    min-height: 0;
    padding: 16px;
  }

  .gpc__form-card {
    order: 2;
    padding: 16px;
  }

  .growth-percentile-page .pregnancy-calendar-page__intro {
    padding-bottom: 0;
  }

  .pregnancy-calendar.growth-percentile {
    gap: 24px;
    padding: 20px 12px;
    border-radius: 12px;
  }

  .gpc__header {
    gap: 16px;
  }

  .gpc__header-aside {
    justify-content: flex-start;
  }

  .gpc__badge {
    font-size: 14px;
    line-height: 16px;
  }

  .gpc__title {
    font-size: 22px;
    line-height: 28px;
  }

  .gpc__subtitle {
    max-width: none;
    font-size: 14px;
    line-height: 20px;
  }

  .growth-percentile-page .height-predictor__units {
    width: auto;
    max-width: 320px;
  }

  .gpc__form-title {
    font-size: 18px;
    line-height: 22px;
  }

  .gpc__label {
    font-size: 14px;
    line-height: 22px;
  }

  .gpc__result-empty {
    min-height: 220px;
    gap: 12px;
  }

  .gpc__result-visual img {
    width: min(100%, 220px);
  }

  .gpc__result-heading {
    font-size: 20px;
  }

  .gpc__result-lead,
  .gpc__result-disclaimer {
    font-size: 14px;
    line-height: 20px;
  }

  .gpc__actions {
    gap: 12px;
  }

  .gpc__actions .pregnancy-calendar__submit,
  .gpc__actions .pregnancy-calendar__clear {
    height: 48px;
  }

  .gpc__loading {
    min-height: 220px;
  }

  .gpc__metric-top {
    flex-wrap: wrap;
  }

  .gpc__status-badge {
    max-width: 100%;
  }

  .gpc__guide-item {
    flex-wrap: wrap;
  }

  .growth-percentile-page .height-predictor-content p {
    line-height: 18px;
  }
}

/* ==========================================================================
   Small mobile (max-width 767px)
   ========================================================================== */

@media (max-width: 767px) {
  .growth-percentile-page .pregnancy-calendar-page__intro {
    padding-top: 16px;
  }

  .pregnancy-calendar.growth-percentile {
    padding: 16px;
    border-radius: 10px;
  }

  .gpc__metric-row {
    display: grid;
    grid-template-columns: 56px minmax(0, 1fr);
    column-gap: 14px;
    row-gap: 8px;
    align-items: start;
  }

  .gpc__metric-body {
    display: contents;
  }

  .gpc__metric-icon {
    grid-column: 1;
    grid-row: 1;
  }

  .gpc__metric-top {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .gpc__metric-message,
  .gpc__metric-message.js-gpc-msg-weight,
  .gpc__metric-message.js-gpc-msg-length,
  .gpc__metric-message.js-gpc-msg-head {
    grid-column: 1 / -1;
    grid-row: 2;
    max-width: none;
    width: 100%;
  }

  .gpc__guide-item {
    flex-wrap: nowrap;
    gap: 17px;
  }

  .gpc__guide-range {
    flex-shrink: 0;
    min-width: 0;
  }

  .gpc__guide-label {
    flex: 1;
    min-width: 0;
  }

  .gpc__guide-note {
    text-align: center;
  }
}
