/* Modern OTP Popup Styles */
.modern-otp-popup {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999999;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen,
    Ubuntu, Cantarell, sans-serif;
}

.modern-otp-popup.show {
  display: flex;
}

.modern-otp-content {
  background: #ffffff;
  padding: 40px;
  border-radius: 24px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
  border: 1px solid #dbe6d7;
  width: 100%;
  max-width: 420px;
  text-align: center;
  position: relative;
  direction: ltr; /* Force LTR layout to prevent RTL reversal breaking the popup */
}

.verification-icon {
  margin-bottom: 20px;
}

.verification-title {
  margin: 0 0 15px;
  font-size: 24px;
  font-weight: 600;
  color: #2c5530;
}

.verification-description {
  margin: 0 0 30px;
  color: #666;
  font-size: 16px;
  line-height: 1.5;
}

.modern-otp-inputs {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 25px;
  padding: 14px 18px;
  background: #f7fbf2;
  border-radius: 18px;
  border: 1px solid #dfead7;
  direction: ltr; /* Force LTR for input layout */
}

.modern-otp-input {
  width: 65px;
  height: 56px;
  border: 2px solid #cbd5c5;
  border-radius: 14px;
  font-size: 24px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  text-align: center;
  color: #0f172a !important;
  background: #ffffff;
  transition: all 0.2s ease;
  letter-spacing: 2px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: textfield;
  caret-color: #2c5530;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.08);
  direction: ltr; /* Ensure LTR for number display */
  text-indent: 0; /* Prevent text hiding */
  padding: 0; /* Remove any padding that might hide text */
}

.modern-otp-input::placeholder {
  color: rgba(15, 23, 42, 0.4);
  opacity: 1;
}

.modern-otp-input::-webkit-outer-spin-button,
.modern-otp-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.modern-otp-input:focus {
  border-color: #2c5530;
  outline: none;
  box-shadow: 0 0 0 3px rgba(44, 85, 48, 0.18);
  background: #f7fbf8;
  color: #0f172a !important;
}

.modern-otp-input.filled {
  border-color: #2c5530;
  background: rgba(44, 85, 48, 0.08);
  color: #0f172a !important;
  box-shadow: inset 0 2px 4px rgba(15, 23, 42, 0.12);
}

.otp-helper-text {
  margin: 10px 0 24px;
  padding: 10px 14px;
  background: #f3f8ee;
  border-radius: 12px;
  font-size: 14px;
  color: #4b5a4f;
  line-height: 1.5;
}

.modern-verify-btn {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: #2c5530;
  color: white;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.modern-verify-btn:hover {
  background: #234226;
}

.modern-verify-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.modern-error {
  color: #e74c3c;
  margin: 15px 0;
  font-size: 14px;
  display: none;
}

.modern-success {
  color: #2ecc71;
  margin: 15px 0;
  font-size: 18px;
  font-weight: 600;
  padding: 15px;
  background: rgba(46, 204, 113, 0.1);
  border-radius: 12px;
  display: none;
  animation: fadeIn 0.3s ease-in-out;
}

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

.resend-section {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.resend-hint {
  font-size: 13px;
  color: #6b7280;
}

.modern-resend-btn {
  background: none;
  border: none;
  color: #2c5530;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  padding: 5px 10px;
  transition: all 0.2s ease;
}

.modern-resend-btn:hover {
  text-decoration: underline;
}

.modern-resend-btn:disabled {
  color: #999;
  cursor: not-allowed;
  text-decoration: none;
}

.resend-countdown {
  color: #666;
  font-size: 13px;
  line-height: 1.4;
}

/* Loading Spinner Animation */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.loading-spinner {
  animation: spin 1s linear infinite;
}

/* Responsive Design */
@media (max-width: 480px) {
  .modern-otp-content {
    padding: 30px 20px;
    margin: 20px;
  }

  .verification-title {
    font-size: 20px;
  }

  .verification-description {
    font-size: 14px;
  }

  .modern-otp-inputs {
    gap: 8px;
  }

  .modern-otp-input {
    width: 40px;
    height: 50px;
    font-size: 20px;
  }
}

/******************************
 * RTL SUPPORT - OTP POPUP
 ******************************/
[dir="rtl"] #free-trial-otp-popup .modern-otp-content {
  text-align: right;
}

[dir="rtl"] #free-trial-otp-popup .verification-title,
[dir="rtl"] #free-trial-otp-popup .verification-description,
[dir="rtl"] #free-trial-otp-popup .otp-helper-text,
[dir="rtl"] #free-trial-otp-popup .modern-error,
[dir="rtl"] #free-trial-otp-popup .modern-success {
  text-align: right;
}

/* Keep OTP inputs in normal order (LTR) even in RTL - numbers are universal */
[dir="rtl"] #free-trial-otp-popup .modern-otp-inputs {
  flex-direction: row !important; /* Don't reverse - numbers stay in order */
  direction: ltr !important;
}

[dir="rtl"] #free-trial-otp-popup .modern-resend-btn {
  direction: rtl;
}

[dir="rtl"] #free-trial-otp-popup .resend-section,
[dir="rtl"] #free-trial-otp-popup .resend-countdown {
  text-align: right;
}
