/*
Taken from the <style> element with ID '_defaultStyles' in a VS Code webview,
replacing 'body' background-color of 'transparent' with '--vscode-editor-background'
*/

body {
    background-color: var(--vscode-editor-background);
    color: var(--vscode-editor-foreground);
    font-family: var(--vscode-font-family);
    font-weight: var(--vscode-font-weight);
    font-size: var(--vscode-font-size);
    margin: 0px;
    padding: 0px 20px;
}

a,
a code {
    color: var(--vscode-textLink-foreground);
    font-size: var(--vscode-font-size);
    text-decoration: none;
}

a:hover {
    color: var(--vscode-textLink-activeForeground);
    text-decoration: underline;
}

a:focus,
input:focus,
select:focus,
textarea:focus {
    outline: -webkit-focus-ring-color solid 1px;
    outline-offset: -1px;
    outline-color: var(--vscode-focusBorder);
}

button {
    padding: 4.6px 11.5px 4.6px 11.5px;
    border: 1px solid var(--vscode-button-border);
    background-color: var(--vscode-button-background);
    color: var(--vscode-button-foreground);
    font-family: inherit;
    border-radius: 2px;
}

button:hover {
    background-color: var(--vscode-button-hoverBackground);
    border-color: var(--vscode-button-hoverBorder);
    cursor: pointer;
}

button:focus-visible {
    outline: 1px solid var(--vscode-focusBorder);
    outline-offset: 2px;
}

button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: var(--vscode-button-hoverBackground);
}

.secondary-button {
    padding: 4.6px 11.5px 4.6px 11.5px;
    border: 1px solid var(--vscode-button-secondaryBorder);
    background-color: var(--vscode-button-secondaryBackground);
    color: var(--vscode-button-secondaryForeground);
    border-radius: 2px;
}

.secondary-button:hover {
    background-color: var(--vscode-button-secondaryHoverBackground);
    border-color: var(--vscode-button-secondaryHoverBorder);
    cursor: pointer;
}

.secondary-button:disabled {
    background-color: var(--vscode-button-secondaryHoverBackground);
}

.secondary-button:hover:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: var(--vscode-button-secondaryHoverBackground);
}

.secondary-button code {
    color: var(--vscode-textPreformat-foreground);
}

.icon-button,
.choose-location-button {
    color: inherit;
    background: none;
    padding: 0rem 0.3rem 0rem 0.3rem;
    border-radius: 5px;
}
.icon-button:hover,
.choose-location-button:hover {
    background-color: rgba(255, 255, 255, 0.08);
}

.choose-location-button {
    margin-top: 0.1rem;
    padding: 0.15rem 0.3rem 0.15rem 0.1rem;
}

.icon-button:disabled,
.choose-location-button:disabled {
    background: none;
}

blockquote {
    background: var(--vscode-textBlockQuote-background);
    border-color: var(--vscode-textBlockQuote-border);
}

hr {
    border: none;
    border-top: 1px solid var(--vscode-settings-dropdownListBorder);
    margin: 4px 0 4px 0;
}

input[type="text"],
input[type="password"],
input[type="number"] {
    height: 1.5rem;
    color: var(--vscode-foreground);
    background-color: var(--vscode-input-background);
    border: 1px solid var(--vscode-dropdown-border);
    padding: 0 9px;
    box-sizing: border-box;
    border-radius: 2px;
    font-family: inherit;
}

input[type="text"]:read-only {
    cursor: not-allowed;
}

input[type="text"]:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

input[type="checkbox"] {
    width: 18.25px;
    height: 18.25px;
    cursor: pointer;
}

input[type="radio"] {
    -webkit-appearance: none;
    appearance: none;
    width: 17px;
    height: 17px;
    background-color: var(--vscode-checkbox-background, none);
    border: 1px solid var(--vscode-checkbox-border, --radio-border-color);
    border-radius: 50%;
    cursor: pointer;
    outline: none;
    color: var(--vscode-checkbox-foreground, white);
    margin: 0px;
    padding: 0px;
    position: relative;
    top: 0.18rem;
}

