@font-face {
    font-family: "MSLC IRANSans";
    src: url("IRANSansWeb-en.woff2") format("woff2");
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --mslc-primary: #2563eb;
    --mslc-accent: #14b8a6;
    --mslc-ink: #172033;
    --mslc-muted: #667085;
    --mslc-surface: #ffffff;
    --mslc-soft: #f4f7fb;
    --mslc-border: rgba(23, 32, 51, 0.11);
    --mslc-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
    --mslc-radius: 24px;
    --mslc-font: "MSLC IRANSans";
    --mslc-fallback-font: Tahoma, Arial, sans-serif;
}

.mehran-livechat-root,
.mehran-livechat-root * {
    box-sizing: border-box;
}

.mehran-livechat-root {
    position: fixed;
    z-index: 999999;
    right: 22px;
    bottom: 22px;
    font-family: var(--mslc-font), var(--mslc-fallback-font);
    color: var(--mslc-ink);
    line-height: normal;
    font-synthesis-weight: auto;
}

.mehran-livechat-root button,
.mehran-livechat-root textarea {
    -webkit-appearance: none;
    appearance: none;
    font-family: inherit;
    text-transform: none;
    letter-spacing: 0;
}

.mehran-livechat-root button {
    margin: 0 !important;
    padding: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    min-width: 0;
    min-height: 0;
    text-decoration: none;
    line-height: 1;
}

.mehran-livechat-root button:focus,
.mehran-livechat-root button:focus-visible,
.mehran-livechat-root textarea:focus,
.mehran-livechat-root textarea:focus-visible {
    outline: 0 !important;
}

.mehran-livechat-root button::before,
.mehran-livechat-root button::after {
    box-sizing: border-box;
}

.mehran-livechat-root svg {
    display: block;
    flex: 0 0 auto;
    fill: none !important;
}

.mehran-livechat-root svg path {
    fill: none !important;
    stroke: currentColor !important;
}

.mslc-launcher-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    transform-origin: bottom right;
    transition: opacity 160ms ease, visibility 160ms ease, transform 160ms ease;
}

.mehran-livechat-root.is-open .mslc-launcher-wrap {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px) scale(0.92);
}

.mehran-livechat-root.is-open .mslc-launcher {
    animation: none;
}

.mslc-bubble-label {
    direction: rtl;
    padding: 9px 13px;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 14px 40px rgba(15, 23, 42, 0.14);
    color: #1f2937;
    font-size: 12px;
    line-height: 1.8;
    white-space: nowrap;
    backdrop-filter: blur(12px);
}

.mslc-launcher {
    position: relative;
    width: 66px !important;
    height: 66px !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    background: linear-gradient(145deg, var(--mslc-primary), var(--mslc-accent)) !important;
    color: #fff !important;
    box-shadow: 0 18px 42px rgba(37, 99, 235, 0.36) !important;
    cursor: pointer;
    transition: transform 180ms ease, box-shadow 180ms ease;
    animation: mslc-nudge 5s ease-in-out infinite;
}

.mslc-launcher::after,
.mslc-close::before,
.mslc-close::after,
.mslc-send::before,
.mslc-send::after {
    content: none !important;
    display: none !important;
}

.mslc-launcher:hover,
.mslc-launcher:focus-visible {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 22px 52px rgba(37, 99, 235, 0.42) !important;
    outline: none;
}

.mslc-launcher::before {
    content: "";
    position: absolute;
    inset: -8px;
    border: 1px solid color-mix(in srgb, var(--mslc-primary) 34%, transparent);
    border-radius: inherit;
    animation: mslc-pulse 2.8s ease-out infinite;
}

.mslc-launcher svg {
    width: 30px !important;
    height: 30px !important;
}

.mslc-unread-dot {
    position: absolute;
    top: 8px;
    right: 7px;
    width: 13px;
    height: 13px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #ef4444;
}

