/* checkout.css - Checkout Page Layout */

.checkout-layout {
  display: grid;
  /* minmax(0, ...) instead of a bare fr unit -- a bare `1.2fr`/`0.8fr` track
     has an implicit min-width of "auto" (its content's min-content size), so
     a long unbreakable child (e.g. a nowrap product name in the order
     summary) can silently blow the track past the viewport. Because the
     page has a defensive overflow-x:hidden, that overflow doesn't show as a
     scrollbar -- it just clips the grid item's own right-side padding,
     making the checkout card look flush against the right edge. minmax(0, fr)
     lets the track shrink to fit instead of growing to fit its content. */
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 40px;
  margin-top: 24px;
  margin-bottom: 64px;
}

@media (max-width: 992px) {
  .checkout-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 32px;
  }
}

@media (max-width: 576px) {
  .checkout-layout {
    /* A touch more breathing room than the site-wide 16px container padding
       gives every other page, for a slightly more premium checkout feel. */
    margin-left: 4px;
    margin-right: 4px;
  }
}

/* --- FORM CARD WRAPPER --- */
.checkout-form-card {
  background-color: var(--ivory-white);
  border: 1px solid var(--velvet-cream);
  border-radius: var(--radius-card);
  padding: 32px;
  min-width: 0;
}

.checkout-form-card__title {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--primary-rose);
  margin-bottom: 20px;
  border-bottom: 1px solid var(--velvet-cream);
  padding-bottom: 10px;
}

/* Grid layout for form fields */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.form-group--full {
  grid-column: 1 / -1;
}

.form-label {
  font-family: var(--font-ui);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--deep-charcoal);
}

.form-input {
  width: 100%;
  background-color: var(--velvet-cream);
  border: 1px solid var(--velvet-cream);
  border-radius: var(--radius-button);
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 1rem;
  color: var(--deep-charcoal);
  transition: all var(--transition-fast);
}

.form-input:focus {
  border-color: var(--blush-pink);
  background-color: var(--ivory-white);
  box-shadow: 0 0 0 3px rgba(196, 84, 122, 0.15);
}

.form-textarea {
  min-height: 80px;
  resize: vertical;
}

@media (max-width: 576px) {
  .checkout-form-card {
    /* Roomier than the pre-fix 24px, but pulled in from the 32px desktop
       value so the narrow viewport keeps enough width for the inputs
       themselves. */
    padding: 24px 18px;
  }

  .checkout-form-card__title {
    text-align: center;
    margin-bottom: 16px;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr); /* Single column on mobile */
    gap: 14px;
  }

  .form-group {
    gap: 4px;
  }

  .form-input {
    padding: 10px 12px;
  }

  .form-textarea {
    min-height: 64px;
  }

  /* Longer placeholders ("Detailed street address for courier delivery")
     were getting visually cut off against the input's edge on narrow
     screens at the same size as typed text -- shrink just the placeholder,
     not the value the user actually types. */
  .form-input::placeholder {
    font-size: 0.82rem;
  }
}

/* --- SUMMARY LIST --- */
.checkout-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 240px;
  overflow-y: auto;
  padding-right: 4px;
  margin-bottom: 16px;
  border-bottom: 1px dashed rgba(139, 26, 74, 0.15);
  padding-bottom: 16px;
}

.checkout-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-family: var(--font-body);
}

.checkout-item__name {
  font-weight: 500;
  color: var(--deep-charcoal);
  max-width: 70%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.checkout-item__qty {
  color: var(--warm-gray);
  margin-left: 8px;
}

.checkout-item__total {
  font-family: var(--font-ui);
  font-weight: 700;
  color: var(--primary-rose);
}
