/**
 * AI Chat Widget - Frontend Styles
 * 
 * Шлях: /plugins/gs_ai_chat/assets/chat-widget.css
 * Остання модифікація: 2026-04-12
 * Author: ambitiv.com
 */

/* Кнопка чату */
.ai-chat-button {
    position: fixed;
    z-index: 9998;
    width: 60px;
    height: 60px;
    color: white;
    cursor: pointer;
    box-shadow: rgba(0, 0, 0, 0.15) 0px 4px 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background-color: var(--chat-button-color, #667eea);
    background-image: none; /* Важливо! Прибираємо градієнт */
    border: none;
    transition: all 0.3s ease;
}

.ai-chat-button:hover {
    transform: scale(1.05);
    box-shadow: rgba(0, 0, 0, 0.2) 0px 6px 16px;
}
.ai-chat-button.position-bottom {
    bottom: 150px;
}

.ai-chat-button.position-top {
    top: 20px;
}

.ai-chat-button.position-right {
    right: 20px;
}

.ai-chat-button.position-left {
    left: 20px;
}

.ai-chat-button-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-button-icon svg {
    width: 28px;
    height: 28px;
}

.ai-chat-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: bold;
}

/* Вікно чату */
.ai-chat-widget {
    position: fixed;
    z-index: 9999;
    width: 380px;
    height: 600px;
    bottom: 20px; 
    display: none;
    flex-direction: column;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    transition: all 0.3s ease;
}
/* Заголовок */
.ai-chat-header {
    background: var(--chat-header-color, #667eea) !important;
    background-color: var(--chat-header-color, #667eea) !important;
    background-image: none !important;
    color: #ffffff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}


.ai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.ai-chat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-icon svg {
    width: 24px;
    height: 24px;
    fill: white;
}

.ai-chat-header-text h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.3;
}

.ai-chat-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    opacity: 0.9;
}

.ai-chat-status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #22c55e;
    animation: pulse 1.5s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
}

@keyframes pulse {
    0% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.7);
    }
    50% { 
        transform: scale(1.1);
        box-shadow: 0 0 0 6px rgba(34, 197, 94, 0);
    }
    100% { 
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.ai-chat-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}

.ai-chat-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Область повідомлень */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--chat-bg-color, #f8f9fa) !important;
    background-color: var(--chat-bg-color, #f8f9fa) !important;
    background-image: none !important;
}

.ai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.ai-chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 3px;
}

.ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

