:root {
    --toggle-padding: 10px;
}

.avatar-wrap {
    flex-shrink: 0;
    border-radius: 100%;
    width: 44px;
    height: 44px;
    overflow: hidden;
    background: var(--gradient-pink);

    & > img {
        object-fit: cover;
        height: 100%;
        width: 100%;
    }

    & .mars-avatar {
        object-fit: contain;
    }
}

.button {
    position: relative;

    padding: 0.5rem 1rem;
    min-width: 14rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--base-font-family);
    text-align: center;
    cursor: pointer;
    border: 1px solid var(--near-black);
    outline: none;
    transition: all var(--transition-duration) linear;
    background: var(--black);
    color: var(--white);
    width: 100%;

    @media (--lg-up) {
        width: auto;
        height: auto;
    }

    &.isBig {
        font-size: 1.15em;

        @media (--lg-up) {
            padding: 1em 2em;
        }
    }

    &.outline {
        border-radius: 4px;
        border: solid 1px color-mod(var(--black) alpha(10%));
        background-color: var(--white);
        color: var(--black);
    }

    &.rounded {
        border-radius: 50px;
    }

    & path {
        transition: all var(--transition-duration) linear;
    }
}

body:not(.mobile-safari) .button:hover,
.button:focus.focus-visible {
    background-color: var(--white);
    color: var(--black);
}

body:not(.mobile-safari) .button.outline:hover,
.button.outline:focus.focus-visible {
    border-color: black;
}

body:not(.mobile-safari) .button:hover path,
.button:focus.focus-visible path {
    fill: var(--black);
}

.button:disabled {
    pointer-events: none;
    opacity: 0.3;
}

.card-action {
    border: none;
    padding: 0.8rem 1.2rem;
    min-width: unset;
    display: flex;
    flex-direction: row;
    align-items: center;
    font-family: var(--base-font-family);
    font-weight: 600;
    box-shadow: rgba(0, 0, 0, 0.15) 2px 2px 0 2px;
    background: white;
    white-space: nowrap;
    text-transform: none;
    animation: fade-in var(--transition-duration);
}

body:not(.mobile-safari) .card-action:hover,
body:not(.mobile-safari) .button.card-action:hover,
.card-action:focus.focus-visible,
.button.card-action:focus.focus-visible {
    outline: none;
    margin: 1px -1px -1px 1px;
    background: white;
    color: var(--black);
    opacity: 0.8;
    box-shadow: none;
}

body:not(.mobile-safari) .button.card-action:hover path,
button.card-action:focus.focus-visible path {
    fill: var(--black);
}

@media (--xs-down) {
    .card-action {
        white-space: normal;
    }
}

.hr {
    border: none;
    margin: 1.5rem 0;
    width: 100%;
    height: 1.5px;
    background-color: rgba(230, 229, 227, 0.6);
}

.checkbox-container {
    flex-shrink: 0;
    margin-top: 5px;
    margin-inline-end: 10px;
    position: relative;
    border: 1.6px solid var(--near-black);
    border-radius: 2px;
    width: 15px;
    height: 15px;

    &:focus-within {
        border-width: 3px;

        & .checkmark {
            top: -7.5px;
        }
    }

    input {
        position: absolute;
        top: 0;
        left: 0;
        margin: 0 !important;
        padding: 0 !important;
        width: 100%;
        height: 100%;
        appearance: none;
        border: none !important;
        outline: none !important;
        background: transparent;
    }

    & .checkmark {
        width: 100%;
        display: none;
        position: absolute;
        top: -6px;
        pointer-events: none;
    }

    input:checked {
        background: --var(near-black);
    }

    input:checked ~ .checkmark {
        display: block;
    }
}

.labeled-checkbox {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
}

.labeled-form-control,
.checkbox-container {
    position: relative;
    display: flex;
    flex-direction: column;

    & :required,
    & :valid {
        box-shadow: none;
    }

    & .label {
        margin-inline-start: 9px;
        padding: 0 5px;
        position: absolute;
        top: -8px;
        z-index: var(--middle-z-index);
        background: var(--white);
        font-size: var(--font-size-xs);
        color: var(--near-black);
    }

    & input,
    & select,
    & textarea {
        border: 1.6px solid #e6e4e1;
        border-radius: 2px;
        padding: 13px;
        font-size: var(--font-size);
        font-family: var(--base-font-family);
        color: var(--black);
        background-color: var(--white);

        &:focus {
            border-color: var(--black);
        }

        &:disabled {
            color: var(--warm-grey);
            cursor: not-allowed;
        }
    }

    &.for-select {
        & .wrapper {
            position: relative;

            & select {
                cursor: pointer;
                padding-inline-end: 33px;
                width: 100%;
                appearance: none;
            }
        }
    }
}

.menu-icon {
    transform: scale(2);

    & rect {
        transition: transform var(--transition-duration) var(--easing);
    }

    &.active {
        & .left {
            transform: translateX(-4px);
        }

        & .right {
            transform: translateX(4px);
        }
    }
}

.spinner {
    box-sizing: border-box;
    animation: spinner-fade-in 0.5s ease-in forwards;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3em;

    .spinner__shape {
        border-radius: 50%;
        display: inline-block;

        height: var(--spinner-height);
        width: var(--spinner-height);

        animation: spin 4s linear infinite;
        background-color: var(--black);
        opacity: 1;
        transition: opacity var(--transition-duration) linear;
    }
}

.spinner--light {
    .spinner__shape {
        background-color: var(--white);
    }
}

.spinner--floating {
    pointer-events: none;
    z-index: var(--middle-z-index);
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    margin: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: spinner-fade-in 0.5s ease-in forwards;

    .spinner__shape {
        margin: auto;
        position: absolute;
        top: 0;
        bottom: 0;
        left: 0;
        right: 0;
    }
}

@keyframes spinner-fade-in {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.text-button {
    border: none;
    background: none;
    font-family: var(--base-font-family);

    &.left-aligned {
        text-align: left;
    }
}

.toggle-input {
    border-radius: 25px;
    padding: 0 var(--toggle-padding);
    width: min-content;
    height: 36px;

    position: relative;
    display: flex;
    flex-direction: row;
    justify-content: space-around;
    align-items: center;

    [dir='rtl'] & {
        flex-direction: row-reverse;
    }

    color: var(--white);
    background: #9b9b9b;

    & input {
        margin: 0;
        width: 100%;
        height: 100%;
        position: absolute;
        appearance: none;
        cursor: pointer;

        &::before {
            content: '';
            border-radius: 25px;
            position: absolute;
            left: 0;
            width: calc(50% + var(--toggle-padding));
            height: 100%;
            background: var(--valid-green);
            transform: translateX(0%);
            transition: transform var(--easing) var(--transition-duration),
                background linear var(--transition-duration);
        }

        &:checked::before {
            transform: translateX(calc(100% - 2 * var(--toggle-padding)));
        }
    }

    & div {
        z-index: var(--middle-z-index);
        pointer-events: none;
        margin: 0 25px;
    }
}
