/* Koszyk page styles — scoped to .koszyk-main and page-owned components */

.koszyk-main {
  display: block;
  width: 100%;
}

.koszyk-page-container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--container-padding-mobile);
  padding-block: var(--section-padding-mobile);
}

.koszyk-page-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-block-end: var(--space-6);
}

.koszyk-page-title {
  font-size: var(--text-h1);
  line-height: var(--leading-h1);
  margin-block-end: 0;
}

.koszyk-page-lead {
  font-size: var(--text-body-large);
  line-height: var(--leading-body);
  color: var(--color-charcoal);
  margin-block-end: 0;
}

.koszyk-cart-mount {
  display: block;
  width: 100%;
}

/* Cart layout template */
.koszyk-cart-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
}

.koszyk-cart-lines-wrapper {
  min-width: 0;
}

.koszyk-cart-lines {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.koszyk-cart-summary-panel {
  background-color: var(--color-soft-white);
  border: var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

.koszyk-cart-summary-title {
  font-size: var(--text-h3);
  line-height: var(--leading-h3);
  margin-block-end: 0;
}

.koszyk-cart-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block-start: var(--space-4);
  border-block-start: var(--border-subtle);
}

.koszyk-cart-total-label {
  font-weight: var(--weight-h4);
  font-size: var(--text-body);
}

.koszyk-cart-total-value {
  font-family: var(--font-heading);
  font-size: var(--text-h3);
  line-height: var(--leading-h3);
  font-weight: var(--weight-heading);
  color: var(--color-charcoal);
}

.koszyk-cart-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: stretch;
}

.koszyk-cart-continue-link,
.koszyk-empty-cart-link,
.koszyk-checkout-confirmation-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: var(--weight-h4);
  font-size: var(--text-body);
  line-height: 1.2;
  padding: var(--button-padding-y) var(--button-padding-x);
  border-radius: var(--button-radius);
  border: 1px solid var(--color-deep-blue);
  background-color: transparent;
  color: var(--color-deep-blue);
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
  white-space: nowrap;
  max-width: 100%;
}

.koszyk-cart-continue-link:hover,
.koszyk-empty-cart-link:hover,
.koszyk-checkout-confirmation-link:hover {
  background-color: rgba(58, 90, 120, 0.08);
  text-decoration: none;
}

.koszyk-cart-checkout-button,
.koszyk-checkout-review-button,
.koszyk-checkout-confirm-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: var(--weight-h4);
  font-size: var(--text-body);
  line-height: 1.2;
  padding: var(--button-padding-y) var(--button-padding-x);
  border-radius: var(--button-radius);
  border: 1px solid var(--color-deep-blue);
  background-color: var(--color-deep-blue);
  color: var(--color-soft-white);
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
  max-width: 100%;
}

.koszyk-cart-checkout-button:hover,
.koszyk-checkout-review-button:hover,
.koszyk-checkout-confirm-button:hover {
  background-color: #2E4A60;
  border-color: #2E4A60;
}

.koszyk-cart-checkout-host {
  display: block;
  min-width: 0;
}

/* Empty cart template */
.koszyk-empty-cart {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-5);
  background-color: var(--color-soft-white);
  border: var(--border-subtle);
  border-radius: var(--radius-card);
  min-width: 0;
}

.koszyk-empty-cart-icon {
  color: var(--color-deep-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.koszyk-empty-cart-title {
  font-size: var(--text-h2);
  line-height: var(--leading-h2);
  margin-block-end: 0;
}

.koszyk-empty-cart-message {
  font-size: var(--text-body);
  line-height: var(--leading-body);
  margin-block-end: 0;
  max-width: 32rem;
}

.koszyk-empty-cart-link {
  margin-block-start: var(--space-2);
}

/* Cart line template */
.koszyk-cart-line {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: var(--space-4);
  background-color: var(--color-soft-white);
  border: var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-4);
  min-width: 0;
  align-items: start;
}

.koszyk-cart-line-image-wrap {
  width: 96px;
  height: 96px;
  border-radius: var(--radius-small);
  overflow: hidden;
  background-color: var(--color-cloud-grey);
  display: flex;
  align-items: center;
  justify-content: center;
}

.koszyk-cart-line-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius-small);
  display: block;
}

.koszyk-cart-line-details {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.koszyk-cart-line-name {
  font-size: var(--text-h4);
  line-height: var(--leading-h4);
  margin-block-end: 0;
  overflow-wrap: anywhere;
}

.koszyk-cart-line-variant {
  font-size: var(--text-small);
  line-height: var(--leading-small);
  color: var(--color-charcoal);
  margin-block-end: 0;
  overflow-wrap: anywhere;
}

.koszyk-cart-line-unit-price-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: baseline;
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

.koszyk-cart-line-unit-price-label {
  color: var(--color-charcoal);
}

.koszyk-cart-line-unit-price {
  font-weight: var(--weight-h4);
  color: var(--color-charcoal);
}

.koszyk-cart-line-controls {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding-block-start: var(--space-3);
  border-block-start: var(--border-subtle);
  min-width: 0;
}

.koszyk-cart-line-quantity {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.koszyk-cart-line-quantity-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-small);
  border: 1px solid var(--color-cloud-grey);
  background-color: var(--color-cloud-grey);
  color: var(--color-charcoal);
  font-size: var(--text-body-large);
  line-height: 1;
  transition: background-color var(--transition-fast), border-color var(--transition-fast);
  flex-shrink: 0;
}

