/**
 * WP Persian Shield - Frontend Stylesheet (Light Material Design)
 */

@import 'vazir.css';

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Vazirmatn';
  src: url('../fonts/Vazirmatn-Bold.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

.wpps-shield-wrapper,
.wpps-shield-wrapper *:not(code):not(pre) {
  font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Tahoma, Arial, sans-serif !important;
}

.wpps-shield-wrapper {
  margin: 16px 0;
  display: block;
  clear: both;
}

.wpps-captcha-wrap {
  display: inline-flex;
  flex-direction: column;
  gap: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
  max-width: 360px;
  width: 100%;
  box-sizing: border-box;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  transition: all 0.2s ease-in-out;
}

.wpps-captcha-wrap:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.06);
}

.wpps-turnstile-wrap,
.wpps-recaptcha-wrap {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

.wpps-turnstile-wrap .cf-turnstile,
.wpps-turnstile-wrap iframe,
.wpps-recaptcha-wrap iframe {
  margin: 0 auto !important;
}

.wpps-captcha-wrap[dir="rtl"] {
  direction: rtl;
  text-align: right;
}

.wpps-captcha-wrap[dir="ltr"] {
  direction: ltr;
  text-align: left;
}

.wpps-math-box,
.wpps-image-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #f8fafc;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  min-height: 48px;
  box-sizing: border-box;
}

.wpps-math-question-group {
  display: flex;
  align-items: center;
  flex: 1;
}

.wpps-question-text {
  font-size: 19px;
  font-weight: 700;
  color: #0f172a;
  letter-spacing: 2px;
  user-select: none;
  font-feature-settings: "ss01", "ss02";
}

.wpps-math-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.wpps-captcha-img {
  display: block;
  border-radius: 6px;
  max-height: 44px;
  object-fit: contain;
  user-select: none;
}

.wpps-btn-refresh,
.wpps-btn-audio {
  background: #f1f5f9;
  border: 1px solid transparent;
  color: #475569;
  cursor: pointer;
  padding: 7px;
  border-radius: 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
}

.wpps-btn-refresh:hover,
.wpps-btn-audio:hover {
  background: #e2e8f0;
  color: #2563eb;
  border-color: #cbd5e1;
}

.wpps-btn-refresh:active svg {
  transform: rotate(180deg);
  transition: transform 0.25s ease;
}

.wpps-loading svg {
  animation: wpps-spin 0.8s linear infinite;
}

@keyframes wpps-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.wpps-audio-playing {
  background: #dbeafe !important;
  color: #1d4ed8 !important;
  border-color: #93c5fd !important;
  animation: wpps-pulse 1.2s ease infinite;
}

@keyframes wpps-pulse {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4); }
  70% { transform: scale(1.06); box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(37, 99, 235, 0); }
}

.wpps-input-box {
  width: 100%;
}

.wpps-input-field {
  width: 100% !important;
  box-sizing: border-box !important;
  padding: 10px 14px !important;
  font-size: 14px !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 9px !important;
  background: #ffffff !important;
  color: #0f172a !important;
  outline: none !important;
  transition: border-color 0.2s, box-shadow 0.2s !important;
}

.wpps-input-field:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15) !important;
}

.wpps-input-field::placeholder {
  color: #94a3b8 !important;
  font-size: 13px !important;
}

.wpps-fallback-alert {
  background: #f0f7ff !important;
  color: #0b57d0 !important;
  border: 1px solid #c2e7ff !important;
  border-radius: 100px !important;
  padding: 8px 16px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  line-height: 1.5 !important;
  margin: 0 auto 12px auto !important;
  max-width: 340px !important;
  box-shadow: 0 1px 3px rgba(11, 87, 208, 0.08) !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  direction: rtl !important;
}

/* ============================================================
   استایل اختصاصی پازل اسلایدی (Slider Puzzle CAPTCHA)
   ============================================================ */
.wpps-puzzle-wrap {
  max-width: 320px !important;
  width: 100% !important;
  padding: 12px !important;
  border-radius: 14px !important;
  background: #ffffff !important;
  border: 1px solid #e2e8f0 !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04) !important;
  box-sizing: border-box !important;
  user-select: none !important;
}

.wpps-puzzle-topbar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  margin-bottom: 8px !important;
  padding: 0 2px !important;
}

.wpps-puzzle-title {
  font-size: 13px !important;
  font-weight: 700 !important;
  color: #334155 !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 6px !important;
}

