/* Stripe SG Gateway — minimal Singapore-themed styles */

:root {
  --sg-red: #c91f37;
  --sg-red-dark: #9e1224;
  --sg-blue: #003366;
  --sg-gray: #555;
  --sg-light: #f8f9fa;
  --sg-border: #e0e0e0;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background: var(--sg-light);
  color: var(--sg-gray);
  line-height: 1.6;
}

#app-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 24px;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

header h1 {
  color: var(--sg-blue);
  font-size: 1.75rem;
}

.subtitle {
  color: var(--sg-gray);
  font-size: 0.95rem;
  margin-top: 4px;
}

.payment-form-section {
  background: #fff;
  border-radius: 12px;
  padding: 28px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.payment-form-section h2 {
  color: var(--sg-blue);
  font-size: 1.25rem;
  margin-bottom: 20px;
}

.form-group {
  margin-bottom: 18px;
}

.form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--sg-gray);
}

.form-group input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--sg-border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  transition: border-color 0.2s;
}

.form-group input:focus {
  outline: none;
  border-color: var(--sg-red);
  box-shadow: 0 0 0 3px rgba(201, 31, 55, 0.1);
}

.note {
  font-size: 0.825rem;
  color: var(--sg-gray);
  margin: 12px 0;
  font-style: italic;
}

.error-message {
  background: #fff5f5;
  color: var(--sg-red);
  border: 1px solid #fed7d7;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.875rem;
}

.error-message.hidden {
  display: none;
}

.btn-primary {
  width: 100%;
  padding: 14px 24px;
  background: var(--sg-red);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover:not(:disabled) {
  background: var(--sg-red-dark);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  padding: 10px 20px;
  background: var(--sg-gray);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
}

.btn-secondary:hover {
  background: #333;
}

footer {
  text-align: center;
  margin-top: 32px;
  padding: 16px;
  color: var(--sg-gray);
  font-size: 0.85rem;
}

footer .flag {
  font-size: 1.1rem;
}

/* ===== Modal Overlay ===== */

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid var(--sg-border);
}

.modal-header h3 {
  color: var(--sg-blue);
  font-size: 1.15rem;
}

.close-button {
  background: none;
  border: none;
  font-size: 1.75rem;
  cursor: pointer;
  color: var(--sg-gray);
  padding: 4px 8px;
  line-height: 1;
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-subtitle {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--sg-blue);
  margin-bottom: 16px;
}

#payment-element-container {
  margin-bottom: 16px;
}

/* QR Code */
.qr-container {
  text-align: center;
  margin-top: 16px;
}

.qr-container h4 {
  color: var(--sg-blue);
  margin-bottom: 8px;
}

.qr-instructions {
  font-size: 0.85rem;
  color: var(--sg-gray);
  margin-bottom: 12px;
}

.qr-code {
  max-width: 220px;
  width: 100%;
  margin: 0 auto;
  border: 1px solid var(--sg-border);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
}

.qr-expiry {
  font-size: 0.75rem;
  color: var(--sg-gray);
  margin-top: 8px;
}

.payment-status {
  padding: 16px;
  border-radius: 8px;
  margin-top: 16px;
  text-align: center;
  font-weight: 500;
}

.payment-status.error {
  background: #fff5f5;
  color: var(--sg-red);
  border: 1px solid #fed7d7;
}

.payment-status.success {
  background: #f0fff4;
  color: #276749;
  border: 1px solid #c6f6d5;
}

.processing-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border-radius: 8px;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid #e0e0e0;
  border-top-color: var(--sg-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Success message */
.success-message {
  text-align: center;
  padding: 20px 0;
}

.success-icon {
  font-size: 3rem;
  color: #276749;
  margin-bottom: 12px;
}

.payment-ref {
  font-size: 0.85rem;
  color: var(--sg-gray);
  word-break: break-all;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--sg-border);
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

/* Add confirm button before footer */
#confirm-payment-btn {
  width: 100%;
  margin-top: 8px;
}

/* Mobile */
@media (max-width: 600px) {
  #app-container {
    padding: 16px;
  }

  .payment-form-section {
    padding: 20px;
  }

  .modal-footer {
    flex-direction: column;
  }

  #confirm-payment-btn {
    width: 100%;
  }
}