.koszyk-cart-line-quantity-button:hover {
  background-color: var(--color-pale-blue);
  border-color: var(--color-pale-blue);
}

.koszyk-cart-line-quantity-input {
  width: 64px;
  text-align: center;
  padding: var(--space-2) var(--space-2);
  -moz-appearance: textfield;
  appearance: textfield;
}

.koszyk-cart-line-quantity-input::-webkit-outer-spin-button,
.koszyk-cart-line-quantity-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.koszyk-cart-line-subtotal-row {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  font-size: var(--text-small);
  line-height: var(--leading-small);
}

.koszyk-cart-line-subtotal-label {
  color: var(--color-charcoal);
}

.koszyk-cart-line-subtotal {
  font-weight: var(--weight-h4);
  color: var(--color-charcoal);
}

.koszyk-cart-line-remove {
  font-family: var(--font-body);
  font-weight: var(--weight-h4);
  font-size: var(--text-small);
  line-height: var(--leading-small);
  color: var(--color-deep-blue);
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color var(--transition-fast), color var(--transition-fast);
  padding: var(--space-2);
  border-radius: var(--radius-small);
}

.koszyk-cart-line-remove:hover {
  text-decoration-color: var(--color-deep-blue);
  color: #2E4A60;
}

/* Checkout template */
.koszyk-checkout {
  display: block;
  width: 100%;
  min-width: 0;
}

.koszyk-checkout-header {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-block-end: var(--space-5);
}

.koszyk-checkout-title {
  font-size: var(--text-h2);
  line-height: var(--leading-h2);
  margin-block-end: 0;
}

.koszyk-checkout-lead {
  font-size: var(--text-body);
  line-height: var(--leading-body);
  margin-block-end: 0;
}

.koszyk-checkout-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-6);
  align-items: start;
  min-width: 0;
}

.koszyk-checkout-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  min-width: 0;
}

.koszyk-checkout-fieldset {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  border: var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  margin-block-end: 0;
  min-width: 0;
}

.koszyk-checkout-legend {
  font-family: var(--font-body);
  font-weight: var(--weight-h4);
  font-size: var(--text-body);
  color: var(--color-charcoal);
  padding-inline: var(--space-2);
}

.koszyk-checkout-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.koszyk-checkout-field label {
  margin-block-end: 0;
}

.koszyk-checkout-field input,
.koszyk-checkout-field select,
.koszyk-checkout-field textarea {
  width: 100%;
  min-width: 0;
}

.koszyk-checkout-method-description {
  font-size: var(--text-small);
  line-height: var(--leading-small);
  color: var(--color-charcoal);
  margin-block-end: 0;
}

.koszyk-checkout-consent {
  min-width: 0;
}

.koszyk-checkout-consent-label {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  font-size: var(--text-small);
  line-height: var(--leading-small);
  color: var(--color-charcoal);
  cursor: pointer;
  margin-block-end: 0;
}

.koszyk-checkout-consent-label input {
  width: auto;
  flex-shrink: 0;
  margin-block-start: 0.2rem;
}

.koszyk-checkout-demo-notice {
  font-size: var(--text-small);
  line-height: var(--leading-small);
  color: var(--color-charcoal);
  background-color: var(--color-pale-blue);
  border-radius: var(--radius-small);
  padding: var(--space-3) var(--space-4);
  margin-block-end: 0;
}

.koszyk-checkout-form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  align-items: center;
  justify-content: flex-end;
  min-width: 0;
}

.koszyk-checkout-back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  font-family: var(--font-body);
  font-weight: var(--weight-h4);
  font-size: var(--text-body);
  line-height: 1.2;
  padding: var(--button-padding-y) var(--button-padding-x);
  border-radius: var(--button-radius);
  border: 1px solid var(--color-deep-blue);
  background-color: transparent;
  color: var(--color-deep-blue);
  transition: background-color var(--transition-fast);
  white-space: nowrap;
  max-width: 100%;
}

.koszyk-checkout-back-button:hover {
  background-color: rgba(58, 90, 120, 0.08);
}

.koszyk-checkout-summary {
  background-color: var(--color-soft-white);
  border: var(--border-subtle);
  border-radius: var(--radius-card);
  padding: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.koszyk-checkout-summary-title {
  font-size: var(--text-h3);
  line-height: var(--leading-h3);
  margin-block-end: 0;
}

.koszyk-checkout-summary-contact {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.koszyk-checkout-summary-line {
  font-size: var(--text-small);
  line-height: var(--leading-small);
  margin-block-end: 0;
  overflow-wrap: anywhere;
}

.koszyk-checkout-summary-address {
  display: flex;
  flex-wrap: wrap;
  gap: 0 var(--space-2);
  font-size: var(--text-small);
  line-height: var(--leading-small);
  margin-block-end: 0;
  overflow-wrap: anywhere;
}

.koszyk-checkout-summary-methods {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
}

.koszyk-checkout-summary-label {
  font-weight: var(--weight-h4);
}

.koszyk-checkout-review-lines {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  min-width: 0;
}

.koszyk-review-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2) var(--space-4);
  padding-block: var(--space-3);
  border-block-end: var(--border-subtle);
  min-width: 0;
  align-items: baseline;
}

