@import url('../tokens.css');

.page--history {
  --homepage-shell-width: var(--jp-page-shell-width);
  --homepage-shell-inset: var(--jp-page-shell-inset);
  --history-side-sticky-top: 90px;
  --history-cue-blue: var(--home-accent-blue, rgb(74 101 133));
  background: var(--intent-surface-page);
  overflow-x: clip;
  padding-top: 63px;
}

.history-page.section {
  padding: 0 0 12px;
}

body.page--history .history-page > .container {
  width: var(--homepage-shell-width);
  max-width: var(--jp-page-shell-max, 1372px);
  margin: 0 auto;
  padding-inline: var(--homepage-shell-inset);
  box-sizing: border-box;
}

@media (max-width: 1142px) {
  .page--history {
    --homepage-shell-width: var(--jp-page-shell-width);
    --homepage-shell-inset: var(--jp-page-shell-inset);
  }
}

@media (max-width: 760px) {
  .page--history {
    --homepage-shell-width: var(--jp-page-shell-width);
    --homepage-shell-inset: var(--jp-page-shell-inset);
  }
}

.history-page__intro {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin: 0 0 18px;
  padding: 30px 0 8px;
  text-align: left;
  color: var(--intent-text-primary);
}

.history-page__intro-main {
  min-width: 0;
}

.history-page__title {
  font-family: var(--font-display);
  font-size: 40px;
  line-height: 1.05;
  letter-spacing: 0;
  color: var(--color-ink);
  margin: 0 0 8px;
  font-weight: 650;
}

.history-page__lead {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 650;
  line-height: 1.3;
  color: var(--intent-text-primary);
  margin: 0;
  max-width: 660px;
}

.history-page__layout {
  display: grid;
  grid-template-columns: minmax(0, calc(100% - 344px)) minmax(286px, 300px);
  gap: 44px;
  align-items: start;
}

.history-page__main {
  min-width: 0;
}

.history-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 4px 0 14px;
  border-bottom: 1px solid var(--intent-surface-line);
}

.history-toolbar__heading {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--intent-text-primary);
}

.history-toolbar__count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 26px;
  height: 26px;
  padding: 0 9px;
  border-radius: var(--radius-pill, 999px);
  background: var(--intent-surface-sunken);
  color: var(--intent-text-primary);
  font-size: 13px;
  font-weight: 600;
}

.history-side-panel {
  position: sticky;
  top: var(--history-side-sticky-top);
  align-self: start;
  display: grid;
  gap: 22px;
  width: 100%;
  padding-top: 0;
}

