/* Celsian Chatbot Widget - Default Theme */

/* Container positioning */
.celsian-position-bottom-right {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
}

.celsian-position-bottom-left {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 9999;
}

.celsian-position-top-right {
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 9999;
}

.celsian-position-top-left {
    position: fixed;
    top: 80px;
    left: 20px;
    z-index: 9999;
}

/* Chat widget container */
.celsian-chat-widget,
.celsian-chat-widget *,
.celsian-chat-widget *::before,
.celsian-chat-widget *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

.celsian-chat-widget {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    max-width: 350px;
    position: relative;
}

/* Screen reader only */
.celsian-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Chat icon (floating button) */
.celsian-chat-icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    border: none;
}

.celsian-chat-icon:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.celsian-chat-icon svg {
    width: 30px;
    height: 30px;
    fill: white;
}

/* Chat window */
.celsian-chat-window {
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e5e9;
    position: absolute;
    bottom: 0;
    right: 0;
}

.celsian-position-bottom-left .celsian-chat-window,
.celsian-position-top-left .celsian-chat-window {
    right: auto;
    left: 0;
}

.celsian-position-top-right .celsian-chat-window,
.celsian-position-top-left .celsian-chat-window {
    bottom: auto;
    top: 0;
}

/* Header */
.celsian-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 10px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
    flex-shrink: 0;
}

.celsian-chat-title {
    font-weight: 600;
    font-size: 16px;
}

.celsian-header-actions {
    display: flex;
    gap: 8px;
}

.celsian-close-chat {
    width: 28px;
    height: 28px;
    border: none;
    border-radius: 50%;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    outline: none;
}

.celsian-close-chat:hover,
.celsian-close-chat:focus-visible {
    background: rgba(255, 255, 255, 0.15);
}

.celsian-close-chat svg {
    width: 16px;
    height: 16px;
    fill: rgba(255, 255, 255, 0.7);
}

/* Messages area */
.celsian-chat-messages {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: #f8f9fa;
}

.celsian-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
}

.celsian-bot-message {
    background: white;
    color: #2d3748;
    align-self: flex-start;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    border: 1px solid #e2e8f0;
}

.celsian-user-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    box-shadow: 0 1px 2px rgba(102, 126, 234, 0.3);
}

/* Markdown styles in bot messages */
.celsian-bot-message strong {
    font-weight: 600;
}

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

.celsian-bot-message .celsian-inline-code {
    background: #f1f5f9;
    padding: 1px 5px;
    border-radius: 3px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 0.9em;
}

.celsian-bot-message .celsian-link {
    color: #667eea;
    text-decoration: underline;
}

.celsian-bot-message .celsian-link:hover {
    color: #764ba2;
}

.celsian-bot-message .celsian-md-list {
    margin: 4px 0;
    padding-left: 20px;
}

.celsian-bot-message .celsian-md-list li {
    margin: 2px 0;
}

/* Typing indicator */
.celsian-typing {
    background: white !important;
    color: #718096 !important;
    font-style: italic;
}

.celsian-dots {
    display: inline-block;
}

.celsian-dots span {
    animation: typing 1.4s infinite;
    animation-fill-mode: both;
}

.celsian-dots span:nth-child(1) { animation-delay: 0.2s; }
.celsian-dots span:nth-child(2) { animation-delay: 0.4s; }
.celsian-dots span:nth-child(3) { animation-delay: 0.6s; }

@keyframes typing {
    0%, 60%, 100% { opacity: 0.3; }
    30% { opacity: 1; }
}

/* Input area */
.celsian-chat-input {
    display: flex;
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    gap: 8px;
    flex-shrink: 0;
    align-items: center;
}

.celsian-message-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    resize: none;
    font-family: inherit;
}

.celsian-message-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.celsian-message-input:disabled {
    background: #f7fafc;
    color: #a0aec0;
}

.celsian-send-button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.celsian-send-button:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.celsian-send-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.celsian-send-button svg {
    width: 20px;
    height: 20px;
    fill: white;
}

/* Footer */
.celsian-chat-footer {
    padding: 6px 16px;
    background: #f8f9fa;
    text-align: center;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.celsian-branding-link {
    color: #718096;
    font-size: 11px;
    text-decoration: none;
    transition: color 0.2s ease;
}

.celsian-branding-link:hover {
    color: #667eea;
}

/* Mobile responsiveness */
@media (max-width: 480px) {
    .celsian-chat-window {
        width: 95vw;
        height: 80vh;
        max-width: none;
        position: fixed !important;
        bottom: 10px !important;
        right: 2.5vw !important;
        left: 2.5vw !important;
    }
    
    .celsian-position-bottom-right,
    .celsian-position-bottom-left {
        bottom: 10px;
    }
    .celsian-position-top-right,
    .celsian-position-top-left {
        top: 10px;
    }
    .celsian-position-bottom-right,
    .celsian-position-top-right {
        right: 10px;
    }
    .celsian-position-bottom-left,
    .celsian-position-top-left {
        left: 10px;
    }
    
    .celsian-chat-icon {
        width: 56px;
        height: 56px;
    }
    
    .celsian-chat-icon svg {
        width: 26px;
        height: 26px;
    }
}

/* Scrollbar styling */
.celsian-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.celsian-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.celsian-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.celsian-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}