:root {
  --primary-color: #00A651;
  --primary-light: #4CAF50;
  --primary-dark: #008c44;
  --secondary-color: #00A651;
  --success-color: #4caf50;
  --error-color: #d90429;
  --warning-color: #ffbe0b;
  --text-color: #212529;
  --light-text: #6c757d;
  --background-color: #f8f9fa;
  --card-background: #ffffff;
  --border-color: #dee2e6;
  --shadow-color: rgba(0, 0, 0, 0.1);
  --countdown-bg: rgba(0, 166, 81, 0.1);
  --animation-duration: 0.3s;
}

body {
  font-family: "Poppins", "Segoe UI", Roboto, -apple-system, BlinkMacSystemFont,
    sans-serif;
  background-color: var(--background-color);
  color: var(--text-color);
  line-height: 1.5;
  margin: 0;
  padding: 0;
  font-size: 14px;
}

/* Loading Animation */
.loading-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(255, 255, 255, 0.9);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  border: 5px solid var(--border-color);
  border-top: 5px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.loading-text {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--light-text);
  text-align: center;
}

@keyframes spin {
  0% {
    transform: rotate(0deg);
  }
  100% {
    transform: rotate(360deg);
  }
}

/* Popup Container */
.popup-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  animation: fadeIn 0.3s ease-out;
}

.popup-content {
  background-color: var(--card-background);
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
  max-width: 90%;
  width: 400px;
  animation: slideIn 0.3s ease-out;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.popup-header {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-color);
  position: relative;
}

.popup-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
  text-align: center;
}

.popup-body {
  padding: 1rem 0;
  color: var(--light-text);
  line-height: 1.6;
  flex: 1;
}

.popup-message {
  font-size: 0.9rem;
  color: var(--light-text);
  line-height: 1.6;
}

.popup-message-important {
  font-size: 0.9rem;
  color: var(--error-color);
  line-height: 1.6;
  font-weight: 600;
}

.popup-footer {
  padding: 1rem 0 0;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border-top: 1px solid var(--border-color);
  margin-top: 1rem;
  width: 100%;
}

.popup-confirm-btn {
  flex: 1;
  padding: 0.75rem 0;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: var(--primary-color);
  color: white;
}

.popup-confirm-btn:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes slideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Header - Green Background with Order Info */
.header {
  background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
  color: white;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 101;
  padding: 1rem 1.2rem;
}

.header-content {
  max-width: 480px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: flex-start;
  position: relative;
}

/* Left: Date Time and Order Number */
.header-left {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.order-datetime {
  font-size: 0.75rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.9);
}

.order-number {
  font-size: 0.65rem;
  font-weight: 400;
  color: rgba(255, 255, 255, 0.85);
  word-break: break-all;
}

/* Center: Amount Display */
.amount-display-center {
  display: flex;
  align-items: baseline;
  gap: 0.2rem;
  margin-top: 0.3rem;
}

.currency-symbol {
  font-size: 1.5rem;
  font-weight: 600;
  color: white;
}

.amount {
  font-size: 2rem;
  font-weight: 700;
  color: white;
}

/* Right: Countdown Timer */
.countdown-display {
  position: absolute;
  top: 1rem;
  right: 1.2rem;
}

.countdown {
  font-size: 1.5rem;
  font-weight: 700;
  color: white;
  background-color: rgba(255, 255, 255, 0.15);
  padding: 0.4rem 0.8rem;
  border-radius: 0.5rem;
}

/* Main Content */
.main-content {
  max-width: 480px;
  margin: 0 auto;
  padding: 1rem;
  margin-top: 120px;
}

/* Payment Methods Section - Button Style */
.payment-methods-section {
  background-color: var(--card-background);
  border-radius: 0.75rem;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.payment-methods-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.payment-method-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background-color: #f8f9fa;
  border: 2px solid var(--border-color);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.payment-method-item:hover {
  border-color: var(--primary-color);
  background-color: rgba(0, 166, 81, 0.05);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 166, 81, 0.2);
}

.payment-method-item:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 166, 81, 0.2);
}

.payment-method-icon {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border-radius: 0.25rem;
  flex-shrink: 0;
}

.payment-method-name {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
}

/* QR Code Section */
.qr-section {
  background-color: var(--card-background);
  border-radius: 0.75rem;
  padding: 1.5rem 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px var(--shadow-color);
  text-align: center;
}

.qr-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  /* margin-bottom: 1rem; */
}

.qr-badge {
  background-color: var(--primary-color);
  color: white !important;
  padding: 0.25rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 1rem !important;
  margin-bottom: 0.8rem !important;
  font-weight: 600;
}

