/* Support Chat Widget Styles */
.nexus-chat-widget {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Chat Toggle Button */
.chat-toggle {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    border-radius: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.chat-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.chat-toggle .dashicons {
    font-size: 18px;
    width: 18px;
    height: 18px;
}

.chat-label {
    font-weight: 600;
    font-size: 14px;
}

.priority-badge {
    background: #ff6b6b;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: bold;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { opacity: 1; }
    50% { opacity: 0.7; }
    100% { opacity: 1; }
}

/* Chat Window */
.chat-window {
    position: absolute;
    bottom: 70px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: slideUp 0.3s ease;
}

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

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 16px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

.chat-status {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.status-indicator {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    display: inline-block;
}

.status-indicator.online {
    background: #4caf50;
    animation: pulse 2s infinite;
}

.status-indicator.offline {
    background: #f44336;
}

.chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 20px;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.2s ease;
}

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

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    max-height: 350px;
}

.message {
    margin-bottom: 16px;
}

.system-message .message-content {
    background: #f5f7fa;
    border: 1px solid #e1e8ed;
    border-radius: 12px;
    padding: 12px 16px;
    font-size: 14px;
    line-height: 1.4;
}

.system-message .message-content p {
    margin: 0 0 8px 0;
}

.system-message .message-content p:last-child {
    margin-bottom: 0;
}

.ai-notice {
    color: #667eea;
    font-weight: 500;
}

.agent-notice {
    color: #4caf50;
    font-weight: 500;
}

.response-time {
    color: #666;
    font-size: 12px;
}

.user-message {
    text-align: right;
}

.user-message .message-content {
    background: #667eea;
    color: white;
    border-radius: 18px 18px 4px 18px;
    padding: 10px 16px;
    display: inline-block;
    max-width: 80%;
    font-size: 14px;
}

.bot-message .message-content {
    background: #f1f3f4;
    color: #333;
    border-radius: 18px 18px 18px 4px;
    padding: 10px 16px;
    display: inline-block;
    max-width: 80%;
    font-size: 14px;
}

/* Chat Input Area */
.chat-input-area {
    padding: 16px 20px;
    border-top: 1px solid #e1e8ed;
    display: flex;
    align-items: center;
    gap: 8px;
    background: #fff;
}

.attachment-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.attachment-btn:hover {
    background: #f1f3f4;
}

#chat-message-input {
    flex: 1;
    border: 1px solid #e1e8ed;
    border-radius: 20px;
    padding: 10px 16px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s ease;
}

#chat-message-input:focus {
    border-color: #667eea;
}

.send-btn {
    background: #667eea;
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s ease;
}

.send-btn:hover {
    background: #5a6fd8;
}

.send-btn:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Chat Upgrade Notice */
.chat-upgrade-notice {
    padding: 20px;
    text-align: center;
    background: #f8f9fa;
}

.chat-upgrade-notice p {
    margin: 0 0 16px 0;
    color: #666;
    font-size: 14px;
}

.upgrade-btn {
    background: #667eea;
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: background 0.2s ease;
}

.upgrade-btn:hover {
    background: #5a6fd8;
    color: white;
}

/* Chat Shortcode Elements */
.nexus-chat-trigger,
.nexus-chat-link {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s ease;
}

.nexus-chat-trigger:hover,
.nexus-chat-link:hover {
    background: #5a6fd8;
    color: white;
    transform: translateY(-1px);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 10px 16px;
    color: #666;
    font-size: 12px;
    font-style: italic;
}

.typing-dots {
    display: flex;
    gap: 2px;
}

.typing-dot {
    width: 4px;
    height: 4px;
    background: #666;
    border-radius: 50%;
    animation: typingDot 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 typingDot {
    0%, 80%, 100% {
        transform: scale(0);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    .nexus-chat-widget {
        bottom: 10px;
        right: 10px;
    }
    
    .chat-window {
        width: 300px;
        height: 450px;
    }
    
    .chat-toggle {
        padding: 12px 16px;
    }
    
    .chat-label {
        display: none;
    }
    
    .priority-badge {
        display: none;
    }
}

@media (max-width: 480px) {
    .chat-window {
        width: calc(100vw - 20px);
        height: 400px;
        right: -10px;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .chat-window {
        background: #2d3748;
        color: #e2e8f0;
    }
    
    .chat-messages {
        background: #2d3748;
    }
    
    .system-message .message-content {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    .bot-message .message-content {
        background: #4a5568;
        color: #e2e8f0;
    }
    
    .chat-input-area {
        background: #2d3748;
        border-color: #718096;
    }
    
    #chat-message-input {
        background: #4a5568;
        border-color: #718096;
        color: #e2e8f0;
    }
    
    #chat-message-input::placeholder {
        color: #a0aec0;
    }
}

/* Accessibility */
.chat-toggle:focus,
.chat-close:focus,
.send-btn:focus,
#chat-message-input:focus {
    outline: 2px solid #667eea;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
