/* =========================================================
   CAPTCHA — کد امنیتی با دکمه تغییر
   ========================================================= */

.dc-captcha-field {
  display: block;
  margin: 16px 0;
}

.dc-captcha-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 14px;
  color: #333;
}

.dc-captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

/* --- عبارت ریاضی --- */
.dc-captcha-question {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 90px;
  padding: 10px 14px;
  font-family: 'Courier New', 'Consolas', monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #222;
  background: linear-gradient(135deg, #f5f5f5 0%, #ebebeb 100%);
  border: 1px dashed #bbb;
  border-radius: 8px;
  user-select: none;
  direction: ltr;
  transition: background 0.3s ease;
}

.dc-captcha-field.is-refreshed .dc-captcha-question {
  background: linear-gradient(135deg, #e8f5e9 0%, #d4edda 100%);
  border-color: #5cb85c;
}

/* --- دکمه تغییر --- */
.dc-captcha-refresh {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid #ddd;
  border-radius: 8px;
  background: #fff;
  color: #555;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dc-captcha-refresh:hover:not(:disabled) {
  background: #f0f6ff;
  border-color: #3b82f6;
  color: #3b82f6;
  transform: rotate(90deg);
}

.dc-captcha-refresh:active:not(:disabled) {
  transform: rotate(180deg) scale(0.95);
}

.dc-captcha-refresh:disabled,
.dc-captcha-refresh.is-loading {
  opacity: 0.5;
  cursor: not-allowed;
}

.dc-captcha-refresh.is-loading svg {
  animation: dc-captcha-spin 0.8s linear infinite;
}

@keyframes dc-captcha-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* --- ورودی پاسخ --- */
.dc-captcha-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 10px 12px;
  font-size: 16px;
  font-family: inherit;
  color: #222;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  text-align: center;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.dc-captcha-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

/* حذف فلش‌های ورودی عددی */
.dc-captcha-input::-webkit-outer-spin-button,
.dc-captcha-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.dc-captcha-input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* --- متن راهنما --- */
.dc-captcha-help {
  display: block;
  margin-top: 6px;
  color: #888;
  font-size: 12px;
  line-height: 1.6;
}

/* --- خطا --- */
.dc-captcha-error {
  margin-top: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: #721c24;
  background: #f8d7da;
  border: 1px solid #f5c6cb;
  border-radius: 6px;
  line-height: 1.5;
}

/* =========================================================
   Responsive — Mobile
   ========================================================= */

@media (max-width: 600px) {
  .dc-captcha-row {
    flex-wrap: wrap;
  }

  .dc-captcha-question {
    order: 1;
    flex: 1 1 calc(100% - 52px);
  }

  .dc-captcha-refresh {
    order: 2;
  }

  .dc-captcha-input {
    order: 3;
    flex: 1 1 100%;
    margin-top: 6px;
  }
}

/* =========================================================
   حالت تیره (اختیاری — اگر سایت شما دارک‌مود دارد)
   ========================================================= */

@media (prefers-color-scheme: dark) {
  .dc-captcha-label {
    color: #ddd;
  }

  .dc-captcha-question {
    color: #f0f0f0;
    background: linear-gradient(135deg, #2a2a2a 0%, #1f1f1f 100%);
    border-color: #444;
  }

  .dc-captcha-refresh {
    background: #1f1f1f;
    border-color: #444;
    color: #bbb;
  }

  .dc-captcha-input {
    background: #1f1f1f;
    border-color: #444;
    color: #f0f0f0;
  }

  .dc-captcha-help {
    color: #888;
  }
}