:root {
    --background: 210 40% 98%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 226 71% 40%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 226 71% 40%;
    --radius: 0.5rem;
}

body {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
}

.pulse-red {
    animation: pulse-red 2.5s infinite;
}

@keyframes pulse-red {
    0% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(220, 38, 38, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(220, 38, 38, 0);
    }
}

.pulse-blue {
    animation: pulse-blue 2.5s infinite;
}

@keyframes pulse-blue {
    0% {
        box-shadow: 0 0 0 0 rgba(6, 39, 127, 0.4);
    }

    70% {
        box-shadow: 0 0 0 10px rgba(6, 39, 127, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(6, 39, 127, 0);
    }
}

.support-chat {
    --chat-blue: #06277f;
    --chat-blue-soft: #243f99;
    --chat-ink: #111827;
    --chat-muted: #6b7280;
    --chat-border: #c7ccdc;
    --chat-panel: #f4f7fb;
    --chat-white: #ffffff;
    --chat-shadow: 0 30px 80px rgba(6, 39, 127, 0.24);
    position: fixed;
    right: 24px;
    bottom: 24px;
    width: 56px;
    height: 192px;
    z-index: 80;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    isolation: isolate;
}

.support-chat__phone,
.support-chat__launcher,
.support-chat__totop,
.support-chat__icon-btn,
.support-chat__quick-replies button,
.support-chat__bubble-action,
.support-chat__add,
.support-chat__send {
    appearance: none;
    border: 0;
    cursor: pointer;
    font: inherit;
}

.support-chat button:focus-visible,
.support-chat a:focus-visible {
    outline: 3px solid rgba(6, 39, 127, 0.26);
    outline-offset: 3px;
}

.support-chat__phone {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: #dc2626;
    border-radius: 999px;
    box-shadow: 0 16px 36px rgba(15, 23, 42, 0.2);
    transition: transform 180ms ease, background-color 180ms ease, box-shadow 180ms ease, opacity 180ms ease;
}

.support-chat__phone:hover {
    transform: translateY(-2px) scale(1.03);
    background: #b91c1c;
    box-shadow: 0 20px 44px rgba(185, 28, 28, 0.28);
}

.support-chat__phone:active {
    transform: translateY(0) scale(0.97);
}

.support-chat__phone i {
    font-size: 22px;
}

.support-chat__totop {
    position: absolute;
    right: 0;
    bottom: 136px;
    width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--chat-blue);
    background: rgba(255, 255, 255, 0.96);
    border: 1px solid rgba(6, 39, 127, 0.18);
    border-radius: 999px;
    box-shadow: 0 14px 34px rgba(15, 23, 42, 0.16);
    opacity: 0;
    pointer-events: none;
    transform: translateY(10px) scale(0.92);
    transition: opacity 180ms ease, transform 180ms ease, color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.support-chat.has-scrolled .support-chat__totop {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.support-chat__totop:hover {
    color: #ffffff;
    background: var(--chat-blue);
    box-shadow: 0 18px 42px rgba(6, 39, 127, 0.28);
    transform: translateY(-2px) scale(1.03);
}

.support-chat__totop:active {
    transform: translateY(0) scale(0.97);
}

.support-chat__totop i {
    font-size: 19px;
}

.support-chat__launcher {
    position: absolute;
    right: 0;
    bottom: 68px;
    width: 56px;
    min-width: 56px;
    height: 56px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #ffffff;
    background: var(--chat-blue);
    border-radius: 999px;
    box-shadow: 0 18px 44px rgba(6, 39, 127, 0.34);
    font-size: 15px;
    font-weight: 800;
    letter-spacing: 0;
    transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease, opacity 180ms ease;
}

.support-chat__launcher:hover {
    transform: translateY(-2px);
    background: #0b328f;
    box-shadow: 0 22px 52px rgba(6, 39, 127, 0.4);
}

.support-chat__launcher:active {
    transform: translateY(0) scale(0.97);
}

.support-chat__launcher i {
    font-size: 20px;
}

.support-chat__launcher span {
    display: none;
}

.support-chat__panel {
    position: absolute;
    right: 0;
    bottom: 136px;
    width: min(400px, calc(100vw - 32px));
    height: min(660px, calc(100dvh - 176px));
    min-height: min(500px, calc(100dvh - 176px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    color: var(--chat-ink);
    background:
        radial-gradient(circle at 100% 0%, rgba(6, 39, 127, 0.08), transparent 34%),
        linear-gradient(180deg, #f8fbff 0%, var(--chat-panel) 48%, #eef3f8 100%);
    border: 1px solid rgba(148, 163, 184, 0.5);
    border-radius: 20px;
    box-shadow: var(--chat-shadow);
    opacity: 0;
    pointer-events: none;
    transform: translateY(14px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity 180ms ease, transform 180ms ease;
    backdrop-filter: blur(12px);
}

.support-chat.is-open .support-chat__panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0) scale(1);
}

.support-chat.is-open .support-chat__launcher,
.support-chat.is-open .support-chat__phone,
.support-chat.is-open .support-chat__totop {
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px) scale(0.94);
}

.support-chat__header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    min-height: 74px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.94);
    border-bottom: 1px solid rgba(148, 163, 184, 0.36);
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04), 0 10px 24px rgba(15, 23, 42, 0.04);
}

