/*
   SIS engagement stack: discount popup -> chat popup -> fixed bot -> music
   player. Namespaced under .sis-* the same way the loader is, so it can't
   collide with the theme's own styles.
*/

:root {
    --sis-a: #f99d4e;
    --sis-b: #e93b6e;
}

/* ---------- shared popup shell ---------- */

.sis-popup {
    position: fixed;
    inset: 0;
    z-index: 9500;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .3s ease, visibility 0s linear .3s;
}

.sis-popup.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: opacity .3s ease;
}

.sis-popup__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(7, 7, 11, .6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.sis-popup__close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .8);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .2s ease, transform .2s ease;
}

.sis-popup__close:hover {
    background: rgba(255, 255, 255, .16);
    transform: rotate(90deg);
}

/* ---------- discount popup ---------- */

.sis-popup--discount .sis-popup__card {
    position: relative;
    z-index: 1;
    width: 480px;
    max-width: calc(100vw - 32px);
    padding: 52px 48px 44px;
    border-radius: 24px;
    background: linear-gradient(165deg, #14141c, #0a0a0e);
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
    text-align: center;
    transform: scale(.9) translateY(10px);
    opacity: 0;
    transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .35s ease;
}

.sis-popup--discount.is-open .sis-popup__card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.sis-popup__badge {
    display: inline-block;
    padding: 7px 18px;
    border-radius: 999px;
    background: rgba(249, 157, 78, .12);
    border: 1px solid rgba(249, 157, 78, .35);
    color: var(--sis-a);
    font: 700 12px/1 'Outfit', sans-serif;
    letter-spacing: 2.5px;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.sis-popup__title {
    font-family: 'Outfit', sans-serif;
    font-size: 36px;
    font-weight: 700;
    line-height: 1.25;
    color: #fff;
    margin: 0 0 16px;
}

.sis-popup__title b {
    background: linear-gradient(90deg, var(--sis-a), var(--sis-b));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sis-popup__text {
    font: 400 16px/1.65 'Outfit', sans-serif;
    color: rgba(255, 255, 255, .55);
    margin: 0 0 30px;
}

.sis-popup__cta {
    display: block;
    padding: 18px;
    border-radius: 14px;
    background: linear-gradient(90deg, var(--sis-a), var(--sis-b));
    color: #fff;
    font: 700 16px/1 'Outfit', sans-serif;
    text-decoration: none;
    letter-spacing: .3px;
    transition: transform .2s ease, box-shadow .2s ease;
}

.sis-popup__cta:hover {
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 12px 30px rgba(233, 59, 110, .35);
}

.sis-popup__fine {
    display: block;
    margin-top: 18px;
    font: 400 12.5px/1 'Outfit', sans-serif;
    color: rgba(255, 255, 255, .3);
}

/* ---------- chat popup ---------- */

.sis-chat-card {
    position: relative;
    z-index: 1;
    width: 440px;
    max-width: calc(100vw - 32px);
    border-radius: 22px;
    overflow: hidden;
    background: #101017;
    border: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
    transform: scale(.9) translateY(10px);
    opacity: 0;
    transition: transform .35s cubic-bezier(.2, .8, .2, 1), opacity .35s ease;
}

.sis-popup--chat.is-open .sis-chat-card {
    transform: scale(1) translateY(0);
    opacity: 1;
}

.sis-chat-card__header {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 24px 54px 24px 24px;
    background: linear-gradient(90deg, var(--sis-a), var(--sis-b));
}

.sis-chat-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex: 0 0 auto;
}

.sis-chat-avatar__pulse {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #35e07d;
    border: 2px solid #101017;
}

.sis-chat-card__who {
    display: flex;
    flex-direction: column;
    color: #fff;
    line-height: 1.4;
}

.sis-chat-card__who strong {
    font: 700 17px 'Outfit', sans-serif;
}

.sis-chat-card__who small {
    font: 400 12.5px 'Outfit', sans-serif;
    opacity: .85;
}

.sis-chat-card .sis-popup__close {
    background: rgba(0, 0, 0, .2);
}

.sis-chat-card .sis-popup__close:hover {
    background: rgba(0, 0, 0, .35);
}

.sis-chat-card__body {
    padding: 28px 24px;
    min-height: 110px;
}

.sis-chat-bubble {
    display: inline-block;
    max-width: 88%;
    padding: 14px 18px;
    border-radius: 16px 16px 16px 4px;
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .85);
    font: 400 15px/1.55 'Outfit', sans-serif;
}

.sis-chat-card__input {
    display: flex;
    gap: 10px;
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, .06);
}

.sis-chat-card__input input {
    flex: 1;
    padding: 13px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .04);
    color: rgba(255, 255, 255, .5);
    font: 400 14px 'Outfit', sans-serif;
}

.sis-chat-card__input input::placeholder { color: rgba(255, 255, 255, .3); }

.sis-chat-card__input button {
    width: 46px;
    height: 46px;
    flex: 0 0 auto;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, .06);
    color: rgba(255, 255, 255, .35);
    font-size: 16px;
    cursor: not-allowed;
}