.mslc-panel {
    position: absolute;
    right: 0;
    bottom: 0;
    width: min(390px, calc(100vw - 28px));
    height: min(620px, calc(100vh - 112px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.72);
    border-radius: var(--mslc-radius);
    background: var(--mslc-surface);
    box-shadow: var(--mslc-shadow);
    opacity: 0;
    visibility: hidden;
    transform: translateY(16px) scale(0.98);
    transform-origin: bottom right;
    transition: opacity 180ms ease, visibility 180ms ease, transform 180ms ease;
}

.mslc-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.mslc-header {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 17px;
    background: linear-gradient(135deg, var(--mslc-primary), color-mix(in srgb, var(--mslc-primary) 42%, var(--mslc-accent)));
    color: #fff;
    direction: rtl;
}

.mslc-brand-avatar {
    position: relative;
    width: 48px;
    height: 48px;
    flex: 0 0 48px;
    display: grid;
    place-items: center;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.mslc-brand-avatar svg {
    width: 27px !important;
    height: 27px !important;
}

.mslc-online {
    position: absolute;
    right: -1px;
    bottom: -1px;
    width: 13px;
    height: 13px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #22c55e;
}

.mslc-heading {
    min-width: 0;
    flex: 1;
}

.mslc-title {
    margin: 0;
    font-size: 15px;
    font-weight: 800;
    line-height: 1.7;
    color: #fff;
}

.mslc-subtitle {
    margin: 1px 0 0;
    font-size: 12px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.82);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mslc-close {
    width: 36px !important;
    height: 36px !important;
    flex: 0 0 36px;
    display: grid !important;
    place-items: center;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.13) !important;
    color: #fff !important;
    box-shadow: none !important;
    cursor: pointer;
    transition: background 160ms ease, transform 160ms ease;
}

.mslc-close:hover,
.mslc-close:focus-visible {
    background: rgba(255, 255, 255, 0.22) !important;
    transform: rotate(6deg);
    outline: none;
}

.mslc-close svg {
    width: 20px !important;
    height: 20px !important;
}

.mslc-messages {
    flex: 1;
    padding: 17px 15px 18px;
    overflow-y: auto;
    background:
        linear-gradient(180deg, rgba(244, 247, 251, 0.92), rgba(255, 255, 255, 0.98)),
        radial-gradient(circle at 10% 0%, rgba(20, 184, 166, 0.13), transparent 35%);
    scroll-behavior: smooth;
}

.mslc-row {
    display: flex;
    gap: 9px;
    align-items: flex-end;
    margin: 0 0 13px;
}

.mslc-row.is-user {
    flex-direction: row-reverse;
}

.mslc-avatar {
    width: 31px;
    height: 31px;
    flex: 0 0 31px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    color: #fff;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.12);
}

.mslc-row.is-support .mslc-avatar {
    background: linear-gradient(145deg, var(--mslc-primary), var(--mslc-accent));
}

.mslc-row.is-user .mslc-avatar {
    background: #172033;
}

.mslc-avatar svg {
    width: 17px !important;
    height: 17px !important;
}

.mslc-bubble {
    max-width: min(74%, 285px);
    padding: 10px 12px;
    border-radius: 18px;
    font-size: 13px;
    line-height: 1.9;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.mslc-row.is-support .mslc-bubble {
    border-bottom-right-radius: 7px;
    background: #fff;
    color: #172033;
    border: 1px solid var(--mslc-border);
}

.mslc-row.is-user .mslc-bubble {
    border-bottom-left-radius: 7px;
    background: linear-gradient(135deg, var(--mslc-primary), color-mix(in srgb, var(--mslc-primary) 68%, var(--mslc-accent)));
    color: #fff;
}

.mslc-text[dir="rtl"] {
    direction: rtl;
    text-align: right;
}

.mslc-text[dir="ltr"] {
    direction: ltr;
    text-align: left;
}

.mslc-text a {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    word-break: break-all;
}

.mslc-row.is-support .mslc-text a {
    color: var(--mslc-primary);
}

.mslc-row.is-user .mslc-text a {
    color: #fff;
}

.mslc-text a:hover,
.mslc-text a:focus-visible {
    text-decoration-thickness: 2px;
    outline: none;
}

.mslc-text strong {
    font-weight: 900;
    font-synthesis-weight: auto;
}

.mslc-meta {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 5px;
    font-size: 10.5px;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.82);
}

.mslc-meta[dir="rtl"] {
    justify-content: flex-start;
}

.mslc-status-icon {
    width: 15px;
    height: 15px;
}

.mslc-typing {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 54px;
}

.mslc-typing span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: color-mix(in srgb, var(--mslc-primary) 70%, var(--mslc-accent));
    animation: mslc-typing 1.05s ease-in-out infinite;
}

.mslc-typing span:nth-child(2) {
    animation-delay: 120ms;
}

.mslc-typing span:nth-child(3) {
    animation-delay: 240ms;
}

