/* Land Direct Live Chat, bubble styles
 *
 * Presence first. The faces and the shift line are the feature; the message box is
 * what happens after somebody decides a person is actually there. That ordering is
 * why the collapsed bubble shows photos and a status and no input at all.
 *
 * Nothing here uses a CSS framework. This loads on a WordPress theme that already has
 * its own opinions, so every rule is scoped under .ldchat- to avoid a fight.
 */

.ldchat-root {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99998;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* ---------- collapsed bubble ---------- */
.ldchat-bubble {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 999px;
    padding: 8px 16px 8px 10px;
    box-shadow: 0 6px 24px rgba(15, 23, 42, .16);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease;
    max-width: 300px;
}
.ldchat-bubble:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(15, 23, 42, .22);
}

.ldchat-faces { display: flex; }
.ldchat-face {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid #ffffff;
    background: #e2e8f0;
}
/* Overlap, the way a real team photo strip looks rather than a row of icons. */
.ldchat-face + .ldchat-face { margin-left: -14px; }

.ldchat-bubble-text { line-height: 1.25; min-width: 0; }
.ldchat-bubble-top {
    font-weight: 700;
    font-size: 14px;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ldchat-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.ldchat-dot-on  { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, .18); }
.ldchat-dot-off { background: #94a3b8; }
.ldchat-bubble-sub {
    font-size: 12px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ---------- open panel ---------- */
.ldchat-panel {
    width: 340px;
    max-width: calc(100vw - 32px);
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, .26);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.ldchat-head {
    background: #1e3a5f;
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}
.ldchat-head .ldchat-face { border-color: rgba(255, 255, 255, .85); width: 38px; height: 38px; }
.ldchat-head-text { flex: 1; min-width: 0; }
.ldchat-head-title { font-weight: 700; font-size: 15px; }
.ldchat-head-sub { font-size: 12px; color: #bfdbfe; }
.ldchat-close {
    background: none;
    border: 0;
    color: #bfdbfe;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 0 2px;
}
.ldchat-close:hover { color: #ffffff; }

/* The line Ben asked for twice. It is a requirement, not decoration, so it gets its
   own band rather than being folded into small print. */
.ldchat-human {
    background: #ecfdf5;
    color: #065f46;
    font-size: 11.5px;
    font-weight: 700;
    text-align: center;
    padding: 7px 10px;
    border-bottom: 1px solid #d1fae5;
    letter-spacing: .01em;
}

.ldchat-body {
    padding: 14px 16px;
    max-height: 320px;
    overflow-y: auto;
    background: #f8fafc;
}
.ldchat-intro { font-size: 13.5px; color: #334155; line-height: 1.5; margin-bottom: 12px; }

.ldchat-msg {
    max-width: 82%;
    margin-bottom: 9px;
    padding: 8px 12px;
    border-radius: 14px;
    font-size: 13.5px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-wrap: break-word;
}
.ldchat-msg-them { background: #ffffff; border: 1px solid #e2e8f0; color: #0f172a; }
.ldchat-msg-me   { background: #1e3a5f; color: #ffffff; margin-left: auto; }
.ldchat-msg-who  { font-size: 10.5px; font-weight: 700; opacity: .7; margin-bottom: 2px; }

.ldchat-form { padding: 12px 16px 14px; border-top: 1px solid #eef2f7; background: #ffffff; }
.ldchat-field {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 9px;
    padding: 9px 11px;
    font-size: 13.5px;
    font-family: inherit;
    margin-bottom: 8px;
    box-sizing: border-box;
    background: #ffffff;
    color: #0f172a;
}
.ldchat-field:focus { outline: 2px solid #93c5fd; outline-offset: 0; border-color: #93c5fd; }
textarea.ldchat-field { resize: vertical; min-height: 66px; }

.ldchat-btn {
    width: 100%;
    border: 0;
    border-radius: 9px;
    padding: 11px 14px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    background: #16a34a;
    color: #ffffff;
    font-family: inherit;
}
.ldchat-btn:hover { background: #15803d; }
.ldchat-btn:disabled { opacity: .55; cursor: not-allowed; }

.ldchat-err {
    color: #b91c1c;
    font-size: 12.5px;
    margin-bottom: 8px;
    display: none;
}
.ldchat-note { font-size: 11.5px; color: #94a3b8; margin-top: 8px; text-align: center; }

/* The honeypot. Off screen rather than display:none, because some bots skip hidden
   fields on purpose and fill anything they can reach. */
.ldchat-hp {
    position: absolute !important;
    left: -9999px !important;
    width: 1px !important;
    height: 1px !important;
    opacity: 0 !important;
}

@media (max-width: 480px) {
    .ldchat-root { right: 12px; bottom: 12px; left: 12px; }
    .ldchat-panel { width: 100%; }
    .ldchat-bubble { max-width: 100%; }
}

/* ---------- v1.1.0: the team strip ----------
 * Faces with names under them, sitting between the header and the "live person" band.
 * A row of anonymous circles with the names listed elsewhere would undercut the one
 * thing this build is for. */
.ldchat-team {
    display: flex;
    justify-content: center;
    gap: 22px;
    padding: 12px 16px 10px;
    background: #ffffff;
    border-bottom: 1px solid #eef2f7;
}
.ldchat-person { text-align: center; }
.ldchat-person .ldchat-face {
    width: 48px;
    height: 48px;
    border-color: #e2e8f0;
    display: block;
    margin: 0 auto;
}
.ldchat-person-name {
    font-size: 12px;
    font-weight: 700;
    color: #334155;
    margin-top: 5px;
}

/* ---------- v1.2.0 ---------- */

/* Initial circle when an agent has no photo. Same dimensions as the img, so a mixed
   row of photos and initials still lines up. */
.ldchat-face-initial {
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    font-weight: 800;
    font-size: 16px;
    line-height: 1;
}
.ldchat-person .ldchat-face-initial { font-size: 18px; }

/* MOBILE: the collapsed bubble drops its text and becomes just the faces.
 *
 * On the map page a 300px wide pill covers a meaningful slice of a phone screen, and
 * the map is the reason somebody is on that page. Presence still works: two faces and
 * a green dot say a person is there, which is the whole job of the collapsed state.
 * The words come back the moment they tap it. */
@media (max-width: 600px) {
    .ldchat-bubble { padding: 6px; border-radius: 999px; }
    .ldchat-bubble-text { display: none; }
    .ldchat-bubble .ldchat-face { width: 46px; height: 46px; }
    /* The status dot moves onto the last face, since the text it lived in is gone. */
    .ldchat-faces { position: relative; }
    .ldchat-faces:after {
        content: "";
        position: absolute;
        right: -1px;
        bottom: 0;
        width: 12px;
        height: 12px;
        border-radius: 50%;
        border: 2px solid #ffffff;
        background: #94a3b8;
    }
    .ldchat-root.is-on .ldchat-faces:after { background: #22c55e; }
}
