/* WooCommerce AI Sales Agent - Chat Styles */

.wai-chat-widget {
    position: fixed;
    bottom: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.wai-chat-widget.wai-right {
    right: 20px;
}

.wai-chat-widget.wai-left {
    left: 20px;
}

/* Chat Button */
.wai-chat-button {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #0073aa;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
}

.wai-chat-button:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

.wai-chat-button.wai-active {
    transform: scale(0.9);
}

.wai-notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Chat Window */
.wai-chat-window {
    position: absolute;
    bottom: 80px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 600px;
    max-height: calc(100vh - 120px);
    background: white;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.wai-chat-widget.wai-right .wai-chat-window {
    right: 0;
}

.wai-chat-widget.wai-left .wai-chat-window {
    left: 0;
}

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

.wai-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.wai-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;
}

.wai-header-title {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.4;
}

.wai-header-subtitle {
    font-size: 13px;
    opacity: 0.9;
}

.wai-close-button {
    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;
}

.wai-close-button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Chat Messages */
.wai-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f5f5f5;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.wai-chat-messages::-webkit-scrollbar {
    width: 6px;
}

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

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

.wai-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Messages */
.wai-message {
    display: flex;
    margin-bottom: 8px;
    animation: fadeIn 0.3s ease;
}

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

.wai-message-content {
    padding: 12px 16px;
    border-radius: 12px;
    max-width: 80%;
    line-height: 1.5;
    font-size: 14px;
    word-wrap: break-word;
}

.wai-bot-message .wai-message-content {
    background: white;
    color: #2d3748;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.wai-user-message {
    justify-content: flex-end;
}

.wai-user-message .wai-message-content {
    background: #0073aa;
    color: white;
    border-bottom-right-radius: 4px;
}

/* Typing Indicator */
.wai-typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 12px;
    border-bottom-left-radius: 4px;
    width: fit-content;
}

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

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

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

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
        opacity: 0.7;
    }
    30% {
        transform: translateY(-10px);
        opacity: 1;
    }
}

/* Product Cards */
.wai-product-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 8px;
}

.wai-product-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    gap: 12px;
    padding: 12px;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.wai-product-card img {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    flex-shrink: 0;
}

.wai-product-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.wai-product-info h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: #2d3748;
    line-height: 1.3;
}

.wai-product-price {
    font-size: 16px;
    font-weight: bold;
    color: #0073aa;
}

.wai-product-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.wai-view-btn,
.wai-add-to-cart-btn {
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    border: none;
    flex: 1;
    text-align: center;
}

.wai-view-btn {
    background: #f7fafc;
    color: #4a5568;
    border: 1px solid #e2e8f0;
}

.wai-view-btn:hover {
    background: #edf2f7;
    border-color: #cbd5e0;
}

.wai-add-to-cart-btn {
    background: #0073aa;
    color: white;
}

.wai-add-to-cart-btn:hover {
    background: #005a87;
}

.wai-add-to-cart-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.wai-add-to-cart-btn.wai-added {
    background: #48bb78;
}

/* Chat Input */
.wai-chat-input-container {
    padding: 16px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.wai-chat-input {
    flex: 1;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    font-family: inherit;
    resize: none;
    min-height: 40px;
    max-height: 120px;
    line-height: 1.5;
    transition: border-color 0.2s;
}

.wai-chat-input:focus {
    outline: none;
    border-color: #0073aa;
}

.wai-send-button {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    color: #4a5568;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.wai-send-button:hover {
    background: #0073aa;
    border-color: #0073aa;
    color: white;
}

.wai-send-button:active {
    transform: scale(0.95);
}

/* Notification */
.wai-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: white;
    padding: 16px 20px;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 100000;
    opacity: 0;
    transform: translateY(-20px);
    transition: all 0.3s ease;
    max-width: 320px;
}

.wai-notification.wai-show {
    opacity: 1;
    transform: translateY(0);
}

.wai-notification-success {
    border-left: 4px solid #48bb78;
}

.wai-notification-error {
    border-left: 4px solid #e74c3c;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .wai-chat-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        bottom: 80px;
    }
    
    .wai-chat-button {
        width: 56px;
        height: 56px;
    }
    
    .wai-product-card {
        flex-direction: column;
    }
    
    .wai-product-card img {
        width: 100%;
        height: 150px;
    }
}

@media (max-width: 480px) {
    .wai-chat-widget {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }
    
    .wai-chat-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 100px);
        bottom: 70px;
        left: 0 !important;
        right: 0 !important;
    }
}
