/* Chatbot Container */
#ds-chatbot-container {
    max-width: 1200px;
    width: 95%;
    margin: 0 2.5%;
    padding: 14px;
    background-color: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    display: flex;
    flex-direction: column;
    height: auto !important;
    max-height: 105vh;
    overflow: hidden;
    font-family: inherit;
}

/* Chatbot Header */
#ds-chatbot-header {
    display: flex;
    align-items: center;
    padding: 15px;
    background: #f9f9f9;
    border-bottom: 1px solid #ddd;
    position: sticky;
    top: 0;
    z-index: 1;
}

#ds-chatbot-header img {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    margin-right: 10px;
}

#ds-chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

/* Chatbot Messages */
#ds-chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-message, .bot-message {
    max-width: 80%;
    padding: 12px 15px;
    margin-bottom: 10px;
    border-radius: 15px;
    position: relative;
    word-wrap: break-word;
    line-height: 1.4;
}

.user-message {
    margin-left: auto;
    border-bottom-right-radius: 5px;
}

.bot-message {
    margin-right: auto;
    border-bottom-left-radius: 5px;
}

/* Chatbot Input Area */
#ds-chatbot-input-area {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 16px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

#ds-chatbot-input {
    padding: 7px 14px 3px 7px;
    width: 100%;
    min-height: 48px;
    max-height: 200px;
    resize: none;
    overflow-y: auto;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.5;
    transition: all 0.2s ease;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background-color: #ffffff;
    font-size: 15px;
    color: #333333;
}

#ds-chatbot-input:focus {
    border-color: #0073aa;
    box-shadow: 0 0 0 3px rgba(0, 115, 170, 0.1);
    outline: none;
}

#ds-chatbot-input::placeholder {
    color: #999999;
    font-style: italic;
}

#ds-chatbot-send {
    padding: 10px 20px;
    background: #0073aa;
    color: #fff;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.3s ease;
}

#ds-chatbot-send:hover {
    background: #005177;
}

/* Typing Indicator */
#ds-chatbot-typing-indicator {
    display: none;
    padding: 10px;
    font-style: italic;
    color: #666;
    text-align: center;
    position: relative;
    min-height: 20px;
}

.typing-indicator-dots {
    display: inline-block;
    position: relative;
    width: 60px;
    height: 20px;
}

.typing-indicator-dots span {
    position: absolute;
    width: 8px;
    height: 8px;
    background: #666;
    border-radius: 50%;
    animation: typing-indicator 1.2s infinite ease-in-out;
}

.typing-indicator-dots span:nth-child(1) {
    left: 0;
    animation-delay: 0s;
}

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

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

@keyframes typing-indicator {
    0%, 40%, 100% { transform: translateY(0); }
    20% { transform: translateY(-6px); }
}

/* Responsive Design */
@media (max-width: 480px) {
    #ds-chatbot-container {
        width: 100%;
        height: 100vh;
        border-radius: 0;
        margin: 0;
    }
    
    .user-message, .bot-message {
        max-width: 90%;
    }
}

/* Add these new styles at the end */
.bot-message {
    white-space: pre-wrap;
    word-wrap: break-word;
}

.bot-message p {
    margin: 0 0 0 0;
}

.bot-message ul,
.bot-message ol {
    margin: 1em 0;
    padding-left: 2em;
}

.bot-message li {
    margin-bottom: 0 0 0 0;
}

.bot-message code {
        background: rgba(0, 0, 0, 0.05);
        padding: 2px 4px;
        border-radius: 3px;
        font-family: monospace;
        word-wrap: break-word;
        white-space: pre-wrap;
        font-size: 14px;
}

.bot-message pre {
    background: rgba(0,0,0,0.05);
    padding: 10px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 1em 0;
}

.bot-message blockquote {
    border-left: 3px solid #ddd;
    padding-left: 1em;
    margin: 1em 0;
    color: #666;
}

/* Add error message styling */
.bot-message.error {
    color: #dc3545;
    background-color: #f8d7da;
    border: 1px solid #f5c6cb;
    padding: 10px;
    border-radius: 5px;
    margin: 10px 0;
}

.bot-message h1,
.bot-message h2,
.bot-message h3,
.bot-message h4 {
    line-height: 1.2;
    color: var(--bot-text-color, inherit); /* Default to inherit if not set */
}

.bot-message h1 {
    font-size: 1.5em;
}

.bot-message h2 {
    font-size: 1.3em;
}

.bot-message h3 {
    font-size: 1.3em;
}

.bot-message h4 {
    font-size: 1.3em;
}

.bot-message ul,
.bot-message ol {
    padding-left: 2em;
}

.bot-message li {
    padding-left: 3em;
}

.bot-message strong {
    font-weight: bold;
}

.bot-message em {
    font-style: italic;
}

.bot-message iframe, .bot-message video, .bot-message audio, .bot-message img {
    width: 100%;
}

.video-container {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 aspect ratio */
    height: 0;
    overflow: hidden;
    margin: 1em 0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    max-width: 100%;
}

.video-container video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.video-container iframe {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

.ds-input-wrapper {
    position: relative;
    flex-grow: 1;
    display: flex;
    align-items: center;
    margin-bottom: 7px;
    background-color: #ffffff;
    border-radius: 14px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 8px;
}

#ds-chatbot-speech {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    color: #0073aa;
    transition: all 0.2s ease;
    border-radius: 50%;
    background-color: rgba(0, 115, 170, 0.1);
}

#ds-chatbot-speech:hover {
    color: #ffffff;
    background-color: #0073aa;
    transform: translateY(-50%) scale(1.1);
}

#ds-chatbot-speech.listening {
    color: #ffffff;
    background-color: #dc3545;
    animation: ds-pulse 1s infinite;
}

#ds-chatbot-speech svg {
    width: 24px;
    height: 24px;
}

/* Add these new styles */
#ds-chatbot-input.recording {
    border-color: #dc3545;
    box-shadow: 0 0 0 2px rgba(220, 53, 69, 0.25);
}

@keyframes ds-pulse {
    0% { transform: translateY(-50%) scale(1); }
    50% { transform: translateY(-50%) scale(1.1); }
    100% { transform: translateY(-50%) scale(1); }
}