/* UKREiiF Live Chat Widget - High specificity for theme compatibility */
body #ukreiif-chat-widget {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 999999 !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

/* Chat Button */
body #ukreiif-chat-button {
    width: 60px !important;
    height: 60px !important;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    cursor: pointer !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3) !important;
    transition: all 0.3s ease !important;
    position: relative !important;
    border: none !important;
}

body #ukreiif-chat-button:hover {
    transform: scale(1.1) !important;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4) !important;
}

body #ukreiif-chat-button span {
    font-size: 24px !important;
    color: white !important;
}

body #ukreiif-chat-button.chat-open {
    background: #e74c3c !important;
}

body #ukreiif-chat-button.chat-open span:before {
    content: "×" !important;
    font-size: 30px !important;
}

/* Tooltip */
.chat-tooltip {
    position: absolute;
    right: 70px;
    top: 50%;
    transform: translateY(-50%);
    background: #333;
    color: white;
    padding: 8px 12px;
    border-radius: 4px;
    font-size: 14px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.chat-tooltip:after {
    content: "";
    position: absolute;
    top: 50%;
    left: 100%;
    transform: translateY(-50%);
    border: 5px solid transparent;
    border-left-color: #333;
}

#ukreiif-chat-button:hover .chat-tooltip {
    opacity: 1;
    visibility: visible;
}

/* Chat Popup */
#ukreiif-chat-popup {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 350px;
    height: 500px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Chat Header */
.chat-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.chat-header h4 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}

#ukreiif-chat-close {
    background: none;
    border: none;
    color: white;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.3s ease;
}

#ukreiif-chat-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Chat Messages */
.chat-messages {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    background: #f8f9fa;
}

.message {
    margin-bottom: 15px;
    animation: fadeInUp 0.3s ease;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.message-content {
    padding: 12px 16px;
    border-radius: 18px;
    max-width: 85%;
    word-wrap: break-word;
    word-break: break-word;
    line-height: 1.4;
    font-size: 14px;
}

.user-message {
    text-align: right;
}

.user-message .message-content {
    background: #667eea;
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 6px;
}

.bot-message .message-content {
    background: white;
    color: #333;
    border: 1px solid #e1e5e9;
    border-bottom-left-radius: 6px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

/* Chat Input */
.chat-input-area {
    padding: 15px 20px;
    background: white;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
}

#ukreiif-chat-input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-size: 14px;
    transition: border-color 0.3s ease;
}

#ukreiif-chat-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.1);
}

#ukreiif-chat-input:disabled {
    background: #f5f5f5;
    cursor: not-allowed;
}

#ukreiif-chat-send {
    background: #667eea;
    color: white;
    border: none;
    padding: 12px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: background 0.3s ease;
}

#ukreiif-chat-send:hover:not(:disabled) {
    background: #5a6fd8;
}

#ukreiif-chat-send:disabled {
    background: #ccc;
    cursor: not-allowed;
}

/* Typing Indicator */
#ukreiif-chat-typing {
    padding: 20px;
    background: #f8f9fa;
    border-top: 1px solid #eee;
}

.typing-indicator {
    display: flex;
    gap: 4px;
    align-items: center;
}

.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);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Scrollbar */
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track {
    background: #f1f1f1;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

/* Mobile Responsive */
@media (max-width: 480px) {
    #ukreiif-chat-popup {
        width: 300px;
        height: 450px;
        bottom: 70px;
        right: -10px;
    }
    
    #ukreiif-chat-widget {
        bottom: 15px;
        right: 15px;
    }
    
    #ukreiif-chat-button {
        width: 50px;
        height: 50px;
    }
    
    #ukreiif-chat-button span {
        font-size: 20px;
    }
    
    .chat-tooltip {
        display: none;
    }
}

@media (max-width: 400px) {
    #ukreiif-chat-popup {
        width: calc(100vw - 30px);
        right: -5px;
    }
}