.wpps-puzzle-refresh-top {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
  padding: 4px 10px !important;
  font-size: 12px !important;
  font-weight: 500 !important;
  color: #64748b !important;
  cursor: pointer !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 5px !important;
  transition: all 0.2s ease !important;
}

.wpps-puzzle-refresh-top:hover {
  background: #eff6ff !important;
  border-color: #bfdbfe !important;
  color: #2563eb !important;
}

.wpps-puzzle-stage {
  position: relative !important;
  width: 100% !important;
  aspect-ratio: 2 / 1 !important;
  height: auto !important;
  border-radius: 10px !important;
  overflow: hidden !important;
  background: #f1f5f9 !important;
  user-select: none !important;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.06) !important;
}

.wpps-puzzle-bg {
  width: 100% !important;
  height: 100% !important;
  display: block !important;
  object-fit: fill !important;
  pointer-events: none !important;
}

.wpps-puzzle-piece-wrap {
  position: absolute !important;
  top: 0;
  left: 0;
  width: 48px;
  height: 48px;
  z-index: 10 !important;
  pointer-events: none !important;
  filter: drop-shadow(0 3px 8px rgba(0,0,0,0.5)) !important;
  will-change: left !important;
}

.wpps-puzzle-piece {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
  pointer-events: none !important;
}

/* اسلایدر کشویی پایین پازل - همواره LTR و از چپ به راست */
.wpps-slider-track {
  direction: ltr !important;
  position: relative;
  width: 100%;
  height: 44px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 24px;
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  overflow: hidden;
  box-sizing: border-box;
}

.wpps-slider-progress {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0 !important;
  right: auto !important;
  width: 0;
  background: #e0e7ff;
  border-radius: 24px 0 0 24px;
  transition: background-color 0.2s;
  pointer-events: none;
}

.wpps-slider-text {
  position: absolute;
  left: 0;
  right: 0;
  text-align: center;
  padding: 0 46px; /* جلوگیری قطعی از افتادن هندل روی متن تأیید */
  font-size: 13px;
  font-weight: 600;
  color: #64748b;
  z-index: 2;
  pointer-events: none;
  transition: opacity 0.2s, color 0.2s;
  direction: rtl;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wpps-slider-handle {
  position: absolute;
  top: 2px;
  left: 2px !important;
  right: auto !important;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  z-index: 5;
  transition: transform 0.1s, box-shadow 0.2s, background-color 0.2s;
}

.wpps-slider-handle:active,
.wpps-dragging .wpps-slider-handle {
  cursor: grabbing;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  border-color: #2563eb;
}

/* خطوط عمودی مشخصه هندل اسلایدر (سه خط عمودی ||| مطابق اسکرین شات) */
.wpps-slider-grip {
  display: flex;
  gap: 3px;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.wpps-slider-grip i {
  display: block;
  width: 2.5px;
  height: 14px;
  background: #6366f1;
  border-radius: 2px;
}

/* وضعیت موفقیت - هندل نرم به انتها رفته و متن بدون هم‌پوشانی نمایش می‌یابد */
.wpps-puzzle-wrap.wpps-puzzle-success .wpps-slider-track {
  background: #ecfdf5 !important;
  border-color: #10b981 !important;
}

.wpps-puzzle-wrap.wpps-puzzle-success .wpps-slider-progress {
  background: #d1fae5 !important;
  width: 100% !important;
  border-radius: 24px !important;
}

.wpps-puzzle-wrap.wpps-puzzle-success .wpps-slider-handle {
  background: #10b981 !important;
  border-color: #059669 !important;
  cursor: default !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35) !important;
}

.wpps-puzzle-wrap.wpps-puzzle-success .wpps-slider-text {
  color: #065f46 !important;
  font-weight: 700 !important;
  opacity: 1 !important;
}

.wpps-puzzle-wrap.wpps-puzzle-success .wpps-slider-grip {
  display: none !important;
}

.wpps-puzzle-wrap.wpps-puzzle-success .wpps-slider-handle::after {
  content: "✓";
  color: #ffffff;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.wpps-puzzle-wrap.wpps-puzzle-success .wpps-puzzle-piece {
  filter: drop-shadow(0 0 8px #10b981) !important;
}

/* انیمیشن لرزش هنگام خطا */
.wpps-puzzle-shake {
  animation: wpps-shake 0.4s ease-in-out;
}

@keyframes wpps-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
