/**
 * UNI STUDENT - Built-in Math CAPTCHA Styles
 * Clean, responsive, and styled to match UNI STUDENT brand theme.
 */

/* ==================== 1. DEFAULT / MODAL CAPTCHA ==================== */
.uni-captcha-card {
  background: #f8faff;
  border: 1px solid #e1e8f2;
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 4px;
  margin-bottom: 6px;
  transition: all 0.2s ease;
}

.uni-captcha-card:focus-within {
  border-color: #0056cc;
  box-shadow: 0 0 0 3px rgba(0, 86, 204, 0.08);
}

.uni-captcha-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13.5px;
}

.uni-captcha-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: #e6f0ff;
  color: #0056cc;
  border-radius: 6px;
  font-size: 13px;
}

.uni-captcha-title {
  font-weight: 600;
  color: #0e053f;
  font-size: 13px;
}

.uni-captcha-badge {
  display: inline-flex;
  align-items: center;
  background: #ffffff;
  border: 1px solid #d2dded;
  border-radius: 6px;
  padding: 2px 8px;
  font-family: 'Inter', monospace, sans-serif;
  font-size: 13.5px;
  color: #0e053f;
  letter-spacing: 0.5px;
}

.uni-captcha-badge strong.captcha-q {
  font-weight: 700;
  color: #0056cc;
}

.btn-captcha-refresh {
  background: transparent;
  border: 1px solid #cbd5e1;
  color: #64748b;
  border-radius: 6px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  line-height: 1.2;
}

.btn-captcha-refresh:hover {
  background: #ffffff;
  color: #0056cc;
  border-color: #0056cc;
}

.btn-captcha-refresh i {
  transition: transform 0.35s ease;
}

.btn-captcha-refresh.is-spinning i {
  transform: rotate(360deg);
}

.uni-captcha-body .input-group {
  box-shadow: none;
}

.uni-captcha-body .input-group-text {
  background: #ffffff;
  border-color: #d2dded;
  color: #64748b;
  font-size: 14px;
}

.uni-captcha-body .captcha-input {
  border-color: #d2dded;
  font-size: 14px;
  padding: 9px 12px;
  background: #ffffff;
}

.uni-captcha-body .captcha-input:focus {
  border-color: #0056cc;
  box-shadow: 0 0 0 3px rgba(0, 86, 204, 0.12);
}

/* Validation styles */
.was-validated .captcha-container .captcha-input:invalid,
.captcha-container .captcha-input.is-invalid {
  border-color: #dc3545 !important;
  background-color: #fff9f9 !important;
}

.was-validated .captcha-container .captcha-input:invalid ~ .invalid-feedback,
.captcha-container .captcha-input.is-invalid ~ .invalid-feedback {
  display: block !important;
  font-size: 12px;
  color: #dc3545;
  margin-top: 4px;
}

/* ==================== 2. HERO INQUIRY CAPTCHA ==================== */
.hero-inquiry-field.hero-captcha-field {
  grid-column: 1 / -1;
  margin-bottom: 15px;
  position: relative;
}

.hero-captcha-inner {
  display: flex;
  align-items: stretch;
  background-color: #f8faff;
  border: 1px solid #e1e8f2;
  border-radius: 9px;
  overflow: hidden;
  transition: all 0.2s ease;
  padding-left: 38px; /* space for hero icon */
  min-height: 42px;
}

.hero-inquiry-field.hero-captcha-field:focus-within .hero-captcha-inner {
  border-color: var(--color-primary, #0056cc);
  background-color: #ffffff;
  box-shadow: 0 0 0 3px rgba(0, 86, 204, 0.1);
}

.hero-captcha-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: #eef4fc;
  border-right: 1px solid #e1e8f2;
  font-size: 13px;
  white-space: nowrap;
}

.hero-captcha-badge .captcha-badge-title {
  color: #0e053f;
  font-weight: 600;
  font-size: 12px;
}

.hero-captcha-badge .captcha-q-badge {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  padding: 1px 7px;
  border-radius: 5px;
  font-weight: 700;
  color: #0056cc;
  font-family: 'Inter', monospace, sans-serif;
}

.hero-captcha-badge .btn-captcha-refresh {
  border: none;
  background: transparent;
  color: #71809a;
  padding: 2px 4px;
  font-size: 13px;
  border-radius: 4px;
}

.hero-captcha-badge .btn-captcha-refresh:hover {
  color: #0056cc;
  background: rgba(0, 86, 204, 0.08);
}

.hero-captcha-input-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.hero-captcha-input-wrap .captcha-input {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 8px 12px !important;
  font-size: 13.5px !important;
  width: 100% !important;
  min-height: auto !important;
  color: #1e293b;
}

.hero-captcha-input-wrap .captcha-input:focus {
  outline: none;
}

/* Shake animation on invalid CAPTCHA answer */
@keyframes captchaShake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}

.captcha-shake {
  animation: captchaShake 0.4s ease-in-out;
}

/* ==================== 3. RTL / ARABIC SUPPORT ==================== */
[dir="rtl"] .hero-captcha-inner,
.lang-ar .hero-captcha-inner {
  padding-left: 0;
  padding-right: 38px;
}

[dir="rtl"] .hero-captcha-badge,
.lang-ar .hero-captcha-badge {
  border-right: none;
  border-left: 1px solid #e1e8f2;
}

[dir="rtl"] .uni-captcha-header,
.lang-ar .uni-captcha-header {
  flex-direction: row-reverse;
}

[dir="rtl"] .uni-captcha-body .input-group,
.lang-ar .uni-captcha-body .input-group {
  flex-direction: row-reverse;
}

[dir="rtl"] .uni-captcha-badge strong.captcha-q,
.lang-ar .uni-captcha-badge strong.captcha-q {
  direction: ltr;
  display: inline-block;
}

