/* Scroll lock for body when chatbot is open */
body.scroll-locked {
    overflow: hidden !important;
}

/* Smooth scrolling for mobile input focus */
.chatlogs {
    scroll-behavior: smooth;
}

/* Enhanced mobile input handling */
@media screen and (max-width: 768px) {
    .chatbox {
        transition: none !important;
    }
    
    .chatlogs {
        scroll-behavior: auto; /* Faster scrolling on mobile for immediate response */
    }
    
    #chat-input:focus {
        scroll-margin-bottom: 20px;
    }
}

#chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

.chat-toggle-btn {
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    background: #0564b0;
    color: #fff;
    font-size: 24px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(102, 126, 234, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    margin-left: auto;
}

.chat-toggle-btn svg,
.chat-toggle-btn img {
    width: 32px;
    height: 32px;
    transition: transform 0.2s ease;
}


.chat-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(102, 126, 234, 0.4);
}

.chatbox {
    width: 380px;
    height: 600px;
    background: #fff;
    border-radius: 20px;
    margin-bottom: 15px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    text-align: left;
}

.chat-header h3 {
    margin: 0 0 8px 0;
    font-size: 24px;
    font-weight: 600;
}

.chat-header p {
    margin: 0;
    font-size: 16px;
    opacity: 0.9;
}

.chat-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px;
    overflow: hidden;
}

.faq-buttons {
    margin-bottom: 20px;
}

.faq-button {
    display: block;
    width: 100%;
    background: #fff;
    border: 2px solid #f0f2f5;
    color: #333;
    padding: 15px 20px;
    margin-bottom: 10px;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    position: relative;
}

.faq-button:hover {
    border-color: #667eea;
    background: #f8f9ff;
    color: #000000;
}

.faq-button::after {
    content: '›';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    color: #999;
}

.chat-input-section {
    border-top: 1px solid #f0f2f5;
    padding: 20px;
    background: #fff;
    position: relative;
}

.input-container {
    display: flex;
    align-items: center;
    position: relative;
}

.send-button {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: #667eea;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    color: white;
    cursor: pointer;
    font-size: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.send-button:hover {
    background: #5a67d8;
}

.send-button:disabled {
    background: #ccc;
    cursor: not-allowed;
}

.close-button {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: all 0.2s ease;
    z-index: 10;
    padding: 0;
}

.close-button:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.chat-with-ai {
    display: flex;
    align-items: center;
    background: #f8f9ff;
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chat-with-ai:hover {
    background: #667eea;
    color: white;
}

.chat-with-ai .icon {
    margin-right: 12px;
    font-size: 20px;
}

.chat-with-ai .text {
    flex: 1;
}

.chat-with-ai .main-text {
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 2px;
}

.chat-with-ai .sub-text {
    font-size: 12px;
    opacity: 0.7;
}

.chatlogs {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 15px;
    padding-right: 10px;
}

.chatlogs::-webkit-scrollbar {
    width: 4px;
}

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

.chatlogs::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

.chat-msg {
    margin: 10px 0;
    max-width: 85%;
    word-wrap: break-word;
}

.chat-msg.user {
    margin-left: auto;
    background: #667eea;
    color: white;
    padding: 12px 16px;
    border-radius: 20px 20px 4px 20px;
    font-size: 14px;
}

.chat-msg.bot {
    background: #f0f2f5;
    color: #333;
    padding: 12px 16px;
    border-radius: 20px 20px 20px 4px;
    font-size: 14px;
    line-height: 1.5;
    white-space: pre-line;
    font-weight: normal;
}

.chat-msg.bot p {
    margin: 0 0 10px 0;
    line-height: 1.5;
}

.chat-msg.bot p:last-child {
    margin-bottom: 0;
}

.chat-msg.bot br {
    margin-bottom: 8px;
}

.chat-msg.bot strong {
    font-weight: 600;
    color: #333;
}

#chat-input {
    width: 100%;
    padding: 12px 80px 12px 16px;
    border: 2px solid #f0f2f5;
    border-radius: 12px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    box-sizing: border-box;
}

#chat-input:focus {
    border-color: #667eea;
}

.chat-mode .faq-buttons {
    display: none;
}

.chat-mode .chat-input-section {
    display: block;
}

.faq-mode .chat-input-section {
    display: none;
}

.back-button {
    background: none;
    border: none;
    color: #667eea;
    font-size: 14px;
    cursor: pointer;
    margin-bottom: 15px;
    padding: 8px 0;
    display: none;
}

.chat-mode .back-button {
    display: block;
}

.powered-by {
    text-align: center;
    padding: 10px;
    font-size: 11px;
    color: #999;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.powered-by .logo {
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 3px;
    display: inline-block;
}

/* Typing animation */
.typing-indicator {
    background: #f0f2f5;
    color: #333;
    padding: 12px 16px;
    border-radius: 20px 20px 20px 4px;
    font-size: 14px;
    line-height: 1.4;
    max-width: 85%;
    margin: 10px 0;
    display: flex;
    align-items: center;
    display: inline-block;
}

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

.typing-dots span {
    height: 8px;
    width: 8px;
    background: #999;
    border-radius: 50%;
    display: inline-block;
    animation: typing 1.5s infinite;
}

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

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

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

.chat-msg.fade-in {
    animation: fadeIn 0.5s ease-in;
}

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

