.ub-chat-launcher {
    border: 0;
    padding: 0;
    cursor: pointer;
}

.ub-chat-launcher:hover {
    opacity: 0.9;
}

.ub-chat-layer[hidden] {
    display: none;
}

.ub-chat-layer {
    position: fixed;
    inset: 0;
    z-index: 1090;
    font-family: inherit;
    pointer-events: none;
}

.ub-chat-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    pointer-events: auto;
}

body.dark-mode .ub-chat-backdrop {
    background: rgba(0, 0, 0, 0.42);
}

.ub-chat-panel {
    position: absolute;
    right: 20px;
    bottom: 20px;

    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto auto;

    width: 390px;
    max-width: calc(100vw - 40px);
    height: 650px;
    max-height: calc(100vh - 40px);

    overflow: hidden;

    background: #ffffff;
    border: 1px solid #dddddd;
    border-radius: 12px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);

    pointer-events: auto;

    animation: ubChatPopIn 0.2s ease-out;
}

body.dark-mode .ub-chat-panel {
    background: #222827;
    border-color: rgba(32, 178, 170, 0.3);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.55);
}

body.ub-chat-is-open {
    overflow: hidden;
}

@keyframes ubChatPopIn {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.97);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.ub-chat-header {
    display: flex;
    align-items: center;
    gap: 10px;

    padding: 14px 16px;

    color: #fff;
    background: #12776f;
}

.ub-chat-mark {
    display: flex;
    align-items: center;
    justify-content: center;

    width: 36px;
    height: 36px;

    background: #e64a19;
    border-radius: 8px;

    color: #fff;
    font-size: 1rem;
}

.ub-chat-heading {
    flex: 1;
}

.ub-chat-heading h2 {
    margin: 0;
    color: #fff;
    font-size: 1rem;
}

.ub-chat-heading p {
    margin: 2px 0 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.75rem;
}

.ub-chat-header-action,
.ub-chat-icon-button {
    display: flex;
    align-items: center;
    justify-content: center;

    color: #fff;
    background: transparent;
    border: 0;

    cursor: pointer;
}

.ub-chat-header-action {
    padding: 6px 8px;
    font-size: 0.8rem;
}

.ub-chat-icon-button {
    width: 32px;
    height: 32px;
}

.ub-chat-header-action:hover,
.ub-chat-icon-button:hover {
    background: rgba(255, 255, 255, 0.15);
    border-radius: 6px;
}

.ub-chat-messages {
    min-height: 0;
    overflow-y: auto;

    padding: 16px;

    background: #f7f1e6;
}

body.dark-mode .ub-chat-messages {
    background: #181d1c;
}

.ub-chat-message {
    display: flex;
    width: 100%;
    margin-bottom: 12px;
}

.ub-chat-message--user {
    justify-content: flex-end;
}

.ub-chat-message--assistant,
.ub-chat-message--error {
    justify-content: flex-start;
}

.ub-chat-bubble {
    max-width: 85%;

    padding: 10px 12px;

    border-radius: 10px;

    font-size: 0.9rem;
    line-height: 1.5;

    overflow-wrap: anywhere;
    white-space: pre-wrap;
}

.ub-chat-message--user .ub-chat-bubble {
    color: #fff;
    background: #12776f;
}

.ub-chat-message--assistant .ub-chat-bubble {
    color: #23201c;
    background: #ffffff;
    border: 1px solid #dddddd;
}

body.dark-mode .ub-chat-message--assistant .ub-chat-bubble {
    color: #f4f1ea;
    background: #222827;
    border-color: #3b4140;
}

.ub-chat-message--error .ub-chat-bubble {
    color: #7a2e15;
    background: #fff0e9;
    border: 1px solid #efb59f;
}

body.dark-mode .ub-chat-message--error .ub-chat-bubble {
    color: #ffd8c9;
    background: #432319;
    border-color: #7e3f29;
}

.ub-chat-response-group {
    width: 100%;
    margin-bottom: 12px;
}

.ub-chat-trip-links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;

    margin-top: 6px;
}

.ub-chat-trip-link {
    color: #12776f;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: underline;
}

.ub-chat-trip-link:hover {
    color: #e64a19;
}

.ub-chat-status {
    padding: 6px 16px;

    color: #69645d;
    background: #ffffff;

    font-size: 0.75rem;
}

body.dark-mode .ub-chat-status {
    color: #b7b9b5;
    background: #222827;
}

.ub-chat-status.is-error {
    color: #9a3918;
}

body.dark-mode .ub-chat-status.is-error {
    color: #ffb59c;
}

.ub-chat-composer {
    padding: 10px;

    background: #ffffff;
    border-top: 1px solid #dddddd;
}

body.dark-mode .ub-chat-composer {
    background: #222827;
    border-top-color: #3b4140;
}

.ub-chat-compose-row {
    display: flex;
    align-items: flex-end;
    gap: 8px;

    padding: 6px 6px 6px 10px;

    background: #f7f1e6;
    border: 1px solid #dddddd;
    border-radius: 10px;
}

body.dark-mode .ub-chat-compose-row {
    background: #181d1c;
    border-color: #3b4140;
}

.ub-chat-compose-row textarea {
    flex: 1;

    min-height: 38px;
    max-height: 110px;

    padding: 8px 0;

    color: #23201c;
    background: transparent;
    border: 0;
    outline: 0;

    font: inherit;
    font-size: 0.88rem;

    resize: none;
}

body.dark-mode .ub-chat-compose-row textarea {
    color: #f4f1ea;
}

.ub-chat-compose-row textarea::placeholder {
    color: #69645d;
}

body.dark-mode .ub-chat-compose-row textarea::placeholder {
    color: #969b98;
}

.ub-chat-send {
    display: flex;
    align-items: center;
    justify-content: center;

    min-height: 38px;
    padding: 0 12px;

    color: #fff;
    background: #e64a19;

    border: 0;
    border-radius: 8px;

    font-size: 0.8rem;
    font-weight: 600;

    cursor: pointer;
}

.ub-chat-send:hover {
    background: #c93d12;
}

.ub-chat-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.ub-chat-privacy {
    margin: 6px 0 0;

    color: #69645d;

    font-size: 0.7rem;
    text-align: center;
}

body.dark-mode .ub-chat-privacy {
    color: #b7b9b5;
}

.ub-chat-privacy a {
    color: inherit;
    text-decoration: underline;
}

@media (max-width: 575px) {

    .ub-chat-panel {
        inset: 10px;

        width: auto;
        max-width: none;

        height: auto;
        max-height: none;

        border-radius: 10px;
    }

    .ub-chat-messages {
        padding: 12px;
    }

    .ub-chat-bubble {
        max-width: 90%;
    }

    .ub-chat-header-action {
        padding: 6px;
    }
}