.main {
  max-width: 1100px;
  padding-left: 30px;
  padding-right: 30px;

  margin-top: 140px;
  margin-bottom: 100px;

  /* margin-left: auto;
     margin-right auto;
     Is a trick for centering an element horizontally
     without needing a container. */
  margin-left: auto;
  margin-right: auto;
}

.page-title {
  font-weight: 700;
  font-size: 22px;
  margin-bottom: 18px;
}

.checkout-grid {
  display: grid;
  /* Here, 1fr means the first column will take
     up the remaining space in the grid. */
  grid-template-columns: 1fr 350px;
  column-gap: 12px;

  /* Use align-items: start; to prevent the elements
     in the grid from stretching vertically. */
  align-items: start;
}

@media (max-width: 1000px) {
  .main {
    max-width: 500px;
  }

  .checkout-grid {
    grid-template-columns: 1fr;
  }
}

.cart-item-container,
.payment-summary {
  border: 1px solid rgb(222, 222, 222);
  border-radius: 4px;
  padding: 18px;
}

.cart-item-container {
  margin-bottom: 12px;
}

.payment-summary {
  padding-bottom: 5px;
}

@media (max-width: 1000px) {
  .payment-summary {
    /* grid-row: 1 means this element will be placed into row
      1 in the grid. (Normally, the row that an element is
      placed in is determined by the order of the elements in
      the HTML. grid-row overrides this default ordering). */
    grid-row: 1;
    margin-bottom: 12px;
  }
}

.delivery-date {
  color: rgb(0, 118, 0);
  font-weight: 700;
  font-size: 19px;
  margin-top: 5px;
  margin-bottom: 22px;
}

.cart-item-details-grid {
  display: grid;
  /* 100px 1fr 1fr; means the 2nd and 3rd column will
     take up half the remaining space in the grid
     (they will divide up the remaining space evenly). */
  grid-template-columns: 100px 1fr 1fr;
  column-gap: 25px;
}

@media (max-width: 1000px) {
  .cart-item-details-grid {
    grid-template-columns: 100px 1fr;
    row-gap: 30px;
  }
}

.product-image {
  max-width: 100%;
  max-height: 120px;

  /* margin-left: auto;
     margin-right auto;
     Is a trick for centering an element horizontally
     without needing a container. */
  margin-left: auto;
  margin-right: auto;
}

.product-name {
  font-weight: 700;
  margin-bottom: 8px;
}

.product-price {
  color: rgb(177, 39, 4);
  font-weight: 700;
  margin-bottom: 5px;
}

.product-quantity .link-primary {
  margin-left: 3px;
}

@media (max-width: 1000px) {
  .delivery-options {
    /* grid-column: 1 means this element will be placed
       in column 1 in the grid. (Normally, the column that
       an element is placed in is determined by the order
       of the elements in the HTML. grid-column overrides
       this default ordering).
       
       / span 2 means this element will take up 2 columns
       in the grid (Normally, each element takes up 1
       column in the grid). */
    grid-column: 1 / span 2;
  }
}

.delivery-options-title {
  font-weight: 700;
  margin-bottom: 10px;
}

.delivery-option {
  display: grid;
  grid-template-columns: 24px 1fr;
  margin-bottom: 12px;
  cursor: pointer;
}

.delivery-option-input {
  margin-left: 0px;
  cursor: pointer;
}

.delivery-option-date {
  color: rgb(0, 118, 0);
  font-weight: 500;
  margin-bottom: 3px;
}

.delivery-option-price {
  color: rgb(120, 120, 120);
  font-size: 15px;
}

.payment-summary-title {
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 12px;
}

.payment-summary-row {
  display: grid;
  /* 1fr auto; means the width of the 2nd column will be
     determined by the elements inside the column (auto).
     The 1st column will take up the remaining space. */
  grid-template-columns: 1fr auto;

  font-size: 15px;
  margin-bottom: 9px;
}

.payment-summary-money {
  text-align: right;
}

.subtotal-row .payment-summary-money {
  border-top: 1px solid rgb(222, 222, 222);
}

.subtotal-row div {
  padding-top: 9px;
}

.total-row {
  color: rgb(177, 39, 4);
  font-weight: 700;
  font-size: 18px;

  border-top: 1px solid rgb(222, 222, 222);
  padding-top: 18px;
}

.place-order-button {
  width: 100%;
  padding-top: 12px;
  padding-bottom: 12px;
  border-radius: 8px;

  margin-top: 11px;
  margin-bottom: 15px;
}

.order-confirmation-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  opacity: 1;
  visibility: visible;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

.order-confirmation-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.order-confirmation-modal {
  width: min(94vw, 500px);
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.98),
    rgba(248, 250, 252, 0.97)
  );
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 26px;
  box-shadow: 0 28px 80px rgba(15, 23, 42, 0.28);
  padding: 30px 28px 26px;
  text-align: center;
  transform: translateY(0);
  transition:
    background 0.35s ease,
    transform 0.35s ease;
}

.order-confirmation-modal.success {
  background: linear-gradient(
    180deg,
    rgba(240, 253, 244, 0.98),
    rgba(255, 255, 255, 0.97)
  );
}

.order-confirmation-header h2 {
  margin: 0 0 12px;
  font-size: 30px;
  color: rgb(17, 24, 39);
}

.pin-step {
  display: block;
}

.order-confirmation-text {
  margin: 0 0 18px;
  color: rgb(71, 85, 105);
  font-size: 15px;
}

.pin-inputs {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 20px;
}

.pin-digit {
  width: 58px;
  height: 66px;
  border-radius: 16px;
  border: 1px solid rgb(203, 213, 225);
  background: linear-gradient(180deg, rgb(255, 255, 255), rgb(248, 250, 252));
  text-align: center;
  font-size: 28px;
  font-weight: 700;
  color: rgb(15, 23, 42);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    transform 0.2s ease;
}

.pin-digit.is-filled {
  border-color: rgb(14, 165, 233);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

.pin-digit:focus {
  outline: none;
  border-color: rgb(59, 130, 246);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
}

.pin-confirm-button {
  width: 100%;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 12px;
  background: linear-gradient(180deg, rgb(255, 221, 87), rgb(255, 202, 27));
  border: 1px solid rgb(250, 204, 36);
  color: rgb(33, 33, 33);
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(250, 204, 36, 0.28);
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

.pin-confirm-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 28px rgba(250, 204, 36, 0.36);
  filter: brightness(1.02);
}

.pin-confirm-button:active {
  transform: translateY(0);
}

.success-state {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding-top: 6px;
  opacity: 0;
  transform: translateY(12px);
}

.success-state.show {
  display: flex;
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.45s ease,
    transform 0.45s ease;
}

.success-badge {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgb(34, 197, 94), rgb(22, 163, 74));
  color: rgb(255, 255, 255);
  font-size: 38px;
  font-weight: 700;
  box-shadow: 0 14px 28px rgba(34, 197, 94, 0.28);
  margin-bottom: 16px;
}

.success-state h3 {
  margin: 0 0 10px;
  font-size: 28px;
  color: rgb(20, 83, 45);
}

.confirmation-message {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: rgb(22, 163, 74);
  opacity: 0;
  transform: translateY(8px);
}

.success-state .confirmation-message {
  opacity: 1;
  transform: translateY(0);
  transition:
    opacity 0.4s ease,
    transform 0.4s ease;
}