.koszyk-review-line:last-child {
  border-block-end: none;
}

.koszyk-review-line-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.koszyk-review-line-name {
  font-size: var(--text-body);
  line-height: var(--leading-body);
  font-weight: var(--weight-h4);
  margin-block-end: 0;
  overflow-wrap: anywhere;
}

.koszyk-review-line-variant {
  font-size: var(--text-small);
  line-height: var(--leading-small);
  margin-block-end: 0;
  overflow-wrap: anywhere;
}

.koszyk-review-line-quantity {
  font-size: var(--text-small);
  line-height: var(--leading-small);
  margin-block-end: 0;
  white-space: nowrap;
}

.koszyk-review-line-subtotal {
  font-size: var(--text-small);
  line-height: var(--leading-small);
  font-weight: var(--weight-h4);
  margin-block-end: 0;
  white-space: nowrap;
}

.koszyk-checkout-summary-totals {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding-block-start: var(--space-4);
  border-block-start: var(--border-subtle);
  min-width: 0;
}

.koszyk-checkout-summary-total-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  margin-block-end: 0;
}

.koszyk-checkout-summary-total-row--grand {
  font-weight: var(--weight-h4);
  font-size: var(--text-body-large);
  line-height: var(--leading-body);
  padding-block-start: var(--space-3);
  border-block-start: var(--border-subtle);
}

.koszyk-checkout-confirm-button {
  width: 100%;
  margin-block-start: var(--space-2);
}

.koszyk-checkout-confirmation {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: var(--space-4);
  padding: var(--space-8) var(--space-5);
  background-color: var(--color-soft-white);
  border: var(--border-subtle);
  border-radius: var(--radius-card);
  min-width: 0;
}

.koszyk-checkout-confirmation-icon {
  color: var(--color-deep-blue);
  display: flex;
  align-items: center;
  justify-content: center;
}

.koszyk-checkout-confirmation-title {
  font-size: var(--text-h2);
  line-height: var(--leading-h2);
  margin-block-end: 0;
}

.koszyk-checkout-confirmation-message {
  font-size: var(--text-body);
  line-height: var(--leading-body);
  margin-block-end: 0;
  max-width: 32rem;
}

.koszyk-checkout-confirmation-order {
  font-size: var(--text-body);
  line-height: var(--leading-body);
  margin-block-end: 0;
}

.koszyk-checkout-confirmation-totals {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  width: 100%;
  max-width: 28rem;
  margin-inline: auto;
  padding-block-start: var(--space-4);
  border-block-start: var(--border-subtle);
  min-width: 0;
}

.koszyk-checkout-confirmation-methods {
  font-size: var(--text-small);
  line-height: var(--leading-small);
  margin-block-end: 0;
}

.koszyk-checkout-confirmation-link {
  margin-block-start: var(--space-2);
}

/* Responsive */
@media (min-width: 768px) {
  .koszyk-page-container {
    padding-inline: var(--container-padding-desktop);
    padding-block: var(--section-padding-desktop);
  }

  .koszyk-cart-layout {
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: var(--space-6);
  }

  .koszyk-cart-line {
    grid-template-columns: 112px minmax(0, 1fr);
    gap: var(--space-5);
  }

  .koszyk-cart-line-image-wrap {
    width: 112px;
    height: 112px;
  }

  .koszyk-cart-line-controls {
    grid-column: 2;
    justify-content: flex-start;
    gap: var(--space-6);
  }

  .koszyk-checkout-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: var(--space-6);
  }

  .koszyk-checkout-fieldset {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-4);
  }

  .koszyk-checkout-field--wide {
    grid-column: 1 / -1;
  }
}

@media (min-width: 1024px) {
  .koszyk-cart-layout {
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: var(--space-8);
  }

  .koszyk-checkout-layout {
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: var(--space-8);
  }
}

@media (max-width: 767px) {
  .koszyk-page-container {
    padding-block: var(--section-padding-mobile);
  }

  .koszyk-cart-line {
    grid-template-columns: 80px minmax(0, 1fr);
    gap: var(--space-3);
    padding: var(--space-3);
  }

  .koszyk-cart-line-image-wrap {
    width: 80px;
    height: 80px;
  }

  .koszyk-cart-line-controls {
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
  }

  .koszyk-cart-line-quantity {
    justify-content: space-between;
  }

  .koszyk-cart-line-subtotal-row {
    justify-content: space-between;
  }

  .koszyk-cart-line-remove {
    align-self: flex-start;
  }

  .koszyk-checkout-form-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .koszyk-checkout-form-actions > * {
    width: 100%;
  }

  .koszyk-review-line {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-1);
  }

  .koszyk-review-line-quantity,
  .koszyk-review-line-subtotal {
    white-space: normal;
  }
}
