.ai-message-panel {
    position: fixed;
    right: 50px;
    bottom: 50px;
    z-index: 10000;
}

.ai-message-content {
    position: absolute;
    width: 320px;
    background: rgba(40, 40, 40, 0.95);
    border-radius: 12px 12px 0 12px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--success-color);
    backdrop-filter: blur(10px);
    overflow: hidden;
    pointer-events: auto;
    opacity: 0;
    transition: all 0.3s ease;
    bottom: 70px;
    right: 0;
    transform: translateY(10px);
    display: flex;
    flex-direction: column;
    max-height: 60vh;
}

/* Добавляем правило для скрытого состояния */
.ai-message-panel.ai-message-hidden .ai-message-content {
    pointer-events: none; /* Только в скрытом состоянии блокируем события */
}

.ai-message-panel:not(.ai-message-hidden) .ai-message-content {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto; /* Явно указываем для видимого состояния */
}

/* Шапка */
.ai-message-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-message-title {
    color: white;
    font-weight: bold;
    font-size: 16px;
}

.ai-message-settings-btn {
    cursor: pointer;
    font-size: 18px;
    padding: 5px;
    transition: transform 0.2s ease;
}

.ai-message-settings-btn:hover {
    transform: rotate(45deg);
}

/* Блок чата */
.ai-message-chat {
    overflow-y: auto;
    max-height: 50vh;
    padding: 0 15px;
}

.ai-message-inner {
    padding: 15px 0;
}

.ai-message-container-msg {
    display: flex;
    margin-bottom: 10px;
    align-items: flex-start;
}

.ai-message-container-msg:last-child {
    margin-bottom: 0;
}

.ai-message-avatar {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.1);
    margin-right: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

.ai-message-text {
    color: white;
    font-size: 11px;
    padding: 4px 15px;
    padding-bottom: 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    flex: 1;
}

/* Добавляем отступы между абзацами внутри сообщения */
.ai-message-text p {
    margin-bottom: 8px;
}

.ai-message-text p:last-child {
    margin-bottom: 0;
}

/* Стили для индикатора "Печатает..." */
.ai-message-typing {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
}

.ai-message-typing-dots {
    display: flex;
    gap: 3px;
}

.ai-message-typing-dot {
    width: 6px;
    height: 6px;
    background-color: rgba(255, 255, 255, 0.6);
    border-radius: 50%;
    animation: ai-message-typing-bounce 1.4s ease-in-out infinite both;
}

.ai-message-typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-message-typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.ai-message-typing-dot:nth-child(3) {
    animation-delay: 0s;
}

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

/* Блок настроек */
.ai-message-settings {
    padding: 15px;
    max-height: 50vh;
    overflow-y: auto;
}

.ai-message-settings-title {
    color: white;
    font-weight: bold;
    margin-bottom: 15px;
    text-align: center;
}

.ai-message-character {
    display: flex;
    align-items: center;
    padding: 10px;
    margin-bottom: 10px;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s ease;
    background: rgba(255, 255, 255, 0.05);
}

.ai-message-character:hover {
    background: rgba(255, 255, 255, 0.1);
}

.ai-message-character-icon {
    font-size: 24px;
    margin-right: 12px;
    width: 40px;
    text-align: center;
}

.ai-message-character-info {
    flex: 1;
}

.ai-message-character-name {
    color: white;
    font-weight: bold;
    margin-bottom: 3px;
}

.ai-message-character-desc {
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

/* Скроллбар */
.ai-message-content::-webkit-scrollbar,
.ai-message-chat::-webkit-scrollbar,
.ai-message-settings::-webkit-scrollbar {
    width: 4px;
}

.ai-message-content::-webkit-scrollbar-track,
.ai-message-chat::-webkit-scrollbar-track,
.ai-message-settings::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
}

.ai-message-content::-webkit-scrollbar-thumb,
.ai-message-chat::-webkit-scrollbar-thumb,
.ai-message-settings::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

/* Иконка */
.ai-message-tab {
    position: relative;
    width: 60px;
    height: 60px;
    background: var(--accent-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
    pointer-events: auto;
    transition: transform 0.5s ease;
    z-index: 10001;
}

.ai-message-tab:hover {
    transform: scale(1.2);
}

.ai-message-icon {
    color: white;
    font-size: 28px;
}

/* Стили для кнопки информации */
.ai-message-character-info-btn {
    cursor: pointer;
    font-size: 16px;
    padding: 5px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
    margin-left: 10px;
}

.ai-message-character-info-btn:hover {
    opacity: 1;
}

/* Попап с описанием коуча */
.ai-message-character-popup {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10002;
    backdrop-filter: blur(5px);
}

.ai-message-character-popup-content {
    background: rgba(40, 40, 40, 0.95);
    padding: 25px;
    border-radius: 15px;
    width: 300px;
    text-align: center;
    position: relative;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.ai-message-character-popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    cursor: pointer;
    font-size: 24px;
    color: rgba(255, 255, 255, 0.7);
    transition: color 0.2s ease;
}

.ai-message-character-popup-close:hover {
    color: white;
}

.ai-message-character-popup-icon {
    font-size: 48px;
    margin-bottom: 15px;
}

.ai-message-character-popup-name {
    color: white;
    font-size: 20px;
    font-weight: bold;
    margin-bottom: 10px;
}

.ai-message-character-popup-desc {
    color: white;
    font-size: 12px;
    margin-bottom: 15px;
    line-height: 1.4;
}

.ai-message-character-popup-details {
    color: rgba(255, 255, 255, 0.7);
    font-size: 11px;
    line-height: 1.4;
}

/* Стили для уведомления о новом сообщении */
.ai-message-notification {
    position: absolute;
    top: -8px;
    right: -8px;
    background: linear-gradient(45deg, #ff6b6b, #ffa726);
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.7);
    z-index: 10003;
    border: 2px solid white;
    animation: notificationPulse 0.8s ease-out;
}

@keyframes notificationPulse {
    0% { 
        opacity: 0;
        transform: scale(0.5) rotate(0deg);
    }
    50% { 
        opacity: 1;
        transform: scale(1.2) rotate(180deg);
    }
    100% { 
        opacity: 1;
        transform: scale(1) rotate(360deg);
    }
}

/* Анимация для самой иконки бота */
.ai-message-tab.new-message {
    animation: tabBounce 0.6s ease, tabGradient 2s ease;
}

@keyframes tabBounce {
    0% { transform: translateY(0) scale(1); }
    25% { transform: translateY(-8px) scale(1.1); }
    50% { transform: translateY(-4px) scale(1.05); }
    75% { transform: translateY(-2px) scale(1.02); }
    100% { transform: translateY(0) scale(1); }
}

@keyframes tabGradient {
    0% { background: var(--accent-color); }
    25% { background: #ff6b6b; }
    50% { background: #4ecdc4; }
    75% { background: #ffa726; }
    100% { background: var(--accent-color); }
}

/* Плавное исчезновение уведомления */
.ai-message-notification.fade-out {
    animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
    0% { 
        opacity: 1;
        transform: scale(1);
    }
    100% { 
        opacity: 0;
        transform: scale(0.5);
    }
}