/*
 * Arvsportalen Form UI – choice-card vertical alignment
 * Version 0.5.2
 *
 * Ett valkort kan innehålla en eller flera textrader. Tidigare låg själva
 * radio/checkbox-kontrollen nära överkanten medan texten ibland centrerades,
 * eller tvärtom. Det gav olika optisk höjd mellan kontroll och text.
 *
 * Lösningen här är att behandla kortet som en helhet: både kontrollen och
 * textblocket centreras vertikalt i samma kort. På så sätt ligger enradiga
 * svar exakt i höjd med sin kontroll och flerradiga svar får kontrollen mitt
 * för hela textblocket.
 */

body [id^="gform_wrapper_"] .ap-choice-cards .gchoice {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    align-self: stretch !important;
}

body [id^="gform_wrapper_"] .ap-choice-cards .gchoice > label,
body [id^="gform_wrapper_"] .ap-choice-cards .gchoice > label.gform-field-label {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    align-content: normal !important;
    place-content: normal !important;
    width: 100% !important;
    max-width: none !important;
    height: 100% !important;
    box-sizing: border-box !important;
}

body [id^="gform_wrapper_"] .ap-choice-cards .gchoice > input[type="radio"],
body [id^="gform_wrapper_"] .ap-choice-cards .gchoice > input[type="checkbox"] {
    position: absolute !important;
    top: 50% !important;
    margin-top: 0 !important;
    transform: translateY(-50%) !important;
}

/*
 * Hårda selektorer för de kända två-/trevägsvalen i testamentena. De gör
 * patchen oberoende av Elementor- eller Gravity Forms-regler med högre
 * specificitet.
 */
body #gform_wrapper_18 #input_18_39 > .gchoice > label,
body #gform_wrapper_18 #input_18_24 > .gchoice > label,
body #gform_wrapper_19 #input_19_35 > .gchoice > label,
body #gform_wrapper_19 #input_19_43 > .gchoice > label,
body #gform_wrapper_19 #input_19_24 > .gchoice > label,
body #gform_wrapper_20 #input_20_24 > .gchoice > label,
body #gform_wrapper_21 #input_21_24 > .gchoice > label,
body #gform_wrapper_21 #input_21_54 > .gchoice > label,
body #gform_wrapper_21 #input_21_71 > .gchoice > label {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    height: 100% !important;
}

body #gform_wrapper_18 #input_18_39 > .gchoice > input[type="radio"],
body #gform_wrapper_18 #input_18_24 > .gchoice > input[type="radio"],
body #gform_wrapper_19 #input_19_35 > .gchoice > input[type="radio"],
body #gform_wrapper_19 #input_19_43 > .gchoice > input[type="radio"],
body #gform_wrapper_19 #input_19_24 > .gchoice > input[type="radio"],
body #gform_wrapper_20 #input_20_24 > .gchoice > input[type="radio"],
body #gform_wrapper_21 #input_21_24 > .gchoice > input[type="radio"],
body #gform_wrapper_21 #input_21_54 > .gchoice > input[type="radio"],
body #gform_wrapper_21 #input_21_71 > .gchoice > input[type="checkbox"] {
    top: 50% !important;
    margin-top: 0 !important;
    transform: translateY(-50%) !important;
}

/* =========================================================
   0.5.3 – Arvskifte: explicit overrides

   Arvskiftes-CSS:en har fältspecifika top-värden för radio-knapparna,
   bl.a. #input_17_180, med högre specificitet än den generella
   normaliseringen ovan. Därför måste de kända valkorten i form 17
   normaliseras med lika specifika selektorer.
   ========================================================= */
body #gform_wrapper_17 #input_17_180 > .gchoice > label,
body #gform_wrapper_17 #input_17_99 > .gchoice > label,
body #gform_wrapper_17 #input_17_100 > .gchoice > label {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    height: 100% !important;
}

body #gform_wrapper_17 #input_17_180 > .gchoice > input[type="radio"],
body #gform_wrapper_17 #input_17_99 > .gchoice > input[type="radio"],
body #gform_wrapper_17 #input_17_100 > .gchoice > input[type="radio"] {
    top: 50% !important;
    margin-top: 0 !important;
    transform: translateY(-50%) !important;
}
