:root {
  --primary-color: #7e57c2;
  --text-color: #1a1f36;
  --border-color: #e3e8ee;
  --background-color: #f7fafc;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.5;
}

.checkout-container {
  max-width: 600px;
  margin: 2rem auto;
  padding: 2rem;
  /* background: white; */
  /* border-radius: 8px; */
  /* box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); */
}

.payment-header {
  margin-bottom: 2rem;
  text-align: center;
  min-height: 48px; /* Height of the button to prevent layout shift */
  display: flex;
  justify-content: center;
  align-items: center;
}

.card-payment-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.3s;
  opacity: 1;
  margin: 0 auto; /* Additional centering */
  display: inline-block;
}

.card-payment-btn:hover {
  background-color: #9575cd;
}

.card-payment-btn[style*="display: none"] {
  opacity: 0;
}

.verify-payment-btn {
  background-color: #34d399;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: background-color 0.2s;
  margin-top: 1rem;
  display: inline-block;
}

.verify-payment-btn:hover {
  background-color: #10b981;
}

.verify-payment-btn:disabled {
  background-color: #9ca3af;
  cursor: not-allowed;
}

.merchant-details {
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-color);
}

.merchant-details h2 {
  color: var(--text-color);
  margin-bottom: 0.5rem;
}

.merchant-details p {
  color: #697386;
  font-size: 0.9rem;
}

.payment-reference {
  margin-bottom: 2rem;
  padding: 1rem;
  background-color: #f8fafc;
  border-radius: 6px;
  border: 1px solid var(--border-color);
}

.payment-reference p {
  color: var(--text-color);
  font-size: 0.9rem;
  margin: 0;
}

.payment-details {
  margin-bottom: 2rem;
}

.amount-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 1rem;
}

.amount-row.total {
  border-top: 2px solid var(--border-color);
  margin-top: 1rem;
  padding-top: 1rem;
  font-weight: bold;
  font-size: 1.2rem;
}

.qr-section {
  text-align: center;
  margin-bottom: 2rem;
}

.qr-section h3 {
  margin-bottom: 1rem;
}

.qr-container {
  position: relative;
  display: flex;
  justify-content: center;
  margin-bottom: 1rem;
}

.qr-wrapper {
  position: relative;
  display: inline-block;
}

.qr-code {
  background: white;
  padding: 1rem;
  border-radius: 8px;
  display: inline-block;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.download-qr-btn {
  position: absolute;
  left: 50%;
  bottom: -10px;
  transform: translate(-50%, 100%);
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 6px;
  padding: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  transition: all 0.3s ease;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.qr-wrapper:hover .download-qr-btn {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 50%);
}

.download-qr-btn:hover {
  background-color: var(--background-color);
  color: var(--primary-color);
  border-color: var(--primary-color);
}

.download-qr-btn svg {
  opacity: 0.7;
}

.qr-instruction {
  color: #697386;
  font-size: 0.9rem;
  margin-bottom: 1rem;
  margin-top: 2.5rem;
}

.payment-status {
  text-align: center;
  padding: 1rem;
  margin-top: 1rem;
  border-radius: 6px;
  display: none;
}

.payment-status.success {
  display: block;
  background-color: #e6f4ea;
  color: #1e7e34;
}

.payment-status.error {
  display: block;
  background-color: #fde7e9;
  color: #dc3545;
}


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

/* Processing Overlay */
.processing-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(2px);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.processing-content {
  text-align: center;
  padding: 2rem;
  background: white;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.processing-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid #e3e8ee;
  border-radius: 50%;
  border-top-color: var(--primary-color);
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem auto;
}

.processing-text {
  font-size: 1.1rem;
  color: var(--text-color);
  font-weight: 500;
}


/* Sticky Footer Styles */
.sticky-footer {
  position: sticky;
  bottom: 0;
  left: 0;
  width: 100%;
  background: white;
  border-top: 1px solid var(--border-color);
  padding: 1rem;
  margin-top: 2rem;
}

.footer-content {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 2rem;
  max-width: 100%;
  padding-top: 1rem;
}

.powered-by {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #6b7280;
  font-size: 0.9rem;
  font-weight: normal;
}

.yaya-logo {
  height: 20px;
  width: 60px;
  object-fit: contain;
}

.language-switcher select {
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  background-color: white;
  color: #6b7280;
  font-size: 0.9rem;
  font-weight: normal;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s;
}

.language-switcher select:hover,
.language-switcher select:focus {
  border-color: var(--primary-color);
}

/* Responsive Design */
@media (max-width: 640px) {
  .checkout-container {
    margin: 0;
    padding: 1rem;
    border-radius: 0;
    box-shadow: none;
  }

  .card-payment-btn {
    width: 100%;
  }

  .amount-row {
    font-size: 0.9rem;
  }

  .amount-row.total {
    font-size: 1.1rem;
  }

  .footer-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .powered-by {
    justify-content: center;
  }
}

/* Language Selector Styles */
.language-selector {
  position: relative;
  display: inline-block;
  min-width: 200px;
  cursor: pointer;
}

.language-selector-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  width: 100%;
}

.language-selector-btn:hover {
  background: #f0f1f2;
  border-color: #d0d0d0;
}

.language-selector-btn img {
  width: 24px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
}

.language-dropdown {
  position: absolute;
  top: auto;
  bottom: calc(100% + 4px);
  left: 0;
  width: 100%;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  display: none;
  z-index: 1000;
  overflow: hidden;
  transform-origin: bottom right;
}

.language-dropdown.show {
  display: block;
}

.language-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  text-decoration: none;
  color: #333;
  transition: all 0.2s ease;
  border-bottom: 1px solid #e0e0e0;
}

.language-option:last-child {
  border-bottom: none;
}

.language-option:hover {
  background: #f0f1f2;
}

.language-option.active {
  background: #e7f0ff;
  color: #0066cc;
}

.language-option.active:hover {
  background: #d9e8ff;
}

.language-option img {
  width: 24px;
  height: 12px;
  object-fit: cover;
  border-radius: 2px;
}

.transaction-details span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 48%;
  display: inline-block;
  vertical-align: middle;
}
.transaction-details strong {
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
  max-width: none;
  min-width: fit-content;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

/* Notification System Styles */
.notification-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.notification {
  min-width: 300px;
  max-width: 400px;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  background: white;
  animation: slideIn 0.3s ease-out;
  transition: transform 0.3s ease-out, opacity 0.3s ease-out;
  pointer-events: auto;
}

.notification.notification-hiding {
  transform: translateX(100%);
  opacity: 0;
}

.notification-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.notification-message {
  flex: 1;
  font-size: 14px;
  line-height: 1.4;
  color: var(--text-color);
}

.notification-close {
  background: none;
  border: none;
  color: #666;
  font-size: 20px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  flex-shrink: 0;
}

.notification-close:hover {
  color: #333;
}

.notification-success {
  border-left: 4px solid var(--success-color);
}

.notification-error {
  border-left: 4px solid var(--error-color);
}

.notification-info {
  border-left: 4px solid #17a2b8;
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Spinner animation for loading states */
.spinner {
  animation: spin 1s linear infinite;
}

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

/* Loading state for buttons */
.card-payment-btn:disabled,
.verify-payment-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}

.card-payment-btn .spinner,
.verify-payment-btn .spinner {
  margin-right: 8px;
  width: 16px;
  height: 16px;
}
