/*
 * Turfect live chat widget.
 *
 * Themed from the public site's own tokens rather than ported from the other
 * site's stylesheet: deep green panel, Green 700 actions, sand surfaces. The
 * values are repeated here rather than referenced because this loads on pages
 * the theme's :root may not have reached — but they are the same values, and if
 * the brand moves, both move together.
 */

.tfchat {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 9990;
    font-family: "Source Sans 3", "Source Sans Pro", Arial, Helvetica, sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.tfchat[hidden] { display: none; }

.tfchat-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-left: auto;
    border: 0;
    border-radius: 50%;
    background: #15803D;
    color: #fff;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(11, 31, 26, .28);
    transition: transform .2s cubic-bezier(.2, .7, .2, 1), background-color .2s;
}

.tfchat-bubble:hover,
.tfchat-bubble:focus-visible { background: #0B1F1A; transform: translateY(-2px); }

.tfchat-panel {
    width: min(360px, calc(100vw - 40px));
    max-height: min(560px, calc(100vh - 120px));
    margin-bottom: 12px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 6px;
    background: #F5F3E7;
    color: #111827;
    box-shadow: 0 16px 48px rgba(11, 31, 26, .32);
}

.tfchat-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #0B1F1A;
    color: #F5F3E7;
}

.tfchat-title {
    font-family: Montserrat, Arial, Helvetica, sans-serif;
    font-weight: 700;
    font-size: .8125rem;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.tfchat-x {
    border: 0;
    background: none;
    color: inherit;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}

.tfchat-note {
    margin: 0;
    padding: 14px 16px;
    font-size: .9375rem;
}

.tfchat-note.is-ok { color: #15803D; }
.tfchat-note.is-error { color: #B91C1C; }

/* The conversation itself scrolls; everything else stays put. */
.tfchat-log {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 8px 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.tfchat-msg {
    max-width: 85%;
    padding: 8px 12px;
    border-radius: 10px;
    font-size: .9375rem;
    overflow-wrap: anywhere;
}

.tfchat-msg.is-visitor {
    align-self: flex-end;
    background: #15803D;
    color: #fff;
    border-bottom-right-radius: 2px;
}

.tfchat-msg.is-agent {
    align-self: flex-start;
    background: #fff;
    border: 1px solid #DEDBCB;
    border-bottom-left-radius: 2px;
}

.tfchat-msg.is-system {
    align-self: center;
    background: none;
    color: #575D68;
    font-size: .8125rem;
}

.tfchat-who {
    display: block;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    opacity: .6;
    margin-bottom: 2px;
}

.tfchat-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px 16px 16px;
    border-top: 1px solid #DEDBCB;
}

.tfchat-field,
.tfchat-input {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid #DEDBCB;
    border-radius: 2px;
    background: #fff;
    font: inherit;
    font-size: .9375rem;
    color: inherit;
    resize: vertical;
}

.tfchat-field:focus,
.tfchat-input:focus {
    outline: 2px solid #15803D;
    outline-offset: 1px;
    border-color: #15803D;
}

.tfchat-send {
    align-self: flex-end;
    padding: 9px 18px;
    border: 0;
    border-radius: 2px;
    background: #15803D;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.tfchat-send:hover:not(:disabled) { background: #0B1F1A; }
.tfchat-send:disabled { opacity: .6; cursor: default; }

/* On a phone the panel takes the width it needs and sits above the thumb. */
@media (max-width: 480px) {
    .tfchat { right: 12px; bottom: 12px; left: 12px; }
    .tfchat-panel { width: 100%; max-height: min(70vh, 520px); }
}

@media (prefers-reduced-motion: reduce) {
    .tfchat-bubble { transition: none; }
}
