/* Chatbot Widget Styles */
.chatbot-widget {
    position: fixed;
    bottom: 90px;
    right: 20px;
    z-index: 9999;
    font-family: 'Inter', 'Segoe UI', sans-serif;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 24px;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(40, 167, 69, 0.5);
}

.chatbot-toggle i {
    transition: transform 0.3s ease;
}

.chatbot-toggle.active i {
    transform: rotate(180deg);
}

.chatbot-container {
    position: fixed;
    bottom: 160px;
    right: 20px;
    width: 380px;
    max-width: calc(100vw - 40px);
    height: 550px;
    max-height: calc(100vh - 200px);
    background: white;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chatbot-container.active {
    display: flex;
}

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

.chatbot-header {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.chatbot-action-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    font-size: 14px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: all 0.3s ease;
    font-weight: 500;
}

.chatbot-action-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    flex-shrink: 0;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid white;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.chatbot-title h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #FFD700;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    transition: transform 0.2s;
}

.chatbot-close:hover {
    transform: rotate(90deg);
}

.chatbot-messages {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

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

.message {
    display: flex;
    gap: 10px;
    animation: messageSlide 0.3s ease;
}

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

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

.message-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 18px;
}

.message.bot .message-avatar {
    overflow: hidden;
    border: 2px solid #28a745;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.message.user .message-avatar {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
}

.message-content {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 15px;
    word-wrap: break-word;
    line-height: 1.5;
}

.message.bot .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 5px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message.user .message-content {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border-bottom-right-radius: 5px;
}

.message-time {
    font-size: 11px;
    opacity: 0.6;
    margin-top: 5px;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 12px 16px;
    background: white;
    border-radius: 15px;
    width: fit-content;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #28a745;
    animation: typing 1.4s infinite;
}

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

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

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

.quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
}

.quick-reply-btn {
    background: white;
    border: 2px solid #28a745;
    color: #28a745;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.quick-reply-btn:hover {
    background: #28a745;
    color: white;
    transform: translateY(-2px);
}

.chatbot-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: flex;
    gap: 10px;
    align-items: center;
}

.mic-button {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 16px;
}

.mic-button:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.mic-button.listening {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    animation: pulse-mic 1s infinite;
}

@keyframes pulse-mic {
    0%, 100% {
        transform: scale(1);
        box-shadow: 0 4px 15px rgba(240, 147, 251, 0.4);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 0 6px 20px rgba(240, 147, 251, 0.6);
    }
}

.chatbot-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
    font-family: 'Inter', sans-serif;
}

.chatbot-input:focus {
    border-color: #28a745;
}

.chatbot-send-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 16px;
}

.chatbot-send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
}

.chatbot-send-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.welcome-message {
    text-align: center;
    padding: 20px;
    color: #666;
}

.welcome-message h4 {
    color: #28a745;
    margin-bottom: 10px;
    font-size: 18px;
}

.welcome-message p {
    font-size: 14px;
    margin-bottom: 15px;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .chatbot-container {
        width: calc(100vw - 20px);
        height: calc(100vh - 180px);
        right: 10px;
        bottom: 80px;
    }
    
    .chatbot-toggle {
        right: 10px;
        bottom: 80px;
    }
}

/* Product Cards in Chat */
.chat-product-card {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 12px;
    margin: 8px 0;
}

.chat-order-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Action Buttons for Agentic Chatbot */
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.action-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 10px 18px;
    border-radius: 25px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(40, 167, 69, 0.2);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.action-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.4);
    background: linear-gradient(135deg, #20c997, #28a745);
}

.action-btn:active {
    transform: translateY(0);
}

.action-message {
    font-weight: 600;
    color: #28a745;
    margin-bottom: 8px;
    font-size: 15px;
}

/* Highlight animation for scrolled sections */
@keyframes sectionHighlight {
    0% {
        box-shadow: 0 0 0 rgba(46, 125, 50, 0);
    }
    50% {
        box-shadow: 0 0 30px rgba(46, 125, 50, 0.5);
    }
    100% {
        box-shadow: 0 0 0 rgba(46, 125, 50, 0);
    }
}

/* Product Gallery Styles */
.chat-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.chat-gallery-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    border: 2px solid #e0e0e0;
    transition: all 0.3s ease;
}

.chat-gallery-card:hover {
    border-color: #28a745;
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(40, 167, 69, 0.2);
}

.chat-gallery-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 8px;
    margin-bottom: 8px;
    display: block;
}

.chat-gallery-card h4 {
    font-size: 14px;
    margin: 8px 0;
    color: #333;
    font-weight: 600;
}

.chat-gallery-desc {
    font-size: 11px;
    color: #666;
    margin: 5px 0;
    line-height: 1.3;
}

.chat-gallery-price {
    font-size: 16px;
    font-weight: 700;
    color: #28a745;
    margin: 8px 0;
}

.chat-gallery-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 12px;
    cursor: pointer;
    width: 100%;
    transition: all 0.3s ease;
    font-weight: 500;
}

.chat-gallery-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Product Cards in Chat (continued) */
.chat-product-card h5 {
    color: #28a745;
    font-size: 14px;
    margin: 0 0 8px 0;
}

.chat-product-card p {
    font-size: 13px;
    margin: 4px 0;
    color: #666;
}

.chat-product-price {
    color: #FFD700;
    font-weight: 600;
    font-size: 16px;
}

.chat-order-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 13px;
    cursor: pointer;
    margin-top: 8px;
    width: 100%;
    transition: all 0.3s ease;
}

.chat-order-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

/* Cow photo avatar */
.avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    display: block;
}

/* Agent actions performed on the website */
.agent-note {
    align-self: center;
    margin: 4px auto 12px;
    padding: 6px 12px;
    border-radius: 999px;
    background: #fff8e8;
    border: 1px solid #f6c453;
    color: #6b4a07;
    font-size: 12px;
    font-weight: 600;
    text-align: center;
    max-width: 90%;
    width: fit-content;
}

/* Markdown inside bot replies */
.message-content p { margin: 0 0 8px; }
.message-content p:last-of-type { margin-bottom: 0; }
.message-content ul, .message-content ol { margin: 6px 0 8px; padding-left: 20px; }
.message-content li { margin: 2px 0; }
.message-content a { color: #1f7a3a; text-decoration: underline; word-break: break-word; }
.message-content h1, .message-content h2, .message-content h3, .message-content h4 { font-size: 15px; margin: 8px 0 4px; }
.message-content table { border-collapse: collapse; font-size: 13px; margin: 6px 0; }
.message-content th, .message-content td { border: 1px solid #e0e0e0; padding: 4px 8px; }
.message-content code { background: #f1f1f1; padding: 1px 4px; border-radius: 4px; }
