/**
 * Duotech Chatbot Widget Styles
 * Modern, responsive design for lead generation
 */

/* Main Chatbot Container */
.duotech-chatbot {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Chat Toggle Button */
.chatbot-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    padding: 16px 20px;
    border-radius: 50px;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(37, 211, 102, 0.3);
    transition: all 0.3s ease;
    border: none;
    font-size: 14px;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.chatbot-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(37, 211, 102, 0.4);
}

.chatbot-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}

.chatbot-toggle:hover::before {
    left: 100%;
}

.chatbot-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.chatbot-badge {
    white-space: nowrap;
    opacity: 0;
    max-width: 0;
    transition: all 0.3s ease;
}

.duotech-chatbot:hover .chatbot-badge {
    opacity: 1;
    max-width: 120px;
}

/* Chat Window */
.chatbot-window {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 380px;
    height: 600px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    display: flex;
    flex-direction: column;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px) scale(0.95);
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    border: 1px solid rgba(0,0,0,0.1);
    overflow: hidden;
}

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

/* Chat Header */
.chatbot-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 20px 20px 0 0;
}

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

.chatbot-info {
    flex: 1;
}

.chatbot-info h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chatbot-info p {
    margin: 2px 0 0;
    font-size: 13px;
    opacity: 0.9;
}

.chatbot-actions {
    display: flex;
    gap: 8px;
}

.chatbot-minimize {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,0.2);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-minimize:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.chatbot-minimize svg {
    width: 16px;
    height: 16px;
    stroke: white;
}

/* Messages Area */
.chatbot-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

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

.chatbot-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chatbot-messages::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.2);
    border-radius: 3px;
}

/* Message Styles */
.message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: messageSlide 0.3s ease;
}

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

.bot-message {
    align-self: flex-start;
}

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

.message-avatar {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

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

.bot-message .message-content {
    background: white;
    color: #333;
    border-bottom-left-radius: 4px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

/* Message Options */
.message-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-self: flex-start;
    width: 100%;
}

.chatbot-option {
    background: white;
    border: 2px solid #e9ecef;
    padding: 12px 16px;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    text-align: left;
    color: #495057;
}

.chatbot-option:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateX(4px);
}

.chatbot-option:active {
    transform: translateX(2px);
}

/* Message Form */
.message-form {
    align-self: flex-start;
    width: 100%;
}

.chatbot-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: white;
    padding: 16px;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 13px;
    font-weight: 600;
    color: #495057;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-group textarea {
    resize: vertical;
    min-height: 60px;
}

.chatbot-submit {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.chatbot-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.chatbot-submit:active {
    transform: translateY(0);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 16px;
    background: white;
    border-radius: 18px;
    width: fit-content;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

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

.typing-indicator 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;
    }
}

/* Input Area */
.chatbot-input {
    padding: 16px 20px;
    background: white;
    border-top: 1px solid #e9ecef;
    display: flex;
    gap: 12px;
    align-items: center;
}

.chatbot-input input {
    flex: 1;
    padding: 10px 12px;
    border: 2px solid #e9ecef;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
}

.chatbot-input input:focus {
    border-color: #667eea;
}

.chatbot-input input:disabled {
    background: #f8f9fa;
    cursor: not-allowed;
}

.chatbot-input button {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.chatbot-input button:hover:not(:disabled) {
    transform: scale(1.1);
}

.chatbot-input button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.chatbot-input svg {
    width: 18px;
    height: 18px;
    stroke: white;
}

/* WhatsApp Support */
.chatbot-whatsapp {
    padding: 16px 20px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
}

.whatsapp-support {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    background: #25D366;
    color: white;
    text-decoration: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.whatsapp-support:hover {
    background: #128C7E;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
}

.whatsapp-support svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
    .duotech-chatbot {
        bottom: 20px;
        right: 20px;
    }
    
    .chatbot-window {
        width: calc(100vw - 40px);
        height: calc(100vh - 120px);
        right: -10px;
        bottom: 70px;
    }
    
    .chatbot-toggle {
        padding: 14px 18px;
        font-size: 13px;
    }
    
    .chatbot-badge {
        display: none;
    }
    
    .chatbot-messages {
        padding: 16px;
        gap: 12px;
    }
    
    .message-content {
        font-size: 13px;
        padding: 10px 14px;
    }
    
    .chatbot-form {
        padding: 12px;
    }
    
    .chatbot-input {
        padding: 12px 16px;
    }
}

@media (max-width: 480px) {
    .duotech-chatbot {
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-window {
        width: calc(100vw - 30px);
        height: calc(100vh - 100px);
        right: -5px;
        bottom: 65px;
    }
    
    .chatbot-header {
        padding: 16px;
    }
    
    .chatbot-messages {
        padding: 12px;
    }
    
    .message-content {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    .chatbot-option {
        padding: 10px 14px;
        font-size: 13px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .chatbot-messages {
        background: #1a1a1a;
    }
    
    .bot-message .message-content {
        background: #2a2a2a;
        color: #fff;
    }
    
    .chatbot-option {
        background: #2a2a2a;
        border-color: #444;
        color: #fff;
    }
    
    .chatbot-option:hover {
        border-color: #667eea;
        background: #333;
    }
    
    .chatbot-form {
        background: #2a2a2a;
    }
    
    .form-group input,
    .form-group select,
    .form-group textarea {
        background: #333;
        border-color: #444;
        color: #fff;
    }
    
    .chatbot-input {
        background: #2a2a2a;
        border-top-color: #444;
    }
    
    .chatbot-input input {
        background: #333;
        border-color: #444;
        color: #fff;
    }
    
    .chatbot-whatsapp {
        background: #1a1a1a;
        border-top-color: #444;
    }
}
