/* Chatbox Styles */
.chatbox-container {
    position: fixed;
    bottom: 80px;
    right: 20px;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    z-index: 99999;
    display: none;
    flex-direction: column;
    overflow: hidden;
    animation: chatboxSlideIn 0.3s ease-out;
}

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

.chatbox-container.active {
    display: flex;
}

.chatbox-header {
    background: linear-gradient(135deg, #ff4d00, #ff6b35);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 12px 12px 0 0;
}

.chatbox-header-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.chatbox-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.chatbox-info h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbox-status {
    font-size: 12px;
    opacity: 0.9;
    display: flex;
    align-items: center;
    gap: 5px;
}

.chatbox-status::before {
    content: '';
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    display: inline-block;
}

.chatbox-close {
    background: none;
    border: none;
    color: white;
    font-size: 18px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: background 0.3s ease;
}

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

/* Chatbox Header Controls */
.chatbox-header-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-toggle-btn {
    background: none;
    border: none;
    color: #0066cc; /* Blue color */
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-toggle-btn:hover {
    background: rgba(0, 102, 204, 0.1); /* Blue hover background */
    transform: scale(1.1);
}

.mode-toggle-btn.active {
    color: #0066cc; /* Blue color */
}

.voice-toggle-btn {
    background: none;
    border: none;
    color: #ff4d00;
    font-size: 16px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.voice-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
}

.chatbox-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

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

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

.message.user-message {
    flex-direction: row-reverse;
}

.message-avatar {
    width: 30px;
    height: 30px;
    background: #ff4d00;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 12px;
    flex-shrink: 0;
}

.bot-message .message-avatar {
    background: #6366f1;
}

.message-content {
    max-width: 70%;
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.user-message .message-content {
    background: #ff4d00;
    color: white;
}

.message-content p {
    margin: 0;
    font-size: 14px;
    line-height: 1.4;
}

.chatbox-input-container {
    padding: 15px;
    background: white;
    border-top: 1px solid #e5e7eb;
}

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

#chatboxInput {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d1d5db;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

#chatboxInput:focus {
    border-color: #ff4d00;
}

#chatboxInput.listening {
    background: rgba(255, 77, 0, 0.05);
    border-color: #ff4d00;
    box-shadow: 0 0 0 3px rgba(255, 77, 0, 0.1);
}

/* Enhanced voice button styles */
.voice-button.listening {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    animation: pulse 1.5s infinite, listeningGlow 2s ease-in-out infinite;
}

@keyframes listeningGlow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.1);
    }
}

/* Message voice button enhancements */
.message-voice-btn.speaking {
    background: #ef4444;
    color: white;
    animation: pulse 1s infinite;
}

/* Voice notification enhancements */
.voice-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ff4d00;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 100000;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: slideInRight 0.3s ease-out;
}

/* Enhanced animations */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

/* Voice status indicator in header */
.voice-status-indicator {
    position: absolute;
    top: -2px;
    right: -2px;
    width: 8px;
    height: 8px;
    background: #4ade80;
    border-radius: 50%;
    animation: pulse 2s infinite;
}

.voice-status-indicator.listening {
    background: #ef4444;
    animation: pulse 1s infinite;
}

#chatboxSend {
    width: 40px;
    height: 40px;
    background: #ff4d00;
    border: none;
    border-radius: 50%;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

#chatboxSend:hover {
    background: #e64500;
    transform: scale(1.05);
}

/* Voice Button Styles */
.voice-button {
    width: 40px;
    height: 40px;
    background: #f3f4f6;
    border: 2px solid #d1d5db;
    border-radius: 50%;
    color: #6b7280;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    font-size: 14px;
}

.voice-button:hover {
    background: #ff4d00;
    border-color: #ff4d00;
    color: white;
    transform: scale(1.05);
}

.voice-button.listening {
    background: #ef4444;
    border-color: #ef4444;
    color: white;
    animation: pulse 1.5s infinite;
}

/* Message Voice Button */
.message-voice-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(255, 77, 0, 0.1);
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    color: #ff4d00;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    transition: all 0.3s ease;
    opacity: 0.7;
}

.message-voice-btn:hover {
    background: #ff4d00;
    color: white;
    opacity: 1;
    transform: scale(1.1);
}

.message-content {
    max-width: 70%;
    background: white;
    padding: 12px 16px;
    border-radius: 18px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* Voice Notification */
.voice-notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #ff4d00;
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 100000;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Animation for notifications */
@keyframes slideInRight {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(100%);
        opacity: 0;
    }
}

.chatbox-toggle {
    position: fixed;
    bottom: 20px;
    right: 80px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #ff4d00, #ff6b35);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(255, 77, 0, 0.3);
    z-index: 99998;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbox-toggle:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(255, 77, 0, 0.4);
}

.chatbox-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ef4444;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Typing Indicator Styles */
.typing-dots {
    display: flex;
    gap: 4px;
    padding: 8px 0;
}

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

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

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

@keyframes typing {
    0%, 80%, 100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Responsive Design */
@media (max-width: 768px) {
    .chatbox-container {
        width: calc(100vw - 40px);
        height: 60vh;
        right: 20px;
        left: 20px;
        bottom: 80px;
    }
    
    .chatbox-toggle {
        right: 20px;
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .whatsapp-float {
        right: 80px !important;
    }
}

@media (max-width: 480px) {
    .chatbox-container {
        height: 70vh;
    }
    
    .message-content {
        max-width: 85%;
    }
}
