/* === Checkout Summary === */
#checkout-summary {
  margin-bottom: 20px;
}

#checkout-summary h2 {
  margin-bottom: 10px;
}

.checkout-item {
  font-size: 18px;
  margin: 10px 0;
}

/* === Checkout Button === */
#checkout-button {
  display: block; /* Makes it take full width if needed */
  margin: 30px auto; /* Centers the button horizontally */
  padding: 15px 30px; /* Makes the button larger */
  font-size: 1.2em;
  background-color: #28a745;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease; /* Added transform transition */
  text-align: center;
  width: 60%; /* Adjust as needed */
  max-width: 400px;
}

#checkout-button:hover {
  background-color: #218838;
  transform: translateY(-2px); /* Slight lift on hover */
}

#checkout-button:active {
  background-color: #1e7e34; /* Darker when pressed */
  transform: translateY(0px); /* Pressed down effect */
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 999;
}

.modal-content {
  background: white;
  padding: 40px;
  border-radius: 12px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
  animation: fadeIn 0.3s ease;
}

.modal-content .checkmark {
  font-size: 50px;
  margin-bottom: 15px;
  color: #4caf50;
}

.modal-content h2 {
  margin-bottom: 10px;
}

.modal-content p {
  color: #666;
}

#close-modal {
  margin-top: 20px;
  padding: 12px 24px; /* Slightly increased padding */
  background-color: #4caf50;
  color: white;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease; /* Added transform transition */
}

#close-modal:hover {
  background-color: #3e8e41;
  transform: translateY(-2px); /* Slight lift on hover */
}

#close-modal:active {
  background-color: #367c39; /* Darker when pressed */
  transform: translateY(0px); /* Pressed down effect */
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* === Global Styles === */
body {
  font-family: "Segoe UI", sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f9f9f9;
  color: #333;
}

.container {
  max-width: 800px;
  margin: 60px auto;
  padding: 20px;
  background-color: white;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
  border-radius: 12px;
}

h1,
h2 {
  text-align: center;
  margin-bottom: 30px;
}

/* === Cart Styles === */
#cart-items {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-bottom: 30px;
}

.cart-item {
  background-color: #f0f0f0;
  padding: 15px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.cart-item button {
  background-color: #ff4d4d;
  color: white;
  border: none;
  padding: 8px 15px; /* Slightly increased horizontal padding */
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.1s ease; /* Added transform transition */
}

.cart-item button:hover {
  background-color: #e04343;
  transform: translateY(-1px); /* Slight lift on hover */
}

.cart-item button:active {
  background-color: #c82333; /* Darker when pressed */
  transform: translateY(0px); /* Pressed down effect */
}

#cart-total {
  text-align: right;
  font-size: 1.2em;
  margin-bottom: 20px;
}

/* === Receipt Styles === */
#receipt {
  text-align: left;
  margin-top: 20px;
  padding: 20px;
  background-color: #fafafa;
  border-radius: 10px;
  font-size: 16px;
  line-height: 1.6;
  color: #333;
  border: 1px dashed #ccc;
}

#receipt h3 {
  margin-top: 0;
  font-size: 20px;
  border-bottom: 1px solid #ccc;
  padding-bottom: 8px;
}
#receipt-items {
  max-height: 200px; /* Adjust as needed */
  overflow-y: auto;
  padding-right: 10px; /* optional: prevent cut-off of scrollbar */
}

.scrollable-receipt {
  max-height: 200px;
  overflow-y: auto;
}

.receipt-item {
  display: flex;
  justify-content: space-between;
  margin: 5px 0;
}

.receipt-meta {
  margin-top: 15px;
  font-size: 14px;
  color: #666;
  border-top: 1px solid #ddd;
  padding-top: 10px;
}

#receipt .total-line {
  font-weight: bold;
  font-size: 18px;
  margin-top: 10px;
  border-top: 1px solid #bbb;
  padding-top: 8px;
}

#receipt .highlight {
  color: #000;
  font-weight: bold;
}

