/* ==================== 🤖 CHATBOT AI ==================== */

/* Floating button */
.chatbot-fab {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6c63ff 0%, #8b7fff 100%);
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(108, 99, 255, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    z-index: 9998;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: white;
}

.chatbot-fab:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 6px 30px rgba(108, 99, 255, 0.6);
}

.chatbot-fab.hidden {
    display: none;
}

/* Badge z liczbą nieprzeczytanych */
.chatbot-fab-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 22px;
    height: 22px;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid var(--bg-dark);
}

/* Chat window */
.chatbot-window {
    position: fixed;
    bottom: 100px;
    right: 25px;
    width: 380px;
    height: 550px;
    max-height: calc(100vh - 130px);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    pointer-events: none;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.chatbot-window.active {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: all;
}

/* Header */
.chatbot-header {
    background: linear-gradient(135deg, #6c63ff 0%, #8b7fff 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-shrink: 0;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbot-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    position: relative;
}

.chatbot-avatar::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 12px;
    height: 12px;
    background: #2ed573;
    border-radius: 50%;
    border: 2px solid white;
}

.chatbot-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
}

.chatbot-subtitle {
    font-size: 0.75rem;
    opacity: 0.85;
    margin: 0;
}

.chatbot-header-actions {
    display: flex;
    gap: 5px;
}

.chatbot-header-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-size: 14px;
}

.chatbot-header-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

/* Messages area */
.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: var(--bg-dark);
}

.chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

/* Message bubbles */
.chatbot-message {
    display: flex;
    gap: 8px;
    max-width: 85%;
    animation: messageSlide 0.3s ease;
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chatbot-message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chatbot-message-avatar {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
}

.chatbot-message.bot .chatbot-message-avatar {
    background: linear-gradient(135deg, #6c63ff, #8b7fff);
    color: white;
}

.chatbot-message.user .chatbot-message-avatar {
    background: var(--bg-hover);
    color: var(--text);
}

.chatbot-message-content {
    padding: 10px 14px;
    border-radius: 14px;
    font-size: 0.9rem;
    line-height: 1.5;
    word-wrap: break-word;
}

.chatbot-message.bot .chatbot-message-content {
    background: var(--bg-card);
    color: var(--text);
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
}

.chatbot-message.user .chatbot-message-content {
    background: linear-gradient(135deg, #6c63ff, #8b7fff);
    color: white;
    border-bottom-right-radius: 4px;
}

/* Markdown w wiadomościach */
.chatbot-message-content strong {
    font-weight: 600;
}

.chatbot-message-content em {
    font-style: italic;
}

.chatbot-message-content code {
    background: rgba(0, 0, 0, 0.2);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 0.85em;
}

.chatbot-message-content pre {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px;
    border-radius: 6px;
    overflow-x: auto;
    margin: 8px 0;
}

.chatbot-message-content ul,
.chatbot-message-content ol {
    margin: 8px 0;
    padding-left: 20px;
}

.chatbot-message-content a {
    color: var(--accent);
    text-decoration: underline;
}

/* Typing indicator */
.chatbot-typing {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: var(--bg-card);
    border-radius: 14px;
    border-bottom-left-radius: 4px;
    border: 1px solid var(--border);
    width: fit-content;
}

.chatbot-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-muted);
    animation: typingBounce 1.4s infinite ease-in-out;
}

.chatbot-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.chatbot-typing-dot:nth-child(2) { animation-delay: -0.16s; }

@keyframes typingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input area */
.chatbot-input-area {
    padding: 15px;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}

.chatbot-input {
    flex: 1;
    background: var(--bg-dark);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 10px 14px;
    color: var(--text);
    font-size: 0.9rem;
    resize: none;
    max-height: 100px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
}

.chatbot-input:focus {
    border-color: var(--primary);
}

.chatbot-send-btn {
    background: linear-gradient(135deg, #6c63ff, #8b7fff);
    border: none;
    color: white;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.chatbot-send-btn:hover:not(:disabled) {
    transform: scale(1.05);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quick suggestions */
.chatbot-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 15px 10px;
    background: var(--bg-card);
}

.chatbot-suggestion {
    background: var(--bg-hover);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.chatbot-suggestion:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* Welcome screen */
.chatbot-welcome {
    text-align: center;
    padding: 30px 20px;
    color: var(--text-muted);
}

.chatbot-welcome-icon {
    font-size: 48px;
    margin-bottom: 15px;
    animation: wave 2s ease-in-out infinite;
}

@keyframes wave {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(15deg); }
    75% { transform: rotate(-15deg); }
}

.chatbot-welcome h3 {
    color: var(--text);
    margin-bottom: 10px;
    font-size: 1.1rem;
}

.chatbot-welcome p {
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 15px;
}

/* Mobile */
@media (max-width: 480px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        right: 10px;
        bottom: 80px;
    }
    
    .chatbot-fab {
        bottom: 15px;
        right: 15px;
        width: 55px;
        height: 55px;
    }
}