/* ============================================================
   1R AntiBot — captcha UI (stable for WP + WooCommerce + themes)
   Dropdown below checkbox, fast+smooth open, no backdrop, no click blocking
   ============================================================ */

/* Safety: predictable sizing everywhere inside widget */
.r1ab-box,
.r1ab-box *{
  box-sizing:border-box;
}

/* Outer box: no inner padding, arena can be full-width */
.r1ab-box{
  width: 270px;
  max-width: 270px;
  border:1px solid #dcdcde;
  border-radius:10px;
  padding:0;
  margin:14px 0;
  background:#fff;
  overflow:hidden;

  /* anti-theme: do not let floats/flex layouts drag the widget */
  display:block !important;
  float:none !important;
  clear:both !important;

  /* anchor for dropdown */
  position:relative;
}

/* When dropdown is open, allow it to overflow outside the box */
.r1ab-box:has(.r1ab-wrap.is-open){
  overflow: visible !important;
}

/* Inner padding wrapper (everything except arena) */
.r1ab-inner{
  padding:10px;
}

.r1ab-row{
  display:none;
  align-items:center;
  gap:10px;
}

.r1ab-logo{
  width:28px;
  height:28px;
  display:inline-block;
}

.r1ab-title{
  font-weight:600;
}

/* ============================================================
   TOP GRID: 60% checkbox | 40% logo + link
   ============================================================ */
.r1ab-topgrid{
  display:grid;
  grid-template-columns: 60% 40%;
  gap:12px;
  align-items:start;
  width:100%;
}

/* Left column (checkbox area) */
.r1ab-left{
  min-width:0;
}

/* Right column (logo + link, centered) */
.r1ab-right{
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:flex-start;
  text-align:center;
  gap:3px;
}

.r1ab-brand-logo{
  width:28px;
  height:28px;
  display:block;
}

.r1ab-brand-link{
  font-size:10px;
  line-height:1.2;
  color:#50575e;
  text-decoration:none;
}
.r1ab-brand-link:hover{
  text-decoration:underline;
}

/* ============================================================
   CHECKBOX — native, stable, protected from theme overrides
   ============================================================ */

.r1ab-box label.r1ab-checkbox{
  display:flex !important;
  align-items:center !important;
  gap:10px;
  padding:10px;
  border:1px solid #c3c4c7;
  background:#f5f5f5;
  border-radius:8px;
  max-width:100%;

  float:none !important;
  width:auto !important;
  clear:none !important;
  margin:0 !important;
}

/* protect native checkbox from custom theme "pretty checkbox" rules */
.r1ab-box label.r1ab-checkbox input[type="checkbox"]{
  position:static !important;
  float:none !important;
  margin:0 !important;
  width: 24px !important;
  height: 24px !important;
  opacity:1 !important;
  visibility:visible !important;
  transform:none !important;
  flex:0 0 auto;
}

/* text next to checkbox */
.r1ab-box label.r1ab-checkbox span{
  font-size:12px;
  line-height:1.2;
  display:block;
}

/* ============================================================
   CAPTCHA DROPDOWN SHOW / HIDE (FAST + SMOOTH)
   - below checkbox (relative to r1ab-box)
   - width: 100% of parent box
   - no backdrop, no click blocking, page scroll stays
   ============================================================ */

/* base dropdown (hidden) */
.r1ab-wrap{
  position:absolute !important;
  top: calc(100% + 10px) !important;
  left: 0 !important;
  right: 0 !important;
  width: 100% !important;

  z-index: 999999 !important;

  background:#fff !important;
  border:1px solid #e0e0e0 !important;
  border-radius:10px !important;
  box-shadow: 0 12px 36px rgba(0,0,0,.22) !important;

  opacity:0 !important;
  transform: translateY(-6px) !important;
  pointer-events:none !important;
  visibility:hidden !important;

  /* no layout jumps while hidden */
  max-height:0 !important;
  overflow:hidden !important;
}

/* open */
.r1ab-wrap.is-open{
  opacity:1 !important;
  transform: translateY(0) !important;
  pointer-events:auto !important;
  visibility:visible !important;

  max-height: 1600px !important;
  overflow: visible !important;
}

