/* AI Chat Button Layout Fix - Priority Rules */

/* Reset all header styles first */
.ai-chat-interface .ai-chat-header * {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    transform: none !important;
}

/* Ensure proper flexbox layout for AI header */
.ai-chat-interface .ai-chat-header {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 16px 20px !important;
    gap: 12px !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

/* Back button stays on the left */
.ai-chat-interface #aiBackBtn {
    order: 1 !important;
    flex: 0 0 44px !important;
    margin-right: 12px !important;
}

/* Title takes up middle space */
.ai-chat-interface .ai-chat-title {
    order: 2 !important;
    flex: 1 1 auto !important;
    margin: 0 !important;
    padding: 0 !important;
    text-align: center !important;
}

/* Voice button with specific positioning */
.ai-chat-interface #aiVoiceBtn {
    order: 3 !important;
    flex: 0 0 44px !important;
    margin-left: auto !important;
    margin-right: 12px !important;
}

/* Close button is last with no overlap */
.ai-chat-interface #aiCloseBtn {
    order: 4 !important;
    flex: 0 0 44px !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
}

/* Ensure all buttons have consistent sizing */
.ai-chat-interface .ai-chat-header button {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex-shrink: 0 !important;
}

/* Make absolutely sure no overlapping happens */
.ai-chat-interface #aiVoiceBtn,
.ai-chat-interface #aiCloseBtn {
    position: relative !important;
    z-index: auto !important;
    isolation: isolate !important;
}