/*--------------------------------------------------------------
# AI Assistant Chat Popup
--------------------------------------------------------------*/

/* AI Chat Button */
.ai-chat-button {
    position: fixed;
    bottom: 240px;
    right: 20px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #5fcf80 0%, #2eca6a 100%);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(95, 207, 128, 0.4);
    z-index: 9999;
    transition: all 0.3s ease;
    animation: pulse-glow 2s infinite;
}

.ai-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(95, 207, 128, 0.6);
}

.ai-chat-button i {
    font-size: 28px;
    color: white;
}

.ai-chat-button .ai-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff6b6b;
    color: white;
    font-size: 10px;
    padding: 3px 6px;
    border-radius: 10px;
    font-weight: bold;
}

@keyframes pulse-glow {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(95, 207, 128, 0.4);
    }

    50% {
        box-shadow: 0 4px 30px rgba(95, 207, 128, 0.7);
    }
}

/* Chat Popup Container */
.ai-chat-popup {
    position: fixed;
    bottom: 100px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 520px;
    max-height: calc(100vh - 150px);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 10px 50px rgba(0, 0, 0, 0.2);
    z-index: 10000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(95, 207, 128, 0.2);
}

.ai-chat-popup.active {
    display: flex;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Chat Header */
.ai-chat-header {
    background: linear-gradient(135deg, #5fcf80 0%, #2eca6a 100%);
    color: white;
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chat-header .header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-chat-header .ai-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-header .ai-avatar i {
    font-size: 20px;
}

.ai-chat-header .header-text h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.ai-chat-header .header-text span {
    font-size: 12px;
    opacity: 0.9;
}

.ai-chat-header .close-chat {
    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: all 0.3s ease;
}

.ai-chat-header .close-chat:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.ai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.chat-message {
    max-width: 85%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.chat-message.ai {
    background: linear-gradient(135deg, #f0f9f3 0%, #e8f5e9 100%);
    color: #2d3436;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.chat-message.ai strong {
    font-weight: 600;
    color: #1a7f3e;
}

.chat-message.ai em {
    font-style: italic;
    color: #555;
}

.chat-message.ai .chat-heading {
    font-weight: 600;
    color: #1a7f3e;
    font-size: 15px;
    margin: 8px 0 6px 0;
    display: block;
}

/* Chat Lists - Bullet and Numbered */
.chat-message.ai .chat-list {
    margin: 8px 0;
    padding-left: 0;
    list-style: none;
}

.chat-message.ai .chat-list li {
    position: relative;
    padding: 6px 0 6px 24px;
    margin: 4px 0;
    line-height: 1.5;
}

.chat-message.ai .bullet-item::before {
    content: "•";
    position: absolute;
    left: 8px;
    color: #5fcf80;
    font-weight: bold;
    font-size: 16px;
}

.chat-message.ai .numbered-item {
    padding-left: 8px;
}

.chat-message.ai .numbered-item .list-number {
    font-weight: 600;
    color: #5fcf80;
    margin-right: 6px;
}

/* Clickable Links */
.chat-message.ai .chat-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    margin: 2px 0;
    background: linear-gradient(135deg, #5fcf80 0%, #2eca6a 100%);
    color: white !important;
    text-decoration: none;
    border-radius: 16px;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(95, 207, 128, 0.3);
}

.chat-message.ai .chat-link:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(95, 207, 128, 0.5);
}

.chat-message.ai .phone-link {
    background: linear-gradient(135deg, #5fcf80 0%, #2eca6a 100%);
}

.chat-message.ai .email-link {
    background: linear-gradient(135deg, #6c9ff8 0%, #4a7fd7 100%);
    box-shadow: 0 2px 8px rgba(108, 159, 248, 0.3);
}

.chat-message.ai .email-link:hover {
    box-shadow: 0 4px 12px rgba(108, 159, 248, 0.5);
}

.chat-message.user {
    background: linear-gradient(135deg, #5fcf80 0%, #2eca6a 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
}

.chat-message.typing {
    display: flex;
    gap: 4px;
    padding: 15px 20px;
}

.chat-message.typing .dot {
    width: 8px;
    height: 8px;
    background: #5fcf80;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

.chat-message.typing .dot:nth-child(1) {
    animation-delay: 0s;
}

.chat-message.typing .dot:nth-child(2) {
    animation-delay: 0.2s;
}

.chat-message.typing .dot:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0.6);
        opacity: 0.5;
    }

    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Chat Input */
.ai-chat-input {
    padding: 15px 20px;
    background: #f8f9fa;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    gap: 10px;
    align-items: center;
}

.ai-chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid transparent;
    border-radius: 25px;
    font-size: 14px;
    background: white;
    transition: all 0.3s ease;
}

.ai-chat-input input:focus {
    outline: none;
    border-color: #5fcf80;
}

.ai-chat-input button {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    border: none;
    background: linear-gradient(135deg, #5fcf80 0%, #2eca6a 100%);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.ai-chat-input button:hover {
    transform: scale(1.05);
}

.ai-chat-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Quick Actions */
.ai-quick-actions {
    padding: 10px 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    background: #fafafa;
}

.quick-action-btn {
    padding: 8px 14px;
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #666;
}

.quick-action-btn:hover {
    border-color: #5fcf80;
    color: #5fcf80;
    background: #f0f9f3;
}

/* Mobile Responsiveness */
@media (max-width: 480px) {
    .ai-chat-popup {
        width: calc(100vw - 20px);
        right: 10px;
        bottom: 80px;
        height: calc(100vh - 100px);
        border-radius: 15px;
    }

    .ai-chat-button {
        width: 55px;
        height: 55px;
        bottom: 160px;
        right: 15px;
    }

    .ai-chat-button i {
        font-size: 24px;
    }
}