.order-number {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 8px;
  color: #444;
}

.mwst-line {
  font-size: 14px;
  color: #777;
}

/* === Truck Progress Bar === */
.order-progress {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid #ccc;
  border-radius: 8px;
  background-color: #f9f9f9;
}

.progress-bar-container {
  width: 100%;
  background-color: #ddd;
  border-radius: 10px;
  overflow: hidden;
  height: 30px;
  position: relative;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: linear-gradient(135deg, #2196f3 /* #8b0202 */, #0d7b0d);
  transition: width 1s ease;
  border-radius: 10px;
}

#truck-icon {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  left: 0%; /* Start at 0% */
  font-size: 24px;
  color: #333;
  transition: left 1s ease; /* Smooth movement */
}

#progress-text {
  margin-top: 10px;
}

/* === Payment Section (Stripe-style) === */
.payment-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.payment-option {
  transition: all 0.25s ease, transform 0.15s ease; /* Added transform to existing transition */
  cursor: pointer;
  border: 1px solid #e0e0e0;
  background-color: #fff;
  padding: 35px;
  margin: 15px;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(50, 50, 93, 0.1), 0 1px 0 rgba(0, 0, 0, 0.07);
  position: relative;
}

.payment-option:hover {
  transform: translateY(-3px); /* Increased lift slightly */
  box-shadow: 0 4px 12px rgba(50, 50, 93, 0.15), 0 2px 5px rgba(0, 0, 0, 0.05);
  border-color: #635bff;
}

.payment-option.selected {
  border-color: #635bff;
  background-color: #f5f3ff;
  transform: translateY(-1px); /* Keep a slight lift when selected */
}

.payment-option:active { /* Feedback when clicking the whole option box */
  transform: translateY(0px);
  box-shadow: 0 1px 3px rgba(50, 50, 93, 0.1), 0 1px 0 rgba(0, 0, 0, 0.07);
}


.payment-option h4 {
  font-size: 18px;
  font-weight: 600;
  color: #32325d;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  pointer-events: none; /* This is correct with the JS change above */
}

.payment-option h4 i {
  margin-right: 10px;
  color: #635bff; /* Default icon color */
}

/* Specific styling for Cash Option to make it less "ugly" */
#cash-option h4 {
  color: #1a652f; /* Dark green text for cash option title */
}

#cash-option h4 i {
  color: #28a745; /* Brighter green icon for cash */
}

#cash-option:hover {
  border-color: #28a745; /* Green border on hover for cash option */
  /* It will inherit other hover effects like transform and box-shadow from .payment-option */
}

#cash-option.selected {
  border-color: #28a745; /* Green border when selected for cash option */
  background-color: #e6f4e6; /* Light green background when selected for cash option */
}

/* === Credit Card Input === */
.credit-card-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 15px; /* Increased margin for better spacing */
}

#credit-card-number {
  width: 100%;
  padding: 14px 18px; /* Slightly increased padding */
  padding-right: 45px; /* Make space for the icon inside the input */
  font-size: 16px;
  border: 1px solid #ced4da; /* Lighter border color */
  border-radius: 8px; /* Slightly more rounded corners */
  box-sizing: border-box;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; /* Smooth transitions */
}

#credit-card-number:focus {
  border-color: #635bff; /* Your theme color for focus */
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(99, 91, 255, 0.25); /* Subtle focus glow */
}

.card-type-icon {
  position: absolute;
  right: 18px; /* Adjusted position */
  top: 50%;
  transform: translateY(-50%);
  font-size: 26px; /* Slightly larger icon */
  color: #adb5bd; /* Lighter icon color */
  pointer-events: none;
}

/* General styling for other input fields */
#cardholder-name,
#expiry-date,
#cvv,
#cash-amount { /* Added #cash-amount here */
  width: 100%;
  padding: 14px 18px; /* Consistent padding */
  font-size: 16px;
  border: 1px solid #ced4da; /* Consistent lighter border */
  border-radius: 8px; /* Consistent rounded corners */
  margin-bottom: 15px; /* Consistent margin */
  box-sizing: border-box;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out; /* Smooth transitions */
}

