/* AI Chatbot Frontend Styles */

/* Container */
#ai-chatbot-container {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Toggle Button */
.ai-chatbot-toggle {
    position: fixed;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 1000000;
}

.ai-chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.ai-chatbot-toggle-icon,
.ai-chatbot-toggle-close {
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Widget */
.ai-chatbot-widget {
    position: fixed;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 999999;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Header */
.ai-chatbot-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.ai-chatbot-title {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-size: 16px;
}

.ai-chatbot-avatar {
    margin-right: 8px;
    font-size: 20px;
}

.ai-chatbot-actions {
    display: flex;
    gap: 8px;
}

.ai-chatbot-menu,
.ai-chatbot-minimize,
.ai-chatbot-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
    padding: 0px;
}

.ai-chatbot-menu:hover,
.ai-chatbot-minimize:hover,
.ai-chatbot-close:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Messages */
.ai-chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
}

.ai-chatbot-message {
    display: flex;
    margin-bottom: 16px;
    animation: messageSlideIn 0.3s ease-out;
}

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

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

.ai-chatbot-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    margin-right: 8px;
    flex-shrink: 0;
}

.ai-chatbot-message-user .ai-chatbot-message-avatar {
    background: #007cba;
    color: white;
    margin-right: 0;
    margin-left: 8px;
    order: 2;
}

.ai-chatbot-message-bot .ai-chatbot-message-avatar {
    background: #e9ecef;
}

.ai-chatbot-message-content {
    max-width: 80%;
}

.ai-chatbot-message-text {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    white-space: pre-wrap;
}

.ai-chatbot-message-user .ai-chatbot-message-text {
    background: #007cba;
    color: white;
}

/* Product Results */
.ai-chatbot-product-results {
    margin-top: 12px;
}

.ai-chatbot-product-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 12px;
    padding: 0;
    margin-bottom: 12px;
    display: block;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

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

.ai-chatbot-product-image {
    width: 100%;
    height: 120px;
    border-radius: 0;
    object-fit: cover;
    background: #f8f9fa;
    display: block;
}

.ai-chatbot-product-info {
    padding: 12px;
}

.ai-chatbot-product-name {
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 6px;
    color: #333;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ai-chatbot-product-price {
    color: #007cba;
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 8px;
}

.ai-chatbot-product-description {
    font-size: 12px;
    color: #666;
    margin-bottom: 12px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ai-chatbot-product-actions {
    display: flex;
    gap: 8px;
}

.ai-chatbot-product-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    transition: all 0.2s ease;
    flex: 1;
    text-align: center;
}

.ai-chatbot-product-btn:hover {
    background: #005a87;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 124, 186, 0.3);
}

/* Support Options */
.ai-chatbot-support-options {
    margin-top: 12px;
}

.ai-chatbot-support-option {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #333;
    transition: all 0.2s ease;
}

.ai-chatbot-support-option:hover {
    background: #f8f9fa;
    border-color: #007cba;
    color: #333;
    text-decoration: none;
}

.ai-chatbot-support-icon {
    font-size: 20px;
}

/* Order Tracking */
.ai-chatbot-order-form {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.ai-chatbot-form-group {
    margin-bottom: 12px;
}

.ai-chatbot-form-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 4px;
    color: #555;
}

.ai-chatbot-form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    box-sizing: border-box;
}

.ai-chatbot-form-input:focus {
    outline: none;
    border-color: #007cba;
    box-shadow: 0 0 0 2px rgba(0, 124, 186, 0.1);
}

.ai-chatbot-form-btn {
    background: #007cba;
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s ease;
}

.ai-chatbot-form-btn:hover {
    background: #005a87;
}

/* Quick Actions */
.ai-chatbot-quick-actions {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ai-chatbot-quick-action {
    background: #f8f9fa;
    border: 1px solid #e9ecef;
    color: #555;
    padding: 8px 12px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.ai-chatbot-quick-action:hover {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

/* Input Area */
.ai-chatbot-input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
}

.ai-chatbot-input-container {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ai-chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

.ai-chatbot-input:focus {
    border-color: #007cba;
}

.ai-chatbot-send-btn {
    width: 40px;
    height: 40px;
    background: #007cba;
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    padding: 0px;
}

.ai-chatbot-send-btn:hover:not(:disabled) {
    background: #005a87;
    transform: scale(1.05);
}

.ai-chatbot-send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
}

/* Typing Indicator */
.ai-chatbot-typing {
    padding: 0 20px 16px;
    background: #f8f9fa;
}

.ai-chatbot-typing-dots {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 18px;
    width: fit-content;
}

.ai-chatbot-typing-dots span {
    width: 8px;
    height: 8px;
    background: #ccc;
    border-radius: 50%;
    animation: typingDots 1.4s infinite ease-in-out;
}

.ai-chatbot-typing-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.ai-chatbot-typing-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingDots {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 480px) {
    .ai-chatbot-widget {
        width: calc(100vw - 40px);
        height: calc(100vh - 40px);
        bottom: 20px !important;
        right: 20px !important;
        left: 20px !important;
        top: 20px !important;
    }
    
    .ai-chatbot-toggle {
        bottom: 20px !important;
        right: 20px !important;
    }
}

/* Scrollbar Styling */
.ai-chatbot-messages::-webkit-scrollbar {
    width: 6px;
}

.ai-chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.ai-chatbot-messages::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 3px;
}

.ai-chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: #999;
}

