/* Niche Chatbot - Responsive Styles */

/* Base reset for the container */
#chatbot-container {
    border: 1px solid #ccc;
    border-radius: 12px;
    background: #f9f9f9;
    overflow: hidden;
    margin: 20px auto;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

/* Make width fluid: almost full on mobile, capped on desktop */
#chatbot-container {
    width: 90%;
    max-width: 500px;          /* comfortable max on large screens */
    min-width: 280px;          /* prevent too narrow on tiny phones */
}

/* Chat log: flexible height using viewport units + min/max */
#chat-log {
    height: 50vh;              /* ~half screen on mobile */
    max-height: 400px;         /* cap on desktop */
    min-height: 200px;
    overflow-y: auto;
    padding: 12px;
    background: #fff;
    border-bottom: 1px solid #ddd;
    scroll-behavior: smooth;
}

/* Messages styling */
#chat-log p {
    margin: 8px 0;
    padding: 10px 14px;
    border-radius: 18px;
    line-height: 1.4;
    max-width: 85%;
    word-wrap: break-word;
}

#chat-log p strong {
    font-weight: 600;
}

/* User messages right-aligned, bot left */
#chat-log p:nth-child(odd) {   /* assuming user is odd */
    background: #007bff;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

#chat-log p:nth-child(even) {  /* bot even */
    background: #e9ecef;
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

/* Input area: flex for better mobile layout */
#chatbot-container form, 
#user-input-wrapper {          /* wrap input + button if needed */
    display: flex;
    padding: 10px;
    gap: 8px;
    background: #fff;
}

#user-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ccc;
    border-radius: 24px;
    font-size: 16px;           /* good touch target size */
    outline: none;
}

#send-btn {
    padding: 12px 20px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 24px;
    font-size: 16px;
    cursor: pointer;
    transition: background 0.2s;
}

#send-btn:hover {
    background: #0056b3;
}

/* Media Queries for finer tuning */
@media (max-width: 480px) {    /* small phones */
    #chatbot-container {
        margin: 12px auto;
        border-radius: 0;      /* full-width feel on mobile */
        box-shadow: none;
    }
    
    #chat-log {
        height: 45vh;          /* more space for keyboard */
        padding: 10px;
    }
    
    #user-input, #send-btn {
        font-size: 15px;
        padding: 10px 14px;
    }
}

@media (min-width: 768px) {    /* tablets & up */
    #chat-log {
        height: 60vh;
        max-height: 500px;
    }
    
    #chatbot-container {
        max-width: 520px;
    }
}

/* Accessibility & touch improvements */
#user-input:focus,
#send-btn:focus {
    outline: 2px solid #007bff;
    outline-offset: 2px;
}

/* Smooth scrolling on iOS/Android */
#chat-log::-webkit-scrollbar {
    width: 6px;
}
#chat-log::-webkit-scrollbar-thumb {
    background: #aaa;
    border-radius: 3px;
}