/* EarthEssence AI Styles - Production Ready v2.0 */
#earthEssenceAI {
    font-family: 'Segoe UI', system-ui, 'Arial Unicode MS', 'Tahoma', 'Noto Sans Tamil', 'Noto Sans Devanagari', 'Noto Sans Kannada', 'Noto Sans Telugu', sans-serif;
    --primary-green: #2E8B57;
    --primary-green-dark: #228B22;
    --primary-green-light: rgba(46, 139, 87, 0.1);
    --secondary-orange: #ff9800;
    --user-message-bg: #667eea;
    --ai-message-bg: #f5f5f5;
    --shadow-light: 0 2px 8px rgba(0,0,0,0.1);
    --shadow-medium: 0 4px 20px rgba(0,0,0,0.15);
    --shadow-heavy: 0 10px 40px rgba(0,0,0,0.1);
    --border-radius: 16px;
    --transition: all 0.3s ease;
}

.ai-window {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 420px;
    height: 600px;
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-heavy);
    z-index: 10001;
    display: none;
    flex-direction: column;
    border: 1px solid #e0e0e0;
    transform: translateY(20px);
    opacity: 0;
    transition: var(--transition);
}

.ai-window.open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    animation: slideUp 0.3s ease;
}

.ai-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    max-height: 400px;
    font-family: 'Segoe UI', system-ui, 'Arial Unicode MS', 'Tahoma', 'Noto Sans Tamil', 'Noto Sans Devanagari', 'Noto Sans Kannada', 'Noto Sans Telugu', sans-serif;
    scroll-behavior: smooth;
}

.message {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    animation: messageSlide 0.3s ease;
    position: relative;
}

/* FIXED: FEEDBACK SECTION AT BOTTOM */
.feedback-section {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #e9ecef;
    width: 100%;
}

.feedback-buttons {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    justify-content: flex-start;
    flex-wrap: wrap;
}

.feedback-prompt {
    color: #666;
    font-size: 12px !important;
    font-weight: 500;
}

.feedback-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 12px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 60px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 500;
}

.feedback-btn:hover {
    background: #e9ecef;
    transform: translateY(-1px);
}

.feedback-btn.helpful:hover {
    background: #d4edda;
    border-color: #c3e6cb;
    color: #155724;
}

.feedback-btn.not-helpful:hover {
    background: #f8d7da;
    border-color: #f5c6cb;
    color: #721c24;
}

.feedback-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.message-content {
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    line-height: 1.5;
    font-size: 14px;
    box-shadow: var(--shadow-light);
    font-family: inherit;
    unicode-bidi: plaintext;
    word-wrap: break-word;
    transition: var(--transition);
}

.emergency-message .message-content {
    background: #fff3cd !important;
    border: 1px solid #ffeaa7 !important;
    border-left: 4px solid #dc3545 !important;
}

.ai-trigger {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, var(--primary-green), #32CD32);
    color: white;
    border: none;
    border-radius: 50px;
    padding: 12px 20px;
    cursor: pointer;
    box-shadow: var(--shadow-medium);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 10000;
    transition: var(--transition);
    font-family: 'Segoe UI', system-ui, sans-serif;
}

.ai-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(46, 139, 87, 0.4);
}

.ai-trigger.active {
    background: linear-gradient(135deg, var(--primary-green-dark), var(--primary-green));
}

.trigger-icon {
    font-size: 20px;
}

.trigger-text {
    font-weight: 600;
    font-size: 14px;
}

