/**
 * Amara AI Assistant - Premium UX with Round Edges
 * Beautiful, conversion-focused design with micro-interactions
 * Design System: Premium rounded edges, smooth animations, engaging visuals
 */

/* Design System Variables */
:root {
    --amara-primary: #4CAF50;
    --amara-primary-dark: #45a049;
    --amara-primary-light: #66bb6a;
    --amara-gradient: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    --amara-gradient-hover: linear-gradient(135deg, #45a049 0%, #388e3c 100%);
    --amara-shadow: 0 8px 30px rgba(76, 175, 80, 0.2);
    --amara-shadow-hover: 0 12px 40px rgba(76, 175, 80, 0.3);
    --amara-radius: 20px;
    --amara-radius-small: 12px;
    --amara-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Widget Container - Premium Design - Positioned on Right */
.amara-ai-widget {
    position: fixed;
    bottom: 100px; /* Above WhatsApp widget (which is at 20px) */
    right: 20px;
    z-index: 99999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Premium Circular Avatar with Pulse Animation */
.amara-ai-avatar {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--amara-gradient);
    border: 4px solid #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--amara-shadow);
    transition: var(--amara-transition);
    position: relative;
    animation: avatarPulse 2s infinite;
}

@keyframes avatarPulse {
    0%, 100% {
        box-shadow: 0 4px 20px rgba(76, 175, 80, 0.3);
    }
    50% {
        box-shadow: 0 4px 30px rgba(76, 175, 80, 0.5);
    }
}

.amara-ai-avatar:hover {
    transform: scale(1.1);
    box-shadow: var(--amara-shadow-hover);
    animation: none;
}

.amara-ai-avatar::before {
    content: "👩‍💼";
    font-size: 32px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
    transition: var(--amara-transition);
}

.amara-ai-avatar:hover::before {
    transform: scale(1.1);
}

/* Premium Speech Bubble - Positioned on Right */
.amara-ai-bubble {
    position: absolute;
    bottom: 80px;
    right: 0;
    background: #ffffff;
    border-radius: var(--amara-radius);
    padding: 16px 20px;
    box-shadow: var(--amara-shadow);
    border: 1px solid #e8f5e9;
    max-width: 280px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(15px) scale(0.95);
    transition: var(--amara-transition);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.amara-ai-bubble::after {
    content: "";
    position: absolute;
    bottom: -10px;
    right: 24px; /* Arrow on right side */
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #ffffff;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.1));
}

.amara-ai-widget.active .amara-ai-bubble {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
}

.amara-ai-bubble-text {
    font-size: 15px;
    color: #1a1a1a;
    margin: 0;
    line-height: 1.5;
    font-weight: 500;
    letter-spacing: -0.2px;
}

/* Premium Chat Window - Positioned on Right */
.amara-ai-chat {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    max-height: 600px;
    background: #ffffff;
    border-radius: var(--amara-radius);
    box-shadow: var(--amara-shadow-hover);
    border: 1px solid #e8f5e9;
    transform: translateY(30px) scale(0.9);
    opacity: 0;
    visibility: hidden;
    transition: var(--amara-transition);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.amara-ai-widget.active .amara-ai-chat {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
    animation: chatSlideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes chatSlideUp {
    from {
        transform: translateY(30px) scale(0.9);
        opacity: 0;
    }
    to {
        transform: translateY(0) scale(1);
        opacity: 1;
    }
}

/* Premium Header */
.amara-ai-header {
    background: var(--amara-gradient);
    color: #ffffff;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    position: relative;
}

.amara-ai-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.amara-ai-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    letter-spacing: -0.3px;
}

.amara-ai-title::before {
    content: "👩‍💼";
    font-size: 20px;
    filter: drop-shadow(0 2px 4px rgba(0,0,0,0.2));
}

.amara-ai-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--amara-transition);
    line-height: 1;
}

.amara-ai-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg) scale(1.1);
}

/* Premium Messages Area */
.amara-ai-messages {
    flex: 1;
    max-height: 400px;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 24px;
    background: linear-gradient(180deg, #fafafa 0%, #ffffff 100%);
    scroll-behavior: smooth;
}

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

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

.amara-ai-messages::-webkit-scrollbar-thumb {
    background: var(--amara-primary);
    border-radius: 3px;
    transition: background 0.3s ease;
}

.amara-ai-messages::-webkit-scrollbar-thumb:hover {
    background: var(--amara-primary-dark);
}

/* Premium Message Bubbles */
.amara-ai-message {
    margin-bottom: 16px;
    display: flex;
    align-items: flex-end;
    gap: 10px;
    animation: messageSlideIn 0.3s ease backwards;
}

.amara-ai-message.user {
    flex-direction: row-reverse;
}

.amara-ai-message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.amara-ai-message.ai .amara-ai-message-avatar {
    background: var(--amara-gradient);
    color: #ffffff;
}

.amara-ai-message.user .amara-ai-message-avatar {
    background: #e0e0e0;
    color: #666;
}

.amara-ai-message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: var(--amara-radius-small);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    animation: messageBubbleIn 0.3s ease;
}

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

