/* TheChat Widget Styles */

:root {
    --thedock-chatbot-primary: #0073aa;
    --thedock-chatbot-bg: #ffffff;
    --thedock-chatbot-text: #1e1e1e;
    --thedock-chatbot-border: #e0e0e0;
    --thedock-chatbot-shadow: rgba(0, 0, 0, 0.15);
    --thedock-chatbot-user-bg: #0073aa;
    --thedock-chatbot-user-text: #ffffff;
    --thedock-chatbot-bot-bg: #f5f5f5;
    --thedock-chatbot-bot-text: #1e1e1e;
}

#thedock-chatbot-container {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}

#thedock-chatbot-container.thedock-chatbot-bottom-right {
    bottom: 20px;
    right: 20px;
}

#thedock-chatbot-container.thedock-chatbot-bottom-left {
    bottom: 20px;
    left: 20px;
}

#thedock-chatbot-container.thedock-chatbot-top-right {
    top: 20px;
    right: 20px;
}

#thedock-chatbot-container.thedock-chatbot-top-left {
    top: 20px;
    left: 20px;
}

/* Chat Button */
#thedock-chatbot-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#thedock-chatbot-button svg {
    width: 28px;
    height: 28px;
}

/* Chat Window */
.thedock-chatbot-window {
    position: fixed;
    width: 380px;
    height: 600px;
    max-height: calc(100vh - 100px);
    background: var(--thedock-chatbot-bg);
    border-radius: 12px;
    box-shadow: 0 8px 32px var(--thedock-chatbot-shadow);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease-out;
}

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

.thedock-chatbot-bottom-right .thedock-chatbot-window,
.thedock-chatbot-top-right .thedock-chatbot-window {
    right: 20px;
    bottom: 20px;
}

.thedock-chatbot-bottom-left .thedock-chatbot-window,
.thedock-chatbot-top-left .thedock-chatbot-window {
    left: 20px;
    bottom: 20px;
}

/* Header */
.thedock-chatbot-header {
    background: var(--thedock-chatbot-primary);
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.thedock-chatbot-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.thedock-chatbot-header-actions {
    display: flex;
    gap: 8px;
    margin: 0;
    align-items: center;
}

.thedock-chatbot-close,
.thedock-chatbot-new {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s ease;
}

/* Messages */
.thedock-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.thedock-chatbot-message {
    display: flex;
    flex-direction: column;
    max-width: 80%;
    animation: fadeIn 0.3s ease-out;
}

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

.thedock-chatbot-message.user {
    align-self: flex-end;
}

.thedock-chatbot-message.bot {
    align-self: flex-start;
}

.thedock-chatbot-message-bubble {
    padding: 12px 16px;
    border-radius: 16px;
    word-wrap: break-word;
    line-height: 1.5;
    font-size: 14px;
}

.thedock-chatbot-message-bubble p:not([class*=-font-size]) {
    font-size: 14px;
}

.thedock-chatbot-message.user .thedock-chatbot-message-bubble {
    background: var(--thedock-chatbot-user-bg);
    color: var(--thedock-chatbot-user-text);
    border-bottom-right-radius: 4px;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble {
    background: var(--thedock-chatbot-bot-bg);
    color: var(--thedock-chatbot-bot-text);
    border-bottom-left-radius: 4px;
}

.thedock-chatbot-message-time {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
    padding: 0 4px;
}

/* Typing Indicator */
.thedock-chatbot-typing {
    padding: 0 20px 10px;
    display: flex;
    gap: 4px;
}

.thedock-chatbot-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #999;
    animation: typing 1.4s infinite;
}

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

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

@keyframes typing {
    0%, 60%, 100% {
        opacity: 0.3;
        transform: translateY(0);
    }
    30% {
        opacity: 1;
        transform: translateY(-10px);
    }
}

/* Input Area */
.thedock-chatbot-input-container {
    display: flex;
    gap: 8px;
    padding: 16px;
    border-top: 1px solid var(--thedock-chatbot-border);
    background: var(--thedock-chatbot-bg);
}

.thedock-chatbot-input {
    flex: 1;
    border: 1px solid var(--thedock-chatbot-border);
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    max-height: 100px;
    overflow-y: auto;
}

.thedock-chatbot-input:focus {
    outline: none;
    border-color: var(--thedock-chatbot-primary);
}

.thedock-chatbot-send {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0;
    transition: all 0.2s ease;
}

.thedock-chatbot-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Scrollbar Styling */
.thedock-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.thedock-chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.thedock-chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.thedock-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* HTML Content Styling in Bot Messages */
.thedock-chatbot-message.bot .thedock-chatbot-message-bubble a,
.thedock-chatbot-link {
    color: var(--thedock-chatbot-primary);
    text-decoration: underline;
    font-weight: 500;
    transition: opacity 0.2s ease;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble a:hover,
.thedock-chatbot-link:hover {
    opacity: 0.8;
    text-decoration: none;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble strong,
.thedock-chatbot-message.bot .thedock-chatbot-message-bubble b {
    font-weight: 600;
    color: inherit;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble em,
.thedock-chatbot-message.bot .thedock-chatbot-message-bubble i {
    font-style: italic;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble p {
    margin: 0 0 8px 0;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble p:last-child {
    margin-bottom: 0;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble ul,
.thedock-chatbot-message.bot .thedock-chatbot-message-bubble ol {
    margin: 8px 0;
    padding-left: 20px;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble li {
    margin: 4px 0;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble code {
    background: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 0.9em;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble pre {
    background: rgba(0, 0, 0, 0.05);
    padding: 8px 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble pre code {
    background: none;
    padding: 0;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble blockquote {
    border-left: 3px solid var(--thedock-chatbot-primary);
    padding-left: 12px;
    margin: 8px 0;
    font-style: italic;
    opacity: 0.9;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble h3,
.thedock-chatbot-message.bot .thedock-chatbot-message-bubble h4,
.thedock-chatbot-message.bot .thedock-chatbot-message-bubble h5,
.thedock-chatbot-message.bot .thedock-chatbot-message-bubble h6 {
    font-weight: 600;
    margin: 12px 0 8px 0;
    line-height: 1.3;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble h3 {
    font-size: 1.1em;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble h4 {
    font-size: 1.05em;
}

.thedock-chatbot-message.bot .thedock-chatbot-message-bubble h5,
.thedock-chatbot-message.bot .thedock-chatbot-message-bubble h6 {
    font-size: 1em;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .thedock-chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 100px);
        max-height: calc(100vh - 100px);
    }

    #thedock-chatbot-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .thedock-chatbot-button {
        width: 56px;
        height: 56px;
    }
}
