/* Main Toggle Button */
#emc-chat-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #2563eb, #1e40af);
    border-radius: 50%;
    color: white;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    z-index: 2147483647;
    /* Max Z-index */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

#emc-chat-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
}

/* Chat Box Container */
#emc-chat-box {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 400px;
    /* Increased width */
    height: 600px;
    /* Increased height */
    max-height: 80vh;
    /* Ensure it fits on smaller screens */
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 2147483647;
    /* Max Z-index */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    transition: opacity 0.3s ease, transform 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

#emc-chat-box.hidden {
    display: none;
    opacity: 0;
    transform: translateY(20px);
}

/* Emoji Fix - High Specificity */
.emc-message img.emoji,
.emc-message img.wp-smiley,
#emc-chat-messages img.emoji,
#emc-chat-messages img.wp-smiley {
    width: 1.25em !important;
    height: 1.25em !important;
    max-width: 1.25em !important;
    max-height: 1.25em !important;
    vertical-align: text-bottom !important;
    margin: 0 2px !important;
    display: inline-block !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    background: transparent !important;
}

/* Link as Button Style */
.emc-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #eff6ff;
    color: #2563eb;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-weight: 600;
    margin: 4px 0;
    border: 1px solid #dbeafe;
    transition: all 0.2s;
    font-size: 0.9em;
}

.emc-link-btn:hover {
    background: #dbeafe;
    color: #1d4ed8;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Header */
.emc-chat-header {
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    color: white;
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.emc-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.emc-bot-avatar {
    font-size: 24px;
    background: rgba(255, 255, 255, 0.2);
    padding: 5px;
    border-radius: 50%;
}

.emc-chat-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#emc-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    opacity: 0.8;
}

#emc-chat-close:hover {
    opacity: 1;
}

/* Messages Area */
#emc-chat-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f8fafc;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.emc-message {
    max-width: 88%;
    /* Slightly wider bubble */
    padding: 12px 16px;
    border-radius: 14px;
    font-size: 15px;
    /* Increased readable size */
    line-height: 1.5;
    word-wrap: break-word;
}

.bot-message {
    background: #ffffff;
    color: #1e293b;
    align-self: flex-start;
    border-bottom-left-radius: 2px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.user-message {
    background: #3b82f6;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 2px;
}

/* Input Area */
.emc-chat-input-area {
    padding: 15px;
    background: white;
    border-top: 1px solid #e2e8f0;
    display: flex;
    gap: 10px;
    align-items: center;
}

#emc-chat-input {
    flex: 1;
    padding: 12px;
    border: 1px solid #cbd5e1;
    border-radius: 24px;
    outline: none;
    font-size: 16px;
    /* Increased from 14px */
}

#emc-chat-input:focus {
    border-color: #3b82f6;
}

#emc-chat-send {
    background: #2563eb;
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

#emc-chat-send:hover {
    background: #1d4ed8;
}

.emc-typing {
    font-size: 12px;
    color: #64748b;
    margin-left: 10px;
    font-style: italic;
}