/* Placing order page */
:root {
  --checkout-bg: #f5f6f8;
  --checkout-card-bg: #ffffff;
  --checkout-border: #e3e6eb;
  --checkout-text: #1f2328;
  --checkout-muted: #6b7280;
  --checkout-accent: #c18e64;
}

html,
body {
  background: var(--checkout-bg);
  overflow-x: hidden;
}

.placing-order-page {
  max-width: 1200px;
  margin: 20px auto 60px;
  padding: 0 16px 32px;
  color: var(--checkout-text);
}

.placing-order-page__head {
  margin-bottom: 24px;
}

.placing-order-page__head h1 {
  font-size: 32px;
  margin: 0 0 12px;
}

.placing-order-page__lead {
  margin: 0;
  color: var(--checkout-muted);
  font-size: 16px;
  line-height: 1.5;
}

.placing-order-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

.checkout {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.checkout-card {
  background: var(--checkout-card-bg);
  border-radius: 16px;
  border: 1px solid var(--checkout-border);
  padding: 22px 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.04);
}

.checkout-card h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}

.checkout-card--actions {
  gap: 16px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-grid--single {
  grid-template-columns: 1fr;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

.field--full {
  width: 100%;
}

.field__label {
  font-weight: 600;
  font-size: 14px;
  color: var(--checkout-text);
}

.field input[type="text"],
.field input[type="tel"],
.field input[type="email"],
.field input[type="number"],
.field select,
.field textarea {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--checkout-border);
  font-size: 15px;
  background: #fff;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

/* Make the custom warehouse search field visually consistent */
#np-warehouse-search {
  width: 100%;
  box-sizing: border-box;
}

.field textarea {
  resize: vertical;
  min-height: 120px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--checkout-accent);
  box-shadow: 0 0 0 3px rgba(193, 142, 100, 0.2);
}

.field__hint {
  font-size: 12px;
  color: var(--checkout-muted);
}

.field__input--ghost {
  margin-top: 8px;
  background: rgba(249, 250, 251, 0.8);
}

/* Autocomplete dropdown (custom list for city selection) */
.ac-root {
  /* container appended inside .field */
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  z-index: 1000; /* above cards */
  pointer-events: none; /* panel handles events */
}

.ac-panel {
  background: #fff;
  border: 1px solid var(--checkout-border);
  border-radius: 12px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
  max-height: 320px;
  overflow: auto;
  padding: 6px 0;
  display: none;
  pointer-events: auto;
}

.ac-panel.is-open {
  display: block;
}

.ac-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.3;
  color: var(--checkout-text);
}

.ac-item:hover,
.ac-item[aria-selected="true"],
.ac-item.is-active {
  background: #f5f6f8;
}

.ac-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--checkout-muted);
}

.segmented {
  display: inline-flex;
  background: #f1f2f5;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.segmented--compact {
  flex-wrap: wrap;
  gap: 6px;
}

.segmented__option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--checkout-muted);
}

.segmented__option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.segmented__option span {
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 10px;
  transition:
    background 0.2s ease,
    box-shadow 0.2s ease,
    color 0.2s ease;
  min-width: 0;
}

