/**
 * Food Safety Chatbot Styles
 * Modern, accessible design for the AI food safety assistant
 */

.food-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 350px;
    max-height: 500px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(233, 30, 99, 0.1);
    z-index: 1050;
    display: flex;
    flex-direction: column;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: all 0.3s ease;
}

.food-chatbot-container.minimized {
    height: 60px;
    overflow: hidden;
}

.food-chatbot-container.minimized .chatbot-messages,
.food-chatbot-container.minimized .chatbot-input {
    display: none;
}

.chatbot-header {
    background: linear-gradient(135deg, #e91e63, #f06292);
    color: white;
    padding: 12px 16px;
    border-radius: 16px 16px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
}

.chatbot-header h6 {
    font-weight: 600;
    font-size: 14px;
}

.chatbot-header button {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
}

.chatbot-header button:hover {
    background: rgba(255, 255, 255, 0.3);
}

.chatbot-messages {
    flex: 1;
    padding: 16px;
    overflow-y: auto;
    max-height: 350px;
    scroll-behavior: smooth;
}

.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}

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

.chatbot-messages::-webkit-scrollbar-thumb {
    background: #e91e63;
    border-radius: 2px;
}

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

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

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

.bot-message {
    justify-content: flex-start;
}

.message-content {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
}

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

.bot-message .message-content {
    background: #ffffff;
    color: #212529;
    border: 1px solid #e9ecef;
    border-bottom-left-radius: 4px;
}

.message-text {
    word-wrap: break-word;
}

.message-text strong {
    font-weight: 600;
}

.message-text em {
    font-style: italic;
    color: #e91e63;
}

.message-text hr {
    border: none;
    border-top: 1px solid #dee2e6;
    margin: 8px 0;
}

.message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}

.user-message .message-time {
    color: rgba(255, 255, 255, 0.8);
}

.bot-message .message-time {
    color: #6c757d;
}

.message-suggestions {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}

.message-suggestions .btn {
    font-size: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    transition: all 0.2s;
}

.message-suggestions .btn:hover {
    background-color: #e91e63;
    border-color: #e91e63;
    color: white;
    transform: translateY(-1px);
}

.typing-indicator {
    animation: pulse 1.5s infinite;
}

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

.typing-dots span {
    width: 6px;
    height: 6px;
    background-color: #e91e63;
    border-radius: 50%;
    animation: typingDots 1.4s infinite ease-in-out;
}

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

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

.chatbot-input {
    padding: 12px 16px;
    border-top: 1px solid #e9ecef;
    border-radius: 0 0 16px 16px;
    background: white;
}

.chatbot-input .input-group {
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chatbot-input .form-control {
    border: none;
    padding: 10px 16px;
    font-size: 14px;
    resize: none;
    min-height: 40px;
    max-height: 100px;
    background: #f8f9fa;
}

.chatbot-input .form-control:focus {
    box-shadow: none;
    background: white;
    border-color: #e91e63;
}

.chatbot-input .btn {
    border: none;
    background: #e91e63;
    color: white;
    padding: 10px 16px;
    transition: background-color 0.2s;
}

.chatbot-input .btn:hover {
    background: #d81b60;
}

.chatbot-input .btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

/* Responsive design */
@media (max-width: 768px) {
    .food-chatbot-container {
        width: calc(100vw - 40px);
        max-width: 350px;
        bottom: 10px;
        right: 10px;
    }
}

@media (max-width: 480px) {
    .food-chatbot-container {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        max-height: 400px;
    }
    
    .chatbot-messages {
        max-height: 250px;
    }
}

/* RTL Support for Hebrew */
[dir="rtl"] .food-chatbot-container {
    left: 20px;
    right: auto;
}

[dir="rtl"] .user-message {
    justify-content: flex-start;
}

[dir="rtl"] .bot-message {
    justify-content: flex-end;
}

[dir="rtl"] .user-message .message-content {
    border-bottom-left-radius: 4px;
    border-bottom-right-radius: 18px;
}

[dir="rtl"] .bot-message .message-content {
    border-bottom-right-radius: 4px;
    border-bottom-left-radius: 18px;
}

[dir="rtl"] .message-time {
    text-align: left;
}

/* Accessibility improvements */
.food-chatbot-container:focus-within {
    box-shadow: 0 8px 32px rgba(233, 30, 99, 0.2);
}

.chatbot-input .form-control:focus {
    outline: 2px solid #e91e63;
    outline-offset: -2px;
}

.message-suggestions .btn:focus {
    outline: 2px solid #e91e63;
    outline-offset: 2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .food-chatbot-container {
        border: 2px solid #000;
    }
    
    .bot-message .message-content {
        border: 2px solid #000;
    }
    
    .chatbot-input .form-control {
        border: 1px solid #000;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .message,
    .typing-indicator,
    .typing-dots span,
    .food-chatbot-container {
        animation: none;
        transition: none;
    }
}

/* Print styles */
@media print {
    .food-chatbot-container {
        display: none;
    }
}
