/* Public-site floating contact and customer chat widget. */
.customer-chat-float {
    position: fixed;
    z-index: 920;
    right: 22px;
    bottom: 110px;
    display: grid;
    gap: 8px;
}

.customer-chat-float__item {
    position: relative;
}

.customer-chat-float__action {
    display: grid;
    place-items: center;
    gap: 3px;
    width: 54px;
    min-height: 54px;
    padding: 7px 4px;
    color: #17437b;
    background: #fff;
    border: 1px solid rgba(28, 88, 166, .18);
    border-radius: 10px;
    box-shadow: 0 10px 26px rgba(16, 47, 91, .14);
    font: inherit;
    font-size: 11px;
    line-height: 1.15;
    text-decoration: none;
    cursor: pointer;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.customer-chat-float__action:hover,
.customer-chat-float__action:focus-visible,
.customer-chat-float__action--chat {
    color: #fff;
    background: #1769dd;
    border-color: #1769dd;
    box-shadow: 0 12px 28px rgba(23, 105, 221, .28);
}

.customer-chat-float__action:hover,
.customer-chat-float__action:focus-visible {
    transform: translateY(-2px);
}

.customer-chat-float__action:focus-visible,
.customer-chat-modal__close:focus-visible,
.customer-chat-modal__form button:focus-visible,
.customer-chat-modal__form textarea:focus-visible {
    outline: 3px solid rgba(38, 128, 255, .36);
    outline-offset: 3px;
}

.customer-chat-float__action svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.8;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.customer-chat-float__item--qr .customer-chat-float__action svg {
    fill: currentColor;
    stroke: none;
}

.customer-chat-float__popover {
    position: absolute;
    z-index: 1;
    right: calc(100% + 13px);
    top: 50%;
    width: max-content;
    max-width: min(260px, calc(100vw - 92px));
    padding: 13px;
    color: #18324f;
    background: #fff;
    border: 1px solid rgba(23, 105, 221, .16);
    border-radius: 12px;
    box-shadow: 0 14px 36px rgba(13, 40, 76, .18);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translate(8px, -50%);
    transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
}

.customer-chat-float__popover::after {
    position: absolute;
    top: 50%;
    right: -6px;
    width: 10px;
    height: 10px;
    background: #fff;
    border-top: 1px solid rgba(23, 105, 221, .16);
    border-right: 1px solid rgba(23, 105, 221, .16);
    content: "";
    transform: translateY(-50%) rotate(45deg);
}

.customer-chat-float__item:hover .customer-chat-float__popover,
.customer-chat-float__item:focus-within .customer-chat-float__popover {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translate(0, -50%);
}

.customer-chat-float__popover--qr {
    display: grid;
    justify-items: center;
    gap: 8px;
}

.customer-chat-float__popover--qr img {
    display: block;
    width: min(176px, calc(100vw - 122px));
    height: auto;
    aspect-ratio: 1;
    object-fit: contain;
    background: #fff;
}

.customer-chat-float__popover p,
.customer-chat-float__popover strong,
.customer-chat-float__popover small,
.customer-chat-float__popover span {
    display: block;
    margin: 0;
}

.customer-chat-float__popover--qr p,
.customer-chat-float__popover small {
    color: #60718a;
    font-size: 12px;
}

.customer-chat-float__contact-name {
    margin-bottom: 4px !important;
    color: #60718a;
    font-size: 12px;
}

.customer-chat-float__popover--phone strong {
    color: #0d3d78;
    font-size: 16px;
    letter-spacing: .02em;
}

.customer-chat-float__popover--phone small {
    margin-top: 5px;
}

.customer-chat-modal {
    position: fixed;
    z-index: 1200;
    inset: 0;
    display: grid;
    align-items: end;
    justify-items: end;
    padding: 24px 92px 24px 24px;
}

.customer-chat-modal[hidden] {
    display: none;
}

.customer-chat-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(4, 17, 37, .42);
    backdrop-filter: blur(2px);
}

.customer-chat-modal__dialog {
    position: relative;
    z-index: 1;
    display: grid;
    grid-template-rows: auto auto minmax(190px, 1fr) auto;
    width: min(420px, 100%);
    max-height: min(680px, calc(100dvh - 48px));
    overflow: hidden;
    color: #1a3150;
    background: #fff;
    border: 1px solid rgba(31, 86, 157, .15);
    border-radius: 16px;
    box-shadow: 0 26px 80px rgba(4, 23, 55, .3);
}