.qr-subtitle {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-color);
}

.qr-container {
  display: flex;
  justify-content: center;
  margin: 0.6rem 0 1.5rem;
}

.qr-code {
  padding: 1rem;
  background-color: white;
  border-radius: 0.5rem;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.qr-warning {
  font-size: 0.85rem;
  color: var(--error-color);
  font-weight: 500;
  margin-top: 1rem;
}

/* Manual Payment Section */
.manual-payment-section {
  background-color: var(--card-background);
  border-radius: 0.75rem;
  padding: 1.5rem 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.manual-payment-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  /* margin-bottom: 1.5rem; */
}

.manual-payment-subtitle {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-color);
}

/* Account Section */
.account-section {
  margin-bottom: 1.5rem;
}

.account-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--light-text);
  margin-bottom: 0.4rem;
  text-align: left;
}

.account-input-group {
  display: flex;
  gap: 0.5rem;
}

.account-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-color);
  background-color: #f8f9fa;
  height: 2.2rem;
}

.account-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0, 166, 81, 0.25);
}

.copy-btn {
  padding: 0.5rem 1rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  white-space: nowrap;
  height: 2.2rem;
}

.copy-btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 166, 81, 0.3);
}

/* UTR Section Inline */
.utr-section-inline {
  margin-bottom: 1rem;
}

.utr-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--light-text);
  margin-bottom: 0.4rem;
  text-align: left;
}

.utr-input-group {
  display: flex;
  gap: 0.5rem;
}

.utr-input {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-color);
  background-color: white;
  height: 2.2rem;
}

.utr-input::placeholder {
  color: var(--light-text);
  opacity: 0.6;
}

.utr-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.2rem rgba(0, 166, 81, 0.25);
}

.submit-btn {
  padding: 0.5rem 1rem;
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0.5rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.3s ease;
  white-space: nowrap;
  height: 2.2rem;
}

.submit-btn:hover {
  background-color: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 166, 81, 0.3);
}

.payment-instruction {
  font-size: 0.8rem;
  color: var(--light-text);
  font-style: italic;
  text-align: left;
  margin-top: 0.5rem;
}

/* Contact and Instructions Section */
.contact-section {
  background-color: var(--card-background);
  border-radius: 0.75rem;
  padding: 1.5rem 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px var(--shadow-color);
}

.contact-link {
  display: inline-block;
  color: #007bff;
  text-decoration: underline;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 1rem;
  cursor: pointer;
}

.contact-link:hover {
  color: #0056b3;
}

.instruction-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.instruction-item {
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  text-align: left;
}

.instruction-number {
  font-weight: 600;
  color: var(--text-color);
  flex-shrink: 0;
}

.instruction-text {
  font-size: 0.9rem;
  color: var(--light-text);
  line-height: 1.5;
}

/* Language Selector Container (Hidden by default) */
.language-selector-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 102;
}

/* 语言选择器下拉菜单容器 */
.language-dropdown {
  position: relative;
  display: inline-block;
  font-family: "Roboto", sans-serif;
  z-index: 100;
}

/* 当前选中的语言显示 */
.selected-language {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-color: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--primary-color);
  border-radius: 20px;
  width: auto;
  min-width: 70px;
  height: 36px;
  cursor: pointer;
  font-size: 18px;
  color: #333;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  line-height: 1;
  padding: 0 8px;
}

.selected-language:hover {
  background-color: #f5f5f5;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

.selected-language:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(0, 166, 81, 0.25);
}

/* 语言选项下拉菜单 */
.language-options {
  position: absolute;
  top: 100%;
  left: -20px;
  background-color: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  margin-top: 4px;
  padding: 4px;
  list-style: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  max-height: 200px;
  overflow-y: auto;
  min-width: 80px;
}

/* 各语言选项 */
.language-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px;
  cursor: pointer;
  font-size: 14px;
  transition: background-color 0.2s ease;
  border-radius: 4px;
  margin-bottom: 4px;
}

.language-option:last-child {
  margin-bottom: 0;
}

.language-option:hover {
  background-color: #f5f5f5;
}

.language-option.active {
  background-color: rgba(0, 166, 81, 0.1);
  color: var(--primary-color);
  font-weight: 500;
}

/* 语言旗帜图标 */
.language-flag {
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
}

/* 语言代码样式 */
.language-code {
  font-size: 14px;
  font-weight: 500;
}

/* Quick Pay Apps Section (Hidden - kept for JS compatibility) */
.quick-pay-section {
  display: none;
}

.quick-pay-title {
  display: none;
}

.quick-pay-grid {
  display: none;
}

