:root {
  --light-grey: #EEF2F5;
  --dark-grey: #7B7B8F;
  --border-color: #e7ecef;
  --dark-terminal-color: #ffffff;
  --accent-color: #A04BE0;
  --text-color: #000000;
  --background-color: #ffffff;
  --radius: 9px;
}

/* Dark mode variables */
[data-theme="dark"] {
  --light-grey: #2d2d2d;
  --dark-grey: #7B7B8F;
  --border-color: #666;
  --dark-terminal-color: #282830;
  --accent-color: #A04BE0;
  --text-color: #ffffff;
  --background-color: #282830;
}

body {
  padding: 10px;
  font-family: 'Open Sans', sans-serif;
  display: flex;
  justify-content: center;
  font-size: 1em;
  color: var(--text-color);
  background-color: var(--background-color);
}

main {
  width: 90%;
  display: grid;
  grid-template-columns: 4fr 4fr;
  grid-gap: 50px;
}

form > * {
  margin: 10px 0;
}

.order-info, .credit-info {
  width: 100%;
}

.order-info-content {
  padding-right: 20px;
  padding-left: 20px;
  padding-bottom: 20px;

  border: 1px solid var(--border-color);
  border-radius: var(--radius);
}

/* Product image styling */
.order-table img {
  width: 100%;
  max-width: 60%;
  max-height: 60%;
  object-fit: contain;
  margin: 0 auto;
}

.order-table td {
  display: flex;
  justify-content: center;
  align-items: center;
  text-align: center; /* Ensure text is centered */
}

.order-summary {
  background-color: var(--dark-terminal-color);
  width: 100%;
  padding-top: 10px;
}

.summary-details {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.item-label {
  font-size: 0.9rem;
  color: var(--dark-grey);
}

.item-value {
  font-size: 0.9rem;
}

.summary-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.total-label {
  font-size: 1.125rem;
  font-weight: 600;
}

.total-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--accent-color);
}

input, select {
  display: block;
  font-size: 1.1em;
  width: 100%;
  margin-bottom: 10px;
}

label {
  display: block;
}

a {
  color: var(--accent-color);
  font-weight: 900;
}

small {
  font-size: .8em;
  color: var(--dark-grey);
}

fieldset, input, select {
  border: 1px solid #C6C8CA;
}

#messages {
  font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New';
  display: none; /* hide initially, then show once the first message arrives */
}

/* Powered by Stripe styles */
.powered-by-stripe {
  display: flex;
  justify-content: center;
  padding-top: 30px;
}

.powered-by-stripe svg {
  width: 150px;
  fill: var(--dark-grey);
}

/* Button and spinner styles */
.submit-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 15px;
  font-size: 1em;
  background-color: var(--accent-color);
  color: white;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s ease;
}

.submit-button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pay-button-text {
  display: inline-block;
}

.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 1s ease-in-out infinite;
  margin-right: 10px;
}

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

/* Mobile styles */
@media (max-width: 768px) {
  body {
    padding: 5px;
    font-family: 'Open Sans', sans-serif;
  }

  main {
    display: block;
    width: 100%;
  }

  .order-info, .credit-info {
    width: 100%;
    margin-bottom: 20px;
  }

  .order-info {
    width: 100%;
  }

  .order-info-content {
    padding-right: 10px;
    padding-left: 10px;
    padding-bottom: 10px;
  }

  .order-table {
    width: 100%;
    table-layout: fixed; /* Ensures consistent cell widths */
    border-collapse: collapse; /* Removes gaps between cells */
  }

  .order-table td {
    width: 100%;
    text-align: center;
    padding: 0;
    margin: 0;
  }

  .order-table img {
    margin: 0 auto;
  }

  .total {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 10px 0;
  }

  .total span {
    width: auto;
    text-align: left;
    margin-bottom: 0;
  }

  .total span:first-child {
    text-align: left;
  }

  .total span:last-child {
    text-align: right;
  }

  button {
    width: 100%;
    padding: 15px;
    font-size: 1em;
  }

  .loader {
    width: 30px;
    height: 30px;
  }

  .powered-by-stripe svg {
    width: 120px;
    fill: var(--dark-grey);
  }
}