/* Chatbot Styles with Enhanced Highlights */
.chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 1000;
    font-family: 'DM Sans', sans-serif;
}

/* Pulsing notification badge */
.chatbot-notification {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    background: #ff4757;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: bold;
    animation: pulse 2s infinite;
    box-shadow: 0 0 0 0 rgba(255, 71, 87, 0.7);
}

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

.chatbot-toggle {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #086AD8 0%, #1E90FF 100%);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    position: relative;
    animation: float 3s ease-in-out infinite;
}

/* Floating animation for the button */
@keyframes float {
    0%, 100% {
        transform: translateY(0px);
    }
    50% {
        transform: translateY(-10px);
    }
}

/* Glowing effect */
.chatbot-toggle::before {
    content: '';
    position: absolute;
    top: -2px;
    left: -2px;
    right: -2px;
    bottom: -2px;
    background: linear-gradient(135deg, #086AD8 0%, #1E90FF 100%);
    border-radius: 50%;
    z-index: -1;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chatbot-toggle:hover::before {
    opacity: 0.7;
    animation: glow 1.5s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        box-shadow: 0 0 20px rgba(29, 48, 134, 0.5);
    }
    to {
        box-shadow: 0 0 30px rgba(29, 48, 134, 0.8);
    }
}

.chatbot-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle svg {
    width: 24px;
    height: 24px;
    color: white;
}

.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 10px;
    width: 400px;
    height: 560px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

.chatbot-window.active {
    display: flex;
}

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

.chatbot-header {
    background: linear-gradient(135deg, #086AD8 0%, #1E90FF 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    animation: headerGlow 3s ease-in-out infinite;
    border-radius: 15px 15px 0 0;
    box-shadow: 0 10px 30px -10px rgba(8, 106, 216, 0.3);
}

.chatbot-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    animation: headerShimmer 4s ease-in-out infinite;
}

.chatbot-header::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: 
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        radial-gradient(circle at 80% 80%, rgba(255, 255, 255, 0.1) 1px, transparent 1px),
        radial-gradient(circle at 40% 60%, rgba(255, 255, 255, 0.1) 1px, transparent 1px);
    background-size: 50px 50px, 30px 30px, 40px 40px;
    animation: floatingParticles 6s ease-in-out infinite;
    pointer-events: none;
}

@keyframes floatingParticles {
    0%, 100% {
        transform: translateY(0px);
        opacity: 0.3;
    }
    50% {
        transform: translateY(-5px);
        opacity: 0.6;
    }
}

@keyframes headerGlow {
    0%, 100% {
        box-shadow: 0 0 20px rgba(29, 48, 134, 0.3);
    }
    50% {
        box-shadow: 0 0 30px rgba(29, 48, 134, 0.6), 0 0 40px rgba(101, 130, 225, 0.4);
    }
}

@keyframes headerShimmer {
    0% {
        left: -100%;
    }
    50% {
        left: 100%;
    }
    100% {
        left: 100%;
    }
}

.chatbot-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    z-index: 2;
    animation: textGlow 4s ease-in-out infinite;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
    letter-spacing: 0.3px;
}

@keyframes textGlow {
    0%, 100% {
        text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
    }
    50% {
        text-shadow: 0 0 10px rgba(255, 255, 255, 0.6), 0 0 20px rgba(29, 48, 134, 0.4);
    }
}

.ai-icon {
    width: 20px;
    height: 20px;
    animation: aiPulse 2s ease-in-out infinite, aiRotate 8s linear infinite, aiGlow 3s ease-in-out infinite;
    filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
}

@keyframes aiPulse {
    0%, 100% {
        transform: scale(1);
        opacity: 1;
    }
    50% {
        transform: scale(1.15);
        opacity: 0.9;
    }
}

@keyframes aiRotate {
    0% {
        transform: rotate(0deg);
    }
    100% {
        transform: rotate(360deg);
    }
}

@keyframes aiGlow {
    0%, 100% {
        filter: drop-shadow(0 0 5px rgba(255, 255, 255, 0.5));
    }
    50% {
        filter: drop-shadow(0 0 15px rgba(255, 255, 255, 0.8)) drop-shadow(0 0 25px rgba(29, 48, 134, 0.6));
    }
}

.chatbot-close {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    font-size: 18px;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
}

.chatbot-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: white;
    border-radius: 0 0 15px 15px;
    scrollbar-width: auto;
    scrollbar-color: rgba(8, 106, 216, 0.4) #f1f3f4;
}

