/* AI Chatbot/styles.css (Updated and Improved) */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap');

:root {
    --user-bubble-color: #007bff;
    --bot-bubble-color: #f1f0f0;
    --background-color: #e9ebee;
    --container-bg: #ffffff;
    --text-color-dark: #212529;
    --text-color-light: #ffffff;
    --header-bg: linear-gradient(135deg, #6a11cb 0%, #2575fc 100%);
}

* {
    box-sizing: border-box;
    scrollbar-width: thin;
    scrollbar-color: #c5c5c5 var(--background-color);
}

body {
    font-family: "Poppins", system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
    /* BACKGROUND KA CODE YAHAN REHNE DEIN */
    background-color: #e2e8f0; 
    color: var(--text-dark);
    display: flex;
    justify-content: center;
    align-items: center;
    
    /* YAHAN FIX KIYA GAYA HAI: Height ko dvh se badla gaya */
    height: 100dvh; 
    min-height: 100vh; /* Fallback */
    
    padding: 1rem;
    overflow: hidden;
    position: relative;
}

.chat-container {
    width: 450px;
    max-width: 95%;
    height: 95dvh; /* Stable height set karein */
    height: 95vh; /* Fallback for older browsers */
    max-height: 700px;
    background: var(--container-bg);
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    border: 1px solid #dee2e6;
}

header {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    background: var(--header-bg);
    color: var(--text-color-light);
    flex-shrink: 0;
}

.avatar {
    width: 45px;
    height: 45px;
    border-radius: 50%;
    margin-right: 1rem;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.chat-header-info h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 600;
}

.chat-header-info span {
    font-size: 0.85rem;
    opacity: 0.9;
}

.chat-window {
    flex: 1;
    overflow: auto;
    padding: 1rem;
    background-color: var(--background-color);
    display: flex;
    flex-direction: column;
}

.message {
    margin: 0.5rem 0;
    display: flex;
    align-items: flex-end;
    max-width: 85%;
}

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

.message.bot {
    align-self: flex-start;
}

.message .bubble-container {
    display: flex;
    flex-direction: column;
}

.bubble {
    padding: 0.8rem 1rem;
    border-radius: 18px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
    line-height: 1.6;
    word-wrap: break-word;
}

.user .bubble {
    background: var(--user-bubble-color);
    color: var(--text-color-light);
    border-bottom-right-radius: 4px;
}

.bot .bubble {
    background: var(--bot-bubble-color);
    color: var(--text-color-dark);
    border-bottom-left-radius: 4px;
}

/* Styling for Markdown content from Bot */
.bot .bubble p {
    margin: 0 0 0.5rem 0;
}
.bot .bubble ul, .bot .bubble ol {
    padding-left: 1.2rem;
}
.bot .bubble li {
    margin-bottom: 0.25rem;
}
.bot .bubble strong {
    font-weight: 600;
}
.bot .bubble a {
    color: var(--user-bubble-color);
    text-decoration: underline;
}

.typing-indicator {
    display: flex;
    align-items: center;
    padding: 10px 12px;
}
.typing-indicator span {
    height: 8px;
    width: 8px;
    background-color: #9ca3af;
    border-radius: 50%;
    display: inline-block;
    margin: 0 2px;
    animation: bounce 1.4s infinite ease-in-out both;
}
.typing-indicator span:nth-child(2) { animation-delay: -0.16s; }
.typing-indicator span:nth-child(3) { animation-delay: -0.32s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1.0); }
}

.chat-form {
    display: flex;
    padding: 1rem;
    background: var(--container-bg);
    border-top: 1px solid #dee2e6;
    flex-shrink: 0;
    gap: 0.5rem;
}

#message-input {
    flex: 1;
    padding: 0.75rem 1rem;
    border-radius: 24px;
    border: 1px solid #ced4da;
    font-size: 1rem;
    background-color: #f8f9fa;
    color: var(--text-color-dark);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

#message-input:focus {
    border-color: #86b7fe;
    box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}

#send-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    background: var(--user-bubble-color);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
}

#send-btn:hover {
    background: #0056b3;
}
#send-btn:active {
    transform: scale(0.95);
}
/* --- Mobile Layout Fixes for Keyboard --- */
@media (max-width: 480px) {
    .chat-container {
        width: 100%;
        height: 100dvh; /* Mobile par poori screen height dega */
        height: 100vh; /* Fallback */
        margin: 0;
        border-radius: 0;
    }
    
    /* 2. Input/Type Bar (chat-form) ko bottom par fixed karein */
    .chat-form {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 9999; /* Isse yeh hamesha sabse upar rahega */
        background: var(--container-bg); /* Thoda solid background de dein */
        border-top: 1px solid #dee2e6;
        padding: 10px; /* Purana padding */

        /* Yahi woh line hai jo mobile OS ke home bar ke liye extra space degi */
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 10px)); 
    }
    
   
    .chat-window {
         padding-bottom: 100px !important;
            }
}