.mslc-error {
    margin: 2px 0 12px;
    padding: 8px 10px;
    border-radius: 14px;
    background: #fff1f2;
    color: #be123c;
    direction: rtl;
    text-align: right;
    font-size: 12px;
    line-height: 1.8;
}

.mslc-composer {
    display: flex;
    align-items: flex-end;
    gap: 9px;
    padding: 12px;
    border-top: 1px solid var(--mslc-border);
    background: rgba(255, 255, 255, 0.96);
}

.mslc-input-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    min-height: 46px;
    border: 1px solid var(--mslc-border);
    border-radius: 18px;
    background: var(--mslc-soft);
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.mslc-input-wrap:focus-within {
    border-color: color-mix(in srgb, var(--mslc-primary) 56%, white);
    background: #fff;
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--mslc-primary) 12%, transparent);
}

.mslc-input {
    width: 100% !important;
    max-height: 112px;
    min-height: 44px;
    padding: 12px 13px !important;
    margin: 0 !important;
    border: 0 !important;
    outline: 0 !important;
    resize: none;
    background: transparent !important;
    color: var(--mslc-ink) !important;
    box-shadow: none !important;
    font-family: var(--mslc-font), var(--mslc-fallback-font);
    font-size: 13px;
    line-height: 1.8;
}

.mslc-input::placeholder {
    color: #8b95a7;
}

.mslc-send {
    width: 46px !important;
    height: 46px !important;
    flex: 0 0 46px;
    display: grid !important;
    place-items: center;
    border-radius: 16px !important;
    background: linear-gradient(145deg, var(--mslc-primary), var(--mslc-accent)) !important;
    color: #fff !important;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(37, 99, 235, 0.24) !important;
    transition: transform 160ms ease, opacity 160ms ease;
}

.mslc-send:hover,
.mslc-send:focus-visible {
    transform: translateY(-1px);
    outline: none;
}

.mslc-send:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.mslc-send svg {
    width: 20px !important;
    height: 20px !important;
}

body.mslc-mobile-open {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
}

@keyframes mslc-nudge {
    0%, 76%, 100% {
        transform: translateX(0) rotate(0);
    }
    79% {
        transform: translateX(-2px) rotate(-3deg);
    }
    82% {
        transform: translateX(2px) rotate(3deg);
    }
    85% {
        transform: translateX(-1px) rotate(-2deg);
    }
    88% {
        transform: translateX(1px) rotate(2deg);
    }
}

@keyframes mslc-pulse {
    0% {
        opacity: 0.72;
        transform: scale(0.96);
    }
    100% {
        opacity: 0;
        transform: scale(1.22);
    }
}

@keyframes mslc-typing {
    0%, 80%, 100% {
        opacity: 0.36;
        transform: translateY(0);
    }
    40% {
        opacity: 1;
        transform: translateY(-4px);
    }
}

@media (max-width: 640px), ((max-height: 520px) and (hover: none) and (pointer: coarse)) {
    .mehran-livechat-root {
        right: 20px;
        bottom: 22px;
    }

    .mslc-bubble-label {
        display: none;
    }

    .mslc-launcher {
        width: 62px;
        height: 62px;
    }

    .mslc-panel {
        position: fixed;
        top: var(--mslc-mobile-top, 0px);
        right: 0;
        bottom: auto;
        left: 0;
        width: 100vw;
        height: var(--mslc-mobile-vh, 100dvh);
        max-height: none;
        border: 0;
        border-radius: 0;
        transform: translateY(18px);
    }

    .mslc-panel.is-open {
        transform: translateY(0);
    }

    .mslc-header {
        padding: max(14px, env(safe-area-inset-top)) 14px 14px;
    }

    .mslc-messages {
        padding: 14px 11px 16px;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    .mslc-bubble {
        max-width: calc(100vw - 92px);
        font-size: 13px;
    }

    .mslc-composer {
        padding: 10px 10px max(10px, env(safe-area-inset-bottom));
        flex-shrink: 0;
        touch-action: manipulation;
    }

    .mslc-input {
        font-size: 16px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .mslc-launcher-wrap,
    .mslc-launcher,
    .mslc-launcher::before,
    .mslc-typing span {
        animation: none;
    }

    .mslc-panel,
    .mslc-launcher-wrap,
    .mslc-send,
    .mslc-close {
        transition: none;
    }
}