/* Custom scrollbar styling */
.chatbot-messages::-webkit-scrollbar {
    width: 8px;
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-track {
    background: rgba(241, 243, 244, 0.3);
    border-radius: 4px;
    margin: 8px 0;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(8, 106, 216, 0.5), rgba(8, 106, 216, 0.7));
    border-radius: 4px;
    border: 1px solid white;
    min-height: 20px;
}

.chatbot-messages::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(8, 106, 216, 0.7), rgba(8, 106, 216, 0.9));
}

.chatbot-message {
    margin-bottom: 15px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: messageSlideIn 0.3s ease-out;
}

/* Message Avatars */
.message-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.bot-avatar {
    background: linear-gradient(135deg, #086AD8 0%, #1E90FF 100%);
    color: white;
    box-shadow: 0 2px 8px rgba(8, 106, 216, 0.3);
}

.user-avatar {
    background: #f1f3f4;
    color: #6b7280;
    border: 1px solid #e5e7eb;
}

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

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

.chatbot-message.bot {
    justify-content: flex-start;
}

.message-bubble {
    max-width: 75%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    word-wrap: break-word;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.message-bubble strong {
    font-weight: 700;
    color: inherit;
}

.message-bubble em {
    font-style: italic;
    color: inherit;
}

.message-bubble.user {
    background: linear-gradient(135deg, #086AD8 0%, #1E90FF 100%);
    color: white;
    border-bottom-right-radius: 6px;
    box-shadow: 0 2px 8px rgba(8, 106, 216, 0.3);
}

.message-bubble.bot {
    background: white;
    color: #333;
    border: 1px solid #e5e7eb;
    border-bottom-left-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: relative;
    overflow: hidden;
}

/* Special highlight for bot messages */
.message-bubble.bot::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: linear-gradient(135deg, #086AD8 0%, #1E90FF 100%);
    animation: highlightSlide 0.5s ease-out;
}

@keyframes highlightSlide {
    from {
        width: 0;
    }
    to {
        width: 4px;
    }
}

.message-time {
    font-size: 11px;
    color: #6c757d;
    margin-top: 5px;
    text-align: right;
}

.chatbot-message.user .message-time {
    text-align: left;
    color: rgba(255, 255, 255, 0.8);
}

.chatbot-message.bot .message-time {
    text-align: right;
    color: #6c757d;
}

.chatbot-input-container {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chatbot-input {
    flex: 1;
    border: 1px solid #e5e7eb;
    border-radius: 25px;
    padding: 12px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
    background: white;
    color: #333;
}

.chatbot-input:focus {
    border-color: #086AD8;
}

.chatbot-send {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #086AD8 0%, #1E90FF 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    box-shadow: 0 2px 8px rgba(8, 106, 216, 0.3);
}

.chatbot-send:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(8, 106, 216, 0.4);
}

.chatbot-send:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Voice Input Button */
.chatbot-voice {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #6582E1 0%, #ADDBFF 100%);
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-right: 8px;
}

.chatbot-voice:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 15px rgba(101, 130, 225, 0.3);
}

.chatbot-voice.listening {
    background: linear-gradient(135deg, #dc3545 0%, #fd7e14 100%);
    animation: voicePulse 1s ease-in-out infinite;
}

@keyframes voicePulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(220, 53, 69, 0.7);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(220, 53, 69, 0);
    }
}

.chatbot-typing {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 15px;
    animation: typingPulse 1.5s ease-in-out infinite;
}

.typing-bubble {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 18px;
    border-bottom-left-radius: 6px;
    padding: 12px 16px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
    max-width: 200px;
}

@keyframes typingPulse {
    0%, 100% {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    }
    50% {
        box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
    }
}

/* Typing dots and text */
.typing-dots {
    display: flex;
    gap: 4px;
}

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

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

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

.typing-text {
    font-size: 14px;
    color: #6b7280;
    font-style: italic;
}

/* AI typing indicator with sparkle effect */
.typing-bubble::after {
    content: '✨';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    animation: sparkle 2s ease-in-out infinite;
}

@keyframes sparkle {
    0%, 100% {
        opacity: 0;
        transform: translateY(-50%) scale(0.5);
    }
    50% {
        opacity: 1;
        transform: translateY(-50%) scale(1);
    }
}

.typing-dot {
    width: 8px;
    height: 8px;
    background: #6c757d;
    border-radius: 50%;
    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);
    }
    40% {
        transform: scale(1);
    }
}

