/**
 * Sticky Element Component
 *
 * @package Bonusovekody
 * @since 2.0.0
 */

.sticky-element {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    z-index: 99999;
    visibility: hidden;
    opacity: 0;
    transition: opacity .3s, visibility 1.5s;
    box-sizing: border-box;
    --max-width: 1020px;
}

.sticky-element * {
    box-sizing: border-box;
}

.sticky-element:not(.sticky-element--image) {
    padding: 0 20px;
}

.sticky-element.sticky-element--opened {
    visibility: visible;
    opacity: 1;
}

.sticky-element .sticky-element__row {
    display: flex;
    align-items: center;
    max-width: var(--max-width);
    margin: 0 auto;
    padding-top: 16px;
    padding-bottom: 16px;
}

.sticky-element .sticky-element__image {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.sticky-element .sticky-element__heading {
    margin-bottom: 0;
}

.sticky-element .sticky-element__content {
    padding: 0 1rem;
}

.sticky-element .sticky-element__code {
    margin-left: auto;
    border: thin solid rgba(0,0,0,.1);
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: .5rem .5rem .5rem 2rem;
    border-radius: .25rem;
}

.sticky-element .sticky-element__code.sticky-element__code--blur span:not(.sticky-element__button) {
    filter: blur(5px);
}

.sticky-element .sticky-element__close {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 6 6 18M6 6l12 12'/%3E%3C/svg%3E");
    background-color: #FFF;
    position: absolute;
    right: 1rem;
    top: 0;
    transform: translateY(-50%);
    padding: 0.25rem;
    background-position: center;
    background-repeat: no-repeat;
    box-shadow: 0 0 5px rgba(0,0,0,.1);
    background-size: 1rem;
    transition: filter .3s;
    cursor: pointer;
}

.sticky-element .sticky-element__close:hover {
    filter: invert(1);
}

/* Default sticky element type */
.sticky-element.sticky-element--sticky_el:not(.sticky-element--autowidth),
.sticky-element.sticky-element--sticky_el.sticky-element--autowidth .sticky-element__row {
    background-color: #FFF;
    box-shadow: 0 -4px 12px 0 rgba(0, 0, 0, .05);
}
/* End of default sticky element */

/* Image sticky element  */

.sticky-element.sticky-element--image .sticky-element__row {
    max-width: 100%;
    justify-content: center;
    padding: 0;
}

.sticky-element.sticky-element--image .sticky-element__image-ad {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sticky-element.sticky-element--image .sticky-element__image-ad-link {
    display: flex;
}
/* End of image sticky element */

/* Advanced sticky element */
.sticky-element.sticky-element--advanced_sticky {
    --max-width: 768px;
}

.sticky-element.sticky-element--advanced_sticky .sticky-element__row {
    position: relative;
}

.sticky-element.sticky-element--advanced_sticky .sticky-element__header-tag {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(-98%);
    display: flex;
    background-color: var(--tag_bg_color, #FFF);
    color: var(--tag_text_color, #000);
    padding: 0.5rem 1.5rem 0.5rem 1rem;
    align-items: center;
    border-radius: 0.25rem 0.25rem 0 0;
    gap: 0.25rem;
    font-size: .9rem;
    line-height: 1;
}

.sticky-element:not(.sticky-element--autowidth) {
    background-color: var(--popup_bg, #FFF);
}

.sticky-element.sticky-element--advanced_sticky .sticky-element__code {
    background-color: var(--code_bg_color, #FFF);
}

.sticky-element.sticky-element--advanced_sticky .sticky-element__code span {
    color: var(--code_text_color, #000);
    font-weight: bold;
}

.sticky-element.sticky-element--advanced_sticky .sticky-element__code {
    display: flex;
    font-size: 1.25rem;
    width: 100%;
}

.sticky-element.sticky-element--advanced_sticky .sticky-element__code-content {
    flex: 1 1 100%;
    display: flex;
    justify-content: center;
}

.sticky-element.sticky-element--advanced_sticky .sticky-element__footer-link-wrapper {
    flex: 0 0 auto;
    display: flex;
    justify-content: center;
    padding: 0 2.5rem;
}

.sticky-element.sticky-element--advanced_sticky .sticky-element__close {
    right: 0;
}

.sticky-element.sticky-element--advanced_sticky span.sticky-element__button {
    right: -1.25rem;
    position: relative;
    background-color: var(--button_bg_color, #000);
    color: var(--button_text_color, #FFF);
    font-size: .9rem;
    border-radius: .25rem;
    padding: .25rem .5rem;
    flex: 0 0 auto;
}

.sticky-element.sticky-element--advanced_sticky .sticky-element__code {
    position: relative;
    gap: 0;
}

/* add css triangle to left side of element .sticky-element__button */
.sticky-element.sticky-element--advanced_sticky .sticky-element__button::before {
    content: '';
    position: absolute;
    top: 50%;
    left: -10px;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-right-color: var(--button_bg_color, #000);
}

.sticky-element.sticky-element--advanced_sticky .sticky-element__footer-link {
    color: var(--popup_text_color, #000);
    text-decoration: underline;
    font-size: .9rem;
}

.sticky-element.sticky-element--advanced_sticky .sticky-element__footer-link:hover,
.sticky-element.sticky-element--advanced_sticky .sticky-element__footer-link.sticky-element__footer-link--no-link {
    text-decoration: none;
}
/* End of advanced sticky element */

/* Sticky element attributes */
.sticky-element.sticky-element--autowidth {
    display: flex;
    width: auto;
    left: 0;
    right: 0;
    margin: 0 auto;
    justify-content: center;
}

.sticky-element.sticky-element--autowidth .sticky-element__row {
    width: 100%;
    position: relative;
}

.sticky-element.sticky-element--autowidth.sticky-element--image .sticky-element__row {
    width: auto;
    box-shadow: none;
    background-color: transparent;
}

.sticky-element.sticky-element--autowidth.sticky-element--sticky_el,
.sticky-element.sticky-element--autowidth.sticky-element--advanced_sticky {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
}

.sticky-element.sticky-element--autowidth.sticky-element--advanced_sticky {
    padding: 0;
}

.sticky-element.sticky-element--autowidth.sticky-element--advanced_sticky .sticky-element__row {
    padding-right: 20px;
    padding-left: 20px
}

.sticky-element.sticky-element--advanced_sticky.sticky-element--autowidth .sticky-element__row {
    background-color: var(--popup_bg, #FFF);
}

.sticky-element.sticky-element--content-maxwidth {
    --max-width: 760px;
}
/* End of sticky element attributes */

@media (max-width: 767px) {
    .sticky-element .sticky-element__image {
        width: 45px;
        height: 45px;
    }
    .sticky-element.sticky-element--sticky_el .sticky-element__heading {
        font-size: .9rem;
    }
}

@media (max-width: 568px) {

    .sticky-element.sticky-element--advanced_sticky .sticky-element__close {
        right: .25rem;
    }

    .sticky-element .sticky-element__row {
        flex-wrap: wrap;
        justify-content: center;
        row-gap: .5rem;
        padding-top: 8px;
        padding-bottom: 8px;
    }

    .sticky-element.sticky-element--advanced_sticky .sticky-element__row {
        padding-top: 16px;
    }

    .sticky-element:not(.sticky-element--image) {
        padding-left: 10px;
        padding-right: 10px;
    }

    .sticky-element.sticky-element--autowidth.sticky-element--advanced_sticky {
        padding: 0;
    }

    .sticky-element.sticky-element--autowidth.sticky-element--advanced_sticky .sticky-element__row {
        padding-left: 20px;
        padding-right: 20px;
    }

    .sticky-element__code {
        margin: 0 auto;
        font-size: .85rem;
    }

    .sticky-element.sticky-element--advanced_sticky .sticky-element__row {
        flex-direction: column;
    }

    .sticky-element.sticky-element--advanced_sticky .sticky-element__code {
        width: 95%;
    }

    .sticky-element.sticky-element--advanced_sticky span.sticky-element__button {
        right: -1rem;
    }
}