.history-search {
  position: static !important;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 5px 14px 5px 11px;
  border: 1px solid var(--popup-control-border);
  border-radius: var(--radius-pill, 999px);
  background: var(--intent-surface-page);
  box-shadow: none;
  overflow: hidden;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

.history-search:hover {
  border-color: var(--intent-brand-primary);
}

.history-search:focus-within {
  border-color: var(--intent-brand-primary);
  box-shadow:
    0 0 0 3px var(--color-ai-glow),
    inset 0 0 0 1px var(--intent-brand-primary);
}

.history-search__icon {
  width: 28px;
  height: 28px;
  display: block;
  object-fit: contain;
  flex: 0 0 28px;
}

.history-search__input {
  width: 100%;
  min-width: 0;
  border: 0 !important;
  border-radius: 0;
  background: transparent !important;
  color: var(--intent-text-primary);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  outline: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
  -webkit-appearance: none;
  appearance: none;
}

.history-search__input:focus,
.history-search__input:focus-visible {
  border: 0 !important;
  outline: 0 !important;
  box-shadow: none !important;
}

.history-search__input::-webkit-search-decoration,
.history-search__input::-webkit-search-cancel-button,
.history-search__input::-webkit-search-results-button,
.history-search__input::-webkit-search-results-decoration {
  display: none;
  -webkit-appearance: none;
}

.history-search__input::placeholder {
  color: var(--intent-text-secondary);
  opacity: 0.78;
}

.history-actions {
  position: static !important;
  display: grid;
  gap: 8px;
}

.history-action {
  min-height: 44px;
  padding: 0 10px;
  border: 0;
  background: transparent;
  color: var(--intent-text-primary);
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
  text-align: left;
  cursor: pointer;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.15;
  text-decoration: none;
  border-radius: 18px;
  transition: background-color 0.18s ease, color 0.18s ease;
}

.history-action:hover,
.history-action:focus-visible {
  color: var(--intent-text-primary);
  background: var(--popup-hover);
}

.history-action:disabled,
.history-action[aria-disabled="true"] {
  cursor: default;
  opacity: 0.52;
}

.history-action:disabled:hover,
.history-action[aria-disabled="true"]:hover {
  background: transparent;
}

.history-action:focus-visible {
  outline: 2px solid var(--intent-brand-primary);
  outline-offset: 2px;
}

.history-action__icon {
  width: 21px;
  height: 21px;
  display: block;
  background: currentColor;
  -webkit-mask: var(--history-action-icon) center / contain no-repeat;
  mask: var(--history-action-icon) center / contain no-repeat;
}

.history-action__icon--trash {
  --history-action-icon: url("../../assets/gift-room-icons/trash.svg");
}

.history-action__icon--pause {
  --history-action-icon: url("../../assets/header-icons/history-pause.svg");
}

.history-action__icon--play {
  --history-action-icon: url("../../assets/header-icons/history-play.svg");
}

.history-action__icon--settings {
  --history-action-icon: url("../../assets/header-account-menu-icons/settings.svg");
}

.history-section--products {
  padding-top: 28px;
}

.history-section--products .cards-grid {
  margin-top: 0;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-items: start;
}

.history-section--products .cards-grid[hidden],
.history-empty[hidden],
.history-no-results[hidden] {
  display: none !important;
}

.history-section--products .cat-card[data-product-card] {
  --cat-card-height: 482px;
  width: 100%;
  max-width: 325px;
  aspect-ratio: 325 / 482;
}

.history-section--products .cat-card--history-facts {
  --cat-card-height: 500px;
  aspect-ratio: 325 / 500;
}

.history-section--products .cat-card--history-facts-one:not([data-product-source="jedipic"]) {
  --cat-card-height: 482px;
  aspect-ratio: 325 / 482;
}

.history-section--products .cat-card--history-facts[data-product-source="jedipic"] {
  --cat-card-height: 522px;
  aspect-ratio: 325 / 522;
}

body.page--history.is-native-checkout-closed .history-section--products .cat-card[data-product-source="jedipic"] .cat-card__cart {
  display: inline-flex !important;
}

.history-section--products .history-card__commerce-facts {
  position: absolute;
  left: calc(9 * var(--cat-card-unit-x));
  right: calc(9 * var(--cat-card-unit-x));
  top: calc((428 * var(--cat-card-unit-y)) + var(--cat-card-content-shift));
  z-index: 3;
  display: grid;
  justify-items: start;
  gap: calc(5 * var(--cat-card-unit-y));
  color: var(--intent-text-primary);
  font-family: var(--font-heading);
  font-size: clamp(11px, calc(13 * var(--cat-card-unit-x)), 13px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0;
  overflow: hidden;
}

.history-section--products .cat-card--no-service .history-card__commerce-facts {
  top: calc((402 * var(--cat-card-unit-y)) + var(--cat-card-content-shift));
}

.history-section--products .history-card__commerce-fact {
  min-width: 0;
  max-width: 100%;
  min-height: calc(26 * var(--cat-card-unit-y));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-pill, 999px);
  padding: calc(5 * var(--cat-card-unit-y)) calc(9 * var(--cat-card-unit-x));
  background: color-mix(in srgb, var(--intent-text-secondary) 18%, var(--intent-surface-raised));
  color: var(--intent-text-primary);
  box-sizing: border-box;
  white-space: nowrap;
}

.history-section--products .history-card__commerce-fact--urgency,
.history-section--products .history-card__commerce-fact--delivery {
  background: color-mix(in srgb, var(--intent-feedback-warning) 40%, var(--color-white));
  color: var(--intent-text-primary);
}

.history-section--products .history-card__commerce-fact--activity {
  background: color-mix(in srgb, var(--history-cue-blue) 62%, var(--color-white));
  color: var(--color-white);
}

.history-section--products .history-card__commerce-fact--shipping,
.history-section--products .history-card__commerce-fact--digital {
  background: color-mix(in srgb, var(--intent-brand-primary) 16%, var(--intent-surface-raised));
  color: var(--intent-brand-primary-strong);
}

.history-section--products .history-card__commerce-fact--popular {
  background: color-mix(in srgb, var(--intent-brand-primary) 20%, var(--intent-surface-raised));
  color: var(--intent-cta-ink);
}

.history-section--products .history-card__commerce-fact--occasion {
  background: color-mix(in srgb, var(--intent-feedback-alert-soft) 70%, var(--color-white));
  color: var(--intent-text-primary);
}

.history-section--products .history-card__commerce-fact--baby {
  background: color-mix(in srgb, var(--intent-feedback-warning-soft) 80%, var(--color-white));
  color: var(--intent-text-primary);
}

.history-section--products .history-card__commerce-fact--personal {
  background: color-mix(in srgb, var(--intent-brand-primary) 24%, var(--color-white));
  color: var(--intent-text-primary);
}

.history-section--products .history-card__commerce-fact--quick {
  background: color-mix(in srgb, var(--history-cue-blue) 24%, var(--color-white));
  color: var(--intent-text-primary);
}

.history-section--products .history-card__commerce-fact--home {
  background: color-mix(in srgb, var(--color-sand-dark) 78%, var(--color-white));
  color: var(--intent-text-primary);
}

.history-section--products .history-card__commerce-fact--returns,
.history-section--products .history-card__commerce-fact--options,
.history-section--products .history-card__commerce-fact--context,
.history-section--products .history-card__commerce-fact--status,
.history-section--products .history-card__commerce-fact--neutral {
  background: color-mix(in srgb, var(--intent-text-secondary) 30%, var(--color-white));
  color: var(--intent-text-primary);
}

.history-section--products .history-card__commerce-fact span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-empty {
  max-width: 640px;
  gap: 12px;
}

.history-empty__art {
  display: block;
  width: min(420px, 54vw);
  max-width: 100%;
  height: auto;
  margin: 0 auto 8px;
}

.history-empty .favorites-empty__cta {
  border-radius: var(--radius-pill, 999px);
}

@media (max-width: 640px) {
  .history-empty__art {
    width: min(280px, 78vw);
  }
}

.history-clear-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: grid;
  place-items: center;
  padding: 20px;
  background: color-mix(in srgb, var(--intent-text-primary) 28%, transparent);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

body.history-clear-modal-open {
  overflow: hidden;
}

.history-clear-modal-overlay[hidden] {
  display: none;
}

.history-clear-modal-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.history-clear-modal-shell {
  width: min(390px, 100%);
}

.history-clear-modal {
  position: relative;
  display: grid;
  gap: 14px;
  width: 100%;
  padding: 23px 24px 22px;
  border: 1px solid var(--intent-surface-line);
  border-radius: 24px;
  background: var(--intent-surface-raised);
  box-shadow: var(--popup-shadow);
  color: var(--intent-text-primary);
  transform: translateY(10px) scale(0.98);
  transition: transform 0.18s ease;
}

.history-clear-modal-overlay.is-open .history-clear-modal {
  transform: translateY(0) scale(1);
}

.history-clear-modal:focus {
  outline: 0;
}

.history-clear-modal__head {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.history-clear-modal__icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-pill, 999px);
  background: transparent;
  color: var(--intent-text-primary);
  flex: 0 0 44px;
  pointer-events: none;
}

