/* Chatbot Button */
.chatbot-button {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 65px;
    height: 65px;
    /* background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); */
    background: transparent;
    border-radius: 0;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: white;
    box-shadow: none;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 1000;
    animation: none;
}

@keyframes pulse {
    0% {
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    }

    50% {
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.6), 0 0 0 10px rgba(102, 126, 234, 0.1);
    }

    100% {
        box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
    }
}

.chatbot-button:hover {
    transform: scale(1.1);
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.6);
}

.chatbot-button.active {
    transform: scale(0.9);
    background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%);
}

/* Notification Badge */
.notification-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    animation: bounce 1s infinite;
}

@keyframes bounce {

    0%,
    20%,
    50%,
    80%,
    100% {
        transform: translateY(0);
    }

    40% {
        transform: translateY(-10px);
    }

    60% {
        transform: translateY(-5px);
    }
}

/* Chatbot Container */
.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 25px;
    /* Use viewport units with max constraints for better responsiveness */
    width: min(480px, 90vw);
    height: min(620px, 85vh);
    max-height: calc(100vh - 120px);
    /* Ensure it doesn't exceed viewport */
    max-width: calc(100vw - 50px);
    /* Prevent horizontal cutoff */
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
    transform: translateY(100%) scale(0.8);
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 999;
    overflow: hidden;
}

.chatbot-container.show {
    transform: translateY(0) scale(1);
    opacity: 1;
    visibility: visible;
}

/* Chatbot Header */
.chatbot-header {
    background: linear-gradient(135deg, #2b8631ff 0%, #2b8631ff 100%);
    color: white;
    padding: 20px;
    position: relative;
    overflow: hidden;
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100"><circle cx="20" cy="20" r="2" fill="white" opacity="0.1"/><circle cx="80" cy="40" r="1.5" fill="white" opacity="0.1"/><circle cx="40" cy="80" r="1" fill="white" opacity="0.1"/></svg>');
    pointer-events: none;
}

.chatbot-header h3 {
    font-size: 18px;
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-header p {
    font-size: 14px;
    opacity: 0.9;
}

.status-indicator {
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
    display: inline-block;
    animation: blink 1.5s infinite;
}

@keyframes blink {

    0%,
    50% {
        opacity: 1;
    }

    51%,
    100% {
        opacity: 0.3;
    }
}

.close-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(90deg);
}

/* Chat Messages */
.chat-messages {
    height: calc(100% - 180px);
    overflow-y: auto;
    padding: 20px;
    background: #f8f9fa;
    background-image:
        radial-gradient(circle at 1px 1px, rgba(102, 126, 234, 0.05) 1px, transparent 0);
    background-size: 20px 20px;
}

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

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #667eea;
    border-radius: 10px;
}

.message {
    margin-bottom: 15px;
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    animation: slideUp 0.3s ease;
    position: relative;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.bot-message {
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
    margin-right: auto;
    border-bottom-left-radius: 8px;
}

.user-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 8px;
}

.message::before {
    content: '';
    position: absolute;
    width: 0;
    height: 0;
}

.bot-message::before {
    bottom: 0;
    left: -8px;
    border: 8px solid transparent;
    border-bottom-color: #bbdefb;
    border-left: none;
}

.user-message::before {
    bottom: 0;
    right: -8px;
    border: 8px solid transparent;
    border-bottom-color: #764ba2;
    border-right: none;
}

/* Category Buttons */
.category-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin: 10px 0;
}

.category-btn,
.question-btn,
.action-btn {
    padding: 10px 14px;
    border: 2px solid #667eea;
    background: white;
    color: #667eea;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 13px;
    text-align: left;
    position: relative;
    overflow: hidden;
}

.category-btn::before,
.question-btn::before,
.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(102, 126, 234, 0.1), transparent);
    transition: left 0.5s ease;
}

.category-btn:hover::before,
.question-btn:hover::before,
.action-btn:hover::before {
    left: 100%;
}

.category-btn:hover,
.question-btn:hover,
.action-btn:hover {
    background: #667eea;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.3);
}

.action-btn {
    background: #4caf50;
    border-color: #4caf50;
    color: white;
    margin: 3px;
}

.action-btn:hover {
    background: #45a049;
    box-shadow: 0 8px 25px rgba(76, 175, 80, 0.3);
}

.back-btn {
    background: #ff9800;
    border-color: #ff9800;
    color: white;
}

.back-btn:hover {
    background: #f57c00;
    box-shadow: 0 8px 25px rgba(255, 152, 0, 0.3);
}

