/**
 * AightBot Frontend Widget Styles
 */

.aightbot-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

/* Toggle Button */
.aightbot-widget-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    color: white;
}

.aightbot-widget-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.aightbot-widget-toggle svg {
    width: 28px;
    height: 28px;
}

/* Chat Window */
.aightbot-widget-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    display: none;
    flex-direction: column;
    overflow: hidden;
}

/* Show widget when open */
.aightbot-widget.aightbot-open .aightbot-widget-window {
    display: flex;
    animation: aightbot-slide-up 0.3s ease;
}

@keyframes aightbot-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.aightbot-widget-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.aightbot-widget-actions {
    display: flex;
    gap: 8px;
}

.aightbot-widget-actions button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    padding: 6px;
    cursor: pointer;
    color: white;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.aightbot-widget-actions button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages Area */
.aightbot-widget-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f9fafb;
    scroll-behavior: smooth;
}

.aightbot-message {
    margin-bottom: 16px;
    animation: aightbot-fade-in 0.3s ease;
}

@keyframes aightbot-fade-in {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

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

.aightbot-user-message .aightbot-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.aightbot-bot-message .aightbot-message-content {
    background: white;
    color: #1f2937;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 4px;
}

/* Markdown formatting in bot messages */
.aightbot-bot-message .aightbot-message-content h1,
.aightbot-bot-message .aightbot-message-content h2,
.aightbot-bot-message .aightbot-message-content h3 {
    margin: 12px 0 8px 0;
    font-weight: 600;
}

.aightbot-bot-message .aightbot-message-content h1 { font-size: 18px; }
.aightbot-bot-message .aightbot-message-content h2 { font-size: 16px; }
.aightbot-bot-message .aightbot-message-content h3 { font-size: 14px; }

.aightbot-bot-message .aightbot-message-content p {
    margin: 8px 0;
}

.aightbot-bot-message .aightbot-message-content ul,
.aightbot-bot-message .aightbot-message-content ol {
    margin: 8px 0;
    padding-left: 24px;
}

.aightbot-bot-message .aightbot-message-content li {
    margin: 4px 0;
}

.aightbot-bot-message .aightbot-message-content code {
    background: #f3f4f6;
    padding: 2px 6px;
    border-radius: 3px;
    font-family: 'Courier New', monospace;
    font-size: 13px;
}

.aightbot-bot-message .aightbot-message-content pre {
    background: #f3f4f6;
    padding: 12px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.aightbot-bot-message .aightbot-message-content pre code {
    background: none;
    padding: 0;
}

.aightbot-bot-message .aightbot-message-content table {
    border-collapse: collapse;
    width: 100%;
    margin: 12px 0;
    font-size: 13px;
}

.aightbot-bot-message .aightbot-message-content table th,
.aightbot-bot-message .aightbot-message-content table td {
    border: 1px solid #d1d5db;
    padding: 8px 12px;
    text-align: left;
}

.aightbot-bot-message .aightbot-message-content table th {
    background: #f3f4f6;
    font-weight: 600;
}

.aightbot-bot-message .aightbot-message-content table tr:nth-child(even) {
    background: #f9fafb;
}

.aightbot-bot-message .aightbot-message-content blockquote {
    border-left: 3px solid #667eea;
    margin: 8px 0;
    padding-left: 12px;
    color: #6b7280;
    font-style: italic;
}

.aightbot-bot-message .aightbot-message-content a {
    color: #667eea;
    text-decoration: none;
}

.aightbot-bot-message .aightbot-message-content a:hover {
    text-decoration: underline;
}

.aightbot-bot-message .aightbot-message-content hr {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 12px 0;
}

.aightbot-bot-message .aightbot-message-content strong {
    font-weight: 600;
}

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

.aightbot-message.aightbot-user-message {
    text-align: right;
}

/* Typing Indicator */
/* Typing Indicator */
.aightbot-typing .aightbot-message-content {
    display: inline-flex;
    gap: 4px;
    padding: 12px 16px;
}

.aightbot-typing .aightbot-message-content span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: aightbot-typing 1.4s infinite;
}

.aightbot-typing .aightbot-message-content span:nth-child(2) {
    animation-delay: 0.2s;
}

.aightbot-typing .aightbot-message-content span:nth-child(3) {
    animation-delay: 0.4s;
}

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

/* Input Area */
.aightbot-widget-input {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.aightbot-widget-input form {
    display: flex;
    gap: 8px;
}

.aightbot-widget-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

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

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

.aightbot-send-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.aightbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Error Message */
.aightbot-error-message {
    background: #fee2e2;
    color: #dc2626;
    padding: 8px 12px;
    border-radius: 6px;
    margin: 12px 20px;
    font-size: 13px;
    text-align: center;
    border: 1px solid #fecaca;
}

/* Scrollbar */
.aightbot-widget-messages::-webkit-scrollbar {
    width: 6px;
}

.aightbot-widget-messages::-webkit-scrollbar-track {
    background: transparent;
}

.aightbot-widget-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.aightbot-widget-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .aightbot-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .aightbot-widget-window {
        width: 100%;
        max-width: 100%;
        bottom: 70px;
        right: 0;
        height: calc(100vh - 100px);
    }
    
    .aightbot-widget-toggle {
        width: 56px;
        height: 56px;
        margin-left: auto;
    }
}
