/* 
 * OTP Content Component Styles
 * Isolated with .otp-component-wrapper to prevent conflicts
 */

/* Wrapper for isolation */
.otp-component-wrapper {
  width: 100%;
}

/* Typography */
.otp-component-wrapper .h1-fs.p-otp {
  margin: 5px 0px;
  color: #3e3e3e;
  font-size: 19px;
  font-family: "Open Sans", sans-serif; /* Ensure font consistency */
  text-align: center;
}

.otp-component-wrapper .h3-fs.otp-directions {
  color: #3e3e3e;
  font-size: 14px;
  font-family: "Open Sans", sans-serif;
  margin-bottom: 15px;
  text-align: center;
}

.otp-component-wrapper #lastFourDigits {
  font-weight: 700;
}

/* OTP Container */
.otp-component-wrapper .otp-container {
  text-align: center; /* Ensure content is centered */
}

.otp-component-wrapper .otp-container form.pure-form {
  display: inline-block; /* Changed from inline to inline-block to allow centering */
  width: 100%;
}

.otp-component-wrapper .otp-container fieldset {
  border: none;
  padding: 0;
  margin: 0;
  text-align: center; /* Ensure fieldset content is centered */
}

.otp-component-wrapper .otp-container input[type="tel"] {
  display: inline-block;
  text-align: center;
  min-height: 4rem;
  letter-spacing: 1rem;
  padding: 0;
  margin: 0 auto; /* Auto margins for centering if block */
  max-width: 386px;
  font-size: 3.5rem;
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 4px;
  box-shadow: inset 0 1px 3px #ddd;
  transition: border 0.3s linear;
  box-sizing: border-box; /* Fix for bootstrap modal sizing */
}

/* New OTP Slots Implementation */
.otp-component-wrapper .otp-visual-container {
  position: relative;
  width: 100%;
  max-width: 386px;
  margin: 0 auto;
  height: 5rem;
}

.otp-component-wrapper .otp-input-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  z-index: 10;
  cursor: default;
  color: transparent;
  background: transparent;
  caret-color: transparent; /* Hide cursor */
}

.otp-component-wrapper .otp-slots-row {
  display: flex;
  justify-content: space-between;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1;
  pointer-events: none; /* Let clicks pass to input */
}

.otp-component-wrapper .otp-slot {
  width: 14%;
  height: 100%;
  border-bottom: 2px solid #ddd;
  font-size: 3rem;
  text-align: center;
  line-height: 5rem;
  font-weight: bold;
  color: #3e3e3e;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Open Sans", sans-serif;
  position: relative; /* Needed for cursor positioning */
}

.otp-component-wrapper .otp-visual-container.focused .otp-slot.active::after {
  content: "";
  position: absolute;
  height: 50%;
  width: 2px;
  background-color: #3e3e3e;
  animation: blink 1s step-end infinite;
  top: 25%;
}

@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0;
  }
}

.otp-component-wrapper .otp-slot.active {
  border-bottom-color: #129fea;
}

.otp-component-wrapper .otp-container input[type="tel"]:focus {
  outline: 0;
  border-color: #129fea;
}

/* Button Styles - Explicitly defined to work without external PureCSS/Bootstrap dependencies */
.otp-component-wrapper .button-success {
  background-color: #27a645; /* Green */
  color: white;
  border: none;
  border-radius: 4px;
  font-weight: 600;
  width: 90%;
  padding: 10px 0px;
  margin: 15px auto;
  margin-top: 35px !important;
  cursor: pointer;
  font-size: 120%;
  display: block; /* Ensure it takes width */
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.2);
}

.otp-component-wrapper .button-success:hover {
  background-image: linear-gradient(
    transparent,
    rgba(0, 0, 0, 0.05) 40%,
    rgba(0, 0, 0, 0.1)
  );
}

.otp-component-wrapper .button-success:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Helper Links and Text */
.otp-component-wrapper p {
  margin: 10px 0;
  text-align: center;
}

.otp-component-wrapper small {
  font-size: 80%;
}

/* Feedback Messages */
.otp-component-wrapper .opt-feedback {
  display: none;
  color: #27a645;
  padding: 5px;
  background-color: #27a6452b;
  margin-top: 10px;
  border-radius: 4px;
  font-size: 14px;
  text-align: center;
}

.otp-component-wrapper .opt-feedback.error {
  color: red;
  background-color: #ff00002e;
}

/* Timer/Resend Link */
.otp-component-wrapper .otp-timer {
  text-decoration: none;
  font-weight: 400;
  color: #2fc4ea; /* Light Blue */
  cursor: pointer;
}

.otp-component-wrapper .otp-timer.timer-active {
  color: #000;
  cursor: default;
}

.otp-component-wrapper .otp-timer .time {
  font-weight: 700;
}

.otp-component-wrapper .otp-timer.disabled {
  opacity: 0.6;
  pointer-events: none;
}

.otp-component-wrapper .otp-timer.prompt-active {
  text-decoration: underline;
  font-weight: bold;
}

/* Loading Spinner */
.otp-component-wrapper .lds-facebook {
  display: inline-block;
  position: relative;
  height: 20px;
  width: 20px;
  vertical-align: middle;
  margin-left: 5px;
}

.otp-component-wrapper .lds-facebook div {
  display: inline-block;
  position: absolute;
  left: 4px;
  width: 4px; /* Slightly smaller for inside button */
  background: #fff;
  animation: lds-facebook 1.2s cubic-bezier(0, 0.5, 0.5, 1) infinite;
}

.otp-component-wrapper .lds-facebook div:nth-child(1) {
  left: 4px;
  animation-delay: -0.24s;
}

.otp-component-wrapper .lds-facebook div:nth-child(2) {
  left: 12px;
  animation-delay: -0.12s;
}

.otp-component-wrapper .lds-facebook div:nth-child(3) {
  left: 20px;
  animation-delay: 0;
}

@keyframes lds-facebook {
  0% {
    top: 0px;
    height: 20px;
  }
  50%,
  100% {
    top: 5px;
    height: 10px;
  }
}

.otp-component-wrapper form.loading .loading-state {
  display: inline-block;
}

.otp-component-wrapper .loading-state {
  display: none;
}

/* Responsive Adjustments */
@media only screen and (max-width: 600px) {
  .otp-component-wrapper .otp-container input[type="tel"] {
    font-size: 2.2rem;
    letter-spacing: 0.6rem;
    min-height: 3.5rem;
  }

  .otp-component-wrapper .button-success {
    width: 100%;
  }
}
