
/*
=========================================================
FORM OBJECTS CSS
=========================================================
 * Innehåller kundanpassad styling av formulär,
 * inmatningsfält, knappar et.c. utanför Envision
 *
 * Copyright (C) Limepark AB.
 * https://limepark.se/licensvillkor
=========================================================*/
/* stylelint-disable no-duplicate-selectors */

/*
---------------------------------------------------------
GENERELLA FORMULÄROBJEKT
--------------------------------------------------------- */

button {
  cursor: pointer;
  font-family: inherit;
}

textarea {
  font-family: inherit;
}

input,
textarea,
select,
.env-form-input {
  transition: border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out;
}

input:not([type='submit']):focus,
textarea:focus,
select:focus,
.env-form-input:focus {
  border-color: #000 !important;
  box-shadow: 0 0 0 0.4rem rgb(83 98 124 / 100%);
  outline: none;
  z-index: 1;
}

/*
---------------------------------------------------------
CHECKBOXAR & RADIOKNAPPAR
--------------------------------------------------------- */

.pagecontent .sv-form-portlet input[type='checkbox'],
.pagecontent .sv-form-portlet input[type='radio'] {
  height: 1px;
  left: -10000px;
  overflow: hidden;
  position: absolute;
  top: auto;
  width: 1px;
}

.pagecontent .sv-form-portlet input[type='checkbox'] + label,
.pagecontent .sv-form-portlet input[type='radio'] + label {
  cursor: pointer;
  font-size: 1.5rem;
  font-weight: normal;
  line-height: 1.5;
  padding: 0.4em 0.6em 0.4em 2em;
  position: relative;
}

/*
.pagecontent .sv-form-portlet input[type='checkbox'] + label:hover,
.pagecontent .sv-form-portlet input[type='radio'] + label:hover,
.pagecontent .sv-form-portlet input[type='checkbox']:focus + label,
.pagecontent .sv-form-portlet input[type='radio']:focus + label {
  text-decoration: underline;
}*/

.pagecontent .sv-form-portlet input[type='checkbox'] + label:before,
.pagecontent .sv-form-portlet input[type='radio'] + label:before {
  background-color: #fff;
  border: 1px solid var(--lp-color-1);
  content: '';
  height: 1.1em;
  left: 0.5rem;
  position: absolute;
  top: 0.45em;
  width: 1.1em;
}

.pagecontent .sv-form-portlet input[type='radio'] + label:before {
  border-radius: 50%;
}

.pagecontent .sv-form-portlet input[type='radio']:checked + label:before {
  background-color: var(--lp-color-1);
  box-shadow: inset 0 0 0 0.2em #fff;
}

.pagecontent .sv-form-portlet input[type='checkbox']:checked + label:after {
  background-color: var(--lp-color-1);
  content: '';
  display: block;
  height: 0.9em;
  left: calc(0.6rem + 0.1em);
  opacity: 1;
  position: absolute;
  top: 0.6em;
  transition: all 0.3s ease;
  width: 0.9em;
  z-index: 1;

  -webkit-clip-path: polygon(14% 38%,0 53%,45% 91%,100% 24%,85% 11%,41% 61%);
  clip-path: polygon(14% 38%,0 53%,45% 91%,100% 24%,85% 11%,41% 61%);
}

/*
---------------------------------------------------------
FIXAR/FÖRBÄTTRINGAR
---------------------------------------------------------*/

.sv-defaultFormTheme input[type=submit]::-moz-focus-inner {
  border: 0; /* fix för felaktig höjd i Firefox */
  padding: 0;
}

.sv-defaultFormTheme input[type=text],
.sv-defaultFormTheme input[type=email],
.sv-defaultFormTheme input[type=url],
.sv-defaultFormTheme input[type=tel],
.sv-defaultFormTheme input[type=number],
.sv-defaultFormTheme textarea,
.sv-defaultFormTheme select {
  box-shadow: none;
  height: auto;
  transition: none;
}

.sv-defaultFormTheme input[type=text],
.sv-defaultFormTheme input[type=email],
.sv-defaultFormTheme input[type=url],
.sv-defaultFormTheme input[type=tel],
.sv-defaultFormTheme input[type=number],
.sv-defaultFormTheme textarea {
  -webkit-appearance: none;
}