/* animate */
.r1ab-wrap.is-anim{
  transition:
    opacity .14s ease-out,
    transform .14s ease-out,
    max-height .14s ease-out,
    visibility 0s linear .14s !important;
}
.r1ab-wrap.is-open.is-anim{
  transition:
    opacity .14s ease-out,
    transform .14s ease-out,
    max-height .14s ease-out,
    visibility 0s linear 0s !important;
}

/* ============================================================
   PROBE (icon to match)
   ============================================================ */
.r1ab-probe{
  display:flex;
  align-items:center;
  gap:8px;
}

.r1ab-probe-title{
  font-weight:600;
}

.r1ab-probe .svg{
  display:inline-flex;
  align-items:center;
  justify-content:center;
}

.r1ab-probe .svg svg{
  width:30px;
  height:30px;
  display:block;
}

/* ============================================================
   ARENA — edge-to-edge
   ============================================================ */
.r1ab-arena{
  position:relative;
  width:100%;
  border:0;
  margin:0;
  padding:0;
  overflow:hidden;
}

.r1ab-arena .arena-wrap{
  position:relative;
  width:100%;
  min-height:200px;
  margin:0;
  padding:0;
}

.r1ab-arena canvas{
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
}

/* ============================================================
   STATUS TEXT
   ============================================================ */
.r1ab-note{
  font-size:13px;
  color:#50575e;
}

.r1ab-error{
  color:#d63638;
}

.r1ab-ok{
  color:#1f883d;
}

/* ============================================================
   MOBILE: stack columns vertically
   ============================================================ */
@media (max-width: 420px){
  .r1ab-topgrid{
    grid-template-columns: 1fr;
    gap:8px;
  }

  .r1ab-right{
    align-items:flex-start;
    text-align:left;
  }
}

/* ============================================================
   ANTI-THEME OVERRIDES (fix #commentform label { position:absolute; ... })
   Put this block at the END of the file.
   ============================================================ */

/* Reset any theme rules that target labels inside the review form */
#commentform .r1ab-box label,
.woocommerce #commentform .r1ab-box label{
  position:static !important;
  left:auto !important;
  top:auto !important;
  right:auto !important;
  bottom:auto !important;
  margin:0 !important;
}

/* Ensure our checkbox label stays flex even if theme forces block/absolute */
#commentform .r1ab-box label.r1ab-checkbox,
.woocommerce #commentform .r1ab-box label.r1ab-checkbox{
  display:flex !important;
  align-items:center !important;
}

/* Some themes apply line-height/size to #commentform label — keep ours stable */
#commentform .r1ab-box label.r1ab-checkbox span{
  font-size:12px !important;
  line-height:1.2 !important;
}

/* ============================================================
   CHECKBOX SIZE NORMALIZATION
   ============================================================ */

.r1ab-checkbox input[type=checkbox]:checked::before {
  margin: -0.1875rem 0 0 -0.25rem !important;
  height: 1.8125rem !important;
  width: 1.8125rem !important;
}

@media screen and (max-width: 782px) {
  .r1ab-checkbox input[type=checkbox]:checked::before {
    width: 1.8125rem !important;
    height: 1.8125rem !important;
    margin: -0.1875rem 0 0 -0.25rem !important;
  }
}

.r1ab-checkbox input[type=checkbox] {
  width: 1.8125rem !important;
  height: 1.8125rem !important;
}

@media screen and (max-width: 782px) {
  .r1ab-checkbox input[type=checkbox] {
    width: 1.8125rem !important;
    height: 1.8125rem !important;
  }
}

/* ============================================================
   LOGO SPIN WHEN CAPTCHA IS OPEN
   ============================================================ */

@keyframes r1abSpin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.r1ab-box.r1ab-open .r1ab-brand-logo{
  animation: r1abSpin 1.2s linear infinite;
  transform-origin: 50% 50%;
}

@media (prefers-reduced-motion: reduce){
  .r1ab-box.r1ab-open .r1ab-brand-logo{
    animation: none !important;
  }
}

/* ============================================================
   PORTAL MODE: dropdown is moved to <body> to avoid clipping
   ============================================================ */

.r1ab-wrap.r1ab-portal{
  position: fixed !important;
  left: var(--r1ab-left, 0px) !important;
  top:  var(--r1ab-top, 0px) !important;
  width: var(--r1ab-w, 270px) !important;
  right: auto !important;

  z-index: 2147483647 !important; /* max-ish */
}

/* optional: keep same visuals */
.r1ab-wrap.r1ab-portal{
  margin: 0 !important;
}