.support-chat-launcher {
    position: fixed;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    width: 62px;
    height: 62px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(145deg, #4361ee 0%, #3a56d4 100%);
    color: #ffffff;
    z-index: 1092;
    box-shadow: 0 18px 34px rgba(15, 23, 42, 0.35);
    border: 2px solid rgba(255, 255, 255, 0.9);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.support-chat-launcher:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 22px 36px rgba(15, 23, 42, 0.38);
}

.support-chat-widget {
    position: fixed;
    right: 12px;
    bottom: 0;
    width: min(420px, calc(100vw - 16px));
    height: min(
        620px,
        calc(100dvh - env(safe-area-inset-top, 0px))
    );
    background: #f8f9fc;
    border-radius: 22px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    box-shadow: 0 30px 68px rgba(15, 23, 42, 0.38);
    overflow: hidden;
    z-index: 1093;
    display: flex;
    flex-direction: column;
}

.support-chat-widget.d-none {
    display: none !important;
}

body.support-chat-open .support-chat-launcher {
    display: none;
}

.support-chat-header {
    background: linear-gradient(135deg, #4361ee 0%, #3a56d4 100%);
    color: #ffffff;
    padding: 15px 16px 14px;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    position: relative;
    overflow: hidden;
}

.support-chat-header::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top right, rgba(255, 255, 255, 0.24), transparent 50%);
    pointer-events: none;
}

.support-chat-title-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.support-chat-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.14);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    border: 1px solid rgba(255, 255, 255, 0.26);
}

.support-chat-title {
    font-size: 1.28rem;
    line-height: 1.1;
    font-weight: 700;
}

.support-chat-subtitle {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 2px;
    opacity: 0.96;
    font-size: 0.94rem;
    line-height: 1.25;
}

.support-chat-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.25);
}

.support-chat-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #ffffff;
    font-size: 1.6rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.support-chat-close:hover {
    background: rgba(255, 255, 255, 0.16);
}

.support-chat-body {
    background: linear-gradient(180deg, #eef3ff 0%, #e7ebf4 100%);
    flex: 1;
    overflow-y: auto;
    padding: 14px 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.support-chat-time-row {
    display: flex;
    justify-content: center;
}

.support-chat-time-pill {
    background: #4b5563;
    color: #ffffff;
    font-size: 0.74rem;
    border-radius: 999px;
    padding: 4px 10px;
}

.support-chat-message-row {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.support-chat-message-row[data-role="customer"] {
    justify-content: flex-end;
}

.support-chat-message-row[data-role="support"] {
    justify-content: flex-start;
}

.support-chat-bubble-wrap {
    max-width: 92%;
}

.support-chat-bubble {
    max-width: 100%;
    padding: 11px 13px;
    border-radius: 14px;
    line-height: 1.5;
    white-space: pre-wrap;
    word-break: normal;
    overflow-wrap: anywhere;
    hyphens: none;
    font-size: 1rem;
    box-shadow: 0 8px 16px rgba(15, 23, 42, 0.07);
}

.support-chat-message-row[data-role="support"] .support-chat-bubble {
    background: rgba(255, 255, 255, 0.95);
    color: #1e293b;
    border-bottom-left-radius: 4px;
    border: 1px solid rgba(203, 213, 225, 0.8);
}

.support-chat-message-row[data-role="customer"] .support-chat-bubble {
    background: linear-gradient(135deg, #4361ee 0%, #3a56d4 100%);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

.support-chat-meta {
    margin-top: 4px;
    font-size: 0.72rem;
    opacity: 0.8;
}

.support-chat-profile {
    padding: 12px;
    background: #ffffff;
    border-top: 1px solid #dde3ee;
}

.support-chat-profile h6 {
    margin: 0 0 8px;
    font-size: 0.82rem;
    color: #334155;
}

.support-chat-profile .row {
    --bs-gutter-x: 0.5rem;
}

.support-chat-profile .form-control {
    border-radius: 10px;
    font-size: 0.84rem;
    padding: 0.5rem 0.6rem;
    border: 1px solid #cbd5e1;
}

.support-chat-profile .btn {
    border-radius: 10px;
    font-size: 0.84rem;
    padding: 0.5rem 0.7rem;
}

.support-chat-input {
    background: #ffffff;
    border-top: 1px solid #dde3ee;
    padding: 9px 10px calc(9px + env(safe-area-inset-bottom, 0px));
}

.support-chat-input form {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: #ffffff;
    border: 1px solid #d6deea;
    border-radius: 14px;
    padding: 6px 8px;
}

.support-chat-input textarea {
    resize: none;
    border: none;
    border-bottom: 1px solid transparent;
    border-radius: 0;
    font-size: 1.03rem;
    min-height: 36px;
    max-height: 120px;
    padding: 6px 3px 4px;
    background: transparent;
}

.support-chat-input textarea:focus {
    box-shadow: none;
    border-color: #1e40af;
}

.support-chat-send {
    border: none;
    background: #e2e8f0;
    color: #334155;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: background 0.2s ease, color 0.2s ease;
}

.support-chat-send:hover {
    background: #4361ee;
    color: #ffffff;
}

.support-chat-send:disabled {
    opacity: 0.4;
}

.support-chat-error {
    color: #b91c1c;
    font-size: 0.78rem;
    margin-top: 4px;
    min-height: 14px;
}

@media (max-width: 991.98px) {
    .support-chat-widget {
        right: max(10px, env(safe-area-inset-right, 0px));
        bottom: 0;
        width: min(380px, calc(100vw - 28px));
        height: min(
            600px,
            calc(100dvh - env(safe-area-inset-top, 0px))
        );
        border-radius: 18px;
    }

    .support-chat-launcher {
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    }

    body.has-mobile-dock .support-chat-launcher {
        right: max(10px, env(safe-area-inset-right, 0px));
        bottom: calc(5.7rem + env(safe-area-inset-bottom, 0px));
        width: 54px;
        height: 54px;
    }

    body.has-mobile-dock .support-chat-widget {
        bottom: calc(5.45rem + env(safe-area-inset-bottom, 0px));
        right: max(10px, env(safe-area-inset-right, 0px));
        width: min(360px, calc(100vw - 30px));
        height: min(
            460px,
            calc(100dvh - 8.8rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
        );
        border-radius: 16px;
    }
}

@media (max-width: 420px) {
    body.has-mobile-dock .support-chat-launcher {
        width: 50px;
        height: 50px;
        bottom: calc(5.6rem + env(safe-area-inset-bottom, 0px));
    }

    body.has-mobile-dock .support-chat-widget {
        width: calc(100vw - 28px);
        right: max(10px, env(safe-area-inset-right, 0px));
        height: min(
            420px,
            calc(100dvh - 9.3rem - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px))
        );
        border-radius: 14px;
    }
}
