/*!
 * AI Live Support - Complete CSS Reset and Isolation
 * Prevents all theme interference using advanced isolation techniques
 */

/* Complete CSS reset for the plugin container */
.ai-live-support-isolated-container {
    /* CSS Containment for performance and isolation */
    contain: layout style paint !important;
    
    /* Create new stacking context */
    isolation: isolate !important;
    
    /* Reset all inherited styles */
    all: initial !important;
    
    /* Force positioning */
    position: fixed !important;
    z-index: 2147483647 !important;
    
    /* Ensure visibility */
    pointer-events: auto !important;
    visibility: visible !important;
    opacity: 1 !important;
    
    /* Set base font properties */
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif !important;
    font-size: 14px !important;
    line-height: 1.4 !important;
    color: #333 !important;
    
    /* Prevent text selection issues */
    -webkit-text-size-adjust: 100% !important;
    -webkit-font-smoothing: antialiased !important;
    -moz-osx-font-smoothing: grayscale !important;
}

/* Reset ALL nested elements completely */
.ai-live-support-isolated-container *,
.ai-live-support-isolated-container *::before,
.ai-live-support-isolated-container *::after {
    /* Complete style reset */
    all: unset !important;
    
    /* Force box model */
    box-sizing: border-box !important;
    
    /* Reset display (but allow elements to have their default display) */
    display: revert !important;
    
    /* Reset positioning */
    position: static !important;
    
    /* Reset margins and padding */
    margin: 0 !important;
    padding: 0 !important;
    
    /* Reset borders */
    border: 0 !important;
    border-radius: 0 !important;
    
    /* Reset backgrounds */
    background: transparent !important;
    
    /* Reset text properties */
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: normal !important;
    font-style: normal !important;
    text-decoration: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    word-spacing: normal !important;
    line-height: inherit !important;
    color: inherit !important;
    
    /* Reset shadows and effects */
    box-shadow: none !important;
    text-shadow: none !important;
    filter: none !important;
    backdrop-filter: none !important;
    
    /* Reset transforms */
    transform: none !important;
    
    /* Reset transitions and animations */
    transition: none !important;
    animation: none !important;
    
    /* Reset flex and grid */
    flex: none !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
    
    /* Reset table properties */
    border-collapse: separate !important;
    border-spacing: 0 !important;
    
    /* Reset form elements */
    appearance: none !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    
    /* Reset overflow */
    overflow: visible !important;
    
    /* Reset cursor */
    cursor: auto !important;
    
    /* Reset user interaction */
    user-select: auto !important;
    -webkit-user-select: auto !important;
    -moz-user-select: auto !important;
    
    /* Reset outline */
    outline: 0 !important;
    
    /* Reset opacity */
    opacity: 1 !important;
    
    /* Reset pointer events */
    pointer-events: auto !important;
    
    /* Reset white space */
    white-space: normal !important;
    word-wrap: normal !important;
    word-break: normal !important;
    
    /* Reset list styles */
    list-style: none !important;
    
    /* Reset quotes */
    quotes: none !important;
    
    /* Reset content */
    content: normal !important;
}

/* Specific resets for common problematic selectors */
.ai-live-support-isolated-container div,
.ai-live-support-isolated-container span,
.ai-live-support-isolated-container button,
.ai-live-support-isolated-container input,
.ai-live-support-isolated-container textarea {
    display: block !important;
}

.ai-live-support-isolated-container button {
    cursor: pointer !important;
    background: none !important;
    border: none !important;
}

.ai-live-support-isolated-container input,
.ai-live-support-isolated-container textarea {
    background: white !important;
    color: #333 !important;
}

/* Override common CSS framework resets */
.ai-live-support-isolated-container .btn,
.ai-live-support-isolated-container .button,
.ai-live-support-isolated-container .form-control,
.ai-live-support-isolated-container .input,
.ai-live-support-isolated-container [class*="wp-"],
.ai-live-support-isolated-container [class*="theme-"],
.ai-live-support-isolated-container [id*="theme-"],
.ai-live-support-isolated-container [id*="wp-"] {
    all: unset !important;
    box-sizing: border-box !important;
    display: revert !important;
}

/* Prevent Bootstrap, Foundation, and other framework interference */
.ai-live-support-isolated-container [class*="col-"],
.ai-live-support-isolated-container [class*="row"],
.ai-live-support-isolated-container [class*="container"],
.ai-live-support-isolated-container [class*="flex-"],
.ai-live-support-isolated-container [class*="d-"],
.ai-live-support-isolated-container [class*="p-"],
.ai-live-support-isolated-container [class*="m-"],
.ai-live-support-isolated-container [class*="text-"],
.ai-live-support-isolated-container [class*="bg-"],
.ai-live-support-isolated-container [class*="border-"] {
    all: unset !important;
    display: revert !important;
}

/* Mobile responsiveness protection */
@media screen and (max-width: 768px) {
    .ai-live-support-isolated-container {
        left: 10px !important;
        right: 10px !important;
        bottom: 10px !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .ai-live-support-isolated-container {
        filter: contrast(1.5) !important;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    .ai-live-support-isolated-container * {
        animation: none !important;
        transition: none !important;
    }
}
