.character-chat {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 40;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.chat-toggle {
    background-color: #B8BDE1;
    color: #404992;
    border: none;
    border-radius: 2rem;
    padding: 0.75rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: 'Raleway', sans-serif;
}

.chat-toggle:hover {
    background-color: #A3A8D6;
    transform: translateY(-1px);
}

.chat-container {
    position: absolute;
    bottom: calc(100% + 1rem);
    right: 0;
    width: 320px;
    height: 480px;
    background-color: white;
    border-radius: 1.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.chat-header {
    padding: 1rem;
    background-color: #f8fafc;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Syne', sans-serif;
    color: #B8BDE1;
    font-weight: 600;
}

.character-chat.open .chat-container {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.chat-messages {
    flex-grow: 1;
    overflow-y: auto;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.chat-message {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    max-width: 80%;
    font-family: 'Raleway', sans-serif;
}

.chat-message.character {
    align-self: flex-start;
}

.chat-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.avatar {
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    background-color: #f4f6fa;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #85C7D3;
}

.message-content {
    background-color: #f4f6fa;
    padding: 0.75rem 1rem;
    border-radius: 1.5rem;
    color: #404992;
    font-size: 0.875rem;
    line-height: 1.5;
    font-family: 'Raleway', sans-serif;
}

.chat-message.user .message-content {
    background-color: #B8BDE1;
    color: #404992;
}

.typing-indicator {
    background-color: #f4f6fa;
    padding: 1rem;
    border-radius: 1.5rem;
    display: flex;
    gap: 0.25rem;
}

.typing-indicator span {
    width: 0.5rem;
    height: 0.5rem;
    background-color: #85C7D3;
    border-radius: 50%;
    animation: typing 1s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-0.5rem); }
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid #f0f0f0;
    display: flex;
    gap: 0.5rem;
}

.chat-input .input-field {
    flex-grow: 1;
    margin: 0;
    font-family: 'Raleway', sans-serif;
}

.chat-input .btn {
    padding: 0.75rem;
    min-width: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #B8BDE1;
    color: #404992;
}

@media (max-width: 768px) {
    .character-chat {
        bottom: 80px;
    }

    .chat-container {
        width: calc(100vw - 40px);
        height: 60vh;
    }
}