.ai-header {
    background: linear-gradient(135deg, var(--primary-green), #32CD32);
    color: white;
    padding: 16px 20px;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.header-icon {
    font-size: 24px;
}

.header-title {
    font-weight: 700;
    font-size: 16px;
}

.header-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

.close-btn {
    background: rgba(255,255,255,0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.user-message {
    flex-direction: row-reverse;
}

.user-message .message-icon {
    background: var(--user-message-bg);
}

.user-message .message-content {
    background: var(--user-message-bg);
    color: white;
}

.bot-message .message-icon {
    background: var(--primary-green);
}

.message-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    flex-shrink: 0;
    transition: var(--transition);
}

.quick-actions {
    padding: 12px 20px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    background: white;
    border-bottom: 1px solid #e0e0e0;
}

.quick-btn {
    background: var(--primary-green-light);
    color: var(--primary-green);
    border: 1px solid rgba(46, 139, 87, 0.2);
    padding: 6px 12px;
    border-radius: 15px;
    font-size: 11px;
    cursor: pointer;
    transition: var(--transition);
    font-weight: 500;
}

.quick-btn:hover {
    background: var(--primary-green);
    color: white;
    transform: translateY(-1px);
}

.input-area {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
}

#aiUserInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    font-family: 'Segoe UI', system-ui, 'Arial Unicode MS', 'Tahoma', 'Noto Sans Tamil', 'Noto Sans Devanagari', 'Noto Sans Kannada', 'Noto Sans Telugu', sans-serif;
    transition: var(--transition);
}

#aiUserInput:focus {
    border-color: var(--primary-green);
    box-shadow: 0 0 0 2px rgba(46, 139, 87, 0.1);
}

.input-area button {
    background: var(--primary-green);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    min-width: 60px;
    font-family: inherit;
    font-size: 14px;
}

.input-area button:hover {
    background: var(--primary-green-dark);
    transform: translateY(-1px);
}

.input-area button:active {
    transform: translateY(0);
}

.loading {
    color: #666;
    font-style: italic;
    position: relative;
}

.loading::after {
    content: '...';
    animation: loadingDots 1.5s infinite;
}

.loading small {
    display: block;
    margin-top: 4px;
    opacity: 0.7;
    font-style: normal;
}

.message-content {
    unicode-bidi: plaintext;
    text-align: start;
}

[lang="hi"], [lang="ta"], [lang="kn"], [lang="te"] {
    font-family: 'Arial Unicode MS', 'Tahoma', 'Noto Sans Tamil', 'Noto Sans Devanagari', 'Noto Sans Kannada', 'Noto Sans Telugu', sans-serif;
}

.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes messageSlide {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes loadingDots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

.ai-trigger:focus,
.quick-btn:focus,
.close-btn:focus,
#aiUserInput:focus,
.input-area button:focus,
.feedback-btn:focus {
    outline: 2px solid var(--primary-green);
    outline-offset: 2px;
}

.product-link {
    color: #2E8B57 !important;
    font-weight: bold !important;
    text-decoration: none !important;
    background: rgba(46, 139, 87, 0.1) !important;
    padding: 2px 6px !important;
    border-radius: 4px !important;
    border: 1px solid rgba(46, 139, 87, 0.3) !important;
    transition: var(--transition) !important;
}

.product-link:hover {
    background: rgba(46, 139, 87, 0.2) !important;
    text-decoration: underline !important;
    color: #228B22 !important;
    transform: translateY(-1px) !important;
}

.message-content .product-link {
    font-size: inherit !important;
    display: inline !important;
}

#earthEssenceAI * {
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@media print {
    #earthEssenceAI {
        display: none !important;
    }
}

@media (max-width: 768px) {
    .ai-window {
        width: calc(100vw - 40px);
        height: 70vh;
        right: 20px;
        bottom: 80px;
    }
    
    .chat-messages {
        max-height: 50vh;
    }
    
    .ai-trigger {
        right: 15px;
        bottom: 15px;
    }
    
    .message-content {
        max-width: 80%;
    }
    
    .feedback-buttons {
        gap: 6px;
    }
    
    .feedback-prompt {
        font-size: 11px !important;
    }
    
    .feedback-btn {
        padding: 4px 10px;
        font-size: 11px;
        min-width: 50px;
        height: 26px;
    }
}

@media (max-width: 480px) {
    .ai-window {
        width: 100vw;
        height: 100vh;
        right: 0;
        bottom: 0;
        border-radius: 0;
    }
    
    .ai-header {
        border-radius: 0;
    }
    
    .quick-actions {
        padding: 8px 15px;
    }
    
    .quick-btn {
        font-size: 10px;
        padding: 4px 8px;
    }
    
    .message-content {
        max-width: 75%;
        font-size: 13px;
    }
    
    .input-area {
        padding: 12px 15px;
    }
    
    .feedback-buttons {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .feedback-prompt {
        width: 100%;
        text-align: center;
        margin-bottom: 4px;
    }
}