:root {
  --wc-auth-sec-primary-color: #198450;
  --wc-auth-sec-error-color: #ba1a1a;
  --wc-auth-sec-success-color: #188038;
  --wc-auth-sec-border-color: #cbd5e1;
  --wc-auth-sec-bg-color: transparent;
}

.wc-auth-sec-js-active .wc-auth-sec-default-field,
.wc-auth-sec-js-active p.wc-auth-sec-default-field,
.wc-auth-sec-js-active div.wc-auth-sec-default-field,
.wc-auth-sec-js-active label.wc-auth-sec-default-field,
.wc-auth-sec-js-active button.wc-auth-sec-default-field,
.wc-auth-sec-js-active .woocommerce-form-row.wc-auth-sec-default-field,
.wc-auth-sec-js-active .woocommerce-FormRow.wc-auth-sec-default-field,
.woocommerce-form-login:not(.wc-auth-sec-bypass-active) p.form-row:not(.wc-passwordless-login-wrapper *):not(.wc-passwordless-return-wrapper *),
.woocommerce-form-login:not(.wc-auth-sec-bypass-active) p.woocommerce-FormRow:not(.wc-passwordless-login-wrapper *),
.woocommerce-form-login:not(.wc-auth-sec-bypass-active) p.lost_password,
.woocommerce-form-login:not(.wc-auth-sec-bypass-active) .woocommerce-form-login__submit,
form.login:not(.wc-auth-sec-bypass-active) p.form-row:not(.wc-passwordless-login-wrapper *):not(.wc-passwordless-return-wrapper *),
form.login:not(.wc-auth-sec-bypass-active) p.lost_password,
form.login:not(.wc-auth-sec-bypass-active) .woocommerce-form-login__submit {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
}

.wc-passwordless-login-wrapper {
  margin: 1.5rem 0;
  padding: 1rem;
  border: 1px solid var(--wc-auth-sec-border-color);
  border-radius: 8px;
  background-color: var(--wc-auth-sec-bg-color);
  box-sizing: border-box;
}

/* Segmented Dual-Tab Switcher Container */
.wc-passwordless-tabs-container {
  display: flex !important;
  flex-direction: row !important;
  gap: 4px !important;
  padding: 4px !important;
  background-color: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  margin-bottom: 1.25rem !important;
  box-sizing: border-box !important;
  width: 100% !important;
}

/* Tab Buttons */
.wc-passwordless-tab-btn {
  flex: 1 1 0 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 10px 16px !important;
  margin: 0 !important;
  font-size: 0.9375rem !important;
  font-weight: 600 !important;
  font-family: inherit !important;
  cursor: pointer !important;
  outline: none !important;
  text-decoration: none !important;
  text-transform: none !important;
  letter-spacing: normal !important;
  line-height: 1.25 !important;
  transition: all 0.2s ease !important;
  box-sizing: border-box !important;
  appearance: none !important;
  -webkit-appearance: none !important;
}

.wc-passwordless-tab-btn:not(.active) {
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  color: #475569 !important;
  -webkit-text-fill-color: #475569 !important;
  box-shadow: none !important;
  border: none !important;
}

.wc-passwordless-tab-btn:hover:not(.active) {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
  background: rgba(255, 255, 255, 0.7) !important;
  background-color: rgba(255, 255, 255, 0.7) !important;
}

