/* Checkout page */

.checkout-page {
  background-color: rgb(var(--bg));
}

.checkout-header {
  position: sticky;
  top: 0;
  z-index: 30;
  padding-block: 12px;
  background-color: rgb(var(--card));
  box-shadow: inset 0 0 0 1px rgb(var(--card-stroke));
}

.checkout-header .header-inner {
  justify-content: space-between;
}

.checkout-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

/* ---------- Order summary ---------- */
.order-panel {
  padding: 32px 16px 8px;
  background-color: rgb(var(--bg));
  color: #fff;
}

.order-panel-inner {
  width: 100%;
  max-width: 524px;
  margin-inline: auto;
}

.order-panel-title {
  color: #fff;
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
}

.order-card {
  margin-top: 24px;
  padding: 16px;
  background-color: rgb(var(--card));
}

.order-card-inner {
  display: flex;
  gap: 16px;
  min-width: 0;
}

.order-card-media {
  width: 92px;
  height: 92px;
  flex: 0 0 92px;
  overflow: hidden;
  background-color: #d0d5dd;
}

.order-card-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.order-card-copy {
  min-width: 0;
  flex: 1;
}

.order-event-name {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.order-event-price {
  margin-top: 2px;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  line-height: 18px;
}

.order-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 8px;
  margin-top: 8px;
  color: #fff;
  font-size: 13px;
  line-height: 18px;
}

.order-item-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.order-item-qty {
  color: rgba(255, 255, 255, 0.65);
  white-space: nowrap;
}

.order-item-meta {
  grid-column: 1 / -1;
  color: rgba(255, 255, 255, 0.65);
  font-size: 12px;
  line-height: 17px;
}

.edit-order-link {
  display: inline-block;
  margin-top: 16px;
  color: rgb(var(--primary));
  font-size: 14px;
  line-height: 20px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.edit-order-link:hover {
  color: #fff;
}

.totals-list {
  margin: 16px 0 0;
  padding-top: 24px;
  border-top: 1px solid rgb(var(--border));
}

.total-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-top: 16px;
  color: #fff;
  font-size: 14px;
  line-height: 20px;
}

.total-line:first-child {
  padding-top: 0;
}

.total-line dt {
  display: flex;
  align-items: center;
  gap: 6px;
}

.total-line dd {
  margin: 0;
  text-align: right;
}

.info-icon {
  display: inline-grid;
  place-items: center;
  width: 14px;
  height: 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.85);
  font-size: 9px;
  font-style: normal;
  font-weight: 600;
  cursor: help;
}

.grand-total {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
}

.order-panel-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 28px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 12px;
  line-height: 18px;
}

.order-panel-note svg {
  flex: 0 0 18px;
  margin-top: 0;
}

.order-panel-note a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Checkout form ---------- */
.checkout-panel {
  background-color: #fff;
  color: #101928;
}

.checkout-panel-inner {
  width: 100%;
  padding: 32px 16px 48px;
}

.checkout-form {
  max-width: 552px;
}

.form-title {
  margin-bottom: 16px;
  color: #101928;
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
}

.payment-title {
  margin-top: 32px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 16px;
}

.field-grid .field {
  margin-top: 0;
}

.field label,
.field-label {
  color: #101928;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
}

.field-label {
  display: block;
  margin-bottom: 8px;
}

