
.ai-chat-open{
    position: fixed;
    right: 0;
    bottom: 5%;
    height: 100px;
    width: fit-content;
    background: #83C2E6;
    border-radius: 50px 0 0 50px;
    display: flex;
    z-index: 9;
    transition: 0.4s;
}

.ai-chat-open__icon{
    position: relative;
    height: 100%;
    width: 120px;
}
.ai-chat-open__icon img{
    position: absolute;
    width: 100%;
    min-width: 200px;
    object-fit: contain;
    bottom: -26px;
    right: -62px;
}
.ai-chat-open__txt{
    color: white;
    font-family: 'GT Eesti Pro Display', sans-serif;
    display: flex;
    flex-direction: column;
    font-size: 14px;
    width: 220px;
    line-height: 1.2;
    justify-content: center;
    align-items: flex-start;
    font-weight: 100;
}

.ai-chat-open__txt span:nth-of-type(1) {
    font-size: 20px;
    font-weight: 400;
}

.ai-chat-open__close{
    position: absolute;
    right: 6px;
    top: -26px;
    width: 24px;
    height: 24px;
}

.ai-chat-open-disable{
    right: -220px;
}

.ai-chat-open-jump {
    animation: jumpClose 1s ease-in-out forwards;
}


@keyframes jumpClose {
    30% {
        right: 20px;
    }
    100% {
        right: -220px;
    }
}

.ai-chat-popup {
    position: fixed;
    bottom: 5%;
    right: 1%;
    width: 455px;
    height: 535px;
    background: var(--white);
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
    display: flex;
    flex-direction: column;
    z-index: 10;
    overflow: hidden;
    font-family: 'GT Eesti Pro Display', sans-serif;
}

.ai-chat-popup.hidden {
    opacity: 0;
    transform: scale(0.96) translateY(15px);
    pointer-events: none;
}

.ai-chat-header {
    padding: 14px 18px;
    background: var(--white);
    color: var(--blue-400);
    display: flex;
    justify-content: space-between;
    font-size: 1.1rem;
    gap: 15px;
    align-items: flex-start;
}

.ai-chat-header img{
    width: 60px;
    height: 60px;
    object-fit: contain;
}

.ai-chat-header__txt{
    display: flex;
    flex-direction: column;
    line-height: 1;
    padding-top: 6px;
}

.ai-chat-header__txt span:nth-of-type(1) {
    font-size: 22px;
    font-weight: 500;
    line-height: 1.1;
}

.ai-chat-header__txt span:nth-of-type(1)::after{
    content: "(beta)";
    font-size: 18px;
    font-weight: 400;
    line-height: 1.1;
}

.ai-chat-header__txt span:nth-of-type(2) {
    font-size: 18px;
    position: relative;
    padding-left: 12px;
}

.ai-chat-header__txt span:nth-of-type(2)::before {
    content: "";
    display: block;
    width: 8px;
    height: 8px;
    background: var(--blue-200);
    border-radius: 50%;
    position: absolute;
    left: 0;
    top: 5px;
}

.ai-chat-popup__close {
    font-size: 34px;
    line-height: 1;
    transition: opacity 0.2s;
}

.ai-chat-popup__close:hover {
    opacity: 0.85;
}

.ai-chat-body {
    background: var(--white);
    height: 350px;
}

.ai-chat-body__container{
    padding: 10px;
    background: #DDEBF4;
    margin: 0 15px;
    height: 100%;
    border-radius: 20px 20px 0 0;
    overflow-y: auto;
}

.ai-chat-body__container::-webkit-scrollbar {
    width: 5px;
}

.ai-chat-body__container::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-body__container::-webkit-scrollbar-thumb {
    background: var(--blue-200);
    border-radius: 10px;
    transition: background 0.2s ease;
}

.ai-chat-body__container::-webkit-scrollbar-thumb:hover {
    background: var(--blue-400);
}

.ai-chat-body__content{
    display: flex;
    flex-direction: column;
}

/* Сообщения */
.message {
    max-width: 90%;
    margin: 4px 0;
}

.message.user {
    align-self: flex-end;
}

.message.ai {
    align-self: flex-start;
}

.message-content {
    padding: 10px 14px;
    border-radius: 20px;
    line-height: 1.1;
    font-size: 16px;
    font-weight: 300;
}

.message-content a{
    color: var(--blue-200);
    text-decoration: underline;
}

.message.user .message-content {
    background: var(--blue-200);
    color: white;
    border-bottom-right-radius: 2px;
}

.message.ai .message-content {
    background: #f9fcff;
    background: var(--white);
    border-bottom-left-radius: 2px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
    color: var(--blue-400);
}

/* Прелоадер */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: transparent;
    border: 2px solid var(--white);
    position: relative;
    animation: stroke 1.8s infinite ease-in-out;
    background: var(--blue-200);
}

.dot:nth-child(1) { animation-delay: 0s; }
.dot:nth-child(2) { animation-delay: 0.3s; }
.dot:nth-child(3) { animation-delay: 0.6s; }

@keyframes stroke {
    0% {
        border-color: var(--white);
        transform: scale(0.6);
    }
    25% {
        border-color: var(--grey-100);
        transform: scale(1.15);
    }
    50% {
        border-color: var(--grey-100);
        transform: scale(1);
    }
    75% {
        border-color: var(--grey-100);
        transform: scale(0.9);
    }
    100% {
        border-color: var(--white);
        transform: scale(0.6);
    }
}

/* Футер ввода */
.ai-chat-footer {
    display: flex;
    padding: 0 15px;
    background: white;
}

.ai-chat-footer__container{
    width: 100%;
    border-radius: 0 0 20px 20px;
    display: flex;
    padding: 10px;
    background: #DDEBF4;
}

.ai-chat-footer__input {
    flex: 1;
    padding: 10px 16px;
    border: transparent;
    border-radius: 10px;
    font-size: 16px;
    resize: none;
    margin-right: 5px;
    line-height: 1.2;
    color: var(--blue-400);
    min-height: 44px;
    max-height: 130px;
    font-family: 'GT Eesti Pro Display', sans-serif;
}

.ai-chat-footer__input:focus {
    outline: none;
}

.ai-chat-footer__input::placeholder {
    color: var(--grey-100);
}

.ai-chat-footer__send {
    padding: 0 20px;
    background: var(--blue-200);
    border: none;
    border-radius: 10px;
    cursor: pointer;
}

.ai-chat-footer__send:hover {
    opacity: .8;
}

.ai-chat-footer__send:disabled {
    background: #F2F9FF;
    cursor: not-allowed;
    box-shadow: none;
}

/* Мобильная адаптивность */
@media (max-width: 480px) {
    .ai-chat-popup {
        width: 92%;
    }
    .ai-chat-header__txt span:nth-of-type(1) {
        font-size: 20px;
    }

    .ai-chat-open-btn {
        bottom: 20px;
        right: 20px;
    }
}

@media (max-height: 690px) {
	.ai-chat-popup {
		box-sizing: border-box;
		padding-bottom: 10px;
		max-height: 535px;
		height: 93vh;
		z-index: 35;
	}

	.ai-chat-header,
	.ai-chat-footer {
		flex-shrink: 0;
	}

	.ai-chat-body {
		height: auto;
		flex: 1;
		min-height: 0;
	}

	.ai-chat-body__container {
		box-sizing: border-box;
	}
}
