/* Reset and base styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body, html {
    font-family: 'DM Sans', Arial, sans-serif;
    line-height: 1.25rem;
    color: #333;
    background-color: #fff;
    overflow: hidden;
    height: 100%;
    font-size: 1rem;
    font-weight: 500;
    font-style: normal;
}


.message.user {
    background-color: #007bff;
    color: white;
    align-self: flex-end;
}

.message.bot {
    background-color: #f0f0f0;
    align-self: flex-start;
}

/* Input area styles */

.input-area {
    background-color: #fff;
    border-top: 1px solid #eee;
    display: flex;
    gap: 0.5rem;
    background-color: rgb(235 235 235/1);
    box-sizing: border-box;
    border-radius: 4px;
    margin-bottom: 0.25rem;
}

.input-area input {
    flex: 1;
    padding: 0.75rem 1rem;
    outline: none;
    background-color: rgb(235 235 235/1);
    border: none;
    line-height: 1.5rem;
    font-size: 16px;
}

.input-area button {
    padding: 0.75rem;
    color: white;
    border: none;
    cursor: pointer;
    background-color: none;
    background-color: rgb(235 235 235/1);
}

body {
    background: transparent !important;
    margin: 0;
    padding: 0;
}

.messages-container {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    scroll-behavior: smooth;
}

.greeting-message {
    padding: 0.75rem;
    background-color: rgb(239 246 255 / 1);
    border-radius: 0.5rem;
    max-width: 80%;
    align-self: flex-start;
    font-size: 0.875rem;
    color: rgb(0 0 125 / 1);
}

.messages-container p {
    margin-bottom: 1rem;
}

.messages-container p:last-child {
    margin-bottom: 0;
}

.messages-container ul, .messages-container ol {
    margin-top: 1rem;
}

.messages-container ul ul, .messages-container ol ol, 
.messages-container ul ol, .messages-container ol ul {
    margin-top: 0;
}

a:hover, button:hover {
    text-decoration: none !important;
}

@keyframes progress {
    0% {
        transform: scaleX(0);
    }
    100% {
        transform: scaleX(1);
    }
}

/* Bot Icon */
.bot-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 1px solid rgba(0, 0, 0, 0.1);
    flex-shrink: 0;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Company Name */
.company-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    font-family: inherit;
    transition: color 0.3s ease;
    display: flex;
    align-items: center;
    max-width: 150px;
}

/* Bot Name */
.bot-name {
    font-size: 12px;
    font-weight: 400;
    color: #666666;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
    font-family: inherit;
    transition: color 0.3s ease;
    text-align: left;
    align-self: flex-start;
    padding-left: 0;
    margin-top: -1px;
}

.bot-name::before {
    content: "Chat with ";
}

/* New Chat Button */
#ai-chat-trigger {
    font-size: 12px;
    padding: 8px 12px;
}

.chat-text-container {
    font-size: 10px;
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px;
}

.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #90949c;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    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(-5px); }
}

/* Iframe Specific Styles */
.iframe-container {
    height: 100%;
    min-height: 100%;
}

.iframe-main {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* Header Styles */
.chat-header {
    padding: 0.5rem;
    border-bottom: 1px solid #e5e7eb;
    background-color: #ffffff;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bot-info {
    display: grid;
    grid-template-columns: 32px 1fr;
    align-items: center;
    gap: 0.75rem;
    align-items: center;
}

.bot-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    background-color: #f3f4f6;
}