/* Responsive Design for Mobile */
@media screen and (max-width: 768px) {
    #chatbot-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
    }

    .chat-toggle-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
        position: fixed;
        bottom: 20px;
        right: 20px;
        left: auto;
    }

    .chat-toggle-btn svg,
    .chat-toggle-btn img {
        width: 26px;
        height: 26px;
    }

    .chatbox {
        /* width: calc(100vw - 20px);
        height: calc(100vh - 40px); */
        /* width: calc(100vw - 150px); */
        width: 100%;
        height: calc(100vh - 100px);
        max-width: 350px;
        margin-left: auto;
        max-height: 600px;
        border-radius: 15px;
        margin-bottom: 10px;
        position: fixed;
        bottom: 10px;
        right: 10px;
        left: 10px;
        z-index: 9;
    }

    /* Ensure smooth scrolling on mobile when input is focused */
    .chatbox.chat-mode {
        scroll-behavior: smooth;
    }

    .chatbox.chat-mode .chatlogs {
        scroll-behavior: smooth;
        scroll-snap-type: none;
    }

    .chat-header {
        padding: 15px;
    }

    .chat-header h3 {
        font-size: 20px;
        margin: 0 0 5px 0;
    }

    .chat-header p {
        font-size: 14px;
    }

    .chat-content {
        padding: 15px;
    }

    .faq-button {
        padding: 12px 15px;
        font-size: 13px;
        margin-bottom: 8px;
        border-radius: 10px;
    }

    .faq-button::after {
        right: 15px;
        font-size: 16px;
    }

    .chat-with-ai {
        padding: 12px;
        border-radius: 10px;
    }

    .chat-with-ai .main-text {
        font-size: 14px;
    }

    .chat-with-ai .sub-text {
        font-size: 11px;
    }

    .chat-with-ai .icon {
        font-size: 18px;
        margin-right: 10px;
    }

    .chat-msg {
        font-size: 13px;
        max-width: 90%;
        margin: 8px 0;
    }

    .chat-msg.user {
        padding: 10px 14px;
        border-radius: 18px 18px 4px 18px;
    }

    .chat-msg.bot {
        padding: 12px 16px;
        border-radius: 18px 18px 18px 4px;
        line-height: 1.6;
    }

    .chat-msg.bot p {
        margin: 0 0 8px 0;
    }

    .typing-indicator {
        padding: 10px 14px;
        border-radius: 18px 18px 18px 4px;
        font-size: 13px;
    }

    .typing-dots span {
        height: 6px;
        width: 6px;
    }

    #chat-input {
        padding: 10px 70px 10px 14px;
        font-size: 13px;
        border-radius: 10px;
    }

    .send-button {
        right: 6px;
        padding: 6px 10px;
        font-size: 11px;
    }

    .close-button {
        top: 12px;
        right: 12px;
        width: 26px;
        height: 26px;
        font-size: 14px;
    }

    .chat-input-section {
        padding: 15px;
    }

    .back-button {
        font-size: 13px;
        margin-bottom: 10px;
        padding: 6px 0;
    }

    .powered-by {
        padding: 8px;
        font-size: 10px;
    }

    .powered-by .logo {
        width: 14px;
        height: 14px;
    }

    .chatlogs {
        margin-bottom: 10px;
        padding-right: 8px;
    }
}
@media (max-width:576px) {
    .chatbox{
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        inset: 0;
        border-radius: 0;
        
    }
}
@media screen and (max-width: 480px) {
    /* .chatbox {
      
         width: 100%;
        height: calc(100vh - 150px); 
        max-width: 350px;
        border-radius: 12px;
        bottom: 5px;
        right: 5px;
        left: 5px;
    } */

    .chat-header {
        padding: 12px;
    }

    .chat-header h3 {
        font-size: 18px;
    }

    .chat-header p {
        font-size: 13px;
    }

    .chat-content {
        padding: 12px;
    }

    .faq-button {
        padding: 10px 12px;
        font-size: 12px;
        margin-bottom: 6px;
    }

    .chat-with-ai {
        padding: 10px;
    }

    .chat-with-ai .main-text {
        font-size: 13px;
    }

    .chat-with-ai .sub-text {
        font-size: 10px;
    }

    .chat-msg {
        font-size: 12px;
        margin: 6px 0;
    }

    .chat-msg.user,
    .chat-msg.bot,
    .typing-indicator {
        padding: 10px 14px;
        border-radius: 16px 16px 4px 16px;
    }

    .chat-msg.bot,
    .typing-indicator {
        border-radius: 16px 16px 16px 4px;
        line-height: 1.6;
    }

    .chat-msg.bot p {
        margin: 0 0 6px 0;
    }

    #chat-input {
        padding: 8px 60px 8px 12px;
        font-size: 12px;
    }

    .send-button {
        right: 5px;
        padding: 5px 8px;
        font-size: 10px;
    }

    .close-button {
        top: 10px;
        right: 10px;
        width: 24px;
        height: 24px;
        font-size: 12px;
    }

    .chat-input-section {
        padding: 12px;
    }

    .back-button {
        font-size: 12px;
    }
}

@media screen and (max-width: 320px) {
    .chat-toggle-btn {
        width: 45px;
        height: 45px;
        font-size: 18px;
    }

    .chat-toggle-btn svg,
    .chat-toggle-btn img {
        width: 22px;
        height: 22px;
    }

    .chat-header h3 {
        font-size: 16px;
    }

    .chat-header p {
        font-size: 12px;
    }

    .faq-button {
        font-size: 11px;
        padding: 8px 10px;
    }

    .chat-with-ai .main-text {
        font-size: 12px;
    }

    .chat-with-ai .sub-text {
        font-size: 9px;
    }

    .chat-msg {
        font-size: 11px;
    }

    #chat-input {
        font-size: 11px;
        padding: 8px 55px 8px 12px;
    }

    .send-button {
        padding: 4px 6px;
        font-size: 9px;
    }

    .close-button {
        width: 22px;
        height: 22px;
        font-size: 11px;
    }
}
