/* Fast Car Mover live chat widget */
.fcm-chat {
    --fcm-primary: #003466;
    --fcm-accent: #2EC4B6;
    --fcm-accent-dark: #28B0A3;
    --fcm-bg: #f4f6f9;
    --fcm-text: #1d2733;
    --fcm-muted: #6b7785;
    --fcm-border: #dde3ea;
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 2147483000;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.45;
    color: var(--fcm-text);
}

.fcm-chat *,
.fcm-chat *::before,
.fcm-chat *::after {
    box-sizing: border-box;
}

/* ---------- launcher ---------- */
.fcm-chat__launcher {
    position: relative;
    width: 60px;
    height: 60px;
    border: 0;
    border-radius: 50%;
    background: var(--fcm-primary);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(0, 52, 102, .35);
    transition: transform .2s ease, background .2s ease;
    margin-left: auto;
}

.fcm-chat__launcher:hover { transform: scale(1.06); }
.fcm-chat__launcher:focus-visible { outline: 3px solid var(--fcm-accent); outline-offset: 3px; }

.fcm-chat__icon-close,
.fcm-chat.is-open .fcm-chat__icon-open { display: none; }
.fcm-chat.is-open .fcm-chat__icon-close { display: flex; }
.fcm-chat__icon-open { display: flex; }

.fcm-chat__badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #e5484d;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 20px;
    display: none;
}

.fcm-chat__badge.is-visible { display: block; }

