/* Base styles */
.digifor-chatbot {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    position: fixed;
    z-index: 9999;
    bottom: 20px;
}

.digifor-chatbot[data-position="bottom-right"] {
    right: 20px;
}

.digifor-chatbot[data-position="bottom-left"] {
    left: 20px;
}

/* Chat bubble button */
.digifor-chat-bubble {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4800ae 0%, #6200ee 100%);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(72, 0, 174, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s, box-shadow 0.2s;
}

.digifor-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(72, 0, 174, 0.4);
}

.digifor-chat-bubble svg {
    width: 24px;
    height: 24px;
}

/* Chat window */
.digifor-chat-window {
    display: none;
    width: 380px;
    height: 600px;
    max-height: 80vh;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    flex-direction: column;
    overflow: hidden;
}

.digifor-chat-window.open {
    display: flex;
}

/* Header */
.digifor-chat-header {
    background: linear-gradient(135deg, #4800ae 0%, #6200ee 100%);
    color: white;
    padding: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.digifor-chat-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.digifor-chat-avatar {
    width: 32px;
    height: 32px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 14px;
}

.digifor-chat-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0;
}

.digifor-chat-subtitle {
    font-size: 12px;
    opacity: 0.9;
    margin: 0;
}

.digifor-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 4px;
    opacity: 0.8;
    transition: opacity 0.2s;
    width: 30px;
    height: 30px;
}

.digifor-chat-close:hover {
    opacity: 1;
}

/* Messages container */
.digifor-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: linear-gradient(to bottom, #f5f5f5 0%, white 100%);
}

/* Welcome screen */
.digifor-chat-welcome {
    text-align: center;
    padding: 32px 16px;
}

.digifor-chat-welcome-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #4800ae 0%, #6200ee 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 20px;
    margin: 0 auto 16px;
    box-shadow: 0 4px 12px rgba(72, 0, 174, 0.3);
}

.digifor-chat-welcome h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px 0;
}

.digifor-chat-welcome p {
    font-size: 12px;
    color: #666;
    margin: 0 0 24px 0;
}

/* FAQ buttons */
.digifor-chat-faq {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.digifor-faq-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: white;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.digifor-faq-button:hover {
    border-color: #4800ae;
    box-shadow: 0 2px 8px rgba(72, 0, 174, 0.1);
}

.digifor-faq-icon {
    width: 32px;
    height: 32px;
    background: rgba(72, 0, 174, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4800ae;
    flex-shrink: 0;
}

.digifor-faq-icon svg {
    width: 16px;
    height: 16px;
}

.digifor-faq-text {
    font-size: 12px;
    font-weight: 500;
    color: #1a1a1a;
}

/* Message bubbles */
.digifor-message {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.digifor-message.user {
    flex-direction: row-reverse;
}

.digifor-message-avatar {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    flex-shrink: 0;
}

.digifor-message.assistant .digifor-message-avatar {
    background: linear-gradient(135deg, #4800ae 0%, #6200ee 100%);
    color: white;
}

.digifor-message.user .digifor-message-avatar {
    background: #e5e5e5;
    color: #666;
}

.digifor-message-content {
    max-width: 75%;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.5;
}

.digifor-message.assistant .digifor-message-content {
    background: white;
    color: #1a1a1a;
    border: 1px solid #e5e5e5;
}

.digifor-message.user .digifor-message-content {
    background: linear-gradient(135deg, #4800ae 0%, #6200ee 100%);
    color: white;
}

/* Loading indicator */
.digifor-message-loading {
    display: flex;
    gap: 4px;
    padding: 10px 12px;
}

.digifor-loading-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: digifor-bounce 1.4s infinite ease-in-out both;
}

.digifor-loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.digifor-loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes digifor-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Input area */
.digifor-chat-input {
    padding: 12px;
    background: white;
    border-top: 1px solid #e5e5e5;
}

.digifor-input-wrapper {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 8px;
    background: #f5f5f5;
    border: 1px solid #e5e5e5;
    border-radius: 8px;
    transition: all 0.2s;
}

.digifor-input-wrapper:focus-within {
    border-color: #4800ae;
    box-shadow: 0 0 0 3px rgba(72, 0, 174, 0.1);
}

.digifor-chat-input input {
    flex: 1;
    border: none;
    background: transparent;
    outline: none;
    font-size: 12px;
    color: #1a1a1a;
}

.digifor-chat-input input::placeholder {
    color: #999;
}

.digifor-send-button {
    background: linear-gradient(135deg, #4800ae 0%, #6200ee 100%);
    border: none;
    color: white;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.digifor-send-button:hover:not(:disabled) {
    background: linear-gradient(135deg, #3a008a 0%, #4800ae 100%);
    box-shadow: 0 2px 8px rgba(72, 0, 174, 0.3);
}

.digifor-send-button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.digifor-send-button svg {
    width: 14px;
    height: 14px;
}

/* Scrollbar styling */
.digifor-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.digifor-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.digifor-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.digifor-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Loading dots animation */
.digifor-loading-dots {
    display: flex;
    gap: 4px;
    padding: 10px 12px;
}

.digifor-loading-dot {
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    animation: digifor-bounce 1.4s infinite ease-in-out both;
}

.digifor-loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.digifor-loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes digifor-bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Welcome screen hidden state */
.digifor-chat-welcome[style*="display: none"] {
    display: none !important;
}

/* Markdown Content Styling */
.digifor-message-content {
    line-height: 1.6;
}

.digifor-message-content p {
    margin: 0 0 12px 0;
}

.digifor-message-content p:last-child {
    margin-bottom: 0;
}

.digifor-message-content h1,
.digifor-message-content h2,
.digifor-message-content h3 {
    margin: 16px 0 8px 0;
    font-weight: 600;
    line-height: 1.3;
}

.digifor-message-content h1 {
    font-size: 1.5em;
}

.digifor-message-content h2 {
    font-size: 1.3em;
}

.digifor-message-content h3 {
    font-size: 1.1em;
}

.digifor-message-content ul,
.digifor-message-content ol {
    margin: 8px 0 12px 0;
    padding-left: 24px;
}

.digifor-message-content li {
    margin-bottom: 4px;
}

.digifor-message-content code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Monaco', 'Menlo', 'Consolas', 'Courier New', monospace;
    font-size: 0.9em;
}

.digifor-message-content pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0 12px 0;
}

.digifor-message-content pre code {
    background: none;
    padding: 0;
}

.digifor-message-content a {
    color: #0066cc;
    text-decoration: none;
}

.digifor-message-content a:hover {
    text-decoration: underline;
}

.digifor-message-content blockquote {
    border-left: 3px solid rgba(0, 0, 0, 0.1);
    padding-left: 12px;
    margin: 8px 0 12px 0;
    color: #666;
    font-style: italic;
}

.digifor-message-content strong {
    font-weight: 600;
}

.digifor-message-content em {
    font-style: italic;
}

.digifor-message-content hr {
    border: none;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    margin: 16px 0;
}

/* Dark mode adjustments für Assistant Messages */
.digifor-message.assistant code,
.digifor-message.assistant pre {
    background: rgba(255, 255, 255, 0.1);
}

.digifor-message.assistant blockquote {
    border-left-color: rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.8);
}