/* Стили для MD внутри сообщений */

.cm-ai-bot-window * {
    font-family: 'Panton ';
}

.cm-ai-bot-message-content p {
    margin: 0 0 8px 0;
}
.cm-ai-bot-message-content p:last-child {
    margin-bottom: 0;
}
.cm-ai-bot-message-content strong {
    font-weight: 700;
}
.cm-ai-bot-message-content em {
    font-style: italic;
}
.cm-ai-bot-message-content ul,
.cm-ai-bot-message-content ol {
    margin: 0 0 8px 20px;
    padding: 0;
}
.cm-ai-bot-message-content li {
    margin-bottom: 4px;
    list-style: disc;
}
.cm-ai-bot-message-content code {
    background-color: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 4px;
    font-size: 0.9em;
}
.cm-ai-bot-message-content pre {
    background-color: #2d2d2d;
    color: #f8f8f2;
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin-bottom: 8px;
}
.cm-ai-bot-message-content pre code {
    background-color: transparent;
    padding: 0;
    color: inherit;
}
.cm-ai-bot-message-content blockquote {
    border-left: 3px solid #2C767A;
    margin: 0 0 8px 0;
    padding-left: 10px;
    color: #555;
}
.cm-ai-bot-message-content a {
    color: #2C767A;
    text-decoration: underline;
}
.cm-ai-bot-hint {
    position: fixed;
    bottom: 159px;
    right: 95px;
    max-width: 120px;
    padding: 8px;

    font-size: 14px;
    line-height: 21px;
    letter-spacing: .02em;
    color: #333;

    border: 1px solid #eaeaea;
    background-color: #FFFFFF;
    border-radius: 12px 12px 0 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);

    z-index: 999;
    animation: cm-ai-bot-hint-fade 0.3s ease-out;
}

@keyframes cm-ai-bot-hint-fade {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.cm-ai-bot-container {
    position: fixed;
    bottom: 130px;
    right: 30px;
    z-index: 1000;
    transition: all 0.3s ease;
}

.cm-ai-bot-container.cm-active {
    bottom: 30px;
}


.cm-ai-bot-launcher {
    width: 60px;
    height: 60px;
    border-radius: 50%;

    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    background: #FFFFFF;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
}

.cm-ai-bot-launcher:hover {
    transform: scale(1.05);
}


.cm-ai-bot-window {
    width: 380px;
    height: 500px;
    max-height: 90vh;
    max-width: 95vw;
    background-color: #FFFFFF;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom right;
    animation: cm-ai-bot-window-appear 0.3s ease-out;
}

@keyframes cm-ai-bot-window-appear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Хедер чата */
.cm-ai-bot-header {
    display: flex;
    justify-content: space-between;
    align-items: center;

    padding: 8px 16px;
    height: 56px;

    background-color: #2C767A;
    color: #FFFFFF;
}

.cm-ai-bot-header h2 {
    margin: 0 0 0 auto;
    font-weight: 600;
    font-size: 18px;
    line-height: 16.5px;

    color: rgb(255, 255, 255);
}

.cm-ai-bot-close-btn {
    background: none;
    border: none;
    color: #FFFFFF;
    font-size: 20px;
    cursor: pointer;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: background-color 0.2s;
}

.cm-ai-bot-close-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.cm-ai-bot-messages-container {
    position: relative;

    flex: 1;
    overflow-y: auto;
    padding: 18px 18px 32px 18px;
    background-color: #FFFFFF;
}

.cm-ai-bot-history {
    display: flex;
    flex-direction: column;
    align-items: center;
    row-gap: 4px;

    margin-bottom: 20px;
    cursor: pointer;
}

.cm-ai-bot-message {
    position: relative;
    margin-bottom: 8px;
    display: flex;
    flex-direction: column;
    max-width: max-content;
}

.cm-ai-bot-message-bot {
    align-self: flex-start;
    padding-left: 46px;
}

.cm-ai-bot-message-user {
    align-self: flex-end;
    padding-right: 46px;
    margin-left: auto;
}

.cm-ai-bot-message-header {
    display: flex;
    align-items: center;
    padding: 8px;
    padding-bottom: 0;
    background: #F4F5F5;
}

.cm-ai-bot-message-bot .cm-ai-bot-message-header {
    border-radius: 0 8px 0 0;
    justify-content: flex-start;
}

.cm-ai-bot-message-user .cm-ai-bot-message-header {
    justify-content: flex-end;
    border-radius: 8px 0 0 0;
    background: #CBDFF8;
}

.cm-ai-bot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;

    font-size: 16px;
}

