/**
 * WP AI Advisor - Frontend Chat Widget Styles
 */

/* Chat Widget Container */
.wpai-chat-widget {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
}

.wpai-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

.wpai-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

/* Chat Bubble Button */
.wpai-chat-bubble {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    color: white;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.wpai-chat-bubble:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 30px rgba(0, 0, 0, 0.3);
}

.wpai-chat-bubble.active .wpai-icon-chat {
    display: none;
}

.wpai-chat-bubble.active .wpai-icon-close {
    display: block !important;
}

/* Chat Window */
.wpai-chat-window {
    position: absolute;
    bottom: 80px;
    width: 380px;
    background: white;
    border-radius: 16px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.wpai-position-bottom-right .wpai-chat-window {
    right: 0;
}

.wpai-position-bottom-left .wpai-chat-window {
    left: 0;
}

/* Size Variations */
.wpai-chat-small .wpai-chat-window {
    width: 320px;
    height: 450px;
}

.wpai-chat-medium .wpai-chat-window {
    width: 380px;
    height: 520px;
}

.wpai-chat-large .wpai-chat-window {
    width: 440px;
    height: 600px;
}

/* Chat Header */
.wpai-chat-header {
    padding: 16px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.wpai-chat-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wpai-chat-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.wpai-chat-title {
    display: flex;
    flex-direction: column;
}

.wpai-chat-name {
    font-weight: 600;
    font-size: 16px;
}

.wpai-chat-status {
    font-size: 12px;
    opacity: 0.8;
}

.wpai-chat-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 8px;
    opacity: 0.8;
    transition: opacity 0.2s;
}

.wpai-chat-close:hover {
    opacity: 1;
}

/* Messages Area */
.wpai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    background: #f9fafb;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.wpai-chat-small .wpai-chat-messages {
    height: 300px;
}

.wpai-chat-medium .wpai-chat-messages {
    height: 370px;
}

.wpai-chat-large .wpai-chat-messages {
    height: 450px;
}

/* Message Styles */
.wpai-message {
    display: flex;
    gap: 10px;
    max-width: 85%;
}

.wpai-message-bot {
    align-self: flex-start;
}

.wpai-message-user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.wpai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    color: #6b7280;
}

.wpai-message-user .wpai-message-avatar {
    background: #dbeafe;
    color: #3b82f6;
}

.wpai-message-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wpai-message-bubble {
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
}

.wpai-message-bot .wpai-message-bubble {
    background: white;
    color: #374151;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wpai-message-user .wpai-message-bubble {
    background: #3b82f6;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Product Card */
.wpai-product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    margin-top: 8px;
    max-width: 250px;
}

.wpai-product-image {
    width: 100%;
    height: 120px;
    object-fit: cover;
    background: #f3f4f6;
}

.wpai-product-info {
    padding: 12px;
}

.wpai-product-name {
    font-weight: 600;
    font-size: 14px;
    color: #1f2937;
    margin-bottom: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wpai-product-price {
    font-size: 16px;
    font-weight: 700;
    color: #059669;
    margin-bottom: 8px;
}

.wpai-product-btn {
    width: 100%;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.wpai-add-to-cart {
    background: #3b82f6;
    color: white;
}

.wpai-add-to-cart:hover {
    background: #2563eb;
}

.wpai-view-product {
    background: #f3f4f6;
    color: #374151;
    margin-top: 6px;
}

.wpai-view-product:hover {
    background: #e5e7eb;
}

/* Typing Indicator */
.wpai-typing {
    display: flex;
    gap: 10px;
    padding: 0 16px 16px;
    background: #f9fafb;
}

.wpai-typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.wpai-typing-indicator span {
    width: 8px;
    height: 8px;
    background: #9ca3af;
    border-radius: 50%;
    animation: wpai-typing 1.4s infinite ease-in-out both;
}

.wpai-typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes wpai-typing {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Input Area */
.wpai-chat-input {
    padding: 12px 16px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

.wpai-chat-input form {
    display: flex;
    gap: 10px;
}

.wpai-chat-input input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
}

.wpai-chat-input input:focus {
    border-color: #3b82f6;
}

.wpai-chat-input button {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: transform 0.2s;
}

.wpai-chat-input button:hover {
    transform: scale(1.05);
}

/* Inline Chat */
.wpai-chat-inline {
    background: white;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    max-width: 500px;
    margin: 20px auto;
}

.wpai-chat-inline .wpai-chat-messages {
    height: 400px;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .wpai-chat-window {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100% !important;
        height: 100% !important;
        border-radius: 0;
    }
    
    .wpai-chat-small .wpai-chat-messages,
    .wpai-chat-medium .wpai-chat-messages,
    .wpai-chat-large .wpai-chat-messages {
        height: calc(100vh - 140px);
    }
    
    .wpai-chat-bubble {
        width: 56px;
        height: 56px;
        font-size: 22px;
    }
}

/* Scrollbar */
.wpai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

.wpai-chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.wpai-chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 3px;
}

.wpai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af;
}

/* Animation */
.wpai-chat-window {
    animation: wpai-slide-up 0.3s ease;
}

@keyframes wpai-slide-up {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}
