﻿/* Chat Widget Styles */

.chat-widget-trigger {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.3);
    transition: all 0.3s ease;
    z-index: 1000 !important;
    /* Lägg till dessa för att undvika konflikter */
    margin: 0 !important;
    padding: 0 !important;
    transform: none !important;
    left: auto !important;
    top: auto !important;
}

    .chat-widget-trigger:hover {
        transform: scale(1.1);
        box-shadow: 0 6px 25px rgba(99, 102, 241, 0.4);
    }

.widget-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
}

.chat-widget-modal {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 350px; /* Minska från 380px */
    height: 450px; /* Minska från 500px */
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    z-index: 9999;
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.1);
}

    .chat-widget-modal.show {
        display: flex;
        animation: slideInUp 0.3s ease;
    }

    .chat-widget-modal.minimized {
        height: 60px;
    }

        .chat-widget-modal.minimized .chat-widget-body {
            display: none;
        }

@keyframes slideInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-widget-header {
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: white;
    padding: 12px 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

.widget-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.widget-avatar {
    width: 35px;
    height: 35px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.widget-header-info h6 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
}

.widget-header-info small {
    font-size: 11px;
    opacity: 0.9;
}

.widget-header-actions {
    display: flex;
    gap: 5px;
}

.btn-widget-action {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
}

    .btn-widget-action:hover {
        background: rgba(255, 255, 255, 0.3);
    }

.chat-widget-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Viktigt för flex-containers */
    overflow: hidden; /* Förhindra overflow-problem */
    height: 380px;
}

.widget-conversation-area {
    flex: 1 1 auto; /* Tillåt att växa och krympa */
    overflow-y: auto;
    padding: 12px;
    background: #fafafa;
    min-height: 0; /* Viktigt för flex-item */
}

.widget-bot-message, .widget-user-message {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

.widget-user-message {
    flex-direction: row-reverse;
}

.widget-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
}

    .widget-avatar-small img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

.widget-message-content {
    background: white;
    padding: 8px 10px; /* Minska från 12px */
    border-radius: 10px; /* Minska från 12px */
    max-width: 220px; /* Minska från 250px */
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.widget-user-message .widget-message-content {
    background: #6366f1;
    color: white;
}

.widget-message-content p {
    margin: 0;
    font-size: 13px; /* Minska från 14px */
    line-height: 1.4;
}

.widget-quick-actions {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.widget-quick-btn {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    padding: 4px 8px; /* Minska från 6px 10px */
    border-radius: 6px;
    font-size: 11px; /* Minska från 12px */
    cursor: pointer;
    transition: all 0.2s ease;
    text-align: left;
}

    .widget-quick-btn:hover {
        background: #6366f1;
        color: white;
        border-color: #6366f1;
    }

.widget-input-area {
    flex: 0 0 auto; /* Förhindra växande/krympande */
    padding: 8px 12px;
    background: white;
    border-top: 1px solid #e5e7eb;
    /* Ta bort eventuell min-height som kan orsaka extra space */
    min-height: auto;
    height: auto;
}

.widget-input-container {
    display: flex;
    gap: 6px;
    align-items: center;
    /* Ta bort min-height som kan orsaka extra space */
    height: 36px; /* Fast höjd istället för min-height */
}

#widgetInput {
    flex: 1;
    border: 1px solid #d1d5db;
    border-radius: 18px; /* Minska från 20px */
    padding: 6px 10px; /* Minska från 8px 12px */
    font-size: 13px; /* Minska från 14px */
    outline: none;
    height: 32px; /* Fast höjd */
    box-sizing: border-box;
}

.widget-send-btn {
    width: 32px; /* Minska från 36px */
    height: 32px;
    background: #6366f1;
    border: none;
    border-radius: 50%;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    font-size: 14px; /* Lägg till för att kontrollera ikonens storlek */
    flex-shrink: 0; /* Förhindra att knappen krymper */
}

    .widget-send-btn:hover {
        background: #5856eb;
    }

/* Responsive design */
@media (max-width: 768px) {
    .chat-widget-modal {
        bottom: 90px;
        right: 10px;
        left: 10px;
        width: auto;
        height: 400px;
    }

    .chat-widget-trigger {
        bottom: 15px;
        right: 15px;
    }
}