.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.bot-details {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.chat-with {
    font-size: 10px;
    color: #6b7280;
    margin: 0;
    line-height: 1.1;
}

.agent-info {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.5rem;
}

.status-indicator {
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: #10b981;
    animation: pulse 2s infinite;
}

.agent-name {
    font-size: 0.875rem;
    font-weight: 700;
    margin: 0;
    line-height: 1.1;
    text-overflow: ellipsis;
    overflow: hidden;
    white-space: nowrap;
}

.header-controls {
    display: flex;
    gap: 0.5rem;
}

.new-chat-btn {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    color: #3b82f6;
    background-color: #eff6ff;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    width: 90px;
    justify-content: center;
}

.close-btn {
    padding: 0.25rem;
    color: #6b7280;
    background: none;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
}

/* Footer Styles */
.chat-footer {
    padding: 0.5rem;
    border-top: 1px solid #e5e7eb;
    background-color: #ffffff;
}

#send-button {
    padding: 0.5rem 1rem;
    color: rgb(43 43 43/1);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    background-color: rgb(235 235 235/1);
}

#send-button svg {
    width: 1.25rem;
    height: 1.25rem;
}

#send-button:disabled {
    opacity: 0.5;
}

.footer-links {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.75rem;
    color: #6b7280;
}

.footer-links a {
    color: #6b7280;
    text-decoration: none;
}

/* Message Styles */
.message {
    max-width: 90%;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    line-height: 1.5;
    margin-bottom: 0.5rem;
    position: relative;
    scroll-margin-top: 56px;
}

.message-content {
    word-wrap: break-word;
    font-size: 0.875rem;
}

.message-timestamp {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.25rem;
    text-align: right;
}

.message.user-message {
    align-self: flex-end;
    background-color: #3b82f6;
    color: white;
    font-size: 0.875rem;
}

.message.user-message .message-timestamp {
    color: rgba(255, 255, 255, 0.8);
}

.message.bot-message {
    align-self: flex-start;
    background-color: #f3f4f6;
    color: #1f2937;
    font-size: 0.875rem;
}

.message.bot-message .message-timestamp {
    color: rgba(31, 41, 55, 0.7);
}

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

/* Markdown Content Styles */
.markdown-content {
    line-height: 1.5;
}

.markdown-content p {
    margin-bottom: 1em;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

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

.markdown-content ul {
    list-style-type: disc;
}

.markdown-content ol {
    list-style-type: decimal;
}

.markdown-content li {
    margin: 0.5em 0;
}

.markdown-content a {
    color: #2563eb;
    text-decoration: underline;
}

.markdown-content a:hover {
    text-decoration: none;
}

.markdown-content code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: monospace;
}

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

.markdown-content pre code {
    background-color: transparent;
    padding: 0;
}

.markdown-content blockquote {
    border-left: 4px solid #e5e7eb;
    padding-left: 1em;
    margin: 1em 0;
    color: #4b5563;
}

.markdown-content h1, .markdown-content h2, .markdown-content h3,
.markdown-content h4, .markdown-content h5, .markdown-content h6 {
    margin: 1.5em 0 0.5em;
    font-weight: 600;
    line-height: 1.25;
}

.markdown-content h1 { font-size: 2em; }
.markdown-content h2 { font-size: 1.5em; }
.markdown-content h3 { font-size: 1.25em; }
.markdown-content h4 { font-size: 1em; }
.markdown-content h5 { font-size: 0.875em; }
.markdown-content h6 { font-size: 0.85em; }

/* Dark mode styles */
.dark .markdown-content a {
    color: #60a5fa;
}

.dark .markdown-content code {
    background-color: rgba(255, 255, 255, 0.1);
}

.dark .markdown-content pre {
    background-color: rgba(255, 255, 255, 0.1);
}

.dark .markdown-content blockquote {
    border-left-color: #374151;
    color: #9ca3af;
}

/* Message-specific markdown styles */
.user-message .markdown-content a {
    color: #ffffff;
    text-decoration: underline;
}

.user-message .markdown-content code {
    background-color: rgba(255, 255, 255, 0.2);
}

.user-message .markdown-content pre {
    background-color: rgba(255, 255, 255, 0.1);
}

.user-message .markdown-content blockquote {
    border-left-color: rgba(255, 255, 255, 0.3);
    color: rgba(255, 255, 255, 0.8);
}