/*
#sms-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    font-family: 'Segoe UI', sans-serif;
    z-index: 9999;

    button {
        height: auto;
    }
}

.chat-toggle {
    background-color: #ca9834 !important;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 50px;
    cursor: pointer;
    font-size: 16px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}*/

:root {
    --quarter-margin: calc(var(--margin) / 4);
}

#sms-widget {
    input[type=text]:focus,
    input[type=email]:focus,
    input[type=tel]:focus,
    input[type=password]:focus,
    input[type=number]:focus,
    select:focus,
    textarea:focus {
        border-color: var(--gold) !important;
        box-shadow: 0 0 2px var(--gold);
        outline: none;
    }


    & .chat-dismiss {
        display: inline-grid;
        width: 44px;
        height: 44px;
        place-items: center;
        padding: 0;
        border: 0;
        border-radius: 50%;
        color: oklch(0.56 0.01 70);
        transition-property: background-color, color, transform;
        transition-duration: 150ms;
        transition-timing-function: cubic-bezier(0.2, 0, 0, 1);

        &:hover {
            color: var(--ink);
        }

        & svg {
            fill: none;
            stroke: currentColor;
            stroke-linecap: round;
            stroke-width: 2;
        }
    }

    #chat-teaser {
        visibility: hidden;
        opacity: 0;
        cursor: pointer;
        transition: visibility 0s, opacity 1s linear;

        &.visible {
            visibility: visible;
            opacity: 1;
            transition: visibility 0s, opacity 1s linear;
        }

        & .chat-dismiss {
            position: absolute;
            inset-block-start: 50%;
            inset-inline-end: 3px;
            transform: translateY(-50%);

            &:active {
                transform: translateY(-50%) scale(0.96);
            }
        }
    }

    #formPanel {
        position: absolute;
        bottom: 60px;
        right: 0;
        width: 300px;
        background: white;
        border-radius: 10px;
        box-shadow: var(--default-box-shadow);
        padding: 20px;
        transform: translateY(100%);
        opacity: 0;
        transition: all 0.4s ease;
        pointer-events: none;

        &.active {
            transform: translateY(0);
            opacity: 1;
            pointer-events: auto;
        }

        & .form-header {
            text-align: center;

            & .chat-dismiss {
                position: absolute;
                top: var(--quarter-margin);
                right: var(--quarter-margin);
            }
        }

        & label {
            display: block;
            margin-top: 10px;
            font-size: 14px;
        }

        & #zipCodeSmsInput {
            max-width: 12ch;
        }

        & input, & textarea {
            width: 100%;
            padding: 8px;
            margin-top: 4px;
            border: 1px solid #ccc;
            border-radius: 6px;
            font-size: 14px;
            padding-left: 10px;
            height: 40px;
        }

        & textarea {
            height: auto;
        }

        & .send-btn {
            margin-top: 15px;
            background-color: var(--gold);
            color: white;
            border: none;
            padding: 10px;
            width: 100%;
            border-radius: 6px;
            cursor: pointer;
            font-size: 16px;

            &:active {
                background-color: #28a745;
            }
        }

        & .disclaimer {
            font-size: 11px;
            color: #666;
            margin-top: 10px;
        }
    }
}

.chat-widget {
    position: fixed;
    z-index: 4;
    inset-inline-end: clamp(18px, 2.6vw, 42px);
    inset-block-end: calc(22px + env(safe-area-inset-bottom));
    display: grid;
    width: min(280px, calc(100vw - 32px));
    justify-items: end;
    gap: 13px;
    pointer-events: none;
    transition-property: opacity;
    transition-duration: 150ms;
    transition-timing-function: ease-out;
}

body.menu-open .chat-widget {
    opacity: 0;
    pointer-events: none;
}

.chat-teaser,
.chat-launcher {
    pointer-events: auto;
}

.chat-teaser {
    position: relative;
    display: grid;
    width: 100%;
    min-height: 64px;
    grid-template-columns: 42px 1fr;
    align-items: center;
    gap: 10px;
    padding: 9px 42px 9px 10px;
    border: 1px solid oklch(0.64 0.024 88.308 / 0.32);
    border-radius: 999px;
    background: var(--white);
    color: var(--ink);
    box-shadow: 0 16px 44px oklch(0.28 0.018 70 / 0.13), 0 3px 10px oklch(0.28 0.018 70 / 0.08);
}

    .chat-teaser::after {
        position: absolute;
        inset-inline-end: 24px;
        inset-block-end: -8px;
        width: 15px;
        height: 15px;
        transform: rotate(45deg);
        border-inline-end: 1px solid oklch(0.64 0.024 88.308 / 0.32);
        border-block-end: 1px solid oklch(0.64 0.024 88.308 / 0.32);
        background: var(--white);
        content: "";
    }

    .chat-teaser[hidden] {
        display: none;
    }

    .chat-teaser img {
        width: 42px;
        height: 42px;
        border-radius: 50%;
        object-fit: cover;
        object-position: 44% center;
        outline: 1px solid oklch(0 0 0 / 0.1);
        outline-offset: -1px;
    }

    .chat-teaser p {
        display: grid;
        gap: 2px;
        margin: 0;
        font-size: 0.78rem;
        line-height: 1.3;
    }

    .chat-teaser strong {
        font-size: 0.84rem;
        font-weight: 600;
    }

    .chat-teaser span {
        color: var(--ink-soft);
    }

.chat-launcher {
    display: inline-flex;
    width: 52px;
    min-width: 52px;
    height: 52px;
    min-height: 52px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border-radius: 999px;
    background: var(--gold);
    color: var(--ink);
    box-shadow: 0 14px 34px oklch(0.35 0.04 88.308 / 0.16), 0 3px 9px oklch(0.35 0.04 88.308 / 0.1);
    text-decoration: none;
    transition-property: background-color, transform, box-shadow;
    transition-duration: 150ms;
    transition-timing-function: cubic-bezier(0.2, 0, 0, 1);
}

    .chat-launcher:hover {
        background: var(--gold-hover);
        box-shadow: 0 17px 38px oklch(0.35 0.04 88.308 / 0.2), 0 4px 10px oklch(0.35 0.04 88.308 / 0.12);
        transform: translateY(-1px);
        color: white;
    }

    .chat-launcher:active {
        transform: scale(0.96);
    }

    .chat-launcher svg {
        width: 23px;
        height: 20px;
        flex: 0 0 auto;
        fill: none;
        stroke: currentColor;
        stroke-linecap: round;
        stroke-linejoin: round;
        stroke-width: 2;
    }

@media (max-width: 560px) {
    .chat-widget {
        inset-inline-start: auto;
        inset-inline-end: 12px;
        inset-block-end: calc(12px + env(safe-area-inset-bottom));
        width: min(270px, calc(100vw - 24px));
    }

    .chat-teaser {
        min-height: 60px;
        grid-template-columns: 38px 1fr;
        gap: 9px;
        padding: 8px 40px 8px 9px;
        border-radius: 999px;
    }

        .chat-teaser img {
            width: 38px;
            height: 38px;
        }

        .chat-teaser strong {
            font-size: 0.8rem;
        }

        .chat-teaser p {
            font-size: 0.74rem;
        }

    .chat-launcher {
        width: 50px;
        min-width: 50px;
        height: 50px;
        min-height: 50px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .chat-dismiss,
    .chat-launcher {
        transition-duration: 0.01ms;
    }
}