@keyframes messageBubbleIn {
    from {
        transform: scale(0.9);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

.amara-ai-message.ai .amara-ai-message-content {
    background: #ffffff;
    color: #1a1a1a;
    border: 1px solid #e8f5e9;
    border-bottom-left-radius: 4px;
}

.amara-ai-message.user .amara-ai-message-content {
    background: var(--amara-gradient);
    color: #ffffff;
    border-bottom-right-radius: 4px;
}

/* Quick actions (product page) */
.amara-ai-quick-actions {
    padding: 8px 16px 4px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    background: #fafdfb;
    border-top: 1px solid #e8f5e9;
}
.amara-ai-quick-actions button {
    font-size: 12px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid rgba(76, 175, 80, 0.45);
    background: #fff;
    color: #1a5c1f;
    cursor: pointer;
    transition: var(--amara-transition, 0.2s ease);
}
.amara-ai-quick-actions button:hover {
    background: rgba(76, 175, 80, 0.12);
}

/* Premium Input Area */
.amara-ai-input-area {
    padding: 20px 24px;
    background: #ffffff;
    border-top: 1px solid #e8f5e9;
    display: flex;
    gap: 10px;
    align-items: center;
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
}

.amara-ai-input {
    flex: 1;
    padding: 12px 18px;
    border: 2px solid #e8f5e9;
    border-radius: 24px;
    font-size: 14px;
    outline: none;
    transition: var(--amara-transition);
    background: #f8f9fa;
    font-family: inherit;
    color: #1a1a1a;
}

.amara-ai-input:focus {
    border-color: var(--amara-primary);
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.1);
}

.amara-ai-input::placeholder {
    color: #999;
}

.amara-ai-send {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--amara-gradient);
    border: none;
    color: #ffffff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--amara-transition);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.3);
    flex-shrink: 0;
}

.amara-ai-send:hover {
    background: var(--amara-gradient-hover);
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.amara-ai-send:active {
    transform: scale(0.95);
}

.amara-ai-send::before {
    content: "➤";
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.2));
}

/* Premium Typing Indicator */
.amara-ai-typing {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 24px;
    background: #f8f9fa;
    border-top: 1px solid #e8f5e9;
    animation: typingSlideIn 0.3s ease;
}

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

.amara-ai-typing-dots {
    display: flex;
    gap: 4px;
    align-items: center;
}

.amara-ai-typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--amara-primary);
    animation: typingDot 1.4s infinite ease-in-out;
    box-shadow: 0 2px 4px rgba(76, 175, 80, 0.3);
}

.amara-ai-typing-dot:nth-child(1) { animation-delay: -0.32s; }
.amara-ai-typing-dot:nth-child(2) { animation-delay: -0.16s; }
.amara-ai-typing-dot:nth-child(3) { animation-delay: 0s; }

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

/* Premium Product Suggestions */
.amara-product-suggestions {
    margin: 12px 0;
    padding: 16px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: var(--amara-radius-small);
    border: 1px solid #e8f5e9;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.amara-product-suggestions h4 {
    margin: 0 0 12px 0;
    color: var(--amara-primary);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

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

.amara-product-item {
    background: #ffffff;
    border-radius: var(--amara-radius-small);
    padding: 10px;
    border: 1px solid #e8f5e9;
    transition: var(--amara-transition);
    cursor: pointer;
}

.amara-product-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.15);
    border-color: var(--amara-primary);
}

.amara-product-image {
    width: 100%;
    height: 60px;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 6px;
}

.amara-product-info {
    text-align: center;
}

.amara-product-name {
    font-size: 11px;
    font-weight: 600;
    margin: 0 0 4px 0;
    color: #1a1a1a;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.amara-product-price {
    font-size: 11px;
    color: var(--amara-primary);
    font-weight: 700;
    margin: 0;
}

.amara-product-suggestion {
    background: var(--amara-gradient);
    color: #ffffff;
    border: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--amara-transition);
    margin-top: 6px;
    width: 100%;
}

.amara-product-suggestion:hover {
    background: var(--amara-gradient-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(76, 175, 80, 0.3);
}

/* Premium Discount Offers */
.amara-discount-offers {
    margin: 12px 0;
    padding: 18px;
    background: var(--amara-gradient);
    border-radius: var(--amara-radius-small);
    color: #ffffff;
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.2);
}

.amara-discount-offers h4 {
    margin: 0 0 12px 0;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.amara-discount-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.2);
    padding: 12px;
    border-radius: var(--amara-radius-small);
    margin-bottom: 10px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: var(--amara-transition);
}

.amara-discount-item:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateX(4px);
}

.amara-discount-info {
    flex: 1;
}

.amara-discount-info strong {
    font-size: 18px;
    display: block;
    margin-bottom: 4px;
    font-weight: 700;
}

.amara-discount-info p {
    margin: 4px 0;
    font-size: 12px;
    opacity: 0.95;
    line-height: 1.4;
}

.amara-discount-info code {
    background: rgba(255, 255, 255, 0.3);
    padding: 3px 8px;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-weight: 700;
    font-size: 11px;
}

.amara-discount-apply {
    background: #ffffff;
    color: var(--amara-primary);
    border: none;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: var(--amara-transition);
    white-space: nowrap;
}

.amara-discount-apply:hover {
    background: #f8f9fa;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
}

/* Responsive Design */
@media (max-width: 768px) {
    .amara-ai-widget {
        bottom: 100px; /* Above WhatsApp on mobile */
        right: 15px;
    }
    
    .amara-ai-avatar {
        width: 56px;
        height: 56px;
    }
    
    .amara-ai-avatar::before {
        font-size: 28px;
    }
    
    .amara-ai-chat {
        width: calc(100vw - 30px);
        max-width: 360px;
        max-height: 500px;
    }
    
    .amara-ai-bubble {
        max-width: 240px;
    }
    
    .amara-products-grid {
        grid-template-columns: 1fr;
    }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
