@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;600&display=swap');

/* PULSE ANIMATION */
@keyframes pulse-purple {
    0% {
        box-shadow: 0 0 0 0 rgba(118, 75, 162, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(118, 75, 162, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(118, 75, 162, 0);
    }
}

/* TYPING ANIMATION */
@keyframes blink {
    0% {
        opacity: .2;
    }

    20% {
        opacity: 1;
    }

    100% {
        opacity: .2;
    }
}

.typing span {
    animation-name: blink;
    animation-duration: 1.4s;
    animation-iteration-count: infinite;
    animation-fill-mode: both;
}

.typing span:nth-child(2) {
    animation-delay: .2s;
}

.typing span:nth-child(3) {
    animation-delay: .4s;
}

.ai-sales-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 360px;
    height: 550px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 20px;
    z-index: 9999;
    display: none;
    flex-direction: column;
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    transition: opacity 0.3s ease, transform 0.3s ease;
    opacity: 0;
    transform: translateY(20px);
}

.ai-sales-widget.open {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.ai-widget-header {
    background: rgba(255, 255, 255, 0.8);
    color: #333;
    padding: 18px 20px;
    font-weight: 600;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-widget-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: transparent;
    display: flex;
    flex-direction: column;
    gap: 12px;
    scrollbar-width: thin;
}

/* Custom Scrollbar */
.ai-widget-body::-webkit-scrollbar {
    width: 6px;
}

.ai-widget-body::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.ai-widget-footer {
    padding: 15px 20px;
    background: transparent;
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-widget-input {
    flex: 1;
    padding: 12px 15px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background: rgba(255, 255, 255, 0.6);
    border-radius: 25px;
    outline: none;
    font-family: inherit;
    font-size: 14px;
    transition: all 0.2s;
}

.ai-widget-input:focus {
    background: white;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
    border-color: #667eea;
}

.ai-widget-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(118, 75, 162, 0.3);
    transition: transform 0.2s;
}

.ai-widget-btn:hover {
    transform: scale(1.05);
}

.ai-trigger-btn {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 65px;
    height: 65px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(118, 75, 162, 0.4);
    z-index: 9998;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    transition: transform 0.3s;
    animation: pulse-purple 2s infinite;
}

.ai-trigger-btn:hover {
    transform: scale(1.1);
}

.message-bubble {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    line-height: 1.5;
    font-size: 14px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.03);
    user-select: text;
    /* Force selectable text */
    -webkit-user-select: text;
}

.message-user {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.message-ai {
    background: white;
    color: #444;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    position: relative;
    padding-bottom: 25px;
    /* Space for copy button */
}

.wpaic-copy-btn {
    position: absolute;
    bottom: 5px;
    right: 8px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 10px;
    color: #999;
    padding: 2px 5px;
    border-radius: 4px;
    opacity: 0.6;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    gap: 3px;
}

.wpaic-copy-btn:hover {
    opacity: 1;
    background: #f0f0f0;
}

.message-ai.typing span {
    display: inline-block;
    width: 6px;
    height: 6px;
    background: #999;
    border-radius: 50%;
    margin: 0 2px;
}

/* MOBILE RESPONSIVE */
@media (max-width: 480px) {
    .ai-sales-widget {
        bottom: 15px;
        right: 15px;
        left: 15px;
        /* Centrat si cu margini */
        width: auto;
        height: 45vh;
        /* Mult mai mic, sub jumătate de ecran */
        max-height: 400px;
        border-radius: 20px;
        border: 1px solid rgba(255, 255, 255, 0.5);
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    }

    .ai-widget-header {
        border-radius: 20px 20px 0 0;
        padding-top: 20px;
    }

    .ai-trigger-btn {
        bottom: 20px;
        right: 20px;
        width: 60px;
        height: 60px;
    }
}