.support-chat__brand {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}

.support-chat__logo {
    flex: 0 0 auto;
    width: 46px;
    height: 46px;
    object-fit: contain;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.45);
    background: #ffffff;
}

.support-chat__title-wrap {
    min-width: 0;
}

.support-chat__title {
    max-width: 238px;
    margin: 0;
    overflow: hidden;
    color: var(--chat-blue);
    font-size: 18px;
    font-weight: 900;
    line-height: 1.15;
    letter-spacing: 0;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-chat__status {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 5px 0 0;
    overflow: hidden;
    color: #2f3440;
    font-size: 13px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.support-chat__status span {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    background: #16c784;
    border-radius: 999px;
}

.support-chat__actions {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 4px;
}

.support-chat__icon-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #374151;
    background: transparent;
    border-radius: 999px;
    transition: background-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.support-chat__icon-btn:hover {
    color: var(--chat-blue);
    background: #eef2ff;
}

.support-chat__icon-btn:active {
    transform: scale(0.94);
}

.support-chat__body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 20px 16px 18px;
    scroll-behavior: smooth;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(6, 39, 127, 0.28) transparent;
}

.support-chat__body::-webkit-scrollbar {
    width: 8px;
}

.support-chat__body::-webkit-scrollbar-thumb {
    background: rgba(6, 39, 127, 0.22);
    border: 2px solid transparent;
    border-radius: 999px;
    background-clip: content-box;
}

.support-chat__message {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.support-chat__message--user {
    justify-content: flex-end;
}

.support-chat__avatar {
    flex: 0 0 auto;
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 2px;
    color: #b8c6ff;
    background: var(--chat-blue-soft);
    border-radius: 999px;
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.13);
}

.support-chat__avatar i {
    font-size: 16px;
}

.support-chat__bubble {
    max-width: min(82%, calc(100% - 48px));
    padding: 14px 15px;
    color: #111827;
    background: var(--chat-white);
    border: 1px solid var(--chat-border);
    border-radius: 6px 18px 18px 18px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.07);
    font-size: 15px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.support-chat__bubble p {
    margin: 0;
}

.support-chat__bubble a {
    color: var(--chat-blue);
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}

.support-chat__message--user .support-chat__bubble {
    max-width: 78%;
    color: #ffffff;
    background: var(--chat-blue);
    border-color: var(--chat-blue);
    border-radius: 18px 6px 18px 18px;
    box-shadow: 0 12px 28px rgba(6, 39, 127, 0.22);
}

.support-chat__message--user .support-chat__bubble a {
    color: #ffffff;
}

.support-chat__quick-replies {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
    margin: -4px 0 22px 46px;
}

.support-chat__quick-replies button {
    min-width: 0;
    min-height: 40px;
    padding: 0 12px;
    color: var(--chat-blue);
    background: #ffffff;
    border: 1px solid rgba(6, 39, 127, 0.55);
    border-radius: 12px;
    box-shadow: 0 5px 16px rgba(6, 39, 127, 0.05);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
    text-align: center;
    text-wrap: balance;
    transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.support-chat__quick-replies button:hover {
    color: #ffffff;
    background: var(--chat-blue);
    border-color: var(--chat-blue);
    box-shadow: 0 10px 24px rgba(6, 39, 127, 0.16);
    transform: translateY(-1px);
}

.support-chat__quick-replies button:active {
    transform: translateY(0) scale(0.98);
}

.support-chat__bubble-actions {
    display: grid;
    gap: 9px;
    margin-top: 16px;
}

.support-chat__bubble-action {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 0 16px;
    color: #c5d0ff;
    background: var(--chat-blue-soft);
    border-radius: 10px;
    text-decoration: none;
    font-size: 14px;
    font-weight: 800;
    transition: color 160ms ease, background-color 160ms ease, transform 160ms ease;
}

.support-chat__bubble .support-chat__bubble-action {
    color: #ffffff;
    text-decoration: none;
}

.support-chat__bubble .support-chat__bubble-action i,
.support-chat__bubble .support-chat__bubble-action span {
    color: inherit;
}

.support-chat__bubble-action:hover {
    color: #ffffff;
    background: var(--chat-blue);
    transform: translateY(-1px);
}

.support-chat__bubble .support-chat__bubble-action:hover {
    color: #ffffff;
}

.support-chat__quick-replies button.support-chat__location-btn {
    grid-column: 1 / -1;
    background: #0b5cff;
    color: #ffffff;
    border-color: #0b5cff;
    font-weight: 850;
    width: 100%;
    min-height: 44px;
}

.support-chat__quick-replies button.support-chat__location-btn:hover {
    background: #064cd8;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 104, 255, 0.24);
}

.support-chat__quick-replies button.support-chat__location-btn.is-loading {
    cursor: progress;
    opacity: 0.82;
}

.support-chat__composer {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    align-items: center;
    gap: 8px;
    margin: 0;
    padding: 12px;
    background: rgba(255, 255, 255, 0.96);
    border-top: 1px solid rgba(148, 163, 184, 0.44);
    box-shadow: 0 -10px 24px rgba(15, 23, 42, 0.05);
}

.support-chat__composer input {
    width: 100%;
    min-width: 0;
    height: 46px;
    color: #111827;
    background: transparent;
    border: 0;
    outline: 0;
    font-size: 15px;
    font-weight: 500;
}

.support-chat__composer input::placeholder {
    color: #7b8495;
}

.support-chat__add,
.support-chat__send {
    width: 42px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #4b5568;
    background: transparent;
    border-radius: 999px;
    transition: color 160ms ease, background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.support-chat__add {
    border: 1.5px solid #5b6478;
}

.support-chat__add:hover,
.support-chat__send:hover {
    color: var(--chat-blue);
    background: #eef2ff;
    border-color: var(--chat-blue);
}

.support-chat__add:active,
.support-chat__send:active {
    transform: scale(0.94);
}

.support-chat__add.is-loading i,
.support-chat__location-btn.is-loading i {
    animation: chat-spin 800ms linear infinite;
}

.support-chat__send {
    color: var(--chat-blue);
}

.support-chat__send i {
    font-size: 22px;
}

@keyframes chat-spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 640px) {
    body.support-chat-open {
        overflow: hidden;
    }

    .support-chat {
        right: 16px;
        bottom: calc(16px + env(safe-area-inset-bottom));
    }

    .support-chat__panel {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100vh;
        height: 100dvh;
        min-height: 0;
        border: 0;
        border-radius: 0;
        transform: translateY(18px);
        background:
            radial-gradient(circle at 100% 0%, rgba(6, 39, 127, 0.1), transparent 40%),
            linear-gradient(180deg, #f8fbff 0%, #f2f6fb 48%, #eef3f8 100%);
    }

    .support-chat__header {
        min-height: calc(68px + env(safe-area-inset-top));
        padding: calc(10px + env(safe-area-inset-top)) 12px 10px;
    }

    .support-chat__logo {
        width: 42px;
        height: 42px;
    }

    .support-chat__title {
        max-width: calc(100vw - 158px);
        font-size: 17px;
    }

    .support-chat__status {
        max-width: calc(100vw - 158px);
        font-size: 12px;
    }

    .support-chat__body {
        padding: 18px 12px 16px;
    }

    .support-chat__message {
        gap: 10px;
        margin-bottom: 16px;
    }

    .support-chat__avatar {
        width: 32px;
        height: 32px;
    }

    .support-chat__bubble {
        max-width: min(86%, calc(100% - 42px));
        padding: 13px 14px;
        font-size: 14.5px;
    }

    .support-chat__quick-replies {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        margin: -2px 0 20px 42px;
    }

    .support-chat__quick-replies button {
        min-width: 0;
        min-height: 42px;
        padding: 0 10px;
        border-radius: 11px;
        font-size: 12.5px;
        white-space: normal;
        line-height: 1.2;
    }

    .support-chat__quick-replies button:last-child {
        grid-column: span 2;
        justify-self: stretch;
        min-width: 0;
    }

    .support-chat__quick-replies button.support-chat__location-btn {
        grid-column: span 2;
        min-height: 44px;
    }

    .support-chat__composer {
        grid-template-columns: 40px minmax(0, 1fr) 40px;
        gap: 8px;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    }

    .support-chat__composer input {
        height: 44px;
        font-size: 16px;
    }

    .support-chat__add,
    .support-chat__send {
        width: 40px;
        height: 40px;
    }
}

@media (max-width: 380px) {
    .support-chat__quick-replies {
        grid-template-columns: 1fr;
        margin-left: 42px;
    }

    .support-chat__quick-replies button:last-child {
        grid-column: auto;
        justify-self: stretch;
        min-width: 0;
    }

    .support-chat__quick-replies button.support-chat__location-btn {
        grid-column: auto;
    }

    .support-chat__message--user .support-chat__bubble {
        max-width: 88%;
    }
}

@media (prefers-reduced-motion: reduce) {
    .support-chat *,
    .support-chat *::before,
    .support-chat *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}