/* Toast Notifications */
.toast-container {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 9999;
}

.toast {
  padding: 1rem;
  border-radius: 0.25rem;
  margin-bottom: 0.5rem;
  box-shadow: 0 2px 8px var(--shadow-color);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.toast.show {
  animation: slideInToast 0.3s ease-in;
}

.toast.hide {
  animation: slideOutToast 0.3s ease-out;
}

.toast-success {
  background-color: var(--success-color);
  color: white;
}

.toast-error {
  background-color: var(--error-color);
  color: white;
}

@keyframes slideInToast {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutToast {
  from {
    transform: translateX(0);
    opacity: 1;
  }
  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

/* Modal Styles */
.modal-content {
  border-radius: 0.5rem;
  border: none;
  overflow: hidden;
  box-shadow: 0 4px 15px var(--shadow-color);
}

.modal-header {
  border-bottom-color: var(--border-color);
  padding: 0.8rem 1rem;
}

.modal-body {
  padding: 1.2rem;
}

.modal-footer {
  border-top-color: var(--border-color);
  padding: 0.8rem 1rem;
}

/* Status Pages Common Styles */
.success-container,
.error-container,
.timeout-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 2rem;
  margin-bottom: 2rem;
  padding: 1.5rem;
  background-color: var(--card-background);
  border-radius: 0.5rem;
  box-shadow: 0 2px 4px var(--shadow-color);
  text-align: center;
  margin-top: 65px;
  max-width: 480px;
  margin-left: auto;
  margin-right: auto;
}

.success-title,
.error-title,
.timeout-title {
  margin-top: 1.5rem;
  font-weight: 600;
  color: var(--text-color);
  font-size: 1.5rem;
}

.success-message,
.error-message,
.timeout-message {
  margin: 1rem 0 2rem;
  color: var(--light-text);
  max-width: 400px;
  font-size: 0.9rem;
}

.success-title {
  color: var(--success-color);
}

.error-title {
  color: var(--error-color);
}

.timeout-title {
  color: var(--warning-color);
}

/* Return Button Styles */
.return-btn {
  padding: 0.7rem 1.5rem;
  border: none;
  border-radius: 0.25rem;
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--animation-duration);
  font-size: 0.9rem;
}

.success-container .return-btn {
  background-color: var(--success-color);
}

.success-container .return-btn:hover {
  background-color: #2a9d00;
}

.error-container .return-btn,
.timeout-container .return-btn {
  background-color: var(--primary-color);
}

.error-container .return-btn:hover,
.timeout-container .return-btn:hover {
  background-color: var(--primary-light);
}

/* Embedded Container Styles */
.embedded-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--background-color);
  display: flex;
  flex-direction: column;
  z-index: 10000;
  overflow: hidden;
}

.embedded-header {
  background-color: var(--card-background);
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: center;
  align-items: center;
  box-shadow: 0 2px 4px var(--shadow-color);
  z-index: 10001;
}

.embedded-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-color);
}

.embedded-content {
  flex: 1;
  position: relative;
  overflow: hidden;
}

#upstream-iframe {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background-color: white;
}

/* Loading state for iframe */
.embedded-content::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  z-index: 1;
}

/* Hide loading when iframe is loaded */
.embedded-container .embedded-content.loaded::before,
.embedded-container .embedded-content[data-loaded="true"]::before {
  content: none !important;
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  animation: none !important;
}

/* Frame blocked error styles */
.frame-blocked-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 2rem;
  text-align: center;
  background-color: var(--background-color);
}

.frame-blocked-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  opacity: 0.6;
}

.frame-blocked-title {
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--text-color);
  margin-bottom: 1rem;
}

.frame-blocked-message {
  font-size: 1rem;
  color: var(--light-text);
  line-height: 1.6;
  margin-bottom: 2rem;
  max-width: 400px;
}

.frame-blocked-button {
  background-color: var(--primary-color);
  color: white;
  border: none;
  border-radius: 0.5rem;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
}

.frame-blocked-button:hover {
  background-color: var(--primary-light);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .embedded-header {
    padding: 0.6rem 0.8rem;
  }

  .embedded-title {
    font-size: 1rem;
  }

  .header {
    padding: 0.8rem 1rem;
  }

  .countdown-display {
    top: 0.8rem;
    right: 1rem;
  }

  .order-datetime,
  .order-number {
    font-size: 0.65rem;
  }

  .amount {
    font-size: 1.5rem;
  }

  .currency-symbol {
    font-size: 1.2rem;
  }

  .countdown {
    font-size: 1.2rem;
    padding: 0.3rem 0.6rem;
  }
}
