/* =========================================================
   PPS Nutrition
   Public Support Chat
   ========================================================= */

.pps-support-chat {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1200;
    font-family: "Montserrat", sans-serif;
}

.pps-support-chat__launcher {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 54px;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: #1f1954;
    color: #ffffff;
    box-shadow:
        0 12px 30px rgba(31, 25, 84, 0.24);
    cursor: pointer;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    transition:
        transform 160ms ease,
        box-shadow 160ms ease,
        background 160ms ease;
}

.pps-support-chat__launcher:hover {
    background: #2e2f79;
    box-shadow:
        0 14px 34px rgba(31, 25, 84, 0.3);
    transform: translateY(-1px);
}

.pps-support-chat__launcher .material-icons {
    font-size: 21px;
}

.pps-support-chat__launcher-close {
    display: none;
}

.pps-support-chat--open
.pps-support-chat__launcher-chat {
    display: none;
}

.pps-support-chat--open
.pps-support-chat__launcher-close {
    display: inline-block;
}

.pps-support-chat__panel {
    position: absolute;
    right: 0;
    bottom: 68px;
    width: min(380px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid rgba(31, 25, 84, 0.1);
    border-radius: 18px;
    background: #ffffff;
    box-shadow:
        0 24px 70px rgba(15, 23, 42, 0.2);
}

.pps-support-chat__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 17px 18px;
    background:
        linear-gradient(
            135deg,
            #1f1954 0%,
            #2e2f79 100%
        );
    color: #ffffff;
}

.pps-support-chat__identity {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}

.pps-support-chat__avatar {
    display: flex;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
}

.pps-support-chat__avatar .material-icons {
    font-size: 22px;
}

.pps-support-chat__identity strong {
    display: block;
    font-size: 14px;
    line-height: 1.3;
}

.pps-support-chat__identity span {
    display: block;
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.78);
    font-size: 11px;
    line-height: 1.35;
}

.pps-support-chat__close {
    display: flex;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #ffffff;
    cursor: pointer;
}

.pps-support-chat__close:hover {
    background: rgba(255, 255, 255, 0.12);
}

.pps-support-chat__close .material-icons {
    font-size: 20px;
}

.pps-support-chat__body {
    padding: 22px 20px;
}

.pps-support-chat__welcome {
    text-align: center;
}

.pps-support-chat__welcome-icon {
    display: flex;
    width: 48px;
    height: 48px;
    margin: 0 auto 13px;
    align-items: center;
    justify-content: center;
    border-radius: 14px;
    background: #f0eff8;
    color: #2e2f79;
}

.pps-support-chat__welcome-icon .material-icons {
    font-size: 24px;
}

.pps-support-chat__welcome h2 {
    margin: 0;
    color: #1e293b;
    font-size: 20px;
    line-height: 1.3;
}

.pps-support-chat__welcome p {
    margin: 9px auto 0;
    max-width: 310px;
    color: #64748b;
    font-size: 13px;
    line-height: 1.6;
}

.pps-support-chat__trust {
    display: grid;
    gap: 8px;
    margin-top: 20px;
    padding: 14px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #f8fafc;
}

.pps-support-chat__trust > div {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #475569;
    font-size: 12px;
    line-height: 1.4;
}

.pps-support-chat__trust .material-icons {
    color: #4d539f;
    font-size: 17px;
}

.pps-support-chat__preview-action {
    margin-top: 18px;
    text-align: center;
}

.pps-support-chat__start {
    display: flex;
    width: 100%;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: #2e2f79;
    color: #ffffff;
    font: inherit;
    font-size: 13px;
    font-weight: 800;
}

.pps-support-chat__start:disabled {
    cursor: default;
    opacity: 0.92;
}

.pps-support-chat__preview-action > span {
    display: block;
    margin-top: 8px;
    color: #94a3b8;
    font-size: 10px;
}