.history-clear-modal__icon .history-action__icon {
  width: 22px;
  height: 22px;
}

.history-clear-modal__title {
  margin: 0;
  font-family: var(--popup-title-font, var(--font-display));
  font-size: var(--popup-title-size, 25px);
  font-weight: var(--popup-title-weight, 600);
  line-height: var(--popup-title-line-height, 1.16);
  letter-spacing: var(--popup-title-letter-spacing, 0);
  color: var(--intent-text-primary);
  min-width: 0;
}

.history-clear-modal__copy {
  margin: 0;
  color: var(--intent-text-secondary);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.35;
}

.history-clear-modal__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 2px;
}

.history-clear-modal__button {
  position: relative;
  isolation: isolate;
  min-height: 46px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius-pill, 999px);
  background: transparent;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 0;
  cursor: pointer;
  transform: none;
  box-shadow: none;
}

.history-clear-modal__button::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  background: var(--history-clear-modal-button-bg, transparent);
  transform: scale(1);
  transform-origin: center;
  transition: transform 0.18s ease;
  will-change: transform;
}

.history-clear-modal__button--secondary {
  --history-clear-modal-button-bg: var(--intent-surface-raised);
  min-width: 142px;
  color: var(--intent-text-primary);
}

.history-clear-modal__button--primary {
  --history-clear-modal-button-bg: var(--intent-text-primary);
  min-width: 172px;
  color: var(--intent-brand-on);
}

