/* Modern Chatbot Styles with Enhanced Animations */
.chatbot-widget {
    background: linear-gradient(135deg, #4a6bff 0%, #6b4aff 100%);
    box-shadow: 0 10px 25px -5px rgba(74, 107, 255, 0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    will-change: transform;
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 999;
}

.chatbot-widget:hover {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 15px 30px -5px rgba(74, 107, 255, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(74, 107, 255, 0.4); }
    70% { box-shadow: 0 0 0 15px rgba(74, 107, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(74, 107, 255, 0); }
}

.chatbot-container {
    position: fixed;
    bottom: 100px;
    right: 30px;
    width: 350px;
    max-width: 90%;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 15px 50px -10px rgba(0, 0, 0, 0.2);
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    z-index: 1000;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

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

.chatbot-header {
    background: linear-gradient(135deg, #4a6bff 0%, #6b4aff 100%);
    padding: 18px 25px;
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chatbot-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.chatbot-title i {
    font-size: 20px;
}

.chatbot-close {
    cursor: pointer;
    font-size: 18px;
    transition: all 0.3s ease;
    opacity: 0.8;
}

.chatbot-close:hover {
    transform: rotate(90deg);
    opacity: 1;
}

.chatbot-messages {
    height: 300px;
    overflow-y: auto;
    padding: 20px;
    background: rgba(245, 247, 255, 0.7);
    backdrop-filter: blur(5px);
    scroll-behavior: smooth;
}

.chatbot-welcome {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.05);
    border-left: 4px solid var(--primary-color);
    padding: 15px;
    margin-bottom: 15px;
}

.message {
    transition: all 0.3s ease;
    opacity: 0;
    transform: translateY(10px);
    animation: messageAppear 0.3s ease forwards;
    margin-bottom: 15px;
    display: flex;
}

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

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

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

.message-content {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.4;
    position: relative;
    word-wrap: break-word;
}

.user-message .message-content {
    background: linear-gradient(135deg, #4a6bff 0%, #6b4aff 100%);
    color: white;
    border-radius: 18px 18px 4px 18px;
    box-shadow: 0 4px 8px rgba(74, 107, 255, 0.2);
}

.bot-message .message-content {
    background: var(--white);
    border-radius: 18px 18px 18px 4px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.05);
    color: var(--dark-color);
}

.chatbot-input {
    display: flex;
    padding: 15px;
    border-top: 1px solid var(--light-gray);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(5px);
}

.chatbot-input input {
    flex: 1;
    padding: 12px 18px;
    border-radius: 30px;
    border: 2px solid rgba(74, 107, 255, 0.1);
    background: rgba(241, 241, 241, 0.5);
    font-family: var(--font-primary);
    font-size: 14px;
    transition: all 0.3s ease;
    outline: none;
}

.chatbot-input input:focus {
    border-color: rgba(74, 107, 255, 0.3);
    box-shadow: 0 0 0 4px rgba(74, 107, 255, 0.1);
}

.chatbot-input button {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #4a6bff 0%, #6b4aff 100%);
    color: white;
    border: none;
    margin-left: 10px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(74, 107, 255, 0.3);
}

.chatbot-input button:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 15px rgba(74, 107, 255, 0.4);
}

/* Enhanced Typing Indicator */
.typing-dots {
    display: flex;
    padding: 10px 15px;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.typing-dots span {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--primary-color);
    opacity: 0.4;
    animation: typing 1.4s infinite ease-in-out;
}

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

.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(-5px);
        opacity: 1;
    }
}

/* Quick Replies with Modern Style */
.quick-replies {
    margin-top: 15px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.quick-reply {
    background: rgba(74, 107, 255, 0.1);
    color: var(--primary-color);
    border-radius: 20px;
    padding: 8px 16px;
    transition: all 0.2s ease;
    border: none;
    font-size: 13px;
    cursor: pointer;
    font-weight: 500;
}

.quick-reply:hover {
    background: rgba(74, 107, 255, 0.2);
    transform: translateY(-2px);
}

/* Message timestamp */
.message-time {
    font-size: 10px;
    opacity: 0.6;
    margin-top: 4px;
    text-align: right;
}

/* Responsive Chatbot - Enhanced for 2026 */
@media (max-width: 768px) {
    .chatbot-container {
        width: calc(100% - 20px);
        max-width: 100%;
        right: 10px;
        left: 10px;
        bottom: 90px;
        border-radius: 20px;
    }
    
    .chatbot-widget {
        width: 56px;
        height: 56px;
        bottom: 20px;
        right: 20px;
        box-shadow: 0 8px 20px -5px rgba(74, 107, 255, 0.5);
    }
    
    .chatbot-messages {
        height: calc(100vh - 280px);
        min-height: 250px;
        max-height: 400px;
        padding: 15px;
    }
    
    .chatbot-header {
        padding: 15px 20px;
    }
    
    .chatbot-title {
        font-size: 14px;
    }
    
    .message-content {
        max-width: 85%;
        font-size: 14px;
        padding: 10px 14px;
    }
    
    .chatbot-input {
        padding: 12px;
    }
    
    .chatbot-input input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 10px 16px;
    }
    
    .chatbot-input button {
        width: 40px;
        height: 40px;
        margin-left: 8px;
    }
}

@media (max-width: 480px) {
    .chatbot-container {
        width: calc(100% - 16px);
        right: 8px;
        left: 8px;
        bottom: 80px;
        border-radius: 16px;
    }
    
    .chatbot-widget {
        width: 52px;
        height: 52px;
        bottom: 16px;
        right: 16px;
    }
    
    .chatbot-widget .chatbot-icon {
        font-size: 20px;
    }
    
    .chatbot-widget .chatbot-label {
        font-size: 9px;
    }
    
    .chatbot-messages {
        height: calc(100vh - 260px);
        min-height: 200px;
        max-height: 350px;
        padding: 12px;
    }
    
    .chatbot-header {
        padding: 12px 16px;
    }
    
    .chatbot-title {
        font-size: 13px;
    }
    
    .chatbot-title i {
        font-size: 18px;
    }
    
    .chatbot-close {
        font-size: 16px;
        width: 32px;
        height: 32px;
    }
    
    .message-content {
        max-width: 90%;
        font-size: 13px;
        padding: 9px 12px;
    }
    
    .chatbot-input {
        padding: 10px;
    }
    
    .chatbot-input input {
        font-size: 16px; /* Prevents zoom on iOS */
        padding: 9px 14px;
    }
    
    .chatbot-input button {
        width: 36px;
        height: 36px;
        margin-left: 6px;
    }
    
    .chatbot-input button i {
        font-size: 14px;
    }
}

/* iOS specific fixes */
@supports (-webkit-touch-callout: none) {
    .chatbot-input input {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
    
    .chatbot-container {
        /* Fix for iOS viewport issues */
        max-height: calc(100vh - 100px);
    }
    
    .chatbot-messages {
        /* Better scrolling on iOS */
        -webkit-overflow-scrolling: touch;
    }
}

/* Android specific fixes */
@media screen and (-webkit-min-device-pixel-ratio: 0) {
    .chatbot-container {
        /* Better rendering on Android */
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }
}

/* Landscape orientation on mobile */
@media (max-width: 768px) and (orientation: landscape) {
    .chatbot-container {
        bottom: 10px;
        max-height: calc(100vh - 20px);
    }
    
    .chatbot-messages {
        height: calc(100vh - 180px);
        min-height: 150px;
        max-height: 300px;
    }
    
    .chatbot-widget {
        bottom: 10px;
        right: 10px;
    }
}

/* Touch device optimizations */
@media (hover: none) and (pointer: coarse) {
    .chatbot-widget {
        /* Larger touch target */
        width: 60px;
        height: 60px;
    }
    
    .chatbot-input button {
        /* Larger touch target */
        width: 44px;
        height: 44px;
    }
    
    .chatbot-close {
        /* Larger touch target */
        width: 40px;
        height: 40px;
    }
}

/* Floating animation for widget */
@keyframes float {
    0% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-10px) rotate(2deg); }
    100% { transform: translateY(0px) rotate(0deg); }
}

.chatbot-widget {
    animation: float 6s ease-in-out infinite;
}