.wc-passwordless-tab-btn.active {
  background: var(--wc-auth-sec-primary-color, #198450) !important;
  background-color: var(--wc-auth-sec-primary-color, #198450) !important;
  color: #ffffff !important;
  -webkit-text-fill-color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.08) !important;
}

.wc-passwordless-tab-btn:focus-visible {
  outline: 2px solid var(--wc-auth-sec-primary-color, #198450) !important;
  outline-offset: 2px !important;
}

.wc-passwordless-login-wrapper .form-row {
  margin-bottom: 1.25rem;
}

.wc-passwordless-login-wrapper label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.wc-passwordless-login-wrapper input[type="text"].wc-passwordless-identity {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
  min-height: 48px;
  box-sizing: border-box;
}

/* 6-Digit OTP Box Grid Styling (Immune to theme CSS overrides) */
.wc-passwordless-otp-boxes {
  display: flex !important;
  flex-direction: row !important;
  flex-wrap: nowrap !important;
  gap: 8px !important;
  justify-content: center !important;
  align-items: center !important;
  width: 100% !important;
  max-width: 360px !important;
  margin: 1rem auto !important;
  padding: 0 !important;
  box-sizing: border-box !important;
  direction: ltr !important;
}

.wc-otp-digit {
  flex: 1 1 0 !important;
  width: 48px !important;
  min-width: 36px !important;
  max-width: 52px !important;
  height: 52px !important;
  min-height: 52px !important;
  max-height: 52px !important;
  line-height: 48px !important;
  padding: 0 !important;
  margin: 0 !important;
  text-align: center !important;
  font-size: 1.5rem !important;
  font-weight: 700 !important;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
  color: #111827 !important;
  -webkit-text-fill-color: #111827 !important;
  background-color: #ffffff !important;
  background-image: none !important;
  border: 1.5px solid #cbd5e1 !important;
  border-radius: 8px !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
  outline: none !important;
  box-sizing: border-box !important;
  direction: ltr !important;
  vertical-align: middle !important;
  opacity: 1 !important;
  visibility: visible !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease !important;
}

.wc-otp-digit:focus {
  border-color: var(--wc-auth-sec-primary-color) !important;
  box-shadow: 0 0 0 3px rgba(25, 132, 80, 0.25) !important;
  background-color: #ffffff !important;
  color: #111827 !important;
  -webkit-text-fill-color: #111827 !important;
}

.wc-passwordless-login-wrapper button,
button.wc-passwordless-request-btn,
button.wc-passwordless-verify-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  width: 100% !important;
  min-height: 48px !important;
  height: 48px !important;
  padding: 0 20px !important;
  margin: 0 !important;
  font-size: 1rem !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  cursor: pointer !important;
  background-color: var(--wc-auth-sec-primary-color) !important;
  color: #ffffff !important;
  border: none !important;
  border-radius: 6px !important;
  box-sizing: border-box !important;
  letter-spacing: 0.5px !important;
  vertical-align: middle !important;
}

.wc-passwordless-login-wrapper .wc-recaptcha-row {
  margin-bottom: 1rem;
}

.wc-passwordless-hint {
  display: block;
  font-size: 0.875rem;
  color: #666;
  margin-top: 0.25rem;
  text-align: center;
}

.wc-passwordless-cooldown-wrapper {
  font-size: 0.875rem;
  margin-top: 0.75rem;
  text-align: center;
}

.wc-passwordless-bypass-wrapper,
.wc-passwordless-return-wrapper {
  text-align: center;
  margin-top: 1rem;
  border-top: 1px solid var(--wc-auth-sec-border-color);
  padding-top: 0.75rem;
}

.wc-passwordless-alt-mode-wrapper {
  text-align: center !important;
  margin-top: 1rem !important;
  padding-top: 0.25rem !important;
}

.wc-passwordless-bypass-wrapper a,
.wc-passwordless-return-wrapper a,
.wc-passwordless-cooldown-wrapper a {
  text-decoration: underline;
  cursor: pointer;
  color: var(--wc-auth-sec-primary-color);
}

.wc-passwordless-alt-mode-wrapper a,
a.wc-passwordless-alt-mode-btn {
  display: inline-block !important;
  font-size: 0.92rem !important;
  font-weight: 600 !important;
  color: var(--wc-auth-sec-primary-color) !important;
  text-decoration: none !important;
  border-bottom: 1.5px solid var(--wc-auth-sec-primary-color) !important;
  padding-bottom: 2px !important;
  letter-spacing: 0.2px !important;
  transition: opacity 0.2s ease !important;
  background: transparent !important;
}

.wc-passwordless-alt-mode-wrapper a:hover,
a.wc-passwordless-alt-mode-btn:hover {
  opacity: 0.8 !important;
}

.wc-passwordless-msg {
  padding: 0.75rem;
  border-radius: 4px;
  font-size: 0.9rem;
  margin: 1rem 0;
  display: none;
  font-weight: 500;
}

.wc-passwordless-msg.success {
  display: block;
  background-color: #e6f4ea;
  color: var(--wc-auth-sec-success-color);
  border: 1px solid var(--wc-auth-sec-success-color);
}

.wc-passwordless-msg.error {
  display: block;
  background-color: #fce8e6;
  color: var(--wc-auth-sec-error-color);
  border: 1px solid var(--wc-auth-sec-error-color);
}

.wc-auth-sec-default-field {
  display: none !important;
}

/* Fallback hiding of default WooCommerce form login fields when our plugin is active */
form.wc-auth-sec-js-active:has(.wc-passwordless-login-wrapper:not([style*="display: none"])) > *:not(.wc-passwordless-login-wrapper):not(input[type="hidden"]) {
  display: none !important;
}

/* Spinner */
.wc-auth-sec-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: wc-auth-spin 0.6s linear infinite;
  margin-right: 8px;
  vertical-align: middle;
}

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