/* Premium Glassmorphism Chatbot Styles */
.chatbot-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(5px);
    z-index: 9998;
    display: none;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.chatbot-overlay.active {
    display: block;
    opacity: 1;
}

.chatbot-container {
    position: fixed;
    bottom: 40px;
    left: 40px;
    z-index: 9999;
    font-family: "Inter", sans-serif;
}

.chatbot-toggle {
    width: 65px;
    height: 65px;
    border-radius: 50%;
    background: linear-gradient(135deg, #fe740d 0%, #ff3e76 100%);
    box-shadow: 0 10px 30px rgba(254, 116, 13, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: none;
    color: white;
    font-size: 32px;
}

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

.chatbot-window {
    position: absolute;
    bottom: 85px;
    left: 0;
    width: 380px;
    height: 550px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(15px);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    display: none;
    flex-direction: column;
    overflow: hidden;
    transform-origin: bottom left;
    transition: all 0.4s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.chatbot-window.active {
    display: flex;
    animation: slideUpFade 0.4s ease-out;
}

@keyframes slideUpFade {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.9);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.chatbot-header {
    background: linear-gradient(135deg, #000324 0%, #000a4d 100%);
    padding: 18px 22px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chatbot-header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.chatbot-avatar {
    width: 45px;
    height: 45px;
    background: #fff;
    border-radius: 50%;
    padding: 4px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.chatbot-header-info h4 {
    margin: 0;
    font-size: 17px;
    font-weight: 700;
}

.chatbot-header-info span {
    font-size: 12px;
    color: #4caf50;
    display: flex;
    align-items: center;
    gap: 4px;
}

.chatbot-header-info span::before {
    content: "";
    width: 8px;
    height: 8px;
    background: #4caf50;
    border-radius: 50%;
}

.chatbot-menu-toggle {
    background: transparent;
    border: none;
    color: white;
    font-size: 22px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s;
}

.chatbot-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
}

.chatbot-menu-dropdown {
    position: absolute;
    top: 65px;
    right: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    z-index: 10000;
    min-width: 140px;
    overflow: hidden;
    border: 1px solid #eee;
}

.chatbot-menu-dropdown.active {
    display: flex;
}

.chatbot-menu-dropdown button {
    padding: 12px 16px;
    border: none;
    background: transparent;
    text-align: left;
    font-size: 14px;
    cursor: pointer;
    transition: background 0.2s;
    color: #333;
}

.chatbot-menu-dropdown button:hover {
    background: #f8f9fa;
}

.chatbot-messages {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: #f4f7f9;
}

.message {
    max-width: 85%;
    padding: 14px 18px;
    border-radius: 20px;
    font-size: 14.5px;
    line-height: 1.6;
    animation: messageIn 0.4s ease-out;
}

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

.message.bot {
    background: white;
    color: #2c3e50;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.message.user {
    background: linear-gradient(135deg, #fe740d 0%, #ff5e3a 100%);
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    box-shadow: 0 4px 15px rgba(254, 116, 13, 0.2);
}

.chatbot-typing {
    display: none;
    align-self: flex-start;
    padding: 10px 15px;
    background: white;
    border-radius: 20px;
    gap: 5px;
}

.chatbot-typing span {
    width: 6px;
    height: 6px;
    background: #fe740d;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out;
}

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

@keyframes typingBounce {
    0%,
    80%,
    100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-6px);
    }
}

.chatbot-options {
    display: flex;
    flex-wrap: wrap; /* Allow wrapping */
    gap: 6px; /* Smaller gap */
    margin-top: 8px;
    max-width: 100%;
}

.option-btn {
    background: white;
    border: 1px solid #fe740d;
    color: #fe740d;
    padding: 6px 12px; /* Smaller padding */
    border-radius: 20px; /* Pill shape */
    font-size: 12.5px; /* Smaller font */
    cursor: pointer;
    transition: all 0.2s ease;
    font-weight: 500;
    text-align: center; /* Center text */
    flex: 0 1 auto; /* Allow sizing based on content */
    box-shadow: 0 2px 5px rgba(254, 116, 13, 0.05);
}

.option-btn:hover {
    background: #fe740d;
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(254, 116, 13, 0.2);
}

.option-btn.selected {
    background: #fe740d;
    color: white;
    cursor: default;
    opacity: 0.8;
}

.option-btn.disabled {
    pointer-events: none;
    opacity: 0.5;
    background: #f5f5f5;
    border-color: #ddd;
    color: #999;
}

.chatbot-input-area {
    padding: 18px;
    background: white;
    border-top: 1px solid #eff2f5;
    display: none;
}

.chatbot-input-area.active {
    display: flex;
    gap: 12px;
}

.chatbot-input-area input {
    flex: 1;
    border: 1.5px solid #e1e8ed;
    padding: 12px 20px;
    border-radius: 30px;
    outline: none;
    font-size: 14.5px;
    transition: border-color 0.3s;
}

.chatbot-input-area input:focus {
    border-color: #fe740d;
}

.chatbot-input-area input.error {
    border-color: #ff3e76;
    animation: shake 0.5s linear;
}

@keyframes shake {
    0%,
    100% {
        transform: translateX(0);
    }
    25% {
        transform: translateX(-5px);
    }
    75% {
        transform: translateX(5px);
    }
}

.send-btn {
    background: #fe740d;
    color: white;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: transform 0.2s;
}

.send-btn:hover {
    transform: scale(1.05);
}

/* Scrollbar styles for messages */
.chatbot-messages::-webkit-scrollbar {
    width: 4px;
}
.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}
.chatbot-messages::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 10px;
}

/* Notification Dot */
.chatbot-toggle::after {
    content: "";
    position: absolute;
    top: 5px;
    right: 5px;
    width: 14px;
    height: 14px;
    background: #4caf50;
    border: 2.5px solid white;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0.7);
    }
    70% {
        transform: scale(1);
        box-shadow: 0 0 0 10px rgba(76, 175, 80, 0);
    }
    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(76, 175, 80, 0);
    }
}

/* Welcome Tooltip */
.chatbot-welcome-tooltip {
    position: absolute;
    bottom: 85px;
    left: 0;
    background: white;
    color: #333;
    padding: 12px 18px;
    border-radius: 14px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    animation: floatTooltip 3s ease-in-out infinite;
    border: 1px solid #eee;
    z-index: 9997;
    display: none;
}

.chatbot-welcome-tooltip::after {
    content: "";
    position: absolute;
    bottom: -8px;
    left: 25px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

@keyframes floatTooltip {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.chatbot-welcome-tooltip.active {
    display: block;
    animation:
        slideUpFade 0.4s ease-out,
        floatTooltip 3s ease-in-out infinite 0.4s;
}

@media (max-width: 576px) {
    .chatbot-container {
        left: 20px;
        bottom: 20px;
    }
    .chatbot-window {
        width: calc(100vw - 40px);
        height: 75vh;
        bottom: 80px;
    }
    .chatbot-welcome-tooltip {
        bottom: 75px;
    }
}
