/*
 * Copyright (C) 2020 Apple Inc.  All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#if defined(ENABLE_IOS_FORM_CONTROL_REFRESH) && ENABLE_IOS_FORM_CONTROL_REFRESH

textarea,
input {
    border: 1px solid #4c4c4c;
    font: 11px Helvetica, -webkit-pictograph;
}

input:matches([type="checkbox"], [type="radio"]) {
    border: 1px solid #4c4c4c;
}

input[type="checkbox"]:indeterminate:disabled,
input:matches([type="checkbox"], [type="radio"]):checked:disabled,
input:matches([type="checkbox"], [type="radio"]):disabled {
    opacity: 0.4;
}

input::-webkit-list-button {
    width: 16px;
    content: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" stroke="black" fill="black" width="16" height="16"><polygon points="8 11.031, 4.5 4.969, 11.5 4.969"/></svg>');
}

input[type="search"] {
    border: 1px solid #4c4c4c;
    background-color: initial;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-decoration {
    margin: auto 0;
}

input[type="search"]::-webkit-search-results-button {
    align-self: initial;
    margin: initial;
}

input[type="search"]::-webkit-search-decoration,
input[type="search"]::-webkit-search-results-decoration,
input[type="search"]::-webkit-search-results-button {
    background-color: initial;
    height: initial;
    width: initial;
    mask-image: initial;
}

input:matches([type="button"], [type="submit"], [type="reset"]), input[type="file"]::file-selector-button, button {
    color: ButtonText;
    border: 1px solid #4c4c4c;
    /* We want to be as close to background-color:transparent as possible without actually being transparent. */
    background-color: rgba(255, 255, 255, 0.01);
    font: 11px Helvetica;
}

input[type="submit"] {
    font-weight: initial;
}

input:matches([type="button"], [type="submit"], [type="reset"]):disabled,
input[type="file"]:disabled::file-selector-button, button:disabled,
select:disabled, optgroup:disabled, option:disabled,
select[disabled]>option {
    color: GrayText;
}

input[type="file"]:disabled {
    color: initial;
    opacity: 0.4;
}

input[type="range"]::-webkit-slider-thumb {
    background-color: white;
}

input[type="range"]::-webkit-slider-thumb:active {
    background-color: black;
}

input[type="range"]::-webkit-slider-thumb, input[type="range"]::-webkit-slider-thumb:active {
    box-shadow: initial;
    border: 1px solid rgb(66, 66, 66);
    padding: 0px;
}

input[type="color"]::-webkit-color-swatch-wrapper {
    border-radius: initial;
    padding: 0;
}

input[type="color"]::-webkit-color-swatch {
    border-radius: 2px;
}

input:matches([type="date"], [type="time"], [type="datetime-local"], [type="month"], [type="week"]) {
    border: 1px solid #4c4c4c;
    font-family: Helvetica;
    color: initial;
}

input:matches([type="date"], [type="time"], [type="datetime-local"], [type="month"], [type="week"]):disabled {
    background-color: white;
    color: initial;
    opacity: 0.4;
}

input::-webkit-date-and-time-value {
    margin-right: 18px;
    text-align: inherit;
    width: initial;
}

select {
    color: initial;
    font-weight: initial;
    font: 11px Helvetica;
    border: 1px solid #4c4c4c;
    border-radius: 5px;
    /* We want to be as close to background:transparent as possible without actually being transparent */
    background-color: rgba(255, 255, 255, 0.01);
}

select:focus {
    border-color: rgb(17, 46, 135);
}

#endif
