/* =============================
   MODERN CHAT WIDGET - CLEAN STYLE
   ============================= */

/* Chat Toggle Button */
#ai-chat-toggle {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-radius: 50%;
    font-size: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 99999;
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.4);
    transition: all 0.3s ease;
    border: none;
}

#ai-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 12px 32px rgba(102, 126, 234, 0.5);
}

/* Chat Box Container - Glass Effect */
#ai-chatbox {
    position: fixed;
    bottom: 24px;
    right: 24px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 600px;
    max-height: calc(100vh - 48px);
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: none;
    flex-direction: column;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    z-index: 99999;
    overflow: hidden;
}

/* Chat Header - Solid Color */
.ai-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    padding: 18px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
    border-radius: 20px 20px 0 0;
}

.ai-chat-title {
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.3px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-chat-title::before {
    content: '🤖';
    font-size: 24px;
}

.ai-chat-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    opacity: 0.9;
    margin-left: 8px;
}

.ai-chat-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #48bb78;
    border-radius: 50%;
    box-shadow: 0 0 8px rgba(72, 187, 120, 0.6);
}

.ai-chat-header button {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chat-header button:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(1.05);
}

/* Chat Body */
#ai-chat-box {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    background: #f8f9fb;
}

/* Messages Area */
#ai-chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: transparent;
    min-height: 0;
    scroll-behavior: smooth;
}

/* Custom Scrollbar */
#ai-chat-messages::-webkit-scrollbar {
    width: 5px;
}

#ai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

#ai-chat-messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

#ai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.2);
}

/* Message Bubbles - Clean Style */
.user-msg,
.ai-msg {
    margin-bottom: 16px;
    animation: fadeIn 0.3s ease;
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.user-msg {
    justify-content: flex-end;
}

.ai-msg {
    justify-content: flex-start;
}

/* AI Avatar */
.ai-msg::before {
    content: '🤖';
    width: 36px;
    height: 36px;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.msg-content {
    max-width: 75%;
    padding: 14px 18px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.6;
    word-wrap: break-word;
}

/* User Message - Solid Color (No Gradient) */
.user-msg .msg-content {
    background: #667eea;
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

/* AI Message - Clean White */
.ai-msg .msg-content {
    background: white;
    color: #2d3748;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-msg a {
    color: #667eea;
    text-decoration: underline;
    font-weight: 500;
}

.ai-msg a:hover {
    color: #764ba2;
}

/* Typing Indicator */
.ai-msg.typing .msg-content {
    padding: 16px 20px;
}

.typing-indicator {
    display: flex;
    gap: 5px;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background: #cbd5e0;
    border-radius: 50%;
    animation: typing 1.4s infinite;
}

.typing-indicator span:nth-child(2) {
    animation-delay: 0.2s;
}

.typing-indicator span:nth-child(3) {
    animation-delay: 0.4s;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        background: #cbd5e0;
    }
    30% {
        transform: translateY(-8px);
        background: #667eea;
    }
}

/* Quick Replies - Card Style */
#ai-quick-replies {
    padding: 0 16px 16px 16px;
    background: transparent;
    border-top: none;
    flex-shrink: 0;
}

.quick-replies-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}

.quick-reply-btn {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.1);
    color: #4a5568;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
    text-align: left;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.quick-reply-btn::before {
    font-size: 18px;
}

.quick-reply-btn:nth-child(1)::before {
    content: '🛍️';
}

.quick-reply-btn:nth-child(2)::before {
    content: '🎁';
}

.quick-reply-btn:nth-child(3)::before {
    content: '💡';
}

.quick-reply-btn:nth-child(4)::before {
    content: '🔍';
}

.quick-reply-btn:hover {
    background: #667eea;
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* Input Area - Clean Style */
.ai-chat-input-wrap {
    padding: 16px;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    gap: 10px;
    align-items: center;
    flex-shrink: 0;
}

#ai-chat-input {
    flex: 1;
    padding: 14px 18px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    background: #f8f9fb;
    color: #2d3748;
    transition: all 0.2s ease;
    min-width: 0;
}

#ai-chat-input:focus {
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#ai-chat-input::placeholder {
    color: #a0aec0;
}

