/* The live-support chat on the offer page (templates/partials/_support_chat.html), in the look of Flatio's support widget:
   yellow launcher and header, dark ink (#33475b), the host's avatar with a dark ring. */

.support-chat {
    --sc-yellow: #f6c005;
    --sc-ink: #33475b;
    --sc-text: #1e1e1e;
    --sc-muted: #6d6d6d;
    --sc-line: #e5e5e5;
    --sc-host: #eef2f6;
    font-family: inherit;
    color: var(--sc-text);
}

/* ---- launcher ---- */
.support-chat__launcher {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 99999;
    width: 60px;
    height: 60px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--sc-yellow);
    color: var(--sc-ink);
    box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s ease, box-shadow .15s ease;
}
.support-chat__launcher:hover { transform: scale(1.06); box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }
.support-chat__launcher:focus-visible,
.support-chat__icon-button:focus-visible,
.support-chat__send:focus-visible,
.support-chat__primary:focus-visible { outline: 3px solid var(--sc-ink); outline-offset: 2px; }
.support-chat__launcher-icon { position: absolute; display: flex; transition: opacity .2s ease, transform .2s ease; }
.support-chat__launcher-icon--close { opacity: 0; transform: rotate(-90deg) scale(.6); }
.support-chat--open .support-chat__launcher-icon--chat { opacity: 0; transform: rotate(90deg) scale(.6); }
.support-chat--open .support-chat__launcher-icon--close { opacity: 1; transform: none; }
.support-chat__badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 11px;
    background: #d32f2f;
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 22px;
    text-align: center;
    box-sizing: border-box;
}

/* ---- panel ---- */
.support-chat__panel {
    position: fixed;
    right: 20px;
    bottom: 92px;
    z-index: 99999;
    width: 416px;
    max-width: calc(100vw - 40px);
    height: min(700px, calc(100vh - 120px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 12px 40px rgba(0, 0, 0, .28);
    animation: support-chat-in .2s ease;
}
.support-chat__panel[hidden] { display: none; }
.support-chat--expanded .support-chat__panel { width: 600px; height: min(851px, calc(100vh - 120px)); }
@keyframes support-chat-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.support-chat__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 12px 14px 16px;
    background: var(--sc-yellow);
    color: var(--sc-ink);
    flex: none;
}
.support-chat__avatar {
    flex: none;
    width: 44px;
    height: 44px;
    padding: 2px;
    box-sizing: border-box;
    border-radius: 50%;
    background: var(--sc-ink);
    overflow: hidden;
}
.support-chat__avatar img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.support-chat__avatar span {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #fff;
    color: var(--sc-ink);
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.support-chat__who { flex: 1; min-width: 0; }
.support-chat__who h5 { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.support-chat__who div { font-size: 13px; line-height: 1.3; opacity: .85; }
.support-chat__icon-button {
    flex: none;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: var(--sc-ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.support-chat__icon-button:hover { background: rgba(51, 71, 91, .15); }

/* ---- body ---- */
.support-chat__body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.support-chat__messages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.support-chat__row { display: flex; align-items: flex-end; gap: 8px; max-width: 100%; }
.support-chat__row--me { justify-content: flex-end; }
.support-chat__mini-avatar { flex: none; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; background: var(--sc-ink); }
.support-chat__mini-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.support-chat__mini-avatar span { width: 100%; height: 100%; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.support-chat__bubble {
    max-width: 78%;
    padding: 10px 14px;
    border-radius: 16px;
    background: var(--sc-host);
    font-size: 15px;
    line-height: 1.4;
    overflow-wrap: anywhere;
}
.support-chat__bubble p { margin: 0; }
.support-chat__bubble p + p { margin-top: 6px; }
.support-chat__row--me .support-chat__bubble { background: var(--sc-ink); color: #fff; border-bottom-right-radius: 4px; }
.support-chat__row--host .support-chat__bubble { border-bottom-left-radius: 4px; }
.support-chat__time { display: block; margin-top: 4px; font-size: 11px; opacity: .65; }
.support-chat__error { margin: 0 0 8px; color: #d32f2f; font-size: 13px; }
.support-chat__error a { color: inherit; font-weight: 600; text-decoration: underline; }

/* ---- who are you ---- */
.support-chat__intro { flex: none; padding: 12px 16px 16px; border-top: 1px solid var(--sc-line); }
.support-chat__intro[hidden], .support-chat__composer[hidden], .support-chat__closed[hidden], .support-chat__error[hidden], .support-chat__badge[hidden] { display: none; }
.support-chat__intro p { margin: 0 0 10px; font-size: 14px; color: var(--sc-muted); }
.support-chat__intro label { display: block; margin: 8px 0 4px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; }
.support-chat__intro input {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid #c9d1d9;
    border-radius: 8px;
    font: inherit;
    font-size: 15px;
}
.support-chat__intro input:focus, .support-chat__composer textarea:focus { outline: 2px solid var(--sc-ink); outline-offset: 0; border-color: transparent; }
.support-chat__primary {
    margin-top: 12px;
    width: 100%;
    padding: 11px 16px;
    border: 0;
    border-radius: 8px;
    background: var(--sc-yellow);
    color: var(--sc-ink);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}
.support-chat__primary:disabled { opacity: .6; cursor: default; }
.support-chat__closed { flex: none; margin: 0; padding: 14px 16px; border-top: 1px solid var(--sc-line); color: var(--sc-muted); font-size: 14px; text-align: center; }

/* ---- composer ---- */
.support-chat__composer { flex: none; padding: 10px 12px 12px; border-top: 1px solid var(--sc-line); }
.support-chat__composer-row { display: flex; align-items: flex-end; gap: 8px; }
.support-chat__composer textarea {
    flex: 1;
    min-height: 40px;
    max-height: 140px;
    box-sizing: border-box;
    padding: 9px 12px;
    border: 1px solid #c9d1d9;
    border-radius: 20px;
    font: inherit;
    font-size: 15px;
    line-height: 1.35;
    resize: none;
}
.support-chat__send {
    flex: none;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--sc-yellow);
    color: var(--sc-ink);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.support-chat__send:disabled { background: #eceff3; color: #98a2ad; cursor: default; }

/* ---- small screens: above the booking bar, and the open chat takes the whole screen ---- */
@media (max-width: 991px) {
    .support-chat__launcher { bottom: calc(92px + env(safe-area-inset-bottom)); right: 16px; width: 54px; height: 54px; }
}
@media (max-width: 576px) {
    .support-chat--open .support-chat__launcher { display: none; }
    .support-chat__panel, .support-chat--expanded .support-chat__panel {
        inset: 0;
        width: 100%;
        max-width: none;
        height: 100%;
        border-radius: 0;
    }
    .support-chat__header { padding-top: calc(14px + env(safe-area-inset-top)); }
    .support-chat__composer { padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
    #supportChatExpand { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .support-chat__panel { animation: none; }
    .support-chat__launcher, .support-chat__launcher-icon { transition: none; }
}
