/*
** Form elements
*/


/*
** Normalization
**
** Normalization rules adopted from `normalize.css`, version 8.0.0; may contain
** modifications.
*/

/**
 * 1. Change the font styles in all browsers.
 * 2. Remove the margin in Firefox and Safari.
 * 3. Override browser's default minimum width.
 */

button,
input,
optgroup,
select {
  font-family: inherit; /* 1 */
  font-size: 100%; /* 1 */
  line-height: 1.15; /* 1 */
  margin: 0; /* 2 */
  min-width: 0; /* 3 */
}

/**
 * Remove background shadow on Safari.
 */

input,
select {
    background-repeat: no-repeat;
}

/**
 * Show the overflow in IE.
 * 1. Show the overflow in Edge.
 */

button,
input { /* 1 */
  overflow: visible;
}

/**
 * Remove the inheritance of text transform in Edge, Firefox, and IE.
 * 1. Remove the inheritance of text transform in Firefox.
 */

button,
select { /* 1 */
  text-transform: none;
}

/**
 * Correct the inability to style clickable types in iOS and Safari.
 */

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
}

/**
 * Remove the inner border and padding in Firefox.
 */

button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

/**
 * Restore the focus styles unset by the previous rule.
 */

button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
  outline: 1px dotted ButtonText;
}

/**
 * 1. Add the correct box sizing in IE 10.
 * 2. Remove the padding in IE 10.
 */

[type="checkbox"],
[type="radio"] {
  box-sizing: border-box; /* 1 */
  padding: 0; /* 2 */
}

/**
 * Correct the cursor style of increment and decrement buttons in Chrome.
 */

[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
  height: auto;
}


/* General input element styling */

input, select, button {
    background-color: white;
    color: #222;
    border: 1px solid #ccc;

    border-radius: .25rem;
    padding: 0.25rem;
}

input:focus, select:focus, button:focus {
    outline: 0;
    background-color: white;
    color: #222;
    fill: #222;
    border-color: #ee7601;
    box-shadow: 0 0 0 .2rem hsl(29.6, 99.2%, 72.9%);
}

input:disabled, select:disabled, button:disabled {
    background-color: #eee;
    color: #888;
    fill: #888;
    border-color: #ccc;
    cursor: default;
}


select {
    -webkit-appearance: none;
    appearance: none;

    padding-right: 1rem;
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 1.5'%3E%3Cpath fill='%23343a40' d='M 2 2 L 0 0 h 4 z'/%3E%3C/svg%3E");
    background-position: right .35rem center;
    background-repeat: no-repeat;
    background-size: 0.65rem 0.65rem;
}

select:disabled {
    background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 4 1.5'%3E%3Cpath fill='%23959595' d='M 2 2 L 0 0 h 4 z'/%3E%3C/svg%3E");
}

/* Context-aware fixes for <input type="number"> elements. */

/* Disable spinners on Safari/Chrome */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

/* Disable spinners */
input[type="number"] {
    -webkit-appearance: textfield;
    appearance: textfield;
}


/* Button styling rules for both <button> and <a> elements. */

button {
    text-align: center;
    background-color: #d3d3d3;
    color: inherit;
    border: 1px solid #cacaca;
    border-radius: 3px;

    width: auto;
    flex-shrink: 0;

    cursor: pointer;
}

button:focus:not(:disabled) {
    outline: 0;
    background-color: #ddd;
    color: inherit;
    box-shadow: 0 0 0 0.2rem hsl(29.6, 99.2%, 72.9%);
}

button:hover:not(:disabled) {
    background-color: #bbbbbb;
    border-color: #acacac;
}

button:active:not(:disabled) {
    background-color: var(--orange);
    color: white;
}

button:disabled {
    background-color: #eee;
    border-color: #ddd;
}


button.primary {
    border-color: var(--orange);
    background-color: var(--orange);
    color: white;
}

button.primary:focus:not(:disabled),
button.primary:hover:not(:disabled) {
    border-color: var(--orange-dark);
    background-color: var(--orange);
}

button.primary:focus:not(:disabled) {
    box-shadow: 0 0 0 0.2rem hsl(29.6, 99.2%, 72.9%);
    color: white;
}

button.primary:active:not(:disabled) {
    background-color: var(--orange-dark);
    color: white;
}

button.primary:disabled {
    background-color: #ddd;
    color: #888;
    border-color: transparent;
}



button.in-progress::before {
    content: '';
    display: inline-block;
    vertical-align: middle;
    position: relative;
    width: 1rem;
    height: 1rem;
    margin-top: -0.2rem;
    margin-right: 0.25rem;
    border-radius: 2rem;
    border: 2px solid var(--orange);
    border-right-color: transparent;
    border-left-color: transparent;
    animation: button-progress-spinner .8s linear infinite;
}

@keyframes button-progress-spinner {
    to {
        transform: rotate(360deg);
    }
}



/* Checkbox styling */

label.checkbox-visual input[type="checkbox"] {
    display: none;
}

label.checkbox-visual input[type="checkbox"] + .box {
    display: inline-block;
    border: 1px solid #ccc;
    padding: 0.25rem;
    border-radius: .25rem;
    cursor: pointer;
    user-select: none;
}

label.checkbox-visual input[type="checkbox"] + .box > * {
    display: inline-block;
    color: #222;
    background-color: #ddd;
    border-radius: .15rem;
    padding: 0.1rem 0.5rem;
}

label.checkbox-visual input[type="checkbox"]:not(:checked) + .box .unchecked {
    background-color: #666;
    color: white;
}

label.checkbox-visual input[type="checkbox"]:checked + .box .checked {
    background-color: var(--orange);
    color: white;
}

label.checkbox-visual input[type="checkbox"]:disabled + .box {
    cursor: default;
    background-color: #eee;
    border: 1px solid #ddd;
}

label.checkbox-visual input[type="checkbox"]:disabled + .box > * {
    background-color: #ddd;
    color: #888;
}
