
/*
    input styles
*/

:where(select) {
    color: inherit;
}

.floating:not(:focus-within):has(input[placeholder=" "]:placeholder-shown) span {
    top: 50%;
    transform: translateY(-50%);
    font-size: 1rem;
}

.floating {
    --label-background: white;
    background: var(--label-background);
    color: var(--text-color-dark);

    position: relative;
    display: flex;
    align-items: center;
    gap: 5px;

    padding: 10px 15px;

    border: solid 2px grey;
    border-left: solid 5px var(--red);
    
    transition: border .2s ease-out, box-shadow .2s ease-out;
    min-height: 55px;

    div {
        display: flex;
    }

    &:is(:hover, :focus-within) {
        box-shadow: var(--line-box-shadow);
    }

    & i:not(button > i) {
        font-size: 1.3rem;
        color: var(--red);
        width: 30px;
        transition: color .3s ease-out;
        text-shadow: 3px 3px 0px lightgrey;

        display: flex;
        
    }

    & span {
        position: absolute;
        background: var(--label-background);
        padding: 0 10px;
        opacity: .7;
        transform: translateY(0);
        top: 4px;
        left: 40px;
        font-size: .8em;
        transition: all .2s ease-out;
    }

    & :is(input, select, textarea) {
        display: block;
        flex-grow: 1;
        background: transparent;
        border: 0;
        outline: none;
    }
    
    &:has( span) :is(input, select, textarea) {
        padding-top: 15px;
        height: 33px;
    }

    & textarea {
        min-height: 250px;
    }

    & input[type="file"] {
        padding-top: 12px;
    }



}

/* 
    style checkboxes to look like switches
*/


.floating:has(input[type="checkbox"])
{
    cursor: pointer;

    &:is(:hover, :focus-within):has(:checked) {
        box-shadow: var(--line-box-shadow-red);
    }
}


.floating:has(input[type="checkbox"]) span {
    order: 2;
    position: relative;
    left: unset;
    top: unset;
    margin: unset;
    background: none;
    font-weight: normal;
    flex-grow: 1;
    white-space: nowrap;
    padding-right: 0;

    user-select: none;
}


.floating:has(input[type="checkbox"]:not(:checked)) {

    border-color: var(--text-color-grey);

    & i {
        color: var(--text-color-grey);
    }

    & input {
        --color: var(--text-color-grey);
    }
}

input[type="checkbox"][role=switch] {
    cursor: pointer;

    --color: var(--red);

    display: inline;
    width: fit-content;
    margin-top: 2px;
    
    width: 35px;
    flex-grow: 0;
    height: 19px;
    border: solid var(--color) 1px;
    appearance: none;

    position: relative;
    transition: background .3s ease-out;

    &:checked {
        background: var(--color);
    }

    &:focus {
        outline: 1px var(--color) solid;
        outline-offset: 2px;
    }
}

input[type="checkbox"][role=switch]::before {
    --width: 11px;
    content: ' ';
    display: block;
    top: 3px;
    left: 3px;
    position: absolute;
    width: var(--width);
    height: calc(100% - 6px);
    background: var(--color);
    transition: left .4s var(--bouncy-timing-function), background .4s var(--bouncy-timing-function);
}

input[type="checkbox"][role=switch]:checked:before {
    top: 3px;
    left: calc(100% - calc(var(--width) + 3px));
    background: white;
}


::file-selector-button {
    display: none;
}

/* =========================
    blazor default styles:
 ========================= 

 .valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid var(--red);
}

.validation-message {
    color: var(--red);
}
*/