/* =========================================================================
 * Map floating support chat widget
 * ========================================================================= */

.map-support-fab {
    position: absolute;
    right: 14px;
    bottom: 88px; /* clear Leaflet zoom / attribution */
    z-index: 1003;
    width: 52px;
    height: 52px;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: linear-gradient(135deg, #0f766e 0%, #14b8a6 100%);
    box-shadow:
        0 0 0 0 rgba(20, 184, 166, 0.45),
        0 8px 22px rgba(15, 118, 110, 0.35),
        0 2px 6px rgba(15, 23, 42, 0.18);
    font-size: 1.15rem;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.map-support-fab:hover {
    transform: translateY(-2px) scale(1.04);
    box-shadow:
        0 0 0 4px rgba(20, 184, 166, 0.22),
        0 12px 28px rgba(15, 118, 110, 0.4);
}

.map-support-fab:focus-visible {
    outline: 2px solid #0f766e;
    outline-offset: 3px;
}

.map-support-fab.is-open {
    background: #0f172a;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.28);
}

.map-support-fab__badge {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #f59e0b;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12);
}

.map-support-fab__badge[hidden] {
    display: none !important;
}

.map-container-welcome .map-support-fab,
.map-container-welcome .map-support-chat {
    display: none !important;
}

.map-support-chat {
    position: absolute;
    right: 14px;
    bottom: 152px;
    z-index: 1004;
    width: min(360px, calc(100% - 28px));
    height: min(560px, 70vh);
    display: flex;
    flex-direction: column;
    border-radius: 16px;
    background: #fff;
    border: 1px solid rgba(15, 23, 42, 0.1);
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.22), 0 4px 12px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    transform-origin: bottom right;
    animation: map-support-chat-in 180ms ease-out;
}

.map-support-chat[hidden] {
    display: none !important;
}

@keyframes map-support-chat-in {
    from { opacity: 0; transform: translateY(10px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.map-support-chat__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.75rem 0.85rem;
    background: linear-gradient(135deg, #0f766e 0%, #0d9488 100%);
    color: #fff;
    flex-shrink: 0;
}

.map-support-chat__title {
    margin: 0;
    font-family: "Outfit", "DM Sans", sans-serif;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.map-support-chat__actions {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.map-support-chat__icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.14);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 0.85rem;
}

.map-support-chat__icon-btn:hover {
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
}

.map-support-chat__body {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0.75rem;
    overflow: hidden;
    background: #f8fafc;
}

.map-support-chat__body .od-chat-setup,
.map-support-chat__body .od-chat-webhook-panel,
.map-support-chat__body .od-chat-live {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.map-support-chat__body .od-chat-setup[hidden],
.map-support-chat__body .od-chat-webhook-panel[hidden],
.map-support-chat__body .od-chat-live[hidden],
.map-support-chat__body .od-chat-banner[hidden],
.map-support-chat__body .od-chat-error[hidden] {
    display: none !important;
}

.map-support-chat__body .app2-step-header {
    margin-bottom: 0.65rem;
}

.map-support-chat__body .app2-step-title {
    font-family: "Outfit", sans-serif;
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 0.25rem;
    color: #0f172a;
}

.map-support-chat__body .app2-step-desc {
    margin: 0;
    font-size: 0.8rem;
    color: #64748b;
    line-height: 1.4;
}

.map-support-chat__body .app2-field {
    margin-bottom: 0.55rem;
}

.map-support-chat__body .app2-field label {
    display: block;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #64748b;
    margin-bottom: 0.2rem;
}

.map-support-chat__body .app2-input,
.map-support-chat__body .od-chat-textarea {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid rgba(15, 23, 42, 0.12);
    border-radius: 10px;
    padding: 0.55rem 0.65rem;
    font: inherit;
    font-size: 0.85rem;
    background: #fff;
}

.map-support-chat__body .app2-input[readonly] {
    background: #f1f5f9;
    color: #334155;
}

.map-support-chat__body .app2-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border-radius: 10px;
    padding: 0.55rem 0.85rem;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    border: 1px solid transparent;
}

.map-support-chat__body .app2-btn-primary {
    width: 100%;
    margin-top: 0.25rem;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #fff;
    border: none;
}

.map-support-chat__body .app2-btn-outline {
    background: #fff;
    border-color: rgba(15, 23, 42, 0.14);
    color: #0f172a;
}

.map-support-chat__body .od-chat-banner--warn {
    background: #fff7ed;
    border: 1px solid #fdba74;
    color: #9a3412;
    border-radius: 10px;
    padding: 0.65rem 0.75rem;
    font-size: 0.8rem;
    margin-bottom: 0.5rem;
}

.map-support-chat__body .od-chat-thread {
    flex: 1 1 auto;
    min-height: 8rem;
    overflow-y: auto;
    padding: 0.55rem;
    border-radius: 12px;
    background: #eef2f7;
    border: 1px solid rgba(15, 23, 42, 0.06);
    margin-bottom: 0.55rem;
}

.map-support-chat__body .od-chat-msg {
    display: flex;
    margin-bottom: 0.4rem;
}

.map-support-chat__body .od-chat-msg--user { justify-content: flex-end; }
.map-support-chat__body .od-chat-msg--other { justify-content: flex-start; }

.map-support-chat__body .od-chat-msg-bubble {
    max-width: 88%;
    padding: 0.45rem 0.65rem;
    border-radius: 12px;
    font-size: 0.82rem;
    line-height: 1.4;
    word-break: break-word;
}

.map-support-chat__body .od-chat-msg--user .od-chat-msg-bubble {
    background: #0f766e;
    color: #fff;
    border-bottom-right-radius: 4px;
}

.map-support-chat__body .od-chat-msg--other .od-chat-msg-bubble {
    background: #fff;
    color: #0f172a;
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-bottom-left-radius: 4px;
}

.map-support-chat__body .od-chat-composer {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    flex-shrink: 0;
}

.map-support-chat__body .od-chat-composer-actions {
    display: flex;
    gap: 0.4rem;
    justify-content: flex-end;
    align-items: center;
}

.map-support-chat__body .od-chat-composer-actions .app2-btn-primary {
    width: auto;
    margin: 0;
}

.map-support-chat__body .od-chat-live-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.map-support-chat__body .od-chat-live-title {
    margin: 0;
    font-size: 0.92rem;
    font-weight: 700;
    font-family: "Outfit", sans-serif;
}

.map-support-chat__body .od-chat-end-btn {
    font-size: 0.72rem;
    padding: 0.35rem 0.55rem;
}

.map-support-chat__body .od-chat-error {
    color: #b91c1c;
    font-size: 0.78rem;
    margin: 0.35rem 0 0;
}

.map-support-chat__body .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 540px) {
    .map-support-fab {
        right: 10px;
        bottom: 78px;
        width: 48px;
        height: 48px;
    }

    .map-support-chat {
        right: 10px;
        left: 10px;
        width: auto;
        bottom: 136px;
        height: min(62vh, 520px);
    }
}

[data-theme="dark"] .map-support-chat {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .map-support-chat__body {
    background: #0f172a;
}

[data-theme="dark"] .map-support-chat__body .app2-step-title,
[data-theme="dark"] .map-support-chat__body .od-chat-live-title {
    color: #e2e8f0;
}

[data-theme="dark"] .map-support-chat__body .app2-input,
[data-theme="dark"] .map-support-chat__body .od-chat-textarea {
    background: #1e293b;
    border-color: rgba(255, 255, 255, 0.12);
    color: #e2e8f0;
}