/* Focus state for these fields */
#cardholder-name:focus,
#expiry-date:focus,
#cvv:focus,
#cash-amount:focus { /* Added #cash-amount here */
  border-color: #635bff; /* Your theme color for focus */
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(99, 91, 255, 0.25); /* Subtle focus glow */
}

/* Styling for input field labels */
.payment-details label {
  display: block;
  margin-bottom: 8px; /* Increased space below label */
  font-weight: 500; /* Slightly bolder */
  color: #495057; /* Darker label color for better contrast */
  font-size: 15px; /* Slightly adjusted font size */
}

.payment-details label i.fa-solid,
.payment-details label i.fa-regular { /* Added fa-regular for cash icon */
  margin-right: 10px; /* Increased space next to icon */
  color: #6c757d; /* Consistent icon color */
  width: 1.1em;
  text-align: center;
}


#credit-card-error,
#cardholder-name-error,
#expiry-date-error,
#cvv-error,
#cash-error { /* Added #cash-error here */
  color: #dc3545; /* Standard error red */
  font-size: 14px;
  display: none;
  margin-top: -10px; /* Adjust to pull error message closer to input */
  margin-bottom: 10px;
}

.card-details-row {
  display: flex;
  gap: 20px; /* Increased gap */
  align-items: flex-start;
}

/* === Payment Logos === */
.payment-logos {
  margin-top: 20px;
  text-align: center;
}

.payment-logos h4 {
  font-size: 18px;
  margin-bottom: 10px;
  color: #333;
}

.payment-logos .logos {
  display: flex;
  justify-content: center;
  gap: 15px;
}

.payment-logos .payment-logo {
  max-width: 100px;
  max-height: 100px;
  object-fit: contain;
}

.payment-logos .payment-logo:hover {
  opacity: 0.7;
}

/* === Bargeld input and label === */
#bargeld-label,
#bargeld-input {
  display: none;
  margin-top: 10px;
  font-size: 14px;
}

#bargeld-input {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid #ccc;
  width: 100%;
}

/* === Twint QR Code Styling === */
.twint-qr-code-container {
  display: block; /* Allows margin auto for centering */
  width: -moz-fit-content; /* Firefox */
  width: fit-content; /* Modern browsers */
  margin: 15px auto; /* Center the container and add vertical margin */
  padding: 10px; /* Creates a white space between the red border and the QR image */
  border: 3px solid #e50000; /* Twint's characteristic red color */
  border-radius: 8px; /* Slightly rounded corners for the red border */
  background-color: white; /* Ensures the padding area is white */
  box-shadow: 0 2px 4px rgba(0,0,0,0.1); /* Optional: subtle shadow for depth */
}

.twint-qr-image {
  display: block; /* Removes any extra space below the image if it were inline */
  width: 120px; /* Matches the size specified in the QR code URL */
  height: 120px; /* Matches the size specified in the QR code URL */
}

/* === Responsive === */
@media (max-width: 600px) {
  .payment-options {
    gap: 10px;
  }

  .payment-logos .logos {
    flex-direction: column;
  }

  .receipt-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .receipt-item span {
    margin-top: 4px;
  }
}

.hidden {
  display: none;
}

.points-popup {
  position: fixed;
  top: 70px;
  right: 20px;
  background-color: #ff5722;
  color: white;
  padding: 10px 20px;
  border-radius: 20px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  font-size: 1rem;
  font-weight: bold;
  z-index: 1000;
  animation: fadein 0.3s ease, fadeout 0.5s ease 2s;
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkmark {
  font-size: 1.2rem;
  margin-left: auto;
  opacity: 0;
}

@keyframes checkmark-animation {
  0% {
    opacity: 0;
    transform: scale(0);
  }
  50% {
    opacity: 1;
    transform: scale(1.5);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes fadein {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeout {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