.pps-support-chat__footer {
    padding: 10px 16px;
    border-top: 1px solid #eef2f7;
    background: #fbfcfe;
    color: #94a3b8;
    font-size: 10px;
    text-align: center;
}


@media (max-width: 600px) {

    .pps-support-chat {
        right: 16px;
        bottom: 16px;
    }

    .pps-support-chat__panel {
        position: fixed;
        right: 12px;
        bottom: 82px;
        left: 12px;
        width: auto;
        max-height: calc(100vh - 105px);
    }

    .pps-support-chat__launcher {
        min-width: 54px;
        padding: 0 16px;
    }

    .pps-support-chat__launcher-label {
        display: none;
    }
}


/* =========================================================
   Functional chat states
   ========================================================= */

.pps-support-chat__start-form label {
    display: block;
    margin-bottom: 13px;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
}

.pps-support-chat__start-form label > span {
    color: #94a3b8;
    font-size: 10px;
    font-weight: 500;
}

.pps-support-chat__start-form input,
.pps-support-chat__start-form select,
.pps-support-chat__start-form textarea {
    display: block;
    width: 100%;
    margin-top: 6px;
    padding: 10px 11px;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    background: #ffffff;
    color: #1e293b;
    font: inherit;
    font-size: 13px;
    line-height: 1.45;
    outline: none;
}

.pps-support-chat__start-form textarea {
    resize: vertical;
    min-height: 90px;
}

.pps-support-chat__start-form input:focus,
.pps-support-chat__start-form select:focus,
.pps-support-chat__start-form textarea:focus,
.pps-support-chat__composer textarea:focus {
    border-color: #4d539f;
    box-shadow:
        0 0 0 3px
        rgba(77, 83, 159, 0.1);
}

.pps-support-chat__form-heading {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 16px;
}

.pps-support-chat__form-heading strong {
    display: block;
    color: #1e293b;
    font-size: 14px;
}

.pps-support-chat__form-heading span {
    display: block;
    margin-top: 2px;
    color: #64748b;
    font-size: 11px;
}

.pps-support-chat__back {
    display: flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 50%;
    background: #f1f5f9;
    color: #334155;
    cursor: pointer;
}

.pps-support-chat__back .material-icons {
    font-size: 18px;
}

.pps-support-chat__error,
.pps-support-chat__conversation-error {
    margin-bottom: 12px;
    padding: 10px 11px;
    border: 1px solid #fecaca;
    border-radius: 9px;
    background: #fef2f2;
    color: #991b1b;
    font-size: 11px;
    line-height: 1.45;
}

.pps-support-chat__conversation {
    margin: -22px -20px;
}

.pps-support-chat__messages {
    display: flex;
    flex-direction: column;
    gap: 10px;
    height: 330px;
    padding: 18px;
    overflow-y: auto;
    background: #f8fafc;
}

