/* ========================================
   Profit & Cost Calculator
   ======================================== */

.profit-calculator-page {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 24px 44px;
}

.profit-calculator-page__header {
  position: relative;
  overflow: hidden;
  margin-bottom: 22px;
  padding: 28px;
  border: 1px solid rgba(124, 58, 237, 0.16);
  border-radius: 22px;
  background:
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.14), transparent 34%),
    radial-gradient(circle at left center, rgba(124, 58, 237, 0.12), transparent 42%),
    var(--card-background, #fff);
}

.profit-calculator-page__heading {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  position: relative;
  z-index: 1;
}

.profit-calculator-page__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, #9333ea, #f97316);
  box-shadow: 0 12px 28px rgba(124, 58, 237, 0.28);
  color: #fff;
  font-size: 24px;
}

.profit-calculator-page h1,
.profit-calculator-page h2,
.profit-calculator-page p {
  margin-top: 0;
}

.profit-calculator-page__heading h1 {
  margin-bottom: 7px;
  font-size: clamp(26px, 4vw, 38px);
  line-height: 1.05;
}

.profit-calculator-page__heading p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted-foreground, #667085);
  line-height: 1.55;
}

.profit-calculator-section-label {
  margin-bottom: 5px;
  color: #8b5cf6;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.profit-calculator-product-picker,
.profit-calculator-card,
.profit-calculator-results {
  border: 1px solid rgba(17, 24, 39, 0.1);
  border-radius: 18px;
  background: var(--card-background, #fff);
  box-shadow: 0 12px 32px rgba(17, 24, 39, 0.045);
}

.profit-calculator-product-picker {
  margin-bottom: 22px;
  padding: 20px;
}

.profit-calculator-product-picker__top,
.profit-calculator-card__heading,
.profit-calculator-results__heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.profit-calculator-product-picker__top {
  margin-bottom: 16px;
}

.profit-calculator-product-picker h2,
.profit-calculator-card h2,
.profit-calculator-results h2 {
  margin-bottom: 0;
  font-size: 18px;
}

.profit-calculator-source-tabs {
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  padding: 5px;
  border-radius: 12px;
  background: rgba(148, 163, 184, 0.1);
}

.profit-calculator-source-tabs__button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--muted-foreground, #667085);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.18s ease;
}

.profit-calculator-source-tabs__button:hover {
  background: rgba(255, 255, 255, 0.75);
  color: var(--foreground, #111827);
}

.profit-calculator-source-tabs__button.is-active {
  border-color: rgba(124, 58, 237, 0.18);
  background: #fff;
  box-shadow: 0 2px 8px rgba(17, 24, 39, 0.08);
  color: #7c3aed;
}

.profit-calculator-source-tabs__button--search {
  margin-left: auto;
  color: #7c3aed;
}

.profit-calculator-picker-output {
  position: relative;
  margin-top: 15px;
}

.profit-calculator-empty-picker {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 88px;
  padding: 16px;
  border: 1px dashed rgba(17, 24, 39, 0.16);
  border-radius: 13px;
  color: var(--muted-foreground, #667085);
  font-size: 13px;
  text-align: center;
}

.profit-calculator-empty-picker i {
  margin-right: 8px;
}

.profit-calculator-empty-picker--error {
  color: #b42318;
}

.profit-calculator-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.84);
  backdrop-filter: blur(4px);
  color: #7c3aed;
  font-size: 13px;
  font-weight: 700;
}

.profit-calculator-product-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 10px;
  max-height: 340px;
  overflow: auto;
  padding: 2px;
}

.profit-calculator-product-list__item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(17, 24, 39, 0.09);
  border-radius: 12px;
  background: #fff;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: 0.18s ease;
}

.profit-calculator-product-list__item:hover {
  transform: translateY(-1px);
  border-color: rgba(124, 58, 237, 0.35);
  box-shadow: 0 9px 20px rgba(124, 58, 237, 0.09);
}