.field input {
  width: 100%;
  height: 44px;
  padding: 0 12px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background-color: #fff;
  color: #101928;
  font-family: inherit;
  font-size: 16px;
  line-height: 24px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input::placeholder {
  color: #98a2b3;
}

.field input:focus {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgba(255, 191, 70, 0.25);
}

.field input.is-invalid {
  border-color: #d92d20;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
}

.phone-field {
  display: flex;
  align-items: center;
  height: 44px;
  padding-left: 12px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background-color: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.phone-field:focus-within {
  border-color: rgb(var(--primary));
  box-shadow: 0 0 0 3px rgba(255, 191, 70, 0.25);
}

.phone-field.is-invalid {
  border-color: #d92d20;
  box-shadow: 0 0 0 3px rgba(217, 45, 32, 0.12);
}

.phone-prefix {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-right: 10px;
  color: #101928;
  font-size: 16px;
  line-height: 24px;
  white-space: nowrap;
}

.phone-prefix img {
  width: 20px;
  height: 20px;
}

.phone-field input {
  height: 100%;
  flex: 1;
  padding: 0 12px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.phone-field input:focus {
  border: 0;
  box-shadow: none;
}

.payment-methods {
  display: flex;
  gap: 16px;
}

.pay-method {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
  min-width: 0;
  height: 94px;
  flex: 1 1 0;
  padding: 14px 20px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background-color: #fff;
  color: #101928;
  text-align: left;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.pay-method.is-active {
  border: 2px solid rgb(var(--primary));
  padding: 13px 19px;
}

.pay-method:disabled {
  opacity: 0.8;
  cursor: not-allowed;
}

.pay-method-name {
  font-size: 16px;
  line-height: 24px;
}

.mpesa-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 26px;
  border-radius: 4px;
  background-color: #2e9e4f;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.payment-phone-field {
  margin-top: 20px;
}

.payment-note {
  margin-top: 16px;
  padding: 16px;
  border-radius: 8px;
  background-color: rgb(var(--card));
  color: #fff;
  font-size: 14px;
  line-height: 20px;
}

.gateway-status {
  margin-top: 16px;
  padding: 12px 14px;
  border: 1px solid #f5c26b;
  border-radius: 8px;
  background-color: #fff7e6;
  color: #7a4b00;
  font-size: 13px;
  line-height: 20px;
}

.gateway-status.is-error {
  border-color: #fda29b;
  background-color: #fef3f2;
  color: #b42318;
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 20px;
  color: #101928;
  font-size: 14px;
  line-height: 20px;
}

.check-row input {
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin: 0;
  accent-color: rgb(var(--primary));
  cursor: pointer;
}

.check-row a {
  color: #0f9d8a;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.check-row a:hover {
  color: #0b7d6e;
}

.form-message {
  margin-top: 20px;
  padding: 12px 14px;
  border: 1px solid #fda29b;
  border-radius: 8px;
  background-color: #fef3f2;
  color: #b42318;
  font-size: 14px;
  line-height: 20px;
}

.form-message.is-success {
  border-color: #a6f4c5;
  background-color: #ecfdf3;
  color: #067647;
}

.pay-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 48px;
  margin-top: 24px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background-color: rgb(var(--primary));
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  transition: background-color 0.2s ease, opacity 0.2s ease;
}

.pay-btn:hover:not(:disabled) {
  background-color: rgba(var(--primary), 0.85);
}

.pay-btn:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.pay-btn-total {
  font-weight: 600;
}

.pay-btn .spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: checkout-spin 0.7s linear infinite;
}

.powered-by {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 14px;
  color: #667085;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
}

/* ---------- Empty state ---------- */
.empty-state {
  max-width: 480px;
  padding: 24px 0 40px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: 20px;
  border-radius: 50%;
  background-color: #f0f2f5;
  color: #475367;
}

.empty-state h2 {
  color: #101928;
  font-size: 20px;
  font-weight: 600;
  line-height: 28px;
}

.empty-state p {
  margin-top: 8px;
  color: #475367;
  font-size: 14px;
  line-height: 20px;
}

.empty-action,
.status-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  background-color: rgb(var(--primary));
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  transition: background-color 0.2s ease;
}

.empty-action {
  margin-top: 24px;
}

.empty-action:hover,
.status-retry:hover {
  background-color: rgba(var(--primary), 0.85);
}

/* ---------- Payment status ---------- */
.status-panel {
  max-width: 552px;
  padding: 8px 0 40px;
}

.status-icon {
  display: grid;
  place-items: center;
  width: 68px;
  height: 68px;
  margin-bottom: 24px;
  border-radius: 50%;
  background-color: #fff7e6;
  color: #b7791f;
}

.status-icon.is-success {
  background-color: rgb(var(--success-lighter));
  color: #067647;
}

.status-icon.is-error {
  background-color: #fef3f2;
  color: #b42318;
}

.status-icon .spinner {
  width: 30px;
  height: 30px;
  border: 3px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: checkout-spin 0.8s linear infinite;
}

@keyframes checkout-spin {
  to {
    transform: rotate(360deg);
  }
}

.status-panel h2 {
  color: #101928;
  font-size: 24px;
  font-weight: 600;
  line-height: 32px;
}

.status-text {
  max-width: 480px;
  margin-top: 12px;
  color: #475367;
  font-size: 14px;
  line-height: 22px;
}

.status-reference {
  margin-top: 16px;
  color: #667085;
  font-size: 13px;
  line-height: 20px;
}

.status-reference strong {
  color: #101928;
  font-weight: 600;
}

.status-details {
  margin: 24px 0 0;
  padding: 16px;
  border: 1px solid #e4e7ec;
  border-radius: 8px;
  background-color: #f9fafb;
}

.status-detail-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
  color: #475367;
  font-size: 13px;
  line-height: 20px;
}

.status-detail-row:first-child {
  padding-top: 0;
}

.status-detail-row dd {
  margin: 0;
  color: #101928;
  font-weight: 600;
  text-align: right;
  overflow-wrap: anywhere;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}

.status-back {
  color: #475367;
  font-size: 14px;
  line-height: 20px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.status-back:hover {
  color: #101928;
}

/* ---------- Responsive ---------- */
@media (min-width: 640px) {
  .order-panel {
    padding-top: 40px;
  }

  .pay-method {
    flex: 0 0 126px;
  }
}

@media (min-width: 960px) {
  .checkout-main {
    grid-template-columns: minmax(0, 51%) minmax(0, 49%);
    min-height: calc(100svh - 64px);
  }

  .order-panel {
    padding: 40px 16px;
  }

  .checkout-panel-inner {
    max-width: 600px;
    padding: 40px 24px 64px;
  }

  .order-card {
    margin-top: 28px;
  }

  .order-panel-title {
    padding-top: 0;
  }
}

@media (max-width: 359px) {
  .order-card-media {
    width: 72px;
    height: 72px;
    flex-basis: 72px;
  }

  .pay-method {
    padding: 12px;
  }

  .pay-method.is-active {
    padding: 11px;
  }
}
