/**
 * Expert SEO Chatbot Styles
 * All styles use !important to override theme conflicts
 */

/* Container - Fixed positioning */
.esc-chatbot-container {
    all: initial !important;
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 2147483647 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    pointer-events: auto !important;
    box-sizing: border-box !important;
}

/* Toggle Button */
.esc-chat-toggle {
    all: initial !important;
    width: 60px !important;
    height: 60px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    color: white !important;
    cursor: pointer !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: transform 0.2s, box-shadow 0.2s !important;
    position: relative !important;
    font-family: inherit !important;
}

.esc-chat-toggle:hover {
    transform: scale(1.05) !important;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2) !important;
}

.esc-chat-toggle svg {
    width: 28px !important;
    height: 28px !important;
    pointer-events: none !important;
}

/* Chat Window */
.esc-chat-window {
    all: initial !important;
    width: 380px !important;
    height: 600px !important;
    max-height: 80vh !important;
    background: white !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15) !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    animation: slideUp 0.3s ease-out !important;
    position: relative !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Header */
.esc-chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    padding: 16px 20px !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    flex-shrink: 0 !important;
}

.esc-chat-header h3 {
    all: initial !important;
    margin: 0 !important;
    font-size: 18px !important;
    font-weight: 600 !important;
    color: white !important;
    font-family: inherit !important;
}

.esc-close-btn {
    all: initial !important;
    background: none !important;
    border: none !important;
    color: white !important;
    font-size: 28px !important;
    line-height: 1 !important;
    cursor: pointer !important;
    padding: 0 !important;
    width: 30px !important;
    height: 30px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    border-radius: 4px !important;
    transition: background 0.2s !important;
}

.esc-close-btn:hover {
    background: rgba(255, 255, 255, 0.2) !important;
}

/* Messages Area */
.esc-chat-messages {
    flex: 1 !important;
    overflow-y: auto !important;
    padding: 20px !important;
    background: #f7f8fa !important;
    box-sizing: border-box !important;
}

.esc-message {
    margin-bottom: 16px !important;
    display: flex !important;
    clear: both !important;
}

.esc-message-user {
    justify-content: flex-end !important;
}

.esc-message-bot {
    justify-content: flex-start !important;
}

.esc-message-content {
    max-width: 75% !important;
    padding: 12px 16px !important;
    border-radius: 18px !important;
    word-wrap: break-word !important;
    line-height: 1.4 !important;
    font-size: 14px !important;
    box-sizing: border-box !important;
}

.esc-message-user .esc-message-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
    border-bottom-right-radius: 4px !important;
}

.esc-message-bot .esc-message-content {
    background: white !important;
    color: #333 !important;
    border-bottom-left-radius: 4px !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
}

.esc-message-bot .esc-message-content a {
    color: #667eea !important;
    text-decoration: none !important;
    font-weight: 600 !important;
}

.esc-message-bot .esc-message-content a:hover {
    text-decoration: underline !important;
}

/* Typing indicator */
.esc-typing {
    display: flex !important;
    gap: 4px !important;
    align-items: center !important;
    padding: 12px 16px !important;
}

.esc-typing span {
    width: 8px !important;
    height: 8px !important;
    background: #999 !important;
    border-radius: 50% !important;
    animation: typing 1.4s infinite !important;
    display: inline-block !important;
}

.esc-typing span:nth-child(2) {
    animation-delay: 0.2s !important;
}

.esc-typing span:nth-child(3) {
    animation-delay: 0.4s !important;
}

@keyframes typing {
    0%, 60%, 100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-8px);
    }
}

/* Lead Form */
.esc-lead-form {
    padding: 16px 20px !important;
    background: white !important;
    border-top: 1px solid #e1e4e8 !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
}

.esc-lead-form form {
    all: initial !important;
    display: block !important;
}

.esc-lead-form h4 {
    all: initial !important;
    margin: 0 0 12px 0 !important;
    font-size: 16px !important;
    color: #333 !important;
    font-weight: 600 !important;
    font-family: inherit !important;
    display: block !important;
}