input[type="radio"]:checked::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    background-color: var(--vscode-checkbox-foreground, white);
    border-radius: 50%;
    transform: translate(-50%, -50%);
}

input[type="radio"]:focus-visible {
    border: 1px solid var(--vscode-focusBorder, #007acc);
}

input[type="radio"]:active {
    border: 1px solid var(--vscode-focusBorder, #007acc);
}

input[type="radio"]:disabled {
    cursor: not-allowed;
    opacity: 0.4;
}

fieldset:disabled label {
    opacity: 0.4;
}

select {
    height: 1.5rem;
    color: var(--vscode-input-foreground);
    background-color: var(--vscode-input-background);
    border: 1px solid var(--vscode-input-border);
    padding: 0px 0px 0px 4px;
    box-sizing: border-box;
    font-family: inherit;
    border-radius: 2px;
}

select:hover {
    cursor: pointer;
}

option {
    font-size: var(--vscode-font-size);
}

option:focus {
    background-color: var(--vscode-list-activeSelectionBackground);
}

kbd {
    color: var(--vscode-editor-foreground);
    border-radius: 3px;
    vertical-align: middle;
    padding: 1px 3px;
    background-color: rgba(128, 128, 128, 0.17);
    border-width: 1px;
    border-style: solid;
    border-color: rgba(71, 71, 71, 0.4) rgba(71, 71, 71, 0.4) rgba(88, 88, 88, 0.4);
    border-image: initial;
    box-shadow: rgba(88, 88, 88, 0.4) 0px -1px 0px inset;
}

.vscode-light kbd {
    background-color: rgba(222, 222, 222, 0.5);
    border-width: 1px;
    border-style: solid;
    border-color: rgba(204, 204, 204, 0.7) rgba(204, 204, 204, 0.7) rgba(186, 186, 186, 0.7);
    border-image: initial;
    box-shadow: rgba(186, 186, 186, 0.7) 0px -1px 0px inset;
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-corner {
    background-color: var(--vscode-editor-background);
}

::-webkit-scrollbar-thumb {
    background-color: var(--vscode-scrollbarSlider-background);
}

::-webkit-scrollbar-thumb:hover {
    background-color: var(--vscode-scrollbarSlider-hoverBackground);
}

::-webkit-scrollbar-thumb:active {
    background-color: var(--vscode-scrollbarSlider-activeBackground);
}

::highlight(find-highlight) {
    background-color: var(--vscode-editor-findMatchHighlightBackground);
}

::highlight(current-find-highlight) {
    background-color: var(--vscode-editor-findMatchBackground);
}

dialog {
    background-color: var(--vscode-editor-background);
    color: var(--vscode-editor-foreground);
    border-color: var(--vscode-editorGroup-border);
}

fieldset {
    border: none;
    padding: 0;
    margin: 0;
}

input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

input[type="number"]:disabled {
    cursor: not-allowed;
    opacity: var(--disabled-opacity);
}

/* See:
   - https://blog.logrocket.com/creating-beautiful-tooltips-with-only-css/
   - https://github.com/microsoft/vscode/blob/main/src/vs/base/browser/ui/hover/hoverWidget.css
*/
.tooltip-holder {
    position: relative; /* make the .tooltip element a container for the tooltip text */
    cursor: pointer;
}

.tooltip-holder:after {
    content: attr(data-tooltip-text);
    position: absolute;
    margin-left: 0.5rem;
    padding: 4px 8px;
    z-index: 40;

    color: var(--vscode-editorHoverWidget-foreground);
    background: var(--vscode-editorHoverWidget-background);
    border: 1px solid var(--vscode-editorHoverWidget-border);
    border-radius: 3px;
    box-shadow: 0 2px 8px var(--vscode-widget-shadow);

    max-width: 500px;
    width: max-content;
    white-space: pre-wrap;
    word-wrap: break-word;

    display: none; /* hide by default */
}

.tooltip-holder:hover:after {
    display: inline-block;
}
