/* Cart page — ported from Blazor Cart.razor scoped styles */

.cart-loading,
.cart-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  text-align: center;
  padding: max(24px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.cart-loading p {
  max-width: 100%;
  overflow-wrap: break-word;
  line-height: 1.45;
}

.loading-spinner {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.spinner-dot {
  width: 12px;
  height: 12px;
  background: var(--teal, #2bb8c8);
  border-radius: 50%;
  animation: cart-bounce 1.4s ease-in-out infinite both;
}

.spinner-dot:nth-child(1) {
  animation-delay: -0.32s;
}

.spinner-dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes cart-bounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

.cart-empty-icon {
  color: #ccc;
  margin-bottom: 20px;
}

.cart-empty h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--navy, #0f2a44);
  margin-bottom: 8px;
}

.cart-empty p {
  color: #888;
  margin-bottom: 24px;
}

.btn-shop {
  background: var(--navy, #0f2a44);
  color: white;
  padding: 14px 32px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-size: inherit;
  font-family: inherit;
}

.btn-shop:hover {
  background: var(--teal, #2bb8c8);
}

.cart-page {
  padding: 24px 20px;
  max-width: 1100px;
  margin: 0 auto;
}

.cart-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--navy, #0f2a44);
  margin-bottom: 24px;
}

.cart-count {
  font-size: 16px;
  font-weight: 400;
  color: #888;
}

.cart-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 28px;
  align-items: start;
}

/* Items */
.cart-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cart-item {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(15, 42, 68, 0.08);
  border: 1px solid rgba(15, 42, 68, 0.06);
}

.cart-item.oos {
  border: 1.5px solid #ff6b6b;
}

.cart-item.is-updating {
  opacity: 0.65;
  pointer-events: none;
}

/* Desktop: body wrapper is transparent to the parent grid */
.cart-item-body {
  display: contents;
}

.cart-item-img-wrap {
  width: 90px;
  height: 90px;
  border-radius: 10px;
  overflow: hidden;
  flex-shrink: 0;
  background: #f5f5f5;
  display: block;
}

.cart-item-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cart-item-no-img {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #aaa;
}

.cart-item-info {
  min-width: 0;
}

.cart-item-name {
  font-weight: 600;
  color: var(--navy, #0f2a44);
  text-decoration: none;
  font-size: 15px;
  display: block;
  line-height: 1.35;
}

.cart-item-name:hover {
  color: var(--teal, #2bb8c8);
}

.cart-item-variant {
  font-size: 13px;
  color: #888;
  margin: 2px 0;
}

.cart-item-price {
  font-size: 13px;
  color: #888;
  margin-top: 4px;
}

.cart-item-oos-msg {
  font-size: 12px;
  color: #ff6b6b;
  margin: 4px 0;
}

.cart-item-controls {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 10px;
}

.cart-item-actions-end {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.cart-item-total {
  font-size: 16px;
  font-weight: 700;
  color: var(--navy, #0f2a44);
  margin: 0;
}

.cart-item-remove {
  background: none;
  border: none;
  cursor: pointer;
  color: #aaa;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cart-item-remove:hover:not(:disabled) {
  color: #ff6b6b;
}

.cart-item-remove:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.qty-control {
  display: flex;
  align-items: center;
  border: 1.5px solid #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
}

.qty-control button {
  width: 32px;
  height: 34px;
  border: none;
  background: #f8f8f8;
  font-size: 18px;
  cursor: pointer;
  color: var(--navy, #0f2a44);
  transition: background 0.15s;
}

.qty-control button:hover:not(:disabled) {
  background: #eee;
}

.qty-control button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.qty-control span {
  min-width: 36px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
}

.btn-clear-cart {
  background: none;
  border: 1px solid #e0e0e0;
  color: #888;
  padding: 10px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 13px;
  margin-top: 4px;
  transition: all 0.15s;
  font-family: inherit;
}

.btn-clear-cart:hover {
  border-color: #ff6b6b;
  color: #ff6b6b;
}

/* Summary */
.cart-summary {
  background: #ffffff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(15, 42, 68, 0.08);
  border: 1px solid rgba(15, 42, 68, 0.06);
  position: sticky;
  top: 110px;
}

.summary-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy, #0f2a44);
  margin-bottom: 20px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
  color: #555;
}

.shipping-note {
  font-size: 13px;
  color: var(--teal, #2bb8c8);
  font-weight: 600;
}

.summary-divider {
  height: 1px;
  background: #f0f0f0;
  margin: 16px 0;
}

.summary-total {
  font-size: 17px;
  font-weight: 700;
  color: var(--navy, #0f2a44);
}

.free-shipping-nudge {
  font-size: 12px;
  background: #fff3cd;
  color: #856404;
  padding: 8px 12px;
  border-radius: 8px;
  margin: 12px 0;
  text-align: center;
}

.btn-checkout {
  display: block;
  width: 100%;
  background: var(--navy, #0f2a44);
  color: white;
  text-align: center;
  padding: 14px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  margin-top: 16px;
  transition: background 0.2s;
  box-sizing: border-box;
}

.btn-checkout:hover:not(.disabled) {
  background: var(--teal, #2bb8c8);
}

.btn-checkout.disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-continue {
  display: block;
  text-align: center;
  margin-top: 12px;
  color: #888;
  font-size: 13px;
  text-decoration: none;
}

.btn-continue:hover {
  color: var(--teal, #2bb8c8);
}

@media (max-width: 768px) {
  .cart-layout {
    grid-template-columns: 1fr;
  }

  .cart-summary {
    position: static;
    order: -1;
  }

  .cart-page {
    padding: 16px 12px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .cart-title {
    font-size: 22px;
    margin-bottom: 16px;
  }

  /* Compact horizontal row: thumb | details + actions */
  .cart-item {
    grid-template-columns: 76px minmax(0, 1fr);
    gap: 10px 12px;
    padding: 10px 12px;
    align-items: start;
  }

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

  .cart-item-img-wrap {
    width: 76px;
    height: 76px;
    border-radius: 8px;
  }

  .cart-item-name {
    font-size: 14px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .cart-item-variant {
    font-size: 12px;
    margin: 0;
  }

  .cart-item-price {
    font-size: 12px;
    margin-top: 2px;
  }

  .cart-item-controls {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 8px;
  }

  .cart-item-actions-end {
    flex-direction: row;
    align-items: center;
    gap: 8px;
  }

  .cart-item-total {
    font-size: 14px;
  }

  .qty-control button {
    min-width: 36px;
    min-height: 36px;
    width: 36px;
    height: 36px;
  }

  .btn-checkout {
    min-height: 48px;
  }
}