.profit-calculator-product-list__image {
  display: block;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 9px;
  object-fit: cover;
}

.profit-calculator-product-list__image--empty {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.13), rgba(249, 115, 22, 0.14));
  color: #7c3aed;
}

.profit-calculator-product-list__body {
  min-width: 0;
  flex: 1 1 auto;
}

.profit-calculator-product-list__body strong,
.profit-calculator-product-list__body small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profit-calculator-product-list__body strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.profit-calculator-product-list__body small {
  color: var(--muted-foreground, #667085);
  font-size: 11px;
}

.profit-calculator-product-list__item > i {
  color: #98a2b3;
  font-size: 12px;
}

.profit-calculator-selected-product {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 15px;
  padding: 11px;
  border: 1px solid rgba(124, 58, 237, 0.16);
  border-radius: 13px;
  background: linear-gradient(90deg, rgba(124, 58, 237, 0.07), rgba(249, 115, 22, 0.06));
}

.profit-calculator-selected-product[hidden] {
  display: none;
}

.profit-calculator-selected-product__image img,
.profit-calculator-selected-product__image {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  object-fit: cover;
}

.profit-calculator-selected-product__body {
  min-width: 0;
  flex: 1;
}

.profit-calculator-selected-product__eyebrow {
  margin-bottom: 3px;
  color: #7c3aed;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.profit-calculator-selected-product__name {
  overflow: hidden;
  color: var(--foreground, #111827);
  font-size: 14px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profit-calculator-selected-product__meta {
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted-foreground, #667085);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profit-calculator-selected-product__clear {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #667085;
  cursor: pointer;
}

.profit-calculator-selected-product__clear:hover {
  background: rgba(255, 255, 255, 0.7);
  color: #b42318;
}

.profit-calculator-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 22px;
}

.profit-calculator-mode__button {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 15px;
  border: 1px solid rgba(17, 24, 39, 0.11);
  border-radius: 15px;
  background: #fff;
  color: var(--foreground, #111827);
  text-align: left;
  cursor: pointer;
  transition: 0.18s ease;
}

.profit-calculator-mode__button > i {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 37px;
  height: 37px;
  border-radius: 11px;
  background: rgba(148, 163, 184, 0.11);
  color: #667085;
}

.profit-calculator-mode__button strong,
.profit-calculator-mode__button small {
  display: block;
}

.profit-calculator-mode__button strong {
  font-size: 14px;
}

.profit-calculator-mode__button small {
  margin-top: 3px;
  color: var(--muted-foreground, #667085);
  font-size: 11px;
}

.profit-calculator-mode__button.is-active {
  border-color: rgba(124, 58, 237, 0.42);
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.09), rgba(249, 115, 22, 0.07));
  box-shadow: 0 8px 22px rgba(124, 58, 237, 0.1);
}

.profit-calculator-mode__button.is-active > i {
  background: linear-gradient(135deg, #9333ea, #f97316);
  color: #fff;
}

.profit-calculator-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.8fr);
  gap: 22px;
  margin-bottom: 22px;
}

.profit-calculator-inputs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.profit-calculator-card {
  padding: 20px;
}

.profit-calculator-card__heading {
  justify-content: flex-start;
  margin-bottom: 18px;
}

.profit-calculator-card__heading > i {
  color: #8b5cf6;
}

.profit-calculator-fields {
  display: grid;
  gap: 15px;
}

.profit-calculator-field {
  display: grid;
  gap: 7px;
}

.profit-calculator-field > span {
  color: var(--foreground, #111827);
  font-size: 12px;
  font-weight: 700;
}

.profit-calculator-field input {
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(17, 24, 39, 0.14);
  border-radius: 9px;
  background: #fff;
  color: var(--foreground, #111827);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  outline: none;
}

.profit-calculator-field input:focus {
  border-color: rgba(124, 58, 237, 0.62);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1);
}

.profit-calculator-fee-notice {
  display: flex;
  gap: 8px;
  margin: -4px 0 15px;
  padding: 10px 11px;
  border: 1px solid rgba(124, 58, 237, 0.1);
  border-radius: 10px;
  background: rgba(124, 58, 237, 0.055);
  color: #667085;
  font-size: 12px;
  line-height: 1.4;
}

.profit-calculator-fee-notice > i {
  margin-top: 1px;
  color: #8b5cf6;
}

.profit-calculator-results {
  align-self: start;
  overflow: hidden;
  padding: 20px;
  background:
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.14), transparent 42%),
    radial-gradient(circle at bottom left, rgba(124, 58, 237, 0.12), transparent 52%),
    #fff;
}