/* ---------- fixed bot widget ---------- */

.sis-bot {
    position: fixed;
    right: 22px;
    /* vertically centered on tall viewports, but never closer than 110px to
       the header above or the bottom edge below on short ones */
    top: clamp(110px, 50%, calc(100vh - 110px));
    transform: translateY(-50%) scale(0);
    z-index: 9000;
    width: 60px;
    height: 60px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: transparent;
    cursor: pointer;
    opacity: 0;
    transition: transform .5s cubic-bezier(.2, .8, .2, 1.4), opacity .4s ease;
}

.sis-bot.is-visible {
    opacity: 1;
    transform: translateY(-50%) scale(1);
}

.sis-bot__avatar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: linear-gradient(150deg, var(--sis-a), var(--sis-b));
    box-shadow: 0 10px 30px rgba(233, 59, 110, .4);
    font-size: 26px;
}

.sis-bot__face { line-height: 1; }

.sis-bot__hand {
    position: absolute;
    right: -6px;
    top: -6px;
    font-size: 20px;
    transform-origin: 70% 70%;
    animation: sis-bot-wave 2.6s ease-in-out infinite;
    animation-delay: 1s;
}

@keyframes sis-bot-wave {
    0%, 68%, 100% { transform: rotate(0deg); }
    72% { transform: rotate(-14deg); }
    76% { transform: rotate(18deg); }
    80% { transform: rotate(-10deg); }
    84% { transform: rotate(14deg); }
    88% { transform: rotate(0deg); }
}

.sis-bot__tooltip {
    position: absolute;
    right: calc(100% + 14px);
    top: 50%;
    transform: translateY(-50%) translateX(6px);
    white-space: nowrap;
    padding: 9px 14px;
    border-radius: 10px;
    background: #14141c;
    border: 1px solid rgba(255, 255, 255, .1);
    color: #fff;
    font: 500 12.5px 'Outfit', sans-serif;
    box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s ease, transform .3s ease;
}

.sis-bot__tooltip::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: #14141c;
}

.sis-bot.show-tooltip .sis-bot__tooltip {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
}

@media (max-width: 640px) {
    .sis-bot { right: 14px; width: 52px; height: 52px; }
    .sis-bot__avatar { font-size: 22px; }
}

/* ---------- music player ---------- */

.sis-music {
    position: fixed;
    left: 22px;
    bottom: 22px;
    z-index: 9000;
    opacity: 0;
    transform: scale(.7);
    transition: transform .5s cubic-bezier(.2, .8, .2, 1.4), opacity .4s ease;
}

.sis-music.is-visible {
    opacity: 1;
    transform: scale(1);
}

.sis-music__toggle {
    position: relative;
    width: 64px;
    height: 64px;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: #101017;
    border: 1px solid rgba(255, 255, 255, .1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sis-music__wave {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.sis-music__bar {
    stroke: var(--sis-a);
    stroke-width: 3;
    stroke-linecap: round;
    transform-box: fill-box;
    transform-origin: center top;
    transform: scaleY(.4);
    opacity: .55;
    transition: opacity .3s ease;
}

/* slow-motion circular wave: each radial bar pulses on its own offset,
   driven purely by CSS — no per-frame JS, stays cheap even while playing */
.sis-music.is-playing .sis-music__bar {
    opacity: 1;
    animation: sis-music-pulse 2.4s ease-in-out infinite;
    animation-delay: calc(var(--sis-i) * -0.085s);
}

@keyframes sis-music-pulse {
    0%, 100% { transform: scaleY(.4); }
    50% { transform: scaleY(1.3); }
}

.sis-music__icon {
    position: relative;
    z-index: 1;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

/* paused state: a play triangle, built from two clipped bars */
.sis-music__icon i {
    display: block;
    width: 3px;
    height: 14px;
    border-radius: 1px;
    background: #fff;
    transition: transform .25s ease, opacity .2s ease, width .2s ease, height .2s ease, border-radius .2s ease;
}

.sis-music__icon i:nth-child(3) { display: none; }

/* playing state: swap to a pause icon (two bars) */
.sis-music.is-playing .sis-music__icon i:nth-child(1) { transform: translateX(1px); }
.sis-music.is-playing .sis-music__icon i:nth-child(2) { transform: translateX(-1px); }

/* paused state: merge the two bars into a play triangle via clip-path */
.sis-music:not(.is-playing) .sis-music__icon {
    clip-path: none;
}

.sis-music:not(.is-playing) .sis-music__icon i:nth-child(1) {
    width: 0;
    height: 0;
    background: transparent;
    border-style: solid;
    border-width: 8px 0 8px 13px;
    border-color: transparent transparent transparent #fff;
    border-radius: 0;
    transform: translateX(2px);
}

.sis-music:not(.is-playing) .sis-music__icon i:nth-child(2) {
    display: none;
}

@media (max-width: 640px) {
    .sis-music { left: 14px; bottom: 14px; }
    .sis-music__toggle { width: 54px; height: 54px; }
}