.segmented__option:has(input:checked) span {
  background: linear-gradient(90deg, #d8a07e, #c18e64);
  box-shadow: 0 10px 20px rgba(193, 142, 100, 0.25);
  color: #fff;
}

.segmented__option:has(input:checked) {
  color: #fff;
}

.segmented__option input:focus-visible + span {
  outline: 2px solid var(--checkout-accent);
  outline-offset: 3px;
}

.delivery-variant {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.delivery-provider .segmented {
  margin-bottom: 18px;
}

.info-card {
  padding: 16px 18px;
  background: #fff8f1;
  border-radius: 12px;
  border: 1px solid rgba(193, 142, 100, 0.35);
  color: #7c5033;
  font-size: 14px;
  line-height: 1.5;
}

.radio-list {
  display: grid;
  gap: 12px;
}

.radio-tile {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px 12px;
  padding: 14px 16px;
  border: 1px solid var(--checkout-border);
  border-radius: 14px;
  position: relative;
  cursor: pointer;
  background: #fff;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.radio-tile input {
  margin-top: 4px;
}

.radio-tile__title {
  font-weight: 600;
}

.radio-tile__desc {
  grid-column: 2 / -1;
  font-size: 13px;
  color: var(--checkout-muted);
}

.radio-tile input:checked ~ .radio-tile__title,
.radio-tile input:checked ~ .radio-tile__desc {
  color: var(--checkout-text);
}

.radio-tile input:checked ~ .radio-tile__title {
  color: var(--checkout-accent);
}

.radio-tile:has(input:checked) {
  border-color: rgba(193, 142, 100, 0.7);
  box-shadow: 0 0 0 3px rgba(193, 142, 100, 0.2);
}

.checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 14px;
}

.checkbox input {
  margin-top: 3px;
}

.checkbox a {
  color: var(--checkout-accent);
  text-decoration: underline;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  transition:
    transform 0.2s ease,
    box-shadow 0.2s ease;
  box-sizing: border-box;
}

.btn-primary {
  background: linear-gradient(90deg, #f6e4d7, #edd0bd);
  border: 1px solid #d6ab8c;
  color: #6a4330;
  box-shadow:
    0 2px 0 #d6ab8c,
    0 6px 14px rgba(214, 171, 140, 0.24);
}

.btn-primary:hover {
  background: linear-gradient(90deg, #f8e9de, #f1d8c7);
  box-shadow:
    0 2px 0 #cf9f7d,
    0 9px 18px rgba(214, 171, 140, 0.3);
  transform: translateY(-1px);
}

.btn-primary:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 3px rgba(216, 160, 126, 0.3),
    0 2px 0 #cf9f7d,
    0 9px 18px rgba(214, 171, 140, 0.3);
}

.btn-secondary {
  background: #fff;
  color: var(--checkout-text);
  border: 1px solid var(--checkout-border);
}

.order-summary {
  position: sticky;
  top: 96px;
}

.order-summary__card {
  background: var(--checkout-card-bg);
  border-radius: 18px;
  border: 1px solid var(--checkout-border);
  padding: 22px 24px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.order-summary__card h2 {
  margin: 0;
  font-size: 22px;
}

.order-items {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.order-item {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 10px 14px;
}

.order-item__content {
  display: flex;
  align-items: center;
}

.order-item__thumb {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: #f3f4f6;
}

.order-item__title {
  font-weight: 600;
  font-size: 14px;
  color: var(--checkout-text);
}

.order-item__meta {
  grid-column: 2 / -1;
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--checkout-muted);
}

.order-total {
  display: flex;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
}

.order-note {
  margin: 0;
  font-size: 13px;
  color: var(--checkout-muted);
  line-height: 1.5;
}

.order-empty {
  font-size: 14px;
  color: var(--checkout-muted);
  text-align: center;
  padding: 12px 0;
}

.field--error .field__label,
.field--error .radio-tile__title {
  color: #b91c1c;
}

.field--error input,
.field--error textarea,
.field--error select {
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25);
}

.field--error .segmented__option span {
  box-shadow: 0 0 0 1px rgba(248, 113, 113, 0.6);
}

.radio-list.field--error .radio-tile {
  border-color: #f87171;
  box-shadow: 0 0 0 3px rgba(248, 113, 113, 0.25);
}

#form-status {
  min-height: 20px;
  font-size: 14px;
}

#form-status.success {
  color: #15803d;
}

#form-status.error {
  color: #b91c1c;
}

@media (max-width: 1024px) {
  .placing-order-layout {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }

  .order-summary {
    position: static;
  }
}

@media (max-width: 880px) {
  .placing-order-layout {
    grid-template-columns: 1fr;
  }

  .order-summary {
    position: static;
  }
}

@media (max-width: 760px) {
  .placing-order-page__head h1 {
    font-size: 28px;
  }

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

  .segmented__option {
    flex: 1 1 auto;
  }

  .order-summary__card {
    border-radius: 16px;
  }
}

@media (max-width: 540px) {
  .placing-order-page {
    padding: 0 12px 24px;
  }

  .checkout-card {
    padding: 18px 18px;
  }

  .order-summary__card {
    padding: 18px 18px;
  }

  .actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