.customer-chat-modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 19px 18px 15px;
    color: #fff;
    background: linear-gradient(125deg, #0d417f, #2078e6);
}

.customer-chat-modal__header p {
    margin: 0 0 3px;
    opacity: .78;
    font-size: 11px;
    letter-spacing: .14em;
}

.customer-chat-modal__header h2 {
    margin: 0;
    color: inherit;
    font-size: 18px;
    line-height: 1.25;
}

.customer-chat-modal__close {
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 0;
    color: #fff;
    background: rgba(255, 255, 255, .12);
    border: 0;
    border-radius: 9px;
    cursor: pointer;
}

.customer-chat-modal__close:hover {
    background: rgba(255, 255, 255, .24);
}

.customer-chat-modal__close svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
}

.customer-chat-modal__status {
    min-height: 34px;
    margin: 0;
    padding: 10px 18px 8px;
    color: #708097;
    background: #f7faff;
    border-bottom: 1px solid #eaf0f8;
    font-size: 12px;
}

.customer-chat-modal__messages {
    display: flex;
    flex-direction: column;
    gap: 12px;
    min-height: 0;
    margin: 0;
    padding: 17px 18px;
    overflow-y: auto;
    list-style: none;
    background: #fbfdff;
}

.customer-chat-modal__empty {
    align-self: center;
    max-width: 270px;
    margin: auto;
    padding: 12px 14px;
    color: #75849a;
    background: #f1f6fc;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.65;
    text-align: center;
}

.customer-chat-message {
    display: grid;
    gap: 4px;
    max-width: 86%;
}

.customer-chat-message--visitor {
    align-self: end;
}

.customer-chat-message--agent {
    align-self: start;
}

.customer-chat-message__meta {
    color: #7c8ba0;
    font-size: 11px;
}

.customer-chat-message--visitor .customer-chat-message__meta {
    text-align: right;
}

.customer-chat-message__bubble {
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 14px;
    line-height: 1.62;
    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.customer-chat-message--visitor .customer-chat-message__bubble {
    color: #fff;
    background: #1e73dd;
    border-bottom-right-radius: 3px;
}

.customer-chat-message--agent .customer-chat-message__bubble {
    color: #203b5c;
    background: #edf4fc;
    border-bottom-left-radius: 3px;
}

.customer-chat-message__media {
    width: min(252px, 100%);
    overflow: hidden;
    border: 1px solid #d7e4f1;
    border-radius: 10px;
    background: #102640;
}

.customer-chat-message__media img,
.customer-chat-message__media video {
    display: block;
    width: 100%;
    max-height: 220px;
    object-fit: cover;
    background: #102640;
}

.customer-chat-modal__form {
    padding: 12px;
    background: #fff;
    border-top: 1px solid #e8eef5;
}

.customer-chat-modal__form textarea {
    display: block;
    width: 100%;
    min-height: 68px;
    max-height: 138px;
    resize: vertical;
    padding: 10px;
    box-sizing: border-box;
    color: #1d3858;
    background: #f8fbff;
    border: 1px solid #d8e4f1;
    border-radius: 9px;
    font: inherit;
    font-size: 14px;
    line-height: 1.55;
}

.customer-chat-modal__form textarea::placeholder {
    color: #9baabd;
}

.customer-chat-modal__form-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 9px;
}

.customer-chat-modal__form-footer span {
    color: #8a99ab;
    font-size: 11px;
}

.customer-chat-modal__form button {
    min-width: 68px;
    padding: 8px 14px;
    color: #fff;
    background: #1769dd;
    border: 1px solid #1769dd;
    border-radius: 7px;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

.customer-chat-modal__form button:hover:not(:disabled) {
    background: #0e5ecf;
}

.customer-chat-modal__form button:disabled {
    cursor: wait;
    opacity: .62;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 700px) {
    .customer-chat-float {
        right: 13px;
        bottom: 20px;
    }

    .customer-chat-float__action {
        width: 50px;
        min-height: 50px;
    }

    .customer-chat-modal {
        align-items: end;
        padding: 12px;
    }

    .customer-chat-modal__dialog {
        width: 100%;
        max-height: calc(100dvh - 24px);
        border-radius: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .customer-chat-float__action,
    .customer-chat-float__popover {
        transition: none;
    }
}