.chatbot-btn {
    background: linear-gradient(135deg, #9c27b0 0%, #673ab7 100%);
    border-color: #9c27b0;
    color: white;
    font-weight: bold;
    padding: 12px;
    border-radius: 12px;
    cursor: pointer;
    text-align: center;
    margin: 8px 0;
    width: 100%;
}

.chatbot-btn:hover {
    background: linear-gradient(135deg, #7b1fa2 0%, #512da8 100%);
    box-shadow: 0 8px 25px rgba(156, 39, 176, 0.3);
}

/* Chat Input */
.chat-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e0e0e0;
    display: none;
}

.chat-input-wrapper {
    display: flex;
    gap: 10px;
    align-items: center;
}

.chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid #e0e0e0;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.send-btn {
    background: linear-gradient(135deg, rgb(255, 255, 255) 0%, rgb(255, 255, 255) 100%);
    color: white;
    border: none;
    border-radius: 50%;
    width: 45px;
    height: 45px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}

.send-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.4);
}

/* Typing Indicator */
.typing-indicator {
    display: none;
    padding: 12px 16px;
    background: linear-gradient(135deg, #e3f2fd 0%, #bbdefb 100%);
    border: 1px solid #90caf9;
    border-radius: 18px;
    margin-right: auto;
    margin-bottom: 15px;
    max-width: 80px;
    border-bottom-left-radius: 8px;
}

.typing-dots {
    display: flex;
    gap: 4px;
    justify-content: center;
}

.typing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

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

@keyframes typing {

    0%,
    80%,
    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    40% {
        transform: scale(1.2);
        opacity: 1;
    }
}

/* Answer Box */
.answer-box {
    background: linear-gradient(135deg, #f0f8ff 0%, #e3f2fd 100%);
    border: 2px solid #667eea;
    border-radius: 12px;
    padding: 16px;
    margin: 10px 0;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.1);
    overflow-wrap: break-word;
    word-break: break-word;
    max-width: 100%;
}

.answer-box h3 {
    color: #667eea;
    margin-bottom: 8px;
    font-size: 16px;
}

.answer-box p {
    line-height: 1.6;
    color: #333;
    font-size: 14px;
}

/* Loading Animation */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(360deg);
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .chatbot-container {
        width: 100%;
        height: 100%;
        bottom: 0;
        right: 0;
        border-radius: 0;
        transform: translateY(100%);
    }

    .chatbot-container.show {
        transform: translateY(0);
    }

    .chat-messages {
        height: calc(100vh - 180px);
    }

    .main-content h1 {
        font-size: 2rem;
    }

    .main-content p {
        font-size: 1rem;
    }

    /* .chatbot-button{
        display: none;
    } */
}

@media (min-width: 1440px) {
    .chatbot-button {
        position: fixed;
        bottom: 25px;
        right: min(345px, 25vw);
        width: 65px;
        height: 65px;
        background: transparent;
        border-radius: 0;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        color: white;
        box-shadow: none;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        z-index: 1000;
        animation: none;
    }

    /* Chatbot Container */
    .chatbot-container {
        position: fixed;
        bottom: 100px;
        right: min(365px, 26vw);
        width: min(380px, 26vw);
        height: min(570px, 80vh);
        max-height: calc(100vh - 120px);
        max-width: calc(100vw - 385px);
        background: white;
        border-radius: 20px;
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
        transform: translateY(100%) scale(0.8);
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        z-index: 999;
        overflow: hidden;
    }
}

@media (min-width: 1024px) and (max-width: 1439px) {
    .chatbot-button {
        position: fixed;
        bottom: 25px;
        right: min(110px, 10vw);
        width: 65px;
        height: 65px;
        background: transparent;
        border-radius: 0;
        border: none;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 24px;
        color: white;
        box-shadow: none;
        transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        z-index: 1000;
        animation: none;
    }

    /* Chatbot Container */
    .chatbot-container {
        position: fixed;
        bottom: 100px;
        right: min(165px, 13vw);
        width: min(380px, 35vw);
        height: min(570px, 80vh);
        max-height: calc(100vh - 120px);
        max-width: calc(100vw - 185px);
        background: white;
        border-radius: 20px;
        box-shadow: 0 25px 50px rgba(0, 0, 0, 0.2);
        transform: translateY(100%) scale(0.8);
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        z-index: 999;
        overflow: hidden;
    }
}

/* Improved Animations */
.fade-in {
    animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.scale-in {
    animation: scaleIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleIn {
    from {
        transform: scale(0.8);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}