/* Confirmation Dialog */
.ai-chatbot-confirmation-buttons {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}

.ai-chatbot-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    text-decoration: none;
    display: inline-block;
}

.ai-chatbot-btn-danger {
    background: #ef4444;
    color: white;
}

.ai-chatbot-btn-danger:hover {
    background: #dc2626;
}

.ai-chatbot-btn-secondary {
    background: #6b7280;
    color: white;
}

.ai-chatbot-btn-secondary:hover {
    background: #4b5563;
}

/* Proactive Engagement Styles */
.ai-chatbot-proactive-badge {
    position: fixed;
    bottom: 100px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
    border: 1px solid #e5e7eb;
    max-width: 320px;
    z-index: 999999;
    opacity: 0;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.ai-chatbot-proactive-badge.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.ai-chatbot-proactive-content {
    padding: 16px;
}

.ai-chatbot-proactive-message {
    font-size: 14px;
    line-height: 1.4;
    color: #374151;
    margin-bottom: 12px;
}

.ai-chatbot-proactive-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.ai-chatbot-proactive-accept {
    background: #007cba;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s ease;
    flex: 1;
}

.ai-chatbot-proactive-accept:hover {
    background: #005a87;
}

.ai-chatbot-proactive-dismiss {
    background: #f3f4f6;
    color: #6b7280;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ai-chatbot-proactive-dismiss:hover {
    background: #e5e7eb;
    color: #374151;
}



/* Conditional Form Styles */
.ai-chatbot-conditional-form {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 8px;
    padding: 16px;
    margin-top: 12px;
}

.ai-chatbot-form-step {
    display: none;
}

.ai-chatbot-form-step.active {
    display: block;
}

.ai-chatbot-form-progress {
    background: #f1f5f9;
    border-radius: 8px;
    padding: 8px 12px;
    margin-bottom: 16px;
    font-size: 12px;
    color: #64748b;
}

.ai-chatbot-form-progress-bar {
    background: #e2e8f0;
    height: 4px;
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.ai-chatbot-form-progress-fill {
    background: #007cba;
    height: 100%;
    transition: width 0.3s ease;
}

.ai-chatbot-form-navigation {
    display: flex;
    gap: 8px;
    margin-top: 16px;
}

.ai-chatbot-form-nav-btn {
    padding: 8px 16px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    cursor: pointer;
    font-size: 13px;
    transition: all 0.2s ease;
}

.ai-chatbot-form-nav-btn:hover {
    background: #f9fafb;
}

.ai-chatbot-form-nav-btn.primary {
    background: #007cba;
    color: white;
    border-color: #007cba;
}

.ai-chatbot-form-nav-btn.primary:hover {
    background: #005a87;
}

/* Satisfaction Rating Styles */
.ai-chatbot-satisfaction {
    margin-top: 10px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 8px;
    border: 1px solid #e9ecef;
}

.ai-chatbot-satisfaction-title {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
    text-align: center;
}

.ai-chatbot-satisfaction-buttons {
    display: flex;
    justify-content: center;
    gap: 4px;
    margin-bottom: 6px;
}

.ai-chatbot-satisfaction-btn.star-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 2px;
    border-radius: 4px;
    transition: all 0.2s ease;
    color: #ddd;
    margin: 0 1px;
}

.ai-chatbot-satisfaction-btn.star-btn:hover,
.ai-chatbot-satisfaction-btn.star-btn.hover {
    color: #ffc107;
    transform: scale(1.1);
}

.ai-chatbot-satisfaction-btn.star-btn.selected {
    color: #ffc107;
    text-shadow: 0 0 4px rgba(255, 193, 7, 0.5);
}

.ai-chatbot-satisfaction-labels {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: #6c757d;
    padding: 0 4px;
}

.ai-chatbot-satisfaction-labels span {
    font-weight: 500;
}
