/*
 * Suosikkipainike (peh-favorite). Säännöt vastaavat korvattavien elementtien
 * perustyylejä, jotta ulkoasu pysyy samana (G9, suunnitelman kohta 3.4):
 * BricksExtras 1.7.6 `components/assets/css/favorite.css` (vain add_remove-painikkeen
 * ja latausindikaattorin säännöt; työkaluvihje ja laskuri jäävät pois) ja
 * Bricks Boilerplate 1.1.0 `inc/Elements/Wishlist.css`.
 */
:root {
    --x-favorite-transitionout: 300ms;
    --x-favorite-transitionin: 300ms;
    --x-favorite-translatex: 0;
    --x-favorite-translatey: -10px;
    --x-favorite-scale: .95;
    --x-favorite-background: #fff;
    --x-favorite-duration: 300ms;
    --x-favorite-background-active: var(--x-favorite-background);
    --x-spinner-track-color: #0d131e20;
    --x-spinner-stroke-width: 1px;
    --x-spinner-size: 0.8em;
}

/* xfavorite */
.brxe-xfavorite {
    position: relative;
}

[data-x-favorite] {
    display: inline-flex;
}

.x-favorite {
    background-color: #efefef;
    color: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all var(--x-favorite-duration) ease;
    padding: 1rem;
    gap: .5em;
    overflow: hidden;
    position: relative;
}

.x-favorite:disabled,
.x-favorite[disabled] {
    cursor: not-allowed;
}

.x-favorite_icons {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.x_favorite-added-icon {
    position: absolute;
}

.x-favorite_inner ~ .x-favorite_inner {
    display: none;
}

.x-favorite_icon {
    width: 1em;
    height: 1em;
    font-size: 1em;
    display: flex;
    align-items: center;
    justify-content: center;
}

.x-favorite_icon svg {
    fill: currentColor
}

.x_favorite-added-icon {
    color: inherit;
    opacity: 0;
}

.x-favorite.x-favorite_added .x_favorite-added-icon {
    opacity: 1;
    transform: none!important;
}

.x-favorite_added .x_favorite-removed-icon {
    opacity: 0;
}

.brxe-xfavorite[data-x-spinner] .x-favorite_icons::before,
.brxe-xfavorite[data-x-spinner] .x-favorite_text:only-of-type::before {
    -webkit-animation: xFavoriteSpinAnimation 1s linear infinite;
    animation: xFavoriteSpinAnimation 1s linear infinite;
    border: solid var(--x-spinner-stroke-width) var(--x-spinner-track-color);
    border-radius: 50%;
    border-right-color: currentColor;
    border-top-color: currentColor;
    display: inline-block;
    height: var(--x-spinner-size);
    width: var(--x-spinner-size);
    -webkit-transition: opacity .25s ease;
    transition: opacity .25s ease;
    left: calc(50% - var(--x-spinner-size)/2);
    opacity: 0;
    position: absolute;
    top: calc(50% - var(--x-spinner-size)/2);
    visibility: hidden;
    content: '';
    transform: none;
}

.brxe-xfavorite[data-x-spinner] .x-favorite_busy .x-favorite_icons::before,
.brxe-xfavorite[data-x-spinner] .x-favorite_busy .x-favorite_text:only-of-type::before {
    opacity: 1;
    visibility: visible
}

.brxe-xfavorite[data-x-spinner] .x-favorite_busy .x-favorite_icon,
.brxe-xfavorite[data-x-spinner] .x-favorite_busy .x-favorite_text:only-of-type .x-favorite_text-inner {
    opacity: 0;
    visibility: hidden;
}

@keyframes xFavoriteSpinAnimation {
    0% {
        transform: rotate(0deg)
    }

    to {
        transform: rotate(1turn)
    }
}

/* brt-wishlist */
.brtheme-wishlist-button {
    cursor: pointer;
}

.brtheme-wishlist-button.loading {
    position: relative;
}

@keyframes loading {
    0% {
        transform: translate(-50%, -50%) rotate(0deg);
    }

    100% {
        transform: translate(-50%, -50%) rotate(360deg);
    }
}

.brtheme-wishlist-button.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    border-radius: 50px;
    border: 2px solid currentColor;
    border-top-color: white;
    animation: loading 2s linear infinite;
    z-index: 2;
}

.brtheme-wishlist-button.added .brtheme-wishlist-icon.default-icon {
    display: none;
}

.brtheme-wishlist-button:not(.added) .brtheme-wishlist-icon.active-icon {
    display: none;
}