.history-clear-modal__button--secondary:hover,
.history-clear-modal__button--secondary:focus-visible {
  box-shadow: var(--shadow-card-hover);
}

.history-clear-modal__button--primary:hover::before,
.history-clear-modal__button--primary:focus-visible::before {
  transform: scale(var(--hover-grow-scale));
}

.history-no-results {
  margin: 34px 0 50px;
  color: var(--intent-text-secondary);
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
}

@media (max-width: 1180px) {
  .history-page__layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 22px;
  }

  .history-side-panel {
    order: -1;
    padding-top: 0;
  }

  .history-actions {
    gap: 8px;
  }
}

@media (max-width: 951px) {
  .page--history {
    --history-side-sticky-top: 106px;
    padding-top: 89px;
  }
}

@media (max-width: 760px) {
  .history-side-panel {
    position: static;
    top: auto;
  }

  .history-page__title {
    font-size: 32px;
  }

  .history-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .history-section--products .cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .history-section--products .history-card__commerce-facts {
    top: calc(
      (466 * var(--cat-card-unit-y)) +
      var(--cat-card-content-shift) -
      var(--cat-card-title-lift, 0px)
    );
    gap: calc(4 * var(--cat-card-unit-y));
    font-size: calc(12px * var(--cat-card-mobile-readable, 1));
  }

  .history-section--products .cat-card--no-service .history-card__commerce-facts {
    top: calc(
      (444 * var(--cat-card-unit-y)) +
      var(--cat-card-content-shift) -
      var(--cat-card-title-lift, 0px)
    );
  }

  .history-section--products .history-card__commerce-fact {
    min-height: calc(24px * var(--cat-card-mobile-readable, 1));
    padding: calc(5px * var(--cat-card-mobile-readable, 1)) calc(8px * var(--cat-card-mobile-readable, 1));
  }

  .history-actions {
    grid-template-columns: minmax(0, 1fr);
  }

  .history-search {
    min-height: 48px;
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .history-search__input {
    font-size: 16px;
  }

  .history-clear-modal-overlay {
    align-items: end;
    padding: 16px 10px calc(16px + env(safe-area-inset-bottom, 0px));
  }

  .history-clear-modal-shell {
    width: 100%;
  }

  .history-clear-modal {
    gap: 13px;
    padding: 20px 18px 18px;
    border-radius: 22px;
  }

  .history-clear-modal__title {
    font-size: var(--popup-title-size, 25px);
    line-height: var(--popup-title-line-height, 1.16);
  }

  .history-clear-modal__copy {
    font-size: 14px;
  }

  .history-clear-modal__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .history-clear-modal__button {
    min-width: 0;
    min-height: 44px;
    padding-inline: 12px;
    font-size: 14px;
  }
}

@media (max-width: 720px) {
  .page--history {
    padding-top: 68px;
  }
}

@media (max-width: 360px) {
  .history-section--products .history-card__commerce-facts {
    left: calc(5 * var(--cat-card-unit-x));
    right: calc(5 * var(--cat-card-unit-x));
    font-size: calc(11px * var(--cat-card-mobile-readable, 1));
  }

  .history-section--products .history-card__commerce-fact {
    padding: calc(4px * var(--cat-card-mobile-readable, 1)) calc(6px * var(--cat-card-mobile-readable, 1));
  }
}

body.page--history .history-clear-modal-overlay.is-open {
  opacity: 1 !important;
}