.cm-ai-bot-avatar-bot {
    position: absolute;
    top: 0;
    left: 0;

    background: none;
    color: #FFFFFF;
}

.cm-ai-bot-avatar-user {
    position: absolute;
    top: 0;
    right: 0;

    background-color: #2C767A;
    color: #FFFFFF;
    margin-right: 0;
}

.cm-ai-bot-sender-name {
    font-weight: 700;
    font-size: 12px;
    line-height: 18px;
}

.cm-ai-bot-message-bot .cm-ai-bot-sender-name {
    color: #2c3e50;
}

.cm-ai-bot-message-user .cm-ai-bot-sender-name {
    color: #2c3e50;
}

.cm-ai-bot-message-content {
    padding: 8px;
    position: relative;
    font-size: 14px;
    line-height: 20px;
    overflow-wrap: break-word;
}

.cm-ai-bot-message-bot .cm-ai-bot-message-content {
    background-color: #F4F5F5;
    color: #333;
    font-weight: 400;
}

.cm-ai-bot-message-user .cm-ai-bot-message-content {
    background-color: #CBDFF8;
    color: #333;
}

.cm-ai-bot-message-time {
    width: 100%;
    padding: 0 8px 8px 8px;

    font-size: 11px;
    color: #95a5a6;

    background: #F4F5F5;
}

.cm-ai-bot-message-bot .cm-ai-bot-message-time {
    border-radius: 0 0 8px 8px;
}

.cm-ai-bot-message-user .cm-ai-bot-message-time {
    align-self: flex-start;
    background: #CBDFF8;
    border-radius: 0 0 8px 8px;
}

.cm-ai-bot-input-container {
    padding: 8px 0;
    border-top: 1px solid #eaeaea;
    border-bottom: 1px solid #eaeaea;
    background-color: #FFFFFF;
}

.cm-ai-bot-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.cm-ai-bot-message-input {
    height: 44px;
    padding: 12px 60px 12px 20px;
    font-size: 14px;
    font-weight: 600;

    outline: none;
    transition: border-color 0.3s;
    flex: 1;
    border: none;
    border-radius: 0;
    appearance: none;
    resize: none;
    color: #000000;
}

.cm-ai-bot-message-input::placeholder {
    color: #000;
    font-weight: 700;
}

.cm-ai-bot-message-input:focus {
    border-color: #1abc9c;
}

.cm-ai-bot-send-btn {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);

    border: none;

    width: 40px;
    height: 40px;
    border-radius: 50%;

    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    background: none;
}

.cm-ai-bot-send-btn:hover:not(:disabled) {
    background: none;
}

.cm-ai-bot-send-btn:disabled {
    opacity: .5;
    cursor: not-allowed;
}


.cm-ai-bot-legal-footer {
    background-color: #FFFFFF;
    padding: 12px 16px;
    margin-top: 8px;

    font-size: 11px;
    line-height: 15px;
    color: #000;
}

.cm-ai-bot-legal-footer span {
    font-weight: 600;
}


.cm-ai-bot-messages-container::-webkit-scrollbar {
    width: 6px;
}