.pps-support-chat__message {
    width: fit-content;
    max-width: 84%;
    padding: 10px 12px;
    border-radius: 13px;
    font-size: 12px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.pps-support-chat__message strong {
    display: block;
    margin-bottom: 3px;
    font-size: 10px;
}

.pps-support-chat__message > div {
    white-space: pre-wrap;
}

.pps-support-chat__message > span {
    display: block;
    margin-top: 5px;
    font-size: 9px;
    opacity: 0.62;
}

.pps-support-chat__message--customer {
    align-self: flex-end;
    background: #2e2f79;
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.pps-support-chat__message--admin {
    align-self: flex-start;
    border: 1px solid #e2e8f0;
    background: #ffffff;
    color: #334155;
    border-bottom-left-radius: 4px;
}

.pps-support-chat__message--system {
    align-self: center;
    max-width: 92%;
    background: #e2e8f0;
    color: #475569;
    text-align: center;
}

.pps-support-chat__composer {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    padding: 12px;
    border-top: 1px solid #e2e8f0;
    background: #ffffff;
}

.pps-support-chat__composer textarea {
    flex: 1;
    min-width: 0;
    max-height: 110px;
    padding: 9px 11px;
    resize: vertical;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #ffffff;
    color: #1e293b;
    font: inherit;
    font-size: 12px;
    line-height: 1.45;
    outline: none;
}

.pps-support-chat__composer button {
    display: flex;
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 10px;
    background: #2e2f79;
    color: #ffffff;
    cursor: pointer;
}

.pps-support-chat__composer button:hover {
    background: #1f1954;
}

.pps-support-chat__composer button:disabled {
    cursor: default;
    opacity: 0.55;
}

.pps-support-chat__composer .material-icons {
    font-size: 18px;
}

.pps-support-chat__closed {
    padding: 14px;
    border-top: 1px solid #e2e8f0;
    background: #f8fafc;
    color: #64748b;
    font-size: 11px;
    text-align: center;
}

.pps-support-chat__badge {
    display: inline-flex;
    position: absolute;
    top: -5px;
    right: -5px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    align-items: center;
    justify-content: center;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #dc2626;
    color: #ffffff;
    font-size: 9px;
    font-weight: 800;
}

.pps-support-chat__badge[hidden] {
    display: none;
}


@media (max-width: 600px) {

    .pps-support-chat__messages {
        height:
            min(
                380px,
                calc(100vh - 285px)
            );
    }
}


/* =========================================================
   Typing indicator
   ========================================================= */

.pps-support-chat__typing {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    border-top: 1px solid #eef2f7;
    background: #ffffff;
    color: #64748b;
    font-size: 10px;
    line-height: 1.3;
}

.pps-support-chat__typing[hidden] {
    display: none;
}

.pps-support-chat__typing-dots {
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

.pps-support-chat__typing-dots i {
    display: block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #4d539f;
    animation:
        pps-support-chat-typing-dot
        1.1s
        infinite
        ease-in-out;
}

.pps-support-chat__typing-dots i:nth-child(2) {
    animation-delay: 0.15s;
}

.pps-support-chat__typing-dots i:nth-child(3) {
    animation-delay: 0.3s;
}

@keyframes pps-support-chat-typing-dot {

    0%,
    60%,
    100% {
        opacity: 0.35;
        transform: translateY(0);
    }

    30% {
        opacity: 1;
        transform: translateY(-2px);
    }
}


/* =========================================================
   Manual availability
   ========================================================= */

.pps-support-chat__availability {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 18px;
    padding: 12px 13px;
    border: 1px solid #e2e8f0;
    border-radius: 11px;
    background: #f8fafc;
    text-align: left;
}

.pps-support-chat__availability-dot {
    display: block;
    width: 9px;
    height: 9px;
    flex: 0 0 9px;
    margin-top: 4px;
    border-radius: 50%;
    background: #64748b;
}

.pps-support-chat__availability strong {
    display: block;
    color: #334155;
    font-size: 12px;
    line-height: 1.35;
}

.pps-support-chat__availability p {
    margin: 3px 0 0;
    color: #64748b;
    font-size: 10px;
    line-height: 1.45;
}

.pps-support-chat__availability--online {
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.pps-support-chat__availability--online
.pps-support-chat__availability-dot {
    background: #16a34a;
    box-shadow:
        0 0 0 4px
        rgba(22, 163, 74, 0.1);
}

.pps-support-chat__availability--online strong {
    color: #166534;
}

.pps-support-chat__availability--offline
.pps-support-chat__availability-dot {
    background: #64748b;
}


/* =========================================================
   Mobile chat UX
   ========================================================= */

[data-support-chat-start-screen]
> .pps-support-chat__start {
    margin-top: 18px;
}

.pps-support-chat__backdrop {
    display: none;
}

body.pps-support-chat-page-locked {
    position: fixed;
    right: 0;
    left: 0;
    width: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}


@media (max-width: 600px) {

    .pps-support-chat__backdrop:not([hidden]) {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 1;
        background: rgba(15, 23, 42, 0.52);
        -webkit-backdrop-filter: blur(2px);
        backdrop-filter: blur(2px);
    }

    .pps-support-chat__panel {
        z-index: 2;

        max-height:
            calc(100vh - 106px);

        max-height:
            calc(100dvh - 106px);
    }

    .pps-support-chat__panel:not([hidden]) {
        display: flex;
        flex-direction: column;
    }

    .pps-support-chat__header,
    .pps-support-chat__footer {
        flex: 0 0 auto;
    }

    .pps-support-chat__body {
        flex: 1 1 auto;
        min-height: 0;
        overflow-y: auto;
        overscroll-behavior: contain;
        -webkit-overflow-scrolling: touch;
    }

    .pps-support-chat__launcher {
        position: relative;
        z-index: 3;
    }

    .pps-support-chat__start-form input,
    .pps-support-chat__start-form select,
    .pps-support-chat__start-form textarea,
    .pps-support-chat__composer textarea {
        font-size: 16px;
    }
}


/* =========================================================
   Support chat unread badge
   ========================================================= */

.pps-support-chat__badge {
    top: -6px;
    right: -6px;
    min-width: 19px;
    height: 19px;
    padding: 0 5px;
    border: 2px solid #ffffff;
    border-radius: 999px;
    background: #ff3b30;
    box-shadow:
        0 2px 7px
        rgba(15, 23, 42, 0.22);
    font-size: 9px;
    font-weight: 800;
    line-height: 1;
}


/* =========================================================
   Support chat authenticated customer
   ========================================================= */

.pps-support-chat__signed-in {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 0 0 18px;
    padding: 13px 14px;
    border: 1px solid #e2e5f0;
    border-radius: 14px;
    background: #f7f8fc;
}

.pps-support-chat__signed-in > .material-icons {
    display: flex;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: #e9eaf5;
    color: #2e2f79;
    font-size: 22px;
}

.pps-support-chat__signed-in > div {
    min-width: 0;
}

.pps-support-chat__signed-in strong {
    display: block;
    margin: 0;
    color: #1f2937;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.pps-support-chat__signed-in > div > span {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.pps-support-chat__start-form
> .pps-support-chat__start {
    margin-top: 4px;
}


@media (max-width: 600px) {

    .pps-support-chat__body {
        padding: 19px 16px;
    }

    .pps-support-chat__form-heading {
        gap: 11px;
        margin-bottom: 18px;
    }

    .pps-support-chat__form-heading strong {
        font-size: 16px;
        line-height: 1.25;
    }

    .pps-support-chat__form-heading span {
        margin-top: 3px;
        font-size: 12px;
        line-height: 1.4;
    }

    .pps-support-chat__back {
        width: 38px;
        height: 38px;
        flex-basis: 38px;
    }

    .pps-support-chat__signed-in {
        gap: 12px;
        margin-bottom: 20px;
        padding: 13px;
        border-radius: 14px;
    }

    .pps-support-chat__signed-in > .material-icons {
        width: 40px;
        height: 40px;
        flex-basis: 40px;
        font-size: 23px;
    }

    .pps-support-chat__signed-in strong {
        font-size: 15px;
    }

    .pps-support-chat__signed-in > div > span {
        margin-top: 2px;
        font-size: 12px;
    }

    .pps-support-chat__start-form label {
        margin-bottom: 16px;
        font-size: 13px;
        line-height: 1.35;
    }

    .pps-support-chat__start-form input,
    .pps-support-chat__start-form select,
    .pps-support-chat__start-form textarea {
        margin-top: 7px;
        padding: 12px 13px;
        border-radius: 12px;
    }

    .pps-support-chat__start-form select {
        min-height: 48px;
    }

    .pps-support-chat__start-form textarea {
        min-height: 112px;
    }

    .pps-support-chat__start-form
    > .pps-support-chat__start {
        min-height: 50px;
        margin-top: 2px;
        border-radius: 12px;
        font-size: 14px;
    }
}