.sv-defaultFormTheme input[type=button],
.sv-defaultFormTheme input[type=submit],
.sv-defaultFormTheme input[type=reset] {
  border-style: solid; /* sätts för att undvika konstig default i Chrome */
  box-sizing: border-box;

  -webkit-appearance: none;
}


/* Fixar för Envision */
.env-form textarea {
  font-family: inherit;
}

.env-form-radio__fake {
  top: 2px;
}

[type=radio]:checked + label .env-form-radio__fake:before {
  border-color: #6892d5;
  top: 0;
}

[type=checkbox]:checked + label .env-checkbox__fake:after {
  border-bottom: 4px solid #fff;
  border-left: 4px solid #fff;
  height: 0.35em;
  width: 0.6em;
}


/* Samtycke */

.sv-formField .sv-form-consent {
  padding-left: 0;
}

.pagecontent .sv-form-portlet .sv-form-consent input[type='checkbox'] + label:before,
.pagecontent .sv-form-portlet .sv-form-consent input[type='radio'] + label:before {
  left: 0;
}

.pagecontent .sv-form-portlet .sv-form-consent input[type='checkbox']:checked + label:after {
  left: calc(0.1rem + 0.1em);
}

/*
---------------------------------------------------------
DEFAULT FORM THEME - INMATNINGSFÄLT
--------------------------------------------------------- */

.sv-defaultFormTheme input[type=text],
.sv-defaultFormTheme input[type=email],
.sv-defaultFormTheme input[type=url],
.sv-defaultFormTheme input[type=tel],
.sv-defaultFormTheme input[type=number],
.sv-defaultFormTheme textarea,
.sv-defaultFormTheme select {
  background-color: #fff;
  border: 1px solid rgba(0,0,0,0.418);
  border-radius: 4px;
  font-size: 1.8rem;
  line-height: 1.6 !important; /* Important skriver över SiteVision's styling */
  padding: 1rem 1.5rem;
  transition: border-color 0.15s ease-in-out,box-shadow 0.15s ease-in-out;
}

.sv-defaultFormTheme input[type=text]:hover,
.sv-defaultFormTheme input[type=email]:hover,
.sv-defaultFormTheme input[type=url]:hover,
.sv-defaultFormTheme input[type=tel]:hover,
.sv-defaultFormTheme input[type=number]:hover,
.sv-defaultFormTheme textarea:hover,
.sv-defaultFormTheme select:hover {
  border-color: #3f4d09;
}

.sv-defaultFormTheme input[type=text]:focus,
.sv-defaultFormTheme input[type=email]:focus,
.sv-defaultFormTheme input[type=url]:focus,
.sv-defaultFormTheme input[type=tel]:focus,
.sv-defaultFormTheme input[type=number]:focus,
.sv-defaultFormTheme textarea:focus,
.sv-defaultFormTheme select:focus {
  /*samma utseende vid musklick som vid tabbning */
  border-color: #000 !important;
  box-shadow: 0 0 0 0.4rem rgb(52 64 85 / 50%);
}


/*
---------------------------------------------------------
DEFAULT FORM THEME - KNAPPAR
--------------------------------------------------------- */

.sv-defaultFormTheme input[type=button],
.sv-defaultFormTheme input[type=submit],
.sv-defaultFormTheme input[type=reset] {
  background-color: var(--lp-color-1);
  border-color: var(--lp-color-1);
  border-radius: 4px;
  color: var(--lp-color-1-text);
  cursor: pointer;
  font-size: 1.8rem;
  line-height: 1.6;
  padding: 1rem 2rem;
}

.sv-defaultFormTheme input[type=button]:hover,
.sv-defaultFormTheme input[type=submit]:hover,
.sv-defaultFormTheme input[type=reset]:hover,
.sv-defaultFormTheme input[type=button]:active,
.sv-defaultFormTheme input[type=submit]:active,
.sv-defaultFormTheme input[type=reset]:active {
  background-color: var(--lp-color-1-dark);
  border-color: var(--lp-color-1-dark);
  color: var(--lp-color-1-text);
}

.sv-defaultFormTheme input[type=reset]:focus,
.sv-defaultFormTheme input[type=submit]:focus,
.sv-defaultFormTheme input[type=button]:focus {
  background-color: var(--lp-color-1-dark);
  border-color: var(--lp-color-1-dark);
  color: var(--lp-color-1-text); /* samma utseende vid musklick som vid tabbning */
}

.sv-defaultFormTheme input[type=reset]:focus {
  outline: none;
}