.ai-chat-message {
    margin-bottom: 16px;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chat-message-user {
    align-items: flex-end;
}

.ai-chat-message-assistant {
    align-items: flex-start;
}

.ai-chat-message-assistant {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 12px;
}

.ai-chat-message-assistant .ai-chat-message-avatar {
    flex-shrink: 0;
    margin-top: 2px;
}

.ai-chat-message-assistant .ai-chat-message-content {
    background: #ffffff;
    color: #333;
    padding: 10px 14px;
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ai-chat-message-user {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 12px;
}

.ai-chat-message-user .ai-chat-message-content {
    background: #667eea;
    color: #ffffff;
    padding: 10px 14px;
    border-radius: 18px 18px 4px 18px;
}

/* Область повідомлень */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--chat-bg-color, #f8f9fa) !important;
    background-color: var(--chat-bg-color, #f8f9fa) !important;
    background-image: none !important;
}

.ai-chat-message-content {
    padding: 10px 14px; 
    border-radius: 18px;
    max-width: 100%;
    word-wrap: break-word;
}

/* Повідомлення користувача */
.ai-chat-message-user .ai-chat-message-content {
    background: var(--user-message-color, #667eea) !important;
    background-color: var(--user-message-color, #667eea) !important;
    background-image: none !important;
    color: var(--user-text-color, #ffffff) !important;
    border-radius: 18px 18px 4px 18px;
}

/* Повідомлення бота */
.ai-chat-message-assistant .ai-chat-message-content {
    background: var(--bot-message-color, #ffffff) !important;
    background-color: var(--bot-message-color, #ffffff) !important;
    background-image: none !important;
    color: var(--bot-text-color, #2d3748) !important;
    border-radius: 18px 18px 18px 4px;
    box-shadow: rgba(0, 0, 0, 0.08) 0px 2px 8px;
}

.ai-chat-message-content a {
    color: inherit;
    text-decoration: underline;
}

.ai-chat-message-time {
    font-size: 11px;
    color: #a0aec0;
    margin-top: 4px;
    padding: 0 4px;
}



/* Індикатор набору */
.ai-chat-typing {
    display: none;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    width: fit-content;
    margin: 0 0 16px 0;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.ai-chat-typing strong {
    font-size: 13px;
    color: #64748b;
    font-weight: 500;
    margin-right: 4px;
}

.ai-chat-typing .dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #cbd5e0;
    margin: 0 2px;
    animation: typing 1.4s ease-in-out infinite;
}

.ai-chat-typing .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.ai-chat-typing .dot:nth-child(3) {
    animation-delay: 0.4s;
}

.ai-chat-typing .dot:nth-child(4) {
    animation-delay: 0.6s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-6px);
        opacity: 1;
    }
}

/* Форма контактів */
.ai-chat-contact-form {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    backdrop-filter: blur(2px);
}

.ai-chat-contact-form-content {
    background: white;
    padding: 30px;
    border-radius: 12px;
    width: 90%;
    max-width: 320px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.ai-chat-contact-form-content h4 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #2d3748;
}

.ai-chat-contact-form-content p {
    margin: 0 0 20px 0;
    font-size: 14px;
    color: #718096;
}

.ai-chat-contact-form-content input {
    width: 100%;
    padding: 12px;
    margin-bottom: 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    box-sizing: border-box;
    transition: border-color 0.2s;
}

.ai-chat-contact-form-content input:focus {
    outline: none;
    border-color: #667eea;
}

.ai-chat-contact-buttons {
    display: flex;
    gap: 10px;
    margin-top: 20px;
}

/* Швидкі дії */
.ai-chat-quick-actions {
    padding: 10px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e2e8f0;
}

.ai-chat-quick-btn {
    width: 100%;
    padding: 10px 16px;
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #2d3748;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.ai-chat-quick-btn:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.ai-chat-quick-btn svg {
    flex-shrink: 0;
}

/* Поле вводу */
.ai-chat-input-wrapper {
    flex-shrink: 0;
    background: white;
    border-top: 1px solid #e2e8f0;
}

.ai-chat-input-container {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    padding: 16px 20px;
}

/* Поле вводу */
.ai-chat-input {
    flex: 1;
    resize: none;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    font-family: inherit;
    line-height: 1.5;
    max-height: 120px;
    overflow-y: auto;
    transition: border-color 0.2s;
    
    /* Ховаємо scrollbar */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE/Edge */
}

/* Ховаємо scrollbar для Chrome/Safari/Opera */
.ai-chat-input::-webkit-scrollbar {
    display: none;
}

.ai-chat-input:focus {
    outline: none;
    border-color: #667eea;
}





/* Кнопка відправки */
.ai-chat-send {
    background: var(--send-button-color, #667eea) !important;
    background-color: var(--send-button-color, #667eea) !important;
    background-image: none !important;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 13px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ai-chat-send:hover:not(:disabled) {
    opacity: 0.9;
    transform: scale(1.05);
}

.ai-chat-send:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Футер */
.ai-chat-footer {
	display:none;
    padding: 12px 20px;
    text-align: center;
    background: #f8f9fa;
    border-top: 1px solid #e2e8f0;
    flex-shrink: 0;
}

.ai-chat-powered {
    font-size: 11px;
    color: #a0aec0;
}

/* Кнопки */
.ai-chat-btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    flex: 1;
}

.ai-chat-btn-primary {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.ai-chat-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-chat-btn-secondary {
    background: white;
    color: #718096;
    border: 1px solid #e2e8f0;
}

.ai-chat-btn-secondary:hover {
    background: #f7fafc;
}

/* Адаптивність */
@media (max-width: 480px) {
    .ai-chat-widget {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        max-height: 100vh;
    }
    
    .ai-chat-button {
        bottom: 15px;
        right: 15px;
    }
    
    .ai-chat-message-content {
        max-width: 85%;
    }
}

@media (max-width: 768px) and (min-width: 481px) {
    .ai-chat-widget {
        width: 90%;
        max-width: 380px;
        height: 80vh;
        max-height: 600px;
    }
}

/* Анімація появи віджету */
@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chat-widget[style*="display: flex"] {
    animation: slideUp 0.3s ease;
}

/* Перебиваємо всі можливі стилі кнопки */
#ai-chat-button {
    background: var(--chat-button-color, #667eea) !important;
    background-color: var(--chat-button-color, #667eea) !important;
    background-image: none !important;
}

/* Якщо і це не спрацює - максимальна специфічність */
html body #ai-chat-button#ai-chat-button {
    background: var(--chat-button-color, #667eea) !important;
    background-color: var(--chat-button-color, #667eea) !important;
    background-image: none !important;
}


/* ============================================
   МОБІЛЬНА ВЕРСІЯ
   ============================================ */

@media (max-width: 768px) {
    /* Віджет на весь екран на мобільних */
    .ai-chat-widget {
        width: 100% !important;
        height: 100% !important;
        max-height: 100vh !important;
        max-height: 100dvh !important; /* Dynamic viewport height для iOS */
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        border-radius: 0 !important;
    }
    
    /* Шапка чату */
    .ai-chat-header {
        padding: 12px 16px;
    }
    
    /* Область повідомлень - фіксована висота */
    .ai-chat-messages {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling iOS */
        padding: 16px;
        /* iOS Safari fix - запобігає зсуву при появі клавіатури */
        max-height: calc(100vh - 140px);
        max-height: calc(100dvh - 140px);
    }
    
    /* Форма вводу - фіксована внизу */
    .ai-chat-input-wrapper {
        padding: 12px 16px;
        background: #fff;
        border-top: 1px solid #e5e7eb;
        /* КРИТИЧНО: фіксуємо внизу */
        position: sticky;
        bottom: 0;
        z-index: 10;
    }
    
   /* Контейнер - вирівнювання по низу */
    .ai-chat-input-container {
        display: flex !important;
        align-items: flex-end !important;
        gap: 10px;
        padding: 12px 16px;
    }
    
    /* Поле вводу - фіксована початкова висота */
    .ai-chat-input {
        font-size: 16px !important;
        padding: 10px 14px !important; /* зменшив padding */
        max-height: 100px;
        min-height: 44px !important;
        height: 44px !important; /* <-- ДОДАЙ фіксовану висоту */
        line-height: 1.4 !important;
        box-sizing: border-box !important;
    }
    
    /* Кнопка відправки */
    .ai-chat-send {
        width: 46px !important;
        height: 44px !important;
        min-width: 44px !important;
        min-height: 44px !important;
        padding: 0 !important;
        border-radius: 8px !important;
        flex-shrink: 0;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
    
    .ai-chat-send svg {
        margin: 0 !important;
        display: block !important;
    }
    
    /* Кнопка чату */
    .ai-chat-button {
        bottom: 16px !important;
        right: 16px !important;
    }
}

/* ============================================
   iOS СПЕЦІАЛЬНІ ФІКСИ
   ============================================ */

/* Запобігаємо зуму при фокусі на iPhone */
@supports (-webkit-touch-callout: none) {
    .ai-chat-input {
        font-size: 16px !important;
    }
}

/* Фікс для iOS клавіатури */
.ai-chat-widget.keyboard-open {
    height: 100vh !important;
    height: 100dvh !important;
}

/* Прибираємо bounce effect на iOS */
.ai-chat-messages {
    overscroll-behavior: contain;
}

/* Прибираємо виділення при натисканні на iOS */
.ai-chat-widget * {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Дозволяємо виділення тексту в повідомленнях */
.ai-chat-message-content {
    -webkit-user-select: text;
    user-select: text;
}

/* Дозволяємо ввід тексту */
.ai-chat-input {
    -webkit-user-select: text;
    user-select: text;
}


/* =============================================
   СТРУКТУРА ПОВІДОМЛЕНЬ (як у Viber)
   ============================================= */

/* Повідомлення оператора */
.ai-chat-message-assistant {
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    margin-bottom: 16px;
    gap: 10px;
}

.ai-chat-msg-avatar-wrap {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
}

.ai-chat-msg-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

.ai-chat-msg-avatar-placeholder {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--chat-header-color, #667eea) 0%, #764ba2 100%);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.ai-chat-msg-body {
    flex: 1;
    min-width: 0;
    max-width: calc(100% - 50px);
}

.ai-chat-msg-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--chat-header-color, #667eea);
    margin-bottom: 4px;
    padding-left: 2px;
}

/* Контент повідомлення оператора */
.ai-chat-message-assistant .ai-chat-message-content {
    position: relative;
    background: var(--bot-message-color, #ffffff);
    color: var(--bot-text-color, #333333);
    padding: 10px 14px;
    padding-bottom: 22px;
    border-radius: 4px 18px 18px 18px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    display: inline-block;
    max-width: 85%;
    word-wrap: break-word;
}

.ai-chat-msg-text {
    line-height: 1.4;
}

/* Час повідомлення - внизу справа як у Viber */
.ai-chat-message-content .ai-chat-msg-time {
    position: absolute;
    bottom: 6px;
    right: 12px;
    font-size: 10px;
    color: #999;
    opacity: 0.8;
}

/* ===== ПОВІДОМЛЕННЯ КОРИСТУВАЧА ===== */
.ai-chat-message-user {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}

.ai-chat-message-user .ai-chat-msg-body-user {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    max-width: 80%;
}

.ai-chat-message-user .ai-chat-message-content {
    position: relative;
    background: var(--user-message-color, #667eea);
    color: var(--user-text-color, #ffffff);
    padding: 10px 14px;
    padding-bottom: 22px;
    border-radius: 18px 18px 4px 18px;
    display: inline-block;
    max-width: 100%;
    word-wrap: break-word;
}

.ai-chat-message-user .ai-chat-msg-time {
    color: rgba(255, 255, 255, 0.7);
}

/* ===== МОБІЛЬНА АДАПТАЦІЯ ===== */
@media (max-width: 480px) {
    .ai-chat-msg-avatar-wrap {
        width: 32px;
        height: 32px;
    }
    
    .ai-chat-msg-avatar,
    .ai-chat-msg-avatar-placeholder {
        width: 32px;
        height: 32px;
        font-size: 14px;
    }
    
    .ai-chat-msg-name {
        font-size: 12px;
    }
    
    .ai-chat-msg-body {
        max-width: calc(100% - 42px);
    }
    
    .ai-chat-message-assistant .ai-chat-message-content {
        max-width: 90%;
    }
    
    .ai-chat-message-user .ai-chat-msg-body-user {
        max-width: 90%;
    }
    
    .ai-chat-message-content {
        padding: 8px 12px;
        padding-bottom: 20px;
    }
}
























/* ===================================
   QUICK REPLIES (Варіанти відповідей)
   =================================== */

.ai-chat-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 16px;
    margin-top: -8px;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ai-chat-quick-reply-btn {
    background: #ffffff;
    border: 1.5px solid #e2e8f0;
    border-radius: 20px;
    padding: 8px 16px;
    font-size: 14px;
    color: #334155;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ai-chat-quick-reply-btn:hover {
    background: #f1f5f9;
    border-color: #cbd5e1;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.ai-chat-quick-reply-btn:active {
    transform: translateY(0);
    background: #e2e8f0;
}

/* Іконка в кнопці (опціонально) */
.ai-chat-quick-reply-btn .qr-icon {
    font-size: 16px;
}

/* Темна тема для кнопок (якщо потрібно) */
.ai-chat-widget.dark-theme .ai-chat-quick-reply-btn {
    background: #1e293b;
    border-color: #334155;
    color: #e2e8f0;
}

.ai-chat-widget.dark-theme .ai-chat-quick-reply-btn:hover {
    background: #334155;
    border-color: #475569;
}
















/* ===================================
   WELCOME BUBBLE (Привітальна бульбашка)
   =================================== */

.ai-chat-welcome-bubble {
    position: fixed;
    bottom: 90px;
    right: 24px;
    z-index: 999998;
    opacity: 0;
    transform: translateY(20px) scale(0.9);
    transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: none;
    max-width: 280px;
}

.ai-chat-welcome-bubble-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

.ai-chat-welcome-bubble-hiding {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

.ai-chat-welcome-bubble-content {
    background: #ffffff;
    border-radius: 16px 16px 4px 16px;
    padding: 14px 40px 14px 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.12), 0 1px 4px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    position: relative;
    transition: box-shadow 0.2s ease;
}

.ai-chat-welcome-bubble-content:hover {
    box-shadow: 0 6px 32px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.1);
}

.ai-chat-welcome-bubble-text {
    font-size: 14px;
    line-height: 1.4;
    color: #1a1a2e;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.ai-chat-welcome-bubble-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: #f1f5f9;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #94a3b8;
    padding: 0;
    transition: all 0.2s ease;
}

.ai-chat-welcome-bubble-close:hover {
    background: #e2e8f0;
    color: #64748b;
}

.ai-chat-welcome-bubble-tail {
    position: absolute;
    bottom: -6px;
    right: 24px;
    width: 16px;
    height: 12px;
    overflow: hidden;
}

.ai-chat-welcome-bubble-tail::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: #ffffff;
    transform: rotate(45deg);
    top: -10px;
    left: 0;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.06);
}

/* Позиція для bottom-left */
.ai-chat-button.position-bottom-left ~ .ai-chat-welcome-bubble,
.ai-chat-welcome-bubble.position-left {
    right: auto;
    left: 24px;
}

.ai-chat-welcome-bubble.position-left .ai-chat-welcome-bubble-content {
    border-radius: 16px 16px 16px 4px;
}

.ai-chat-welcome-bubble.position-left .ai-chat-welcome-bubble-tail {
    right: auto;
    left: 24px;
}

/* Мобільна версія */
@media (max-width: 480px) {
    .ai-chat-welcome-bubble {
        right: 16px;
        left: 16px;
        max-width: none;
        bottom: 80px;
    }
}















/* ===================================
   NOTIFICATION BADGE
   =================================== */

.ai-chat-notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: badgePulse 2s ease-in-out infinite;
}

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}


















/* ===================================
   BUBBLE STACK (стопка бульбашок)
   =================================== */

.ai-chat-bubble-stack {
    position: fixed;
    bottom: 90px;
    right: 24px;
    z-index: 999998;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 280px;
}

.ai-chat-bubble-stack .ai-chat-stack-bubble {
    position: relative;
    bottom: auto;
    right: auto;
    max-width: none;
}

.ai-chat-bubble-stack .ai-chat-welcome-bubble-tail {
    display: none;
}

/* Тільки остання бульбашка має хвостик */
.ai-chat-bubble-stack .ai-chat-stack-bubble:last-child .ai-chat-welcome-bubble-tail {
    display: block;
}

.ai-chat-bubble-stack.ai-chat-welcome-bubble-hiding {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Мобільна версія */
@media (max-width: 480px) {
    .ai-chat-bubble-stack {
        right: 16px;
        left: 16px;
        max-width: none;
        bottom: 80px;
    }
}















/* ===================================
   LINKS IN MESSAGES
   =================================== */

.ai-chat-message a.ai-chat-link {
    color: #2563eb;
    text-decoration: none;
    border-bottom: 1px dashed #2563eb;
    word-break: break-all;
    transition: color 0.2s;
}

.ai-chat-message a.ai-chat-link:hover {
    color: #1d4ed8;
    border-bottom-style: solid;
}

.ai-chat-message.assistant a.ai-chat-link {
    color: #2563eb;
}

.ai-chat-message.user a.ai-chat-link {
    color: #fff;
    border-bottom-color: rgba(255,255,255,0.6);
}