/* =============================================================================
   The chat bubble on the public website.

   Its own file, loaded only on public pages, so it cannot collide with the
   marketing site's styles or the admin's. Everything is prefixed cwc-, and
   every value is written out rather than inherited from a theme, because
   this has to look the same on two different sites.
   ========================================================================== */

.cwc {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 2147483000;
    font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #10201A;
}

/* ------------------------------------------------------------- the bubble */

.cwc-bubble {
    position: relative;
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-left: auto;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: #007D59;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 10px 24px -8px rgba(0, 125, 89, .7);
    transition: transform .16s ease;
}

.cwc-bubble:hover { transform: scale(1.05); }
.cwc-bubble:focus-visible { outline: 3px solid #0B2A20; outline-offset: 3px; }

.cwc.is-nudging .cwc-bubble {
    animation: cwc-nudge 1.6s ease-in-out 3;
}

@keyframes cwc-nudge {
    0%, 100% { transform: translateY(0); }
    40% { transform: translateY(-6px); }
    60% { transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .cwc.is-nudging .cwc-bubble { animation: none; }
    .cwc-bubble { transition: none; }
}

.cwc-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: #E5484D;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

/* -------------------------------------------------------------- the panel */

.cwc-panel {
    display: flex;
    flex-direction: column;
    width: min(360px, calc(100vw - 32px));
    max-height: min(560px, calc(100vh - 110px));
    margin-bottom: 12px;
    border: 1px solid #E1E8E4;
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 24px 60px -24px rgba(16, 32, 26, .45);
}

.cwc-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 10px;
    padding: 14px 46px 14px 16px;
    background: #0B3B2C;
    color: #fff;
    position: relative;
}

.cwc-title {
    flex: 1 1 100%;
    font-size: 15px;
    font-weight: 700;
}

.cwc-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #9FD4BF;
}

.cwc-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9AA8A2;
}

.cwc-status.is-live .cwc-dot {
    background: #3DDC97;
    box-shadow: 0 0 0 3px rgba(61, 220, 151, .28);
}

.cwc-close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: grid;
    place-items: center;
    box-sizing: border-box;
    width: 30px;
    height: 30px;
    margin: 0;
    /* a host theme with a global button padding would otherwise stretch it */
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.cwc-close:hover { background: rgba(255, 255, 255, .22); }

/* --------------------------------------------------------- the messages */

.cwc-list {
    flex: 1 1 auto;
    min-height: 120px;
    padding: 14px 16px;
    overflow-y: auto;
    background: #F6F9F7;
}

.cwc-msg {
    display: flex;
    flex-direction: column;
    max-width: 85%;
    margin-bottom: 10px;
}

.cwc-msg.is-you { margin-left: auto; align-items: flex-end; }

.cwc-msg-body {
    padding: 9px 12px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #E1E8E4;
    white-space: pre-wrap;
    word-break: break-word;
}

.cwc-msg.is-you .cwc-msg-body {
    background: #007D59;
    border-color: #007D59;
    color: #fff;
}

.cwc-msg-at {
    margin-top: 3px;
    font-size: 11px;
    color: #8A9A94;
}

.cwc-away {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 12px 14px;
    margin-bottom: 12px;
    border: 1px solid #E1E8E4;
    border-radius: 12px;
    background: #fff;
}

.cwc-away b { font-size: 13.5px; }
.cwc-away span { font-size: 13px; color: #4A5B55; }

.cwc-failed {
    margin: 6px 0;
    font-size: 12px;
    color: #C2362B;
}

/* ------------------------------------------------------------- the forms */

.cwc-start {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 14px 16px;
    border-top: 1px solid #E1E8E4;
    background: #fff;
}

.cwc-field {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.cwc-label {
    font-size: 12.5px;
    font-weight: 600;
    color: #34453F;
}

.cwc-start input,
.cwc-start select,
.cwc-start textarea,
.cwc-write textarea {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid #E1E8E4;
    border-radius: 9px;
    font: inherit;
    font-size: 14px;
    color: #10201A;
    background: #fff;
    resize: vertical;
}

.cwc-start input:focus,
.cwc-start select:focus,
.cwc-start textarea:focus,
.cwc-write textarea:focus {
    outline: 2px solid #9FD4BF;
    outline-offset: 1px;
    border-color: #007D59;
}

.cwc-error {
    font-size: 12px;
    color: #C2362B;
}

.cwc-error:empty { display: none; }

.cwc-send {
    padding: 10px 14px;
    border: 0;
    border-radius: 9px;
    background: #007D59;
    color: #fff;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
}

.cwc-send:hover { background: #006A4B; }
.cwc-send[disabled] { opacity: .6; cursor: progress; }

.cwc-send.is-round {
    flex: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 18px;
}

.cwc-write {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 12px 14px;
    border-top: 1px solid #E1E8E4;
    background: #fff;
}

.cwc-write textarea {
    max-height: 120px;
}

.cwc-note {
    margin: 0;
    padding: 8px 16px 12px;
    background: #fff;
    font-size: 11px;
    color: #8A9A94;
}

/* ----------------------------------------------------------------- phones */

@media (max-width: 480px) {
    .cwc { right: 12px; bottom: 12px; left: 12px; }
    .cwc-panel { width: 100%; max-height: calc(100vh - 100px); }
    .cwc-bubble { width: 52px; height: 52px; }
}
