/* Chatbot Widget Styles */

#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    /* Ensure it's always visible on mobile */
    -webkit-tap-highlight-color: transparent;
}

.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: transform 0.3s;
    color: white;
    /* Ensure touch events work */
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    /* Always visible */
    visibility: visible !important;
    opacity: 1 !important;
}

.chatbot-toggle:hover {
    transform: scale(1.1);
}

.chatbot-toggle:active {
    transform: scale(0.95);
}

.chatbot-window {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 350px;
    height: 500px;
    max-height: 80vh;
    background-color: var(--white);
    border-radius: 15px;
    box-shadow: 0 5px 25px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 9998;
    /* Ensure proper rendering on mobile */
    -webkit-overflow-scrolling: touch;
}

.chatbot-window.hidden {
    display: none;
}

.chatbot-header {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%);
    color: var(--white);
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-header h3 {
    margin: 0;
    font-size: 1.2rem;
}

.chatbot-close {
    background: none;
    border: none;
    color: var(--white);
    font-size: 2rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.chatbot-close:hover {
    opacity: 0.8;
}

.chatbot-messages {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
    overflow-x: hidden;
    background-color: var(--neutral-light);
    /* Smooth scrolling on mobile */
    -webkit-overflow-scrolling: touch;
    /* Ensure messages are visible */
    min-height: 0;
}

.message {
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    max-width: 80%;
    word-wrap: break-word;
}

.message.user {
    background-color: var(--primary-green);
    color: var(--white);
    margin-left: auto;
    border-bottom-right-radius: 3px;
}

.message.bot {
    background-color: var(--white);
    color: var(--text-dark);
    border: 1px solid #ddd;
    border-bottom-left-radius: 3px;
}

.chatbot-input-container {
    display: flex;
    padding: 1rem;
    background-color: var(--white);
    border-top: 1px solid #ddd;
    gap: 0.5rem;
}

#chatbot-input {
    flex: 1;
    padding: 0.75rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    font-size: 0.9rem;
    outline: none;
    /* Prevent zoom on iOS */
    font-size: 16px;
    /* Better touch target */
    min-height: 44px;
}

#chatbot-input:focus {
    border-color: var(--primary-green);
}

#chatbot-send {
    background: linear-gradient(135deg, var(--primary-green) 0%, var(--secondary-green) 100%);
    color: var(--white);
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 20px;
    cursor: pointer;
    font-weight: 600;
    transition: transform 0.2s;
    /* Better touch target on mobile */
    min-height: 44px;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

#chatbot-send:hover {
    transform: scale(1.05);
}

#chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile Responsive - Tablets and below */
@media (max-width: 768px) {
    #chatbot-container {
        bottom: 15px;
        right: 15px;
        z-index: 9999;
    }
    
    .chatbot-toggle {
        width: 56px;
        height: 56px;
        box-shadow: 0 4px 15px rgba(0,0,0,0.4);
    }
    
    .chatbot-toggle svg {
        width: 22px;
        height: 22px;
    }
    
    .chatbot-window {
        position: fixed;
        width: calc(100vw - 20px);
        max-width: 400px;
        height: calc(100vh - 100px);
        max-height: 600px;
        right: 10px;
        left: auto;
        bottom: 80px;
        top: auto;
        border-radius: 15px;
    }
}

/* Mobile Responsive - Small phones (iPhone SE, etc.) */
@media (max-width: 480px) {
    #chatbot-container {
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-toggle {
        width: 56px;
        height: 56px;
        /* Make it more prominent on small screens */
        box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    }
    
    .chatbot-toggle svg {
        width: 22px;
        height: 22px;
    }
    
    .chatbot-window {
        position: fixed;
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        max-height: 70vh;
        right: 15px;
        left: 15px;
        bottom: 80px;
        top: auto;
        border-radius: 15px;
    }
    
    .chatbot-header h3 {
        font-size: 1rem;
    }
    
    .chatbot-close {
        font-size: 1.8rem;
        width: 32px;
        height: 32px;
    }
    
    .chatbot-input-container {
        padding: 0.75rem;
    }
    
    #chatbot-send {
        padding: 0.75rem 1.25rem;
        font-size: 0.85rem;
    }
}

/* iPhone 14 Pro Max and similar large phones (428px width) */
@media (max-width: 428px) {
    .chatbot-window {
        width: calc(100vw - 20px);
        right: 10px;
        left: 10px;
        height: calc(100vh - 90px);
        max-height: 75vh;
    }
}

/* Very small screens */
@media (max-width: 360px) {
    .chatbot-toggle {
        width: 52px;
        height: 52px;
    }
    
    .chatbot-window {
        width: calc(100vw - 20px);
        height: calc(100vh - 85px);
        max-height: 70vh;
    }
}