.esc-lead-form input[type="text"],
.esc-lead-form input[type="email"],
.esc-lead-form input[type="tel"] {
    all: initial !important;
    width: 100% !important;
    padding: 10px 12px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 6px !important;
    margin-bottom: 10px !important;
    font-size: 14px !important;
    transition: border-color 0.2s !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    display: block !important;
    background: white !important;
    color: #333 !important;
}

.esc-lead-form input[type="text"]:focus,
.esc-lead-form input[type="email"]:focus,
.esc-lead-form input[type="tel"]:focus {
    outline: none !important;
    border-color: #667eea !important;
}

.esc-checkbox-label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    margin: 10px 0 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    color: #333 !important;
}

.esc-checkbox-label input[type="checkbox"] {
    cursor: pointer !important;
    width: 16px !important;
    height: 16px !important;
}

.esc-form-buttons {
    display: flex !important;
    gap: 8px !important;
    margin-top: 12px !important;
}

.esc-form-buttons button {
    all: initial !important;
    flex: 1 !important;
    padding: 10px !important;
    border-radius: 6px !important;
    border: none !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    cursor: pointer !important;
    transition: all 0.2s !important;
    box-sizing: border-box !important;
    font-family: inherit !important;
    text-align: center !important;
    display: inline-block !important;
}

.esc-form-buttons button[type="submit"] {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    color: white !important;
}

.esc-form-buttons button[type="submit"]:hover:not(:disabled) {
    transform: translateY(-1px) !important;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3) !important;
}

.esc-form-buttons button[type="submit"]:disabled {
    opacity: 0.6 !important;
    cursor: not-allowed !important;
}

.esc-form-buttons button[type="button"] {
    background: #f3f4f6 !important;
    color: #333 !important;
}

.esc-form-buttons button[type="button"]:hover {
    background: #e5e7eb !important;
}

/* Input Area */
.esc-chat-input-wrapper {
    display: flex !important;
    gap: 8px !important;
    padding: 16px 20px !important;
    background: white !important;
    border-top: 1px solid #e1e4e8 !important;
    align-items: flex-end !important;
    box-sizing: border-box !important;
    flex-shrink: 0 !important;
}

.esc-chat-input {
    all: initial !important;
    flex: 1 !important;
    padding: 10px 12px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 20px !important;
    font-size: 14px !important;
    resize: none !important;
    max-height: 100px !important;
    font-family: inherit !important;
    transition: border-color 0.2s !important;
    box-sizing: border-box !important;
    background: white !important;
    color: #333 !important;
    line-height: 1.4 !important;
}

.esc-chat-input:focus {
    outline: none !important;
    border-color: #667eea !important;
}

.esc-send-btn {
    all: initial !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border: none !important;
    color: white !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: all 0.2s !important;
    flex-shrink: 0 !important;
}

.esc-send-btn:hover:not(:disabled) {
    transform: scale(1.05) !important;
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.3) !important;
}

.esc-send-btn:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

.esc-send-btn svg {
    width: 20px !important;
    height: 20px !important;
}

/* Scrollbar */
.esc-chat-messages::-webkit-scrollbar {
    width: 6px !important;
}

.esc-chat-messages::-webkit-scrollbar-track {
    background: transparent !important;
}

.esc-chat-messages::-webkit-scrollbar-thumb {
    background: #d1d5db !important;
    border-radius: 3px !important;
}

.esc-chat-messages::-webkit-scrollbar-thumb:hover {
    background: #9ca3af !important;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    .esc-chatbot-container {
        bottom: 0 !important;
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
    }
    
    .esc-chat-window {
        width: 100% !important;
        height: 100vh !important;
        max-height: 100vh !important;
        border-radius: 0 !important;
    }
    
    .esc-chat-toggle {
        position: fixed !important;
        bottom: 20px !important;
        right: 20px !important;
    }
}
