.chat-container {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #000000;
    position: relative;
    padding-bottom: 80px; /* Increased padding to prevent overlap */
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    padding-bottom: 100px; /* Added extra padding at bottom */
    margin-bottom: 80px; /* Added margin to prevent overlap with input */
}

/* Chat message container with avatar */
.chat-message-container {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    width: 100%;
    padding: 0 0.25rem;
}

/* Avatar styling */
.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

.user-avatar {
    background-color: #3b82f6;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-icon {
    font-size: 1rem;
}

.ai-avatar {
    background-color: rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.ai-icon {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Chat bubble wrapper */
.chat-bubble-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: calc(100% - 50px);
}

.message-bubble {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 1rem;
    line-height: 1.5;
    font-size: 0.95rem;
    animation: fadeIn 0.3s ease-out;
    word-wrap: break-word;
    position: relative;
    z-index: 1;
}

.user-message {
    background-color: #3b82f6;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 0.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ai-message {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    margin-right: auto;
    border-bottom-left-radius: 0.25rem;
}

.chat-input-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 1rem;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    z-index: 46;
}

.chat-input-form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    max-width: 800px;
    margin: 0 auto;
    width: 100%;
}

.chat-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    background-color: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 0.95rem;
    transition: all 0.2s;
}

.chat-input:focus {
    outline: none;
    border-color: #3b82f6;
    background-color: rgba(255, 255, 255, 0.1);
}

.chat-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.chat-button {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.5rem;
    background-color: #3b82f6;
    color: white;
    border: none;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chat-button:hover:not(:disabled) {
    background-color: #2563eb;
}

.chat-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Chat bubble styling */
.chat-bubble {
    display: flex;
    flex-direction: column;
    width: 100%;
    border-radius: 1rem;
    overflow: hidden;
    animation: fadeIn 0.3s ease-out;
}

.chat-bubble.user {
    background-color: #3b82f6;
    color: white;
    border-bottom-right-radius: 0.25rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.chat-bubble.ai {
    background-color: rgba(255, 255, 255, 0.1);
    color: white;
    border-bottom-left-radius: 0.25rem;
}

.chat-bubble-content {
    padding: 0.75rem 1rem;
}

.chat-message {
    line-height: 1.5;
    font-size: 0.95rem;
    word-wrap: break-word;
}

.chat-bubble-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0.75rem;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    background-color: rgba(0, 0, 0, 0.1);
}

.chat-bubble-time {
    font-size: 0.7rem;
}

/* Action buttons */
.chat-bubble-actions {
    display: flex;
    gap: 0.5rem;
}

.action-button {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    cursor: pointer;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-size: 0.85rem;
}

.action-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.action-button.active {
    color: #3b82f6;
}

.speak-button.active {
    animation: pulse 1.5s infinite;
}

.copy-button.active {
    color: #10b981;
}

@keyframes pulse {
    0% { opacity: 0.7; }
    50% { opacity: 1; }
    100% { opacity: 0.7; }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Typing indicator for AI responses */
.typing-indicator {
    display: flex;
    gap: 0.25rem;
    padding: 0.5rem 1rem;
    align-items: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    background-color: rgba(255, 255, 255, 0.7);
    border-radius: 50%;
    animation: typingAnimation 1.4s infinite ease-in-out;
}

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

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

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

@keyframes typingAnimation {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-5px); }
}

@media (max-width: 640px) {
    .chat-container {
        padding-bottom: 70px;
    }

    .chat-messages {
        padding-bottom: 90px;
        margin-bottom: 70px;
    }

    .chat-avatar {
        width: 32px;
        height: 32px;
    }

    .chat-bubble-wrapper {
        max-width: calc(100% - 40px);
    }

    .chat-bubble-content {
        padding: 0.6rem 0.8rem;
    }

    .chat-message {
        font-size: 0.9rem;
    }

    .chat-input {
        padding: 0.6rem 0.8rem;
    }

    .chat-button {
        width: 2.5rem;
        height: 2.5rem;
    }

    .action-button {
        width: 1.5rem;
        height: 1.5rem;
        font-size: 0.75rem;
    }

    .chat-message-container {
        gap: 0.35rem;
    }
}