.cm-ai-bot-messages-container::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.cm-ai-bot-messages-container::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.cm-ai-bot-messages-container::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.cm-ai-bot-message-input::-webkit-scrollbar {
    width: 0;
    display: none;
}


.cm-ai-bot-typing {
    display: inline-flex;
    align-items: center;
}

.cm-ai-bot-typing-dots {
    display: inline-flex;
}

.cm-ai-bot-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: #2C767A;
    display: inline-block;
    margin: 0 2px;
    animation: cm-ai-bot-typing 1.4s infinite ease-in-out both;
}

.cm-ai-bot--img {
    width: 100%;
    height: auto;
}

.cm-ai-bot-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.cm-ai-bot-typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

.cm-ai-arrow {
    position: absolute;
    right: 8px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 40px;
    height: 40px;
    z-index: 10;

    background: transparent;
    border-radius: 50%;
    cursor: pointer;
}

.cm-ai-arrow.cm-ai-arrow--top {
    top: 74px;
    transform: rotate(180deg);
}

.cm-ai-arrow.cm-ai-arrow--bottom {
    bottom: 199px;
}

.cm-ai-bot-img--animation {
    transform: rotate(0deg);
    transform-origin: center center;
    animation: spinAnimation 2s ease-in-out 1;
}

@keyframes spinAnimation {
    0% {
        transform: rotate(0deg);
    }
    12.5% {
        transform: rotate(15deg);
    }
    25% {
        transform: rotate(-15deg);
    }
    37.5% {
        transform: rotate(15deg);
    }
    50% {
        transform: rotate(-15deg);
    }
    62.5% {
        transform: rotate(15deg);
    }
    75% {
        transform: rotate(-15deg);
    }
    87.5% {
        transform: rotate(15deg);
    }
    100% {
        transform: rotate(0deg);
    }
}

@keyframes cm-ai-bot-typing {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

@media (max-width: 550px) {
    .cm-ai-bot-window {
        width: 100vw !important;
        height: 100vh !important;
        max-width: 100vw !important;
        max-height: 100vh !important;
        border-radius: 0;
        position: fixed;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
    }

    .cm-ai-bot-container {
        right: 20px;
        bottom: 20px;
    }

    .cm-ai-resize-handle {
        display: none !important;
    }

    .cm-ai-bot-hint {
        right: 20px;
        bottom: 90px;
        max-width: 180px;
    }
}

@keyframes cm-ai-glow-pulse {
    0%, 100% {
        transform: translate(-50%, -50%) scale(1);
        opacity: 0.8;
    }
    50% {
        transform: translate(-50%, -50%) scale(1.15);
        opacity: 1;
    }
}

.cm-ai-bot-asst-pic-waves {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #2C767A;
    pointer-events: none;
    z-index: -1;
    opacity: .7;
    transition: opacity 0.3s ease-in-out;
}

.cm-ai-bot-asst-pic-waves--active {
    opacity: 0.8;
    animation: cm-ai-glow-pulse 2s ease-in-out infinite;
}

.cm-ai-bot-close-btn[data-cm-ai-close] svg path {
    fill: #FFFFFF;
}


.cm-ai-resize-handle {
    position: absolute;
    
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: grab;
    z-index: 100;
}

.cm-ai-resize-handle span {
    margin: auto;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.2);
    transition: background-color 0.2s, transform 0.2s;
    opacity: 0;
}

.cm-ai-resize-handle:hover span {
    opacity: 1;
}

.cm-ai-resize-width {
    left: 4px;
    top: 50%;
    width: 4px;
    height: 100%;
    transform: translateY(-50%);
    cursor: ew-resize;
}

.cm-ai-resize-width span {
    width: 100%;
    height: 32px;
}

.cm-ai-resize-height {
    top: 4px;
    left: 50%;
    width: 100%;
    height: 4px;
    transform: translateX(-50%);
    cursor: ns-resize;
}

.cm-ai-resize-height span {
    width: 32px;
    height: 100%;
}

