/**
 * KEPED Ninja Forms Guard — production presentation layer.
 *
 * Design goal: visually mirror the approved native .keped-form component
 * without changing Ninja Forms globally. Every rule is scoped to
 * .keped-ninja-form.
 */

.keped-ninja-form,
.keped-ninja-form * {
    box-sizing: border-box;
}

/* Keep browser text selection inside the brand palette. */
.keped-ninja-form ::selection {
    background: #dbe5ff;
    color: #071744;
}

/* ---------------------------------------------------------
 * Layout / card
 * --------------------------------------------------------- */
.keped-ninja-form {
    width: 100%;
    max-width: 860px;
    margin: 0;
    color: var(--keped-ink, #101828);
}

.keped-ninja-form .nf-form-wrap,
.keped-ninja-form .nf-form-layout,
.keped-ninja-form .nf-form-content {
    width: 100%;
    max-width: 860px;
    margin: 0;
}

.keped-ninja-form .nf-form-content {
    padding: clamp(24px, 5vw, 48px) !important;
    border: 1px solid var(--keped-line, #dce4f5);
    border-radius: var(--keped-radius, 20px);
    background: #fff;
    box-shadow: var(--keped-shadow-sm, 0 12px 32px rgba(7, 23, 68, .08));
}

/* Ninja Forms' custom-element field wrapper becomes the same two-column
 * grid used by the native KEPED form. */
.keped-ninja-form nf-fields-wrap {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    width: 100%;
}

.keped-ninja-form nf-field {
    min-width: 0;
    margin: 0 !important;
}

/* Message, internal hidden fields, consent and submit occupy the full row.
 * The imported KEPED form has stable field ordering/keys; this is only a
 * presentation rule and does not affect values or validation. */
.keped-ninja-form nf-field:nth-child(n+7) {
    grid-column: 1 / -1;
}

.keped-ninja-form .nf-field-container,
.keped-ninja-form .field-wrap,
.keped-ninja-form .nf-field,
.keped-ninja-form .nf-field-element {
    min-width: 0;
}

.keped-ninja-form .nf-field-container {
    margin: 0 !important;
    padding: 0 !important;
}

/* Remove generic Ninja Forms chrome that was not present in the approved
 * KEPED form. */
.keped-ninja-form .nf-form-fields-required,
.keped-ninja-form .nf-input-limit,
.keped-ninja-form .nf-field-element::after,
.keped-ninja-form .nf-pass .nf-field-element::after,
.keped-ninja-form .nf-error .nf-field-element::after {
    display: none !important;
}

/* Helper text is intentionally hidden on the three fields where it merely
 * repeats information already communicated by the label/placeholder. */
.keped-ninja-form .keped-afm-field .nf-field-description,
.keped-ninja-form .keped-phone-field .nf-field-description,
.keped-ninja-form .keped-partner-type-field .nf-field-description {
    display: none !important;
}

/* ---------------------------------------------------------
 * Labels / descriptions
 * --------------------------------------------------------- */
.keped-ninja-form .nf-field-label {
    margin: 0 0 7px !important;
    padding: 0 !important;
}

.keped-ninja-form .nf-field-label label {
    display: inline;
    margin: 0;
    padding: 0 !important;
    background: transparent !important;
    color: var(--keped-navy, #071744) !important;
    font: inherit;
    font-size: 14px !important;
    font-weight: 800 !important;
    line-height: 1.4;
}

.keped-ninja-form .ninja-forms-req-symbol {
    color: #b4232d !important;
}

.keped-ninja-form .nf-field-description {
    margin: 7px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: var(--keped-muted, #667085) !important;
    font-size: 13px;
    line-height: 1.5;
}

.keped-ninja-form .nf-field-description:empty {
    display: none !important;
}

/* ---------------------------------------------------------
 * Inputs / select / textarea
 * --------------------------------------------------------- */
.keped-ninja-form .nf-field-element input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
.keped-ninja-form .nf-field-element select,
.keped-ninja-form .nf-field-element textarea {
    display: block;
    width: 100% !important;
    min-width: 0;
    min-height: 50px !important;
    margin: 0 !important;
    padding: 12px 15px !important;
    border: 1px solid #cad5eb !important;
    border-radius: 12px !important;
    background-color: #fff !important;
    background-clip: padding-box;
    box-shadow: none !important;
    color: var(--keped-ink, #101828) !important;
    font: inherit !important;
    font-size: 16px !important;
    line-height: 1.4 !important;
    outline: 0 !important;
    transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}

.keped-ninja-form .nf-field-element input::placeholder,
.keped-ninja-form .nf-field-element textarea::placeholder {
    color: #8a94a8 !important;
    opacity: 1;
}

.keped-ninja-form .nf-field-element select {
    height: 50px !important;
    padding-right: 42px !important;
    cursor: pointer;
}

.keped-ninja-form .nf-field-element textarea {
    min-height: 150px !important;
    padding-top: 12px !important;
    resize: vertical;
}

.keped-ninja-form .nf-field-element input:not([type="checkbox"]):not([type="radio"]):focus,
.keped-ninja-form .nf-field-element select:focus,
.keped-ninja-form .nf-field-element textarea:focus {
    border-color: var(--keped-blue, #0a3ce4) !important;
    box-shadow: 0 0 0 4px rgba(10, 60, 228, .10) !important;
}

/* Neutralize Ninja Forms' success presentation so a valid field still looks
 * like the approved KEPED field rather than becoming green. */
.keped-ninja-form .nf-pass .ninja-forms-field,
.keped-ninja-form .nf-pass input,
.keped-ninja-form .nf-pass select,
.keped-ninja-form .nf-pass textarea {
    border-color: #cad5eb !important;
    background-color: #fff !important;
    color: var(--keped-ink, #101828) !important;
}

.keped-ninja-form .nf-pass input:focus,
.keped-ninja-form .nf-pass select:focus,
.keped-ninja-form .nf-pass textarea:focus {
    border-color: var(--keped-blue, #0a3ce4) !important;
    box-shadow: 0 0 0 4px rgba(10, 60, 228, .10) !important;
}

/* Browser autofill should not introduce yellow/green surfaces. */
.keped-ninja-form input:-webkit-autofill,
.keped-ninja-form input:-webkit-autofill:hover,
.keped-ninja-form input:-webkit-autofill:focus,
.keped-ninja-form textarea:-webkit-autofill,
.keped-ninja-form textarea:-webkit-autofill:hover,
.keped-ninja-form textarea:-webkit-autofill:focus,
.keped-ninja-form select:-webkit-autofill,
.keped-ninja-form select:-webkit-autofill:hover,
.keped-ninja-form select:-webkit-autofill:focus {
    -webkit-text-fill-color: var(--keped-ink, #101828) !important;
    -webkit-box-shadow: 0 0 0 1000px #fff inset !important;
    box-shadow: 0 0 0 1000px #fff inset !important;
    caret-color: var(--keped-ink, #101828);
    transition: background-color 9999s ease-out 0s;
}

/* ---------------------------------------------------------
 * AFM compound control (EL + nine digits)
 * --------------------------------------------------------- */
.keped-ninja-form .keped-afm-control {
    display: flex;
    align-items: stretch;
    width: 100%;
    min-width: 0;
}

.keped-ninja-form .keped-afm-prefix {
    position: relative;
    z-index: 1;
    display: inline-flex;
    flex: 0 0 54px;
    align-items: center;
    justify-content: center;
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid #cad5eb;
    border-right: 0;
    border-radius: 12px 0 0 12px;
    background: #f4f7ff !important;
    color: var(--keped-navy, #071744) !important;
    font-size: 14px;
    font-weight: 850;
    line-height: 1;
    letter-spacing: .04em;
}

.keped-ninja-form .keped-afm-control input {
    flex: 1 1 auto;
    min-width: 0;
    border-radius: 0 12px 12px 0 !important;
}

.keped-ninja-form .keped-afm-control:focus-within .keped-afm-prefix {
    border-color: var(--keped-blue, #0a3ce4);
    box-shadow: -4px 0 0 0 rgba(10, 60, 228, .10), 0 -4px 0 -3px rgba(10, 60, 228, .10), 0 4px 0 -3px rgba(10, 60, 228, .10);
}

html[dir="rtl"] .keped-ninja-form .keped-afm-prefix {
    border-right: 1px solid #cad5eb;
    border-left: 0;
    border-radius: 0 12px 12px 0;
}

html[dir="rtl"] .keped-ninja-form .keped-afm-control input {
    border-radius: 12px 0 0 12px !important;
}

/* ---------------------------------------------------------
 * Validation
 * --------------------------------------------------------- */
.keped-ninja-form .nf-error .ninja-forms-field,
.keped-ninja-form .nf-error input,
.keped-ninja-form .nf-error select,
.keped-ninja-form .nf-error textarea,
.keped-ninja-form [aria-invalid="true"] {
    border-color: #c9202c !important;
    box-shadow: 0 0 0 4px rgba(201, 32, 44, .09) !important;
}

.keped-ninja-form .nf-error-msg,
.keped-ninja-form .nf-form-errors .nf-error-msg {
    display: block;
    min-height: 18px;
    margin: 6px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: transparent !important;
    color: #a0121b !important;
    font-size: 12px !important;
    font-weight: 600;
    line-height: 1.45;
}

.keped-ninja-form .nf-form-errors {
    max-width: 860px;
    margin: 0 0 18px;
}

/* ---------------------------------------------------------
 * Consent
 * --------------------------------------------------------- */
.keped-ninja-form .checkbox-container {
    margin: 2px 0 0 !important;
}

.keped-ninja-form .checkbox-container .field-wrap {
    display: flex;
    align-items: flex-start !important;
    gap: 10px;
    margin: 0;
}

.keped-ninja-form .checkbox-container .nf-field-element {
    flex: 0 0 auto;
    width: auto !important;
    padding-top: 2px;
}

.keped-ninja-form .checkbox-container input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    min-height: 18px !important;
    margin: 0 !important;
    padding: 0 !important;
    border-radius: 4px;
    accent-color: var(--keped-blue, #0a3ce4);
}

.keped-ninja-form .checkbox-container .nf-field-label {
    flex: 1 1 auto;
    margin: 0 !important;
}

.keped-ninja-form .checkbox-container .nf-field-label label {
    color: var(--keped-muted, #667085) !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    line-height: 1.55;
}

.keped-ninja-form .checkbox-container .nf-field-description {
    margin: 4px 0 0 28px !important;
}

.keped-ninja-form .checkbox-container .nf-field-description a {
    color: var(--keped-blue, #0a3ce4);
    font-weight: 750;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* ---------------------------------------------------------
 * Submit
 * --------------------------------------------------------- */
.keped-ninja-form .submit-container {
    margin: 2px 0 0 !important;
}

.keped-ninja-form .submit-container input[type="button"],
.keped-ninja-form .submit-container input[type="submit"],
.keped-ninja-form .submit-container button,
.keped-ninja-form .keped-nf-submit-button {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-width: 240px;
    min-height: 52px !important;
    margin: 0 !important;
    padding: 12px 22px !important;
    border: 0 !important;
    border-radius: 999px !important;
    background: var(--keped-blue, #0a3ce4) !important;
    box-shadow: 0 12px 28px rgba(10, 60, 228, .22) !important;
    color: #fff !important;
    font: inherit !important;
    font-size: 15px !important;
    font-weight: 850 !important;
    line-height: 1.2 !important;
    text-decoration: none;
    cursor: pointer;
    transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.keped-ninja-form .submit-container input[type="button"]:hover,
.keped-ninja-form .submit-container input[type="submit"]:hover,
.keped-ninja-form .submit-container button:hover,
.keped-ninja-form .keped-nf-submit-button:hover {
    transform: translateY(-2px);
    background: var(--keped-navy, #071744) !important;
    box-shadow: 0 16px 34px rgba(7, 23, 68, .24) !important;
}

.keped-ninja-form .submit-container input[type="button"]:focus-visible,
.keped-ninja-form .submit-container input[type="submit"]:focus-visible,
.keped-ninja-form .submit-container button:focus-visible,
.keped-ninja-form .checkbox-container input[type="checkbox"]:focus-visible {
    outline: 3px solid rgba(10, 60, 228, .28) !important;
    outline-offset: 3px;
}

/* ---------------------------------------------------------
 * Success response
 * --------------------------------------------------------- */
.keped-ninja-form .nf-response-msg {
    max-width: 860px;
    margin: 0 0 22px;
    padding: 14px 18px;
    border: 1px solid #b7efa9;
    border-radius: 12px;
    background: #eafbe6;
    color: #175908;
    font-weight: 750;
}

.keped-ninja-form .nf-response-msg p:last-child {
    margin-bottom: 0;
}

/* ---------------------------------------------------------
 * Responsive
 * --------------------------------------------------------- */
@media (max-width: 680px) {
    .keped-ninja-form nf-fields-wrap {
        grid-template-columns: 1fr;
    }

    .keped-ninja-form nf-field {
        grid-column: 1 / -1 !important;
    }

    .keped-ninja-form .nf-form-content {
        padding: 22px 18px !important;
        border-radius: 16px;
    }

    .keped-ninja-form .submit-container input[type="button"],
    .keped-ninja-form .submit-container input[type="submit"],
    .keped-ninja-form .submit-container button,
    .keped-ninja-form .keped-nf-submit-button {
        width: 100% !important;
        min-width: 0;
    }
}

@media (prefers-reduced-motion: reduce) {
    .keped-ninja-form .nf-field-element input,
    .keped-ninja-form .nf-field-element select,
    .keped-ninja-form .nf-field-element textarea,
    .keped-ninja-form .submit-container input,
    .keped-ninja-form .submit-container button {
        transition: none !important;
    }
}