/* Special welcome message highlight */
.message-bubble.welcome {
    background: linear-gradient(135deg, #086AD8 0%, #1E90FF 100%);
    color: white;
    border: none;
    position: relative;
    overflow: hidden;
}

.message-bubble.welcome::before {
    content: '🌟';
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 16px;
    animation: twinkle 2s ease-in-out infinite;
}

@keyframes twinkle {
    0%, 100% {
        opacity: 0.5;
        transform: scale(1);
    }
    50% {
        opacity: 1;
        transform: scale(1.2);
    }
}

/* Success message highlight */
.message-bubble.success {
    border-left: 4px solid #28a745;
    background: linear-gradient(135deg, #d4edda 0%, #c3e6cb 100%);
}

/* Error message highlight */
.message-bubble.error {
    border-left: 4px solid #dc3545;
    background: linear-gradient(135deg, #f8d7da 0%, #f5c6cb 100%);
}

/* Special emoji reactions */
.message-reaction {
    display: inline-block;
    margin: 0 2px;
    animation: bounce 0.6s ease-in-out;
}

@keyframes bounce {
    0%, 20%, 50%, 80%, 100% {
        transform: translateY(0);
    }
    40% {
        transform: translateY(-10px);
    }
    60% {
        transform: translateY(-5px);
    }
}

/* Quick Replies */
.quick-replies {
    margin: 15px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 10px;
    border: 1px solid #e9ecef;
}

.quick-replies-label {
    font-size: 12px;
    color: #6c757d;
    margin-bottom: 8px;
    font-weight: 600;
}

.quick-reply-btn {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: 20px;
    padding: 8px 16px;
    margin: 4px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #495057;
}

.quick-reply-btn:hover {
    background: linear-gradient(135deg, #086AD8 0%, #1E90FF 100%);
    color: white;
    border-color: transparent;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(29, 48, 134, 0.3);
}

/* Smart Suggestions */
.smart-suggestions {
    margin: 15px 0;
    padding: 10px;
    background: linear-gradient(135deg, #D8EDFF 0%, #ADDBFF 100%);
    border-radius: 10px;
    border: 1px solid #6582E1;
}

.suggestions-label {
    font-size: 12px;
    color: #1D3086;
    margin-bottom: 8px;
    font-weight: 600;
}

.suggestion-btn {
    background: white;
    border: 1px solid #6582E1;
    border-radius: 15px;
    padding: 6px 12px;
    margin: 3px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #1D3086;
    display: inline-block;
}

.suggestion-btn:hover {
    background: #1D3086;
    color: white;
    border-color: #1D3086;
    transform: scale(1.05);
}

/* Enhanced Input Container */
.chatbot-input-container {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 0 0 15px 15px;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-container {
        bottom: 15px;
        right: 15px;
        left: 15px;
        width: calc(100vw - 30px);
    }
    
    .chatbot-window {
        position: fixed;
        width: calc(100vw - 20px);
        height: calc(100vh - 200px);
        bottom: 85px;
        right: 10px;
        left: 10px;
        top: 20px;
        margin: 0;
        max-width: none;
        max-height: calc(100vh - 200px);
        border-radius: 10px;
    }
    
    .chatbot-toggle {
        width: 55px;
        height: 55px;
        position: fixed;
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-typing::after {
        display: none; /* Hide sparkle on mobile */
    }
    
    .quick-reply-btn, .suggestion-btn {
        font-size: 10px;
        padding: 6px 12px;
    }
    
    .chatbot-voice {
        width: 35px;
        height: 35px;
        margin-right: 6px;
    }
    
    .chatbot-messages {
        padding: 15px;
        max-height: calc(100vh - 240px);
        overflow-y: auto;
    }
    
    .chatbot-input-container {
        padding: 12px 15px;
        flex-wrap: wrap;
    }
    
    .chatbot-input {
        font-size: 16px; /* Prevent zoom on iOS */
        padding: 10px 14px;
    }
}

/* Extra small mobile devices */
@media (max-width: 480px) {
    .chatbot-container {
        bottom: 10px;
        right: 10px;
        left: 10px;
        width: calc(100vw - 20px);
    }
    
    .chatbot-window {
        width: calc(100vw - 10px);
        height: calc(100vh - 180px);
        bottom: 70px;
        right: 5px;
        left: 5px;
        top: 15px;
        border-radius: 8px;
    }
    
    .chatbot-toggle {
        width: 50px;
        height: 50px;
        bottom: 10px;
        right: 10px;
    }
    
    .chatbot-header {
        padding: 12px 15px;
    }
    
    .chatbot-header h3 {
        font-size: 14px;
    }
    
    .chatbot-messages {
        padding: 12px;
        max-height: calc(100vh - 220px);
    }
    
    .message-bubble {
        max-width: 85%;
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .chatbot-input-container {
        padding: 10px 12px;
    }
    
    .chatbot-input {
        font-size: 16px;
        padding: 8px 12px;
    }
    
    .chatbot-send {
        width: 35px;
        height: 35px;
    }
}
