/* ==========================================================================
   Lyran Labs - Professional Captcha & Verification System
   Seamless Google reCAPTCHA v2 with Automatic Case-Sensitive Fallback
   Inline Natural Form Flow & Modern Corporate Styling
   ========================================================================== */

/* ── Inline Captcha Group (No Separated Outer Box) ───────── */
.captcha-group {
    margin-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: transparent !important;
    border: none !important;
    padding: 0 !important;
    box-shadow: none !important;
}

/* ── Captcha Image & Refresh Button Row ───────────────────── */
.captcha-image-wrapper {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.captcha-group img.captcha {
    height: 44px;
    width: auto;
    min-width: 140px;
    max-width: 170px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    background: #ffffff;
    object-fit: contain;
    padding: 2px 6px;
    display: block;
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.captcha-refresh-btn {
    height: 44px;
    padding: 0 14px;
    background: #ffffff;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    color: #475569;
    font-weight: 600;
    font-size: 0.85rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.captcha-refresh-btn:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

.captcha-refresh-btn:active {
    transform: scale(0.98);
}

.captcha-refresh-btn i.spin {
    animation: captchaRotate 0.6s linear infinite;
}

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

/* ── Captcha Text Input (Inline Standard Form Control) ────── */
.captcha-group input[name="captcha_1"] {
    width: 100%;
    height: 46px;
    padding: 0 14px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    background: #ffffff;
    color: #0f172a;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    outline: none;
    text-transform: none; /* Keep natural case for case-sensitive captcha */
}

.captcha-group input[name="captcha_1"]::placeholder {
    font-weight: 400;
    color: #94a3b8;
    font-size: 0.88rem;
    text-transform: none;
}

.captcha-group input[name="captcha_1"]:focus {
    border-color: #0284c7;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14);
}

.captcha-group input[name="captcha_1"].is-invalid {
    border-color: #ef4444 !important;
    background: #fef2f2 !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14) !important;
    animation: captchaShake 0.4s ease-in-out;
}

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

.recaptcha-v3-badge-wrap {
    margin-top: 2px;
    margin-bottom: 8px;
    display: block;
}

.recaptcha-legal-notice {
    font-size: 0.73rem;
    color: #64748b;
    line-height: 1.4;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    font-family: var(--k-font-body, system-ui, sans-serif);
}

.recaptcha-legal-notice a {
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color 0.2s ease;
}

.recaptcha-legal-notice a:hover {
    color: var(--sky, #0284c7);
}

.recaptcha-wrapper {
    margin-top: 4px;
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.recaptcha-wrapper .g-recaptcha {
    display: inline-block;
    min-height: 78px;
}

/* ── Consent / Disclaimer Checkbox ────────────────────────── */
.form-check-consent {
    margin-top: 4px;
    margin-bottom: 8px;
}

.form-check-consent .form-check {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding-left: 0 !important;
    margin-left: 0 !important;
    margin-bottom: 0;
}

.form-check-consent input[type="checkbox"],
.form-check-consent .form-check-input {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    margin: 3px 0 0 0 !important;
    float: none !important;
    border-radius: 4px;
    border: 1.5px solid #94a3b8;
    cursor: pointer;
    accent-color: #0284c7;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.form-check-consent input[type="checkbox"]:focus,
.form-check-consent .form-check-input:focus {
    box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2);
    border-color: #0284c7;
    outline: none;
}

.form-check-consent .form-check-label {
    font-size: 0.86rem;
    line-height: 1.45;
    color: #475569;
    cursor: pointer;
    user-select: none;
}

.form-check-consent .disclaimer-subtext {
    display: block;
    font-size: 0.78rem;
    color: #64748b;
    margin-top: 3px;
    line-height: 1.4;
}

.form-check-consent .disclaimer-subtext a {
    color: #0284c7;
    text-decoration: underline;
    text-underline-offset: 2px;
    font-weight: 500;
    transition: color 0.2s ease;
}

.form-check-consent .disclaimer-subtext a:hover {
    color: #0369a1;
}

/* ── Action Buttons Container & Clear Form Button ─────────── */
.form-action-buttons {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.btn-clear-form {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 48px;
    padding: 0 20px;
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    color: #475569;
    font-size: 0.92rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    text-decoration: none;
}

.btn-clear-form:hover {
    background: #e2e8f0;
    border-color: #94a3b8;
    color: #0f172a;
    transform: translateY(-1px);
}

.btn-clear-form:active {
    transform: translateY(0);
}

/* ── Dark Theme (Industry Form #industrialForm) ───────────── */
#industrialForm .captcha-group img.captcha {
    background: #ffffff;
    border-color: rgba(255, 255, 255, 0.25);
}

#industrialForm .captcha-refresh-btn {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: #e2e8f0;
}

#industrialForm .captcha-refresh-btn:hover {
    background: #0284c7;
    color: #ffffff;
    border-color: #0284c7;
}

#industrialForm .captcha-group input[name="captcha_1"] {
    background: rgba(15, 23, 42, 0.85);
    border-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

#industrialForm .captcha-group input[name="captcha_1"]:focus {
    border-color: #38bdf8;
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
}

#industrialForm .form-check-consent .form-check-label {
    color: #cbd5e1;
}

#industrialForm .form-check-consent .disclaimer-subtext {
    color: #94a3b8;
}

#industrialForm .form-check-consent .disclaimer-subtext a {
    color: #38bdf8;
}

#industrialForm .form-check-consent input[type="checkbox"] {
    background: rgba(15, 23, 42, 0.6);
    border-color: rgba(255, 255, 255, 0.3);
}

#industrialForm .btn-clear-form {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
    color: #cbd5e1;
}

#industrialForm .btn-clear-form:hover {
    background: rgba(255, 255, 255, 0.16);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.35);
}

/* ── STEM Services Theme (#contactForm) ───────────────────── */
#contactForm .captcha-refresh-btn:hover {
    background: #f97316;
    border-color: #f97316;
    color: #ffffff;
}

#contactForm .captcha-group input[name="captcha_1"]:focus {
    border-color: #f97316;
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.15);
}

#contactForm .btn-clear-form {
    border-radius: 50px;
    background: #fff7ed;
    border-color: #fdba74;
    color: #9a3412;
}

#contactForm .btn-clear-form:hover {
    background: #ffedd5;
    border-color: #fb923c;
    color: #7c2d12;
}

/* ── Responsive adjustments ───────────────────────────────── */
@media (max-width: 576px) {
    .captcha-image-wrapper {
        flex-wrap: nowrap;
    }
    .recaptcha-wrapper {
        transform: scale(0.88);
        transform-origin: 0 0;
        margin-bottom: 0;
    }
    .btn-clear-form, .btn-submit {
        flex: 1 1 auto;
    }
}