/* ---------- panel ---------- */
.fcm-chat__panel {
    position: absolute;
    right: 0;
    bottom: 76px;
    width: 370px;
    height: min(600px, calc(100vh - 110px));
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 12px 40px rgba(15, 30, 50, .25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(12px);
    transition: opacity .2s ease, transform .2s ease, visibility .2s;
}

.fcm-chat.is-open .fcm-chat__panel {
    opacity: 1;
    visibility: visible;
    transform: none;
}

.fcm-chat__header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 14px 14px 16px;
    background: linear-gradient(135deg, var(--fcm-primary) 0%, #0b4d8a 100%);
    color: #fff;
}

.fcm-chat__logo {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #fff;
    padding: 4px;
    flex-shrink: 0;
}

.fcm-chat__title {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.fcm-chat__title strong { font-size: 15px; }

.fcm-chat__status {
    font-size: 12px;
    opacity: .85;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fcm-chat__status::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #a6b4c3;
    flex-shrink: 0;
}

.fcm-chat.agents-online .fcm-chat__status::before { background: #3ddc84; }

.fcm-chat__end,
.fcm-chat__min {
    border: 0;
    background: rgba(255, 255, 255, .15);
    color: #fff;
    cursor: pointer;
    border-radius: 8px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fcm-chat__end { padding: 0 10px; font-size: 12px; display: none; }
.fcm-chat__min { width: 30px; padding: 0; }
.fcm-chat__min svg { width: 18px; height: 18px; }
.fcm-chat__end:hover,
.fcm-chat__min:hover { background: rgba(255, 255, 255, .28); }

.fcm-chat__body {
    flex: 1;
    overflow-y: auto;
    padding: 16px 14px;
    background: var(--fcm-bg);
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* ---------- messages ---------- */
.fcm-msg { display: flex; flex-direction: column; max-width: 85%; }
.fcm-msg--agent { align-self: flex-start; }
.fcm-msg--visitor { align-self: flex-end; align-items: flex-end; }

.fcm-msg__bubble {
    padding: 9px 13px;
    border-radius: 14px;
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-wrap: anywhere;
}

.fcm-msg--agent .fcm-msg__bubble {
    background: #fff;
    border: 1px solid var(--fcm-border);
    border-bottom-left-radius: 4px;
}

.fcm-msg--visitor .fcm-msg__bubble {
    background: var(--fcm-primary);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.fcm-msg__meta { font-size: 11px; color: var(--fcm-muted); margin-top: 3px; padding: 0 4px; }

.fcm-msg--system {
    align-self: center;
    max-width: 95%;
    text-align: center;
    font-size: 12px;
    color: var(--fcm-muted);
}

.fcm-msg--system span {
    display: inline-block;
    background: #e6ebf1;
    padding: 5px 10px;
    border-radius: 10px;
}

.fcm-msg--error span { background: #fde8e8; color: #b42318; }

/* ---------- quick options ---------- */
.fcm-options {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-self: flex-end;
    justify-content: flex-end;
    margin-top: 2px;
}

.fcm-option {
    border: 1.5px solid var(--fcm-primary);
    background: #fff;
    color: var(--fcm-primary);
    border-radius: 999px;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background .15s, color .15s;
}

.fcm-option:hover,
.fcm-option:focus-visible {
    background: var(--fcm-primary);
    color: #fff;
    outline: none;
}

/* ---------- inline forms ---------- */
.fcm-form {
    background: #fff;
    border: 1px solid var(--fcm-border);
    border-radius: 12px;
    padding: 12px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.fcm-field { width: 100%; display: flex; flex-direction: column; gap: 3px; }
.fcm-field--half { width: calc(50% - 4px); }

.fcm-field label { font-size: 12px; font-weight: 600; color: #3a4654; margin: 0; }

.fcm-field input,
.fcm-field select,
.fcm-field textarea {
    width: 100%;
    border: 1px solid var(--fcm-border);
    border-radius: 8px;
    padding: 7px 9px;
    font: inherit;
    font-size: 13px;
    color: var(--fcm-text);
    background: #fff;
}

.fcm-field textarea { resize: vertical; min-height: 54px; }

.fcm-field input:focus,
.fcm-field select:focus,
.fcm-field textarea:focus {
    outline: none;
    border-color: var(--fcm-accent);
    box-shadow: 0 0 0 3px rgba(46, 196, 182, .2);
}

.fcm-field.has-error input,
.fcm-field.has-error select,
.fcm-field.has-error textarea { border-color: #e5484d; }

.fcm-field__error { color: #d92d20; font-size: 11px; min-height: 0; }
.fcm-field__error:empty { display: none; }

.fcm-form__error { width: 100%; color: #d92d20; font-size: 12px; }
.fcm-form__error:empty { display: none; }

.fcm-form__submit {
    width: 100%;
    border: 0;
    border-radius: 8px;
    padding: 10px;
    background: var(--fcm-accent);
    color: #fff;
    font-weight: 700;
    cursor: pointer;
}

.fcm-form__submit:hover { background: var(--fcm-accent-dark); }
.fcm-form__submit:disabled { opacity: .6; cursor: wait; }

/* ---------- composer ---------- */
.fcm-chat__composer {
    display: none;
    align-items: flex-end;
    gap: 8px;
    padding: 10px 12px;
    border-top: 1px solid var(--fcm-border);
    background: #fff;
    margin: 0;
}

.fcm-chat.is-live .fcm-chat__composer { display: flex; }

.fcm-chat__composer textarea {
    flex: 1;
    border: 1px solid var(--fcm-border);
    border-radius: 10px;
    padding: 9px 11px;
    font: inherit;
    resize: none;
    max-height: 110px;
    color: var(--fcm-text);
}

.fcm-chat__composer textarea:focus { outline: none; border-color: var(--fcm-accent); }

.fcm-chat__send {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 50%;
    background: var(--fcm-primary);
    color: #fff;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fcm-chat__send:disabled { opacity: .5; }

/* ---------- mobile ---------- */
@media (max-width: 480px) {
    .fcm-chat { right: 14px; bottom: 14px; }

    .fcm-chat.is-open .fcm-chat__launcher { display: none; }

    .fcm-chat__panel {
        position: fixed;
        inset: 0;
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .fcm-field--half { width: 100%; }
    .fcm-chat__composer textarea { font-size: 16px; } /* stops iOS zoom */
}