.profit-calculator-results__heading {
  margin-bottom: 20px;
}

.profit-calculator-results__heading > i {
  color: #8b5cf6;
  font-size: 22px;
}

.profit-calculator-results__main {
  margin-bottom: 14px;
  padding: 19px;
  border: 1px solid rgba(34, 197, 94, 0.17);
  border-radius: 15px;
  background: rgba(34, 197, 94, 0.06);
}

.profit-calculator-results__main[data-pc-profit-state="negative"] {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.06);
}

.profit-calculator-results__label {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
}

.profit-calculator-results__profit {
  margin: 4px 0;
  color: #15803d;
  font-size: 34px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

[data-pc-profit-state="negative"] .profit-calculator-results__profit {
  color: #b42318;
}

.profit-calculator-results__status {
  color: #667085;
  font-size: 12px;
}

.profit-calculator-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.profit-calculator-metric {
  padding: 13px;
  border: 1px solid rgba(17, 24, 39, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.profit-calculator-metric span,
.profit-calculator-metric strong {
  display: block;
}

.profit-calculator-metric span {
  margin-bottom: 5px;
  color: #667085;
  font-size: 11px;
  font-weight: 700;
}

.profit-calculator-metric strong {
  color: var(--foreground, #111827);
  font-size: 17px;
}

.profit-calculator-breakdown__rows {
  max-width: 760px;
}

.profit-calculator-breakdown__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(17, 24, 39, 0.08);
  font-size: 14px;
}

.profit-calculator-breakdown__row > span {
  color: #667085;
}

.profit-calculator-breakdown__row > strong {
  color: var(--foreground, #111827);
}

.profit-calculator-breakdown__row--total {
  margin-top: 3px;
  border-bottom: 0;
  font-size: 16px;
  font-weight: 800;
}

.profit-calculator-breakdown__row--total > span,
.profit-calculator-breakdown__row--total > strong {
  color: var(--foreground, #111827);
}

.profit-calculator-breakdown__empty {
  padding: 12px 0;
  color: #667085;
  font-size: 14px;
}

@media (max-width: 1050px) {
  .profit-calculator-layout {
    grid-template-columns: 1fr;
  }

  .profit-calculator-results {
    align-self: stretch;
  }

  .profit-calculator-inputs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 700px) {
  .profit-calculator-page {
    padding: 18px 14px 34px;
  }

  .profit-calculator-page__header {
    padding: 20px;
  }

  .profit-calculator-page__heading {
    gap: 12px;
  }

  .profit-calculator-page__icon {
    width: 46px;
    height: 46px;
    flex-basis: 46px;
    border-radius: 13px;
    font-size: 19px;
  }

  .profit-calculator-product-picker__top {
    align-items: flex-start;
    flex-direction: column;
  }

  .profit-calculator-mode,
  .profit-calculator-inputs {
    grid-template-columns: 1fr;
  }

  .profit-calculator-source-tabs__button--search {
    margin-left: 0;
  }

  .profit-calculator-product-list {
    grid-template-columns: 1fr;
  }

  .profit-calculator-results__profit {
    font-size: 30px;
  }
}
