/* Support Chatbot Styles */
.support-chatbot {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 999999 !important; /* Increased z-index */
    pointer-events: none; /* Allow clicks to pass through container */
}

.chatbot-toggle-btn {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 24px;
    pointer-events: auto !important; /* Enable clicks on button */
    position: relative;
    z-index: 1000000 !important; /* Very high z-index */
    /* Debug outline - remove this later */
    /* border: 2px solid red !important; */
}

.chatbot-toggle-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.2);
}

.chatbot-toggle-btn:active {
    transform: scale(0.95);
    background: linear-gradient(135deg, #5a6fd8 0%, #6a4c93 100%);
}

.chatbot-toggle-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.chatbot-panel {
    position: absolute;
    bottom: 80px;
    right: 0;
    width: 400px;
    height: 300px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    display: none;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #e1e5e9;
    pointer-events: auto !important; /* Enable clicks on panel */
    z-index: 999999 !important;
}

.chatbot-panel.open {
    display: flex;
}

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

.chatbot-title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

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

.chatbot-close:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.chatbot-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
    height: 100%;
    min-height: 0;
}

.chatbot-avatar-container {
    width: 100%;
    flex: 1;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
    min-height: 0;
}

.chatbot-avatar-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 0;
}

/* Iframe styles for proper portrait display */
.chatbot-avatar-container iframe {
    border: none !important;
    display: block !important;
    background: #f8f9fa;
}

.chatbot-status {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 5px 10px;
    border-radius: 15px;
    font-size: 12px;
}

.chatbot-status.connecting {
    background: #ffc107;
    color: #212529;
}

.chatbot-status.connected {
    background: #28a745;
}

.chatbot-status.error {
    background: #dc3545;
}

.chatbot-controls {
    padding: 15px;
    border-top: 1px solid #e1e5e9;
    background: #f8f9fa;
}

.chatbot-start-btn, .chatbot-end-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 10px;
}

.chatbot-start-btn {
    background: #28a745;
    color: white;
}

.chatbot-start-btn:hover {
    background: #218838;
}

.chatbot-start-btn:disabled {
    background: #6c757d;
    cursor: not-allowed;
}

.chatbot-end-btn {
    background: #dc3545;
    color: white;
    display: none;
}

.chatbot-end-btn:hover {
    background: #c82333;
}

.chatbot-end-btn.show {
    display: block;
}

.chatbot-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    color: #6c757d;
}

.chatbot-loading .spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #f3f3f3;
    border-top: 4px solid #667eea;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 10px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }
    50% {
        transform: scale(1.05);
        box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    }
}

.chatbot-error {
    padding: 20px;
    text-align: center;
    color: #dc3545;
}

.chatbot-description {
    padding: 15px;
    font-size: 14px;
    color: #6c757d;
    text-align: center;
    border-bottom: 1px solid #e1e5e9;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .chatbot-panel {
        width: 350px;
        height: 500px;
        bottom: 70px;
        right: -10px;
    }
    
    .chatbot-avatar-container {
        flex: 1;
        height: auto;
    }
    
    .chatbot-avatar-container iframe {
        width: 100%;
        height: 100%;
        min-height: 350px;
    }
}

@media (max-width: 480px) {
    .chatbot-panel {
        width: 90vw;
        height: 70vh;
        bottom: 70px;
        right: 5vw;
        left: 5vw;
    }
    
    .support-chatbot {
        bottom: 15px;
        right: 15px;
    }
    
    .chatbot-toggle-btn {
        width: 50px;
        height: 50px;
        font-size: 20px;
    }
    
    .chatbot-avatar-container iframe {
        min-height: 300px;
    }
}