/* Send Button */
#ai-chat-send {
    width: 44px;
    height: 44px;
    background: #667eea;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    flex-shrink: 0;
}

#ai-chat-send::before {
    content: '➤';
}

#ai-chat-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

#ai-chat-send:active {
    transform: scale(0.95);
}

/* Product Cards */
.ai-product-card {
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.2s ease;
}

.ai-product-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

.ai-product-card strong {
    display: block;
    font-size: 15px;
    color: #2d3748;
    margin-bottom: 8px;
    font-weight: 600;
}

.ai-price {
    display: block;
    font-size: 19px;
    font-weight: 700;
    color: #667eea;
    margin: 8px 0;
}

.ai-buy-btn {
    display: inline-block;
    background: #667eea;
    color: white !important;
    padding: 10px 24px;
    border-radius: 10px;
    text-decoration: none !important;
    font-weight: 600;
    font-size: 13px;
    margin-top: 10px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.ai-buy-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    background: #764ba2;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #ai-chatbox {
        width: calc(100vw - 24px);
        height: calc(100vh - 24px);
        bottom: 12px;
        right: 12px;
        border-radius: 16px;
    }
    
    #ai-chat-toggle {
        bottom: 16px;
        right: 16px;
        width: 56px;
        height: 56px;
    }
    
    .quick-replies-container {
        grid-template-columns: 1fr;
    }
    
    .msg-content {
        max-width: 85%;
    }
}

/* Lead Capture Form */
.ai-lead-form {
    background: white;
    border-radius: 12px;
    padding: 0;
    margin: 10px 0;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.ai-lead-form-header {
    background: #f8f9fb;
    padding: 16px;
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.ai-lead-form-header strong {
    display: block;
    font-size: 16px;
    color: #2d3748;
    margin-bottom: 6px;
}

.ai-lead-form-header p {
    font-size: 13px;
    color: #4a5568;
    margin: 0;
}

#lead-capture-form {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

#lead-capture-form input,
#lead-capture-form select,
#lead-capture-form textarea {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s ease;
    background: #f8f9fb;
}

#lead-capture-form input:focus,
#lead-capture-form select:focus,
#lead-capture-form textarea:focus {
    outline: none;
    background: white;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

#lead-capture-form textarea {
    resize: vertical;
    min-height: 60px;
}

.ai-lead-submit-btn {
    background: #667eea;
    color: white;
    border: none;
    padding: 14px 24px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
    margin-top: 8px;
}

.ai-lead-submit-btn:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.ai-lead-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Search Box */
.ai-search-wrapper {
    position: relative;
    max-width: 600px;
    margin: 20px auto;
}

#ai-search-input {
    width: 100%;
    padding: 16px 20px;
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 16px;
    font-size: 15px;
    background: white;
    outline: none;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

#ai-search-input:focus {
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

#ai-search-results {
    position: absolute;
    top: calc(100% + 10px);
    left: 0;
    right: 0;
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    border: 1px solid rgba(0, 0, 0, 0.08);
}

.ai-live-results {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ai-live-results li {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.ai-live-results li:last-child {
    border-bottom: none;
}

.ai-live-results a {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    text-decoration: none;
    color: #2d3748;
    transition: all 0.2s ease;
}

.ai-live-results a:hover {
    background: #f8f9fb;
}

.ai-live-results img {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.ai-no-image {
    width: 50px;
    height: 50px;
    background: #f8f9fb;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    flex-shrink: 0;
}

.ai-result-content {
    flex: 1;
}

.ai-result-title {
    font-size: 14px;
    color: #2d3748;
    font-weight: 600;
    display: block;
    margin-bottom: 4px;
}

.ai-type-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 500;
    margin-top: 2px;
}

.ai-badge-product {
    background: rgba(102, 126, 234, 0.15);
    color: #667eea;
}

.ai-badge-page {
    background: rgba(72, 187, 120, 0.15);
    color: #48bb78;
}

.ai-badge-post {
    background: rgba(237, 137, 54, 0.15);
    color: #ed8936;
}

.ai-result-price {
    margin-left: auto;
    color: #667eea;
    font-weight: 700;
    font-size: 15px;
    flex-shrink: 0;
}

.ai-no-results {
    padding: 24px;
    text-align: center;
    color: #a0aec0;
    font-size: 14px;
}
