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

body {
  font-family:
    -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell',
    sans-serif;
  background: #f5f7fa;
  padding: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.trigger-btn {
  background: rgb(25, 119, 242);
  color: white;
  border: none;
  padding: 14px 32px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(25, 119, 242, 0.3);
}

.trigger-btn:hover {
  background: rgb(20, 100, 220);
  box-shadow: 0 4px 12px rgba(25, 119, 242, 0.4);
  transform: translateY(-1px);
}

.payment-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 1000;
  animation: fadeIn 0.2s ease;
}

.payment-overlay.active {
  display: flex;
  justify-content: center;
  align-items: center;
}

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

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* OPTIMIZED DESKTOP - No scrolling needed */
.payment-popup {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 900px;
  max-height: 90vh;
  min-height: 650px;
  /*height: auto;*/
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s ease;
  display: flex;
  flex-direction: column;
}

.payment-header {
  background: rgb(25, 119, 242);
  color: white;
  padding: 14px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.payment-header h2 {
  font-size: 18px;
  font-weight: 600;
}

.close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.payment-amount {
  background: #f8f9fa;
  padding: 12px 20px;
  border-bottom: 1px solid #e9ecef;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.amount-label {
  font-size: 12px;
  color: #6c757d;
  margin-bottom: 2px;
}

.amount-value {
  font-size: 24px;
  font-weight: 700;
  color: #212529;
}

.payment-body {
  display: flex;
  flex: 1;
  overflow-y: auto;
  position: relative;
  min-height: 0;
}

/* Left Sidebar - Payment Methods - Compact */
.payment-sidebar {
  width: 260px;
  background: #f8f9fa;
  border-right: 1px solid #e9ecef;
  overflow-y: auto;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.sidebar-title {
  padding: 12px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.payment-methods {
  padding: 0 10px 10px 10px;
}

.payment-method {
  background: white;
  border: 2px solid #e9ecef;
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.payment-method:hover {
  border-color: rgb(25, 119, 242);
  background: rgba(25, 119, 242, 0.02);
  transform: translateX(4px);
}

.payment-method.active {
  border-color: rgb(25, 119, 242);
  background: rgba(25, 119, 242, 0.1);
}

.method-icon {
  width: 36px;
  height: 36px;
  background: rgba(25, 119, 242, 0.1);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.payment-method.active .method-icon {
  background: rgb(25, 119, 242);
  transform: scale(1.1);
}

.method-details {
  flex: 1;
  min-width: 0;
}

.method-name {
  font-weight: 600;
  font-size: 13px;
  color: #212529;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow-y: auto;
  text-overflow-y: ellipsis;
}

.method-description {
  font-size: 11px;
  color: #6c757d;
  white-space: nowrap;
  overflow-y: auto;
  text-overflow-y: ellipsis;
}

/* Right Content Area - Optimized */
.payment-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: transform 0.2s ease;
  min-height: 0;
}

.content-area {
  flex: 1;
  padding: 18px;
  overflow-y: auto;
  scroll-behavior: smooth;
  min-height: 0;
  position: relative;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #6c757d;
  text-align: center;
  padding: 30px;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.empty-state.hidden {
  opacity: 0;
  pointer-events: none;
}

.empty-state-icon {
  font-size: 52px;
  margin-bottom: 14px;
  opacity: 0.5;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: #495057;
  margin-bottom: 6px;
}

.empty-state-text {
  font-size: 13px;
}

.payment-form {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  transform: translateY(20px);
}

.payment-form.active {
  opacity: 1;
  position: relative;
  left: 0;
  right: 0;
  pointer-events: all;
  transform: translateY(0);
}

.form-header {
  margin-bottom: 16px;
  transition: all 0.2s ease;
}

.form-header-title {
  font-size: 18px;
  font-weight: 700;
  color: #212529;
  margin-bottom: 6px;
}

.form-header-description {
  font-size: 13px;
  color: #6c757d;
}

.form-group {
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #212529;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  padding: 10px;
  border: 2px solid #e9ecef;
  border-radius: 6px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.form-input:focus {
  outline: none;
  border-color: rgb(25, 119, 242);
  box-shadow: 0 0 0 3px rgba(25, 119, 242, 0.1);
  transform: translateY(-1px);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.recurring-section {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 10px;
  margin-top: 12px;
  transition: all 0.2s ease;
  display: none;
}

.recurring-section:hover {
  background: #e9ecef;
}

.recurring-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.recurring-checkbox input[type='checkbox'] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: rgb(25, 119, 242);
  transition: all 0.2s ease;
}

.recurring-checkbox label {
  font-size: 13px;
  font-weight: 600;
  color: #212529;
  cursor: pointer;
}

.recurring-info {
  font-size: 12px;
  color: #6c757d;
  margin-top: 6px;
  padding-left: 24px;
}

.payment-footer {
  padding: 14px 18px;
  border-top: 1px solid #e9ecef;
  background: white;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.pay-button {
  width: 100%;
  background: rgb(25, 119, 242);
  color: white;
  border: none;
  padding: 12px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pay-button:hover:not(:disabled) {
  background: rgb(20, 100, 220);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(25, 119, 242, 0.3);
}

.pay-button:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.secure-badge {
  text-align: center;
  font-size: 11px;
  color: #6c757d;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}

.success-message {
  opacity: 0;
  position: absolute;
  top: 0;
  left: 18px;
  right: 18px;
  text-align: center;
  padding: 30px 18px;
  pointer-events: none;
  transition:
    opacity 0.2s ease,
    transform 0.2s ease;
  transform: scale(0.9);
}

.success-message.active {
  opacity: 1;
  position: relative;
  left: 0;
  right: 0;
  pointer-events: all;
  transform: scale(1);
}

.success-icon {
  width: 70px;
  height: 70px;
  background: #28a745;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  font-size: 36px;
  color: white;
  animation: scaleIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.success-title {
  font-size: 20px;
  font-weight: 700;
  color: #212529;
  margin-bottom: 6px;
}

.success-description {
  font-size: 14px;
  color: #6c757d;
  margin-bottom: 20px;
}

.ussd-code {
  background: #f8f9fa;
  border: 2px dashed #dee2e6;
  border-radius: 6px;
  padding: 14px;
  text-align: center;
  margin-top: 12px;
  transition: all 0.2s ease;
}

.ussd-code:hover {
  border-color: rgb(25, 119, 242);
  background: rgba(25, 119, 242, 0.02);
}

.ussd-code-text {
  font-size: 20px;
  font-weight: 700;
  color: rgb(25, 119, 242);
  letter-spacing: 1.5px;
}

.account-details {
  background: #f8f9fa;
  border-radius: 6px;
  padding: 12px;
  margin-top: 12px;
  transition: all 0.2s ease;
}

.account-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #e9ecef;
  transition: all 0.2s ease;
}

.account-item:hover {
  padding-left: 6px;
  background: rgba(25, 119, 242, 0.02);
}

.account-item:last-child {
  border-bottom: none;
}

.account-label {
  font-size: 12px;
  color: #6c757d;
}

.account-value {
  font-size: 13px;
  font-weight: 600;
  color: #212529;
}

.qr-code {
  text-align: center;
  margin-top: 50px;
  margin-bottom: 35px;
}

.qr-placeholder {
  width: 180px;
  height: 180px;
  margin: 0 auto;
  background: #f8f9fa;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #dee2e6;
  transition: all 0.2s ease;
}

.qr-placeholder:hover {
  border-color: rgb(25, 119, 242);
  transform: scale(1.05);
}

/* Loading Styles */
.loading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.95);
  display: none;
  justify-content: center;
  align-items: center;
  /*border-radius: 16px;*/
  z-index: 10;
  backdrop-filter: blur(4px);
  transition: opacity 0.2s ease;
}

.loading-overlay.active {
  display: flex;
}

.loading-content {
  text-align: center;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid #e9ecef;
  border-top-color: rgb(25, 119, 242);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 16px;
}

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

.loading-text {
  font-size: 15px;
  color: #212529;
  font-weight: 600;
  margin-bottom: 4px;
}

.loading-subtext {
  font-size: 13px;
  color: #6c757d;
}

.dots::after {
  content: '';
  animation: dots 1.5s steps(4, end) infinite;
}

@keyframes dots {
  0%,
  20% {
    content: '';
  }
  40% {
    content: '.';
  }
  60% {
    content: '..';
  }
  80%,
  100% {
    content: '...';
  }
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

#businessLogoHeader {
  transition: transform 0.2s ease;
}

#businessLogoHeader:hover {
  transform: scale(1.05);
}

/* Hide back button on desktop */
.mobile-back-btn {
  display: none;
}

/* COMPACT MOBILE DESIGN - Reduced fonts, spacing, and weights */
@media (max-width: 768px) {
  body {
    padding: 0;
  }

  .payment-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    overflow-y: auto;
    padding: 0;
    margin: 0;
  }

  .payment-overlay.active {
    display: block;
  }

  .payment-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    border-radius: 0;
    overflow-y: auto;
    margin: 0;
    transform: none;
    animation: none;
    display: flex;
    flex-direction: column;
    padding-bottom: 60px;
  }

  /* COMPACT HEADER */
  .payment-header {
    padding: 20px 14px 10px 14px;
    min-height: 60px;
    flex-shrink: 0;
  }

  .payment-header h2 {
    font-size: 15px;
    font-weight: 500;
  }

  .close-btn {
    width: 32px;
    height: 32px;
    font-size: 20px;
  }

  /* COMPACT AMOUNT SECTION */
  .payment-amount {
    flex-shrink: 0;
    padding: 8px 14px;
  }

  .amount-label {
    font-size: 11px;
    font-weight: 400;
    margin-bottom: 1px;
  }

  .amount-value {
    font-size: 20px;
    font-weight: 600;
  }

  .payment-body {
    flex-direction: column;
    position: relative;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  /* COMPACT SIDEBAR */
  .payment-sidebar {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    border-right: none;
    border-bottom: 1px solid #e9ecef;
    transform: translateX(0);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .payment-sidebar.method-selected {
    transform: translateX(-100%);
  }

  .sidebar-title {
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.3px;
  }

  .payment-methods {
    padding: 0 10px 10px 10px;
  }

  /* COMPACT PAYMENT METHODS */
  .payment-method {
    padding: 10px;
    margin-bottom: 6px;
    border-radius: 8px;
    gap: 10px;
  }

  .method-icon {
    width: 36px;
    height: 36px;
    font-size: 16px;
    border-radius: 6px;
  }

  .method-name {
    font-size: 13px;
    font-weight: 500;
  }

  .method-description {
    font-size: 11px;
    font-weight: 400;
  }

  .payment-content {
    width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    transform: translateX(100%);
    display: flex;
    flex-direction: column;
  }

  .payment-content.has-selection {
    transform: translateX(0);
    z-index: 3;
  }

  /* COMPACT CONTENT AREA */
  .content-area {
    flex: 1;
    min-height: 0;
    padding: 12px;
    padding-bottom: 16px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* COMPACT FORMS */
  .form-header {
    margin-bottom: 12px;
  }

  .form-header-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 4px;
  }

  .form-header-description {
    font-size: 12px;
    font-weight: 400;
  }

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

  .form-label {
    font-size: 12px;
    font-weight: 500;
    margin-bottom: 5px;
  }

  .form-input,
  select.form-input {
    font-size: 14px;
    padding: 9px 10px;
    border-width: 1px;
    border-radius: 6px;
  }

  .form-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  /* COMPACT RECURRING SECTION */
  .recurring-section {
    margin-top: 20px;
    padding: 10px;
    border-radius: 6px;
  }

  .recurring-checkbox input[type='checkbox'] {
    width: 16px;
    height: 16px;
  }

  .recurring-checkbox label {
    font-size: 12px;
    font-weight: 500;
  }

  .recurring-info {
    font-size: 11px;
    font-weight: 400;
    margin-top: 5px;
    padding-left: 24px;
  }

  /* COMPACT ACCOUNT DETAILS */
  .account-details {
    padding: 10px;
    margin-top: 10px;
    border-radius: 6px;
  }

  .account-item {
    padding: 7px 0;
  }

  .account-label {
    font-size: 11px;
    font-weight: 400;
  }

  .account-value {
    font-size: 12px;
    font-weight: 500;
  }

  /* COMPACT USSD CODE */
  .ussd-code {
    padding: 12px;
    margin-top: 10px;
    border-radius: 6px;
  }

  .ussd-code-text {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 1px;
  }

  /* COMPACT QR CODE */
  .qr-placeholder {
    width: 160px;
    height: 160px;
  }

  /* COMPACT EMPTY STATE */
  .empty-state {
    padding: 16px;
  }

  .empty-state-icon {
    font-size: 40px;
    margin-bottom: 10px;
  }

  .empty-state-title {
    font-size: 14px;
    font-weight: 500;
  }

  .empty-state-text {
    font-size: 12px;
  }

  /* COMPACT MOBILE BACK BUTTON */
  .mobile-back-btn {
    display: none;
    align-items: center;
    gap: 6px;
    background: #f8f9fa;
    border: none;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 500;
    color: rgb(25, 119, 242);
    cursor: pointer;
    border-bottom: 1px solid #e9ecef;
    width: 100%;
    text-align: left;
    transition: all 0.2s ease;
    user-select: none;
    -webkit-user-select: none;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
  }

  .mobile-back-btn:active {
    background: #e9ecef;
  }

  .payment-content.has-selection .mobile-back-btn {
    display: flex;
  }

  /* COMPACT FIXED FOOTER */
  .payment-footer {
    flex-shrink: 0;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px 12px;
    padding-bottom: 65px;
    background: white;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
    z-index: 100;
  }

  .pay-button {
    min-height: 48px;
    font-size: 15px;
    font-weight: 500;
    border-radius: 8px;
    padding: 12px;
  }

  .secure-badge {
    font-size: 10px;
    font-weight: 400;
    margin-top: 6px;
    gap: 4px;
  }

  /* COMPACT SUCCESS MESSAGE */
  .success-icon {
    width: 60px;
    height: 60px;
    font-size: 30px;
    margin-bottom: 12px;
  }

  .success-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 6px;
  }

  .success-description {
    font-size: 13px;
    margin-bottom: 16px;
  }
}

/* Landscape mobile - even more compact */
@media (max-width: 768px) and (orientation: landscape) {
  .payment-popup {
    padding-bottom: 50px;
  }

  .payment-header {
    padding: 14px 12px 8px 12px;
    min-height: 52px;
  }

  .payment-header h2 {
    font-size: 14px;
  }

  .payment-amount {
    padding: 6px 12px;
  }

  .amount-value {
    font-size: 18px;
  }

  .content-area {
    padding: 10px;
    padding-bottom: 12px;
  }

  .form-header-title {
    font-size: 15px;
  }

  .payment-footer {
    padding: 8px 12px;
    padding-bottom: 55px;
  }

  .pay-button {
    min-height: 44px;
    font-size: 14px;
  }

  .empty-state-icon {
    font-size: 32px;
    margin-bottom: 6px;
  }

  .empty-state-title {
    font-size: 13px;
  }

  .empty-state-text {
    font-size: 11px;
  }
}

/* Small screens - ultra compact */
@media (max-width: 375px) {
  .payment-header h2 {
    font-size: 14px;
  }

  .amount-value {
    font-size: 18px;
  }

  .form-header-title {
    font-size: 15px;
  }

  .method-name {
    font-size: 12px;
  }

  .method-description {
    font-size: 10px;
  }

  .payment-footer {
    padding-bottom: 62px;
  }
}

/* Adaptive bottom padding based on screen height */
@media (max-width: 768px) and (min-height: 800px) {
  .payment-footer {
    padding-bottom: 60px;
  }
}

@media (max-width: 768px) and (max-height: 667px) {
  .payment-popup {
    padding-bottom: 55px;
  }

  .payment-footer {
    padding-bottom: 70px;
  }
}

input,
select,
textarea {
  font-size: 16px; /* prevents zoom on focus */
}
