/*
 * Scoped CSS Isolation Reset
 * Prevents WordPress theme styles from bleeding into plugin UI.
 * Loaded BEFORE widget.css so plugin styles naturally override these resets.
 *
 * Uses :where() for container scoping so these resets have minimal specificity
 * (just the element selector). Any class-based selector in widget.css or
 * component CSS will naturally beat these resets — no conflicts with plugin styles.
 *
 * But :where() resets DO beat bare theme rules like `h1 { }` or `p { }`,
 * and theme rules scoped to content areas like `.entry-content p` still lose
 * to the plugin's own class-based selectors in widget.css.
 */

/* ==========================================================================
   Container Baseline
   These use real class specificity (not :where) because they set the
   foundation that all children inherit from. The PHP dynamic styles
   (ai_research_output_body_styles) override font-family and --ai-primary-color
   after this file loads.
   ========================================================================== */

.ai-assistant-overlay,
.ai-search-widget,
.assistant-cta-container {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
    color: #212121;
    text-transform: none;
    letter-spacing: normal;
    word-spacing: normal;
    text-align: left;
    direction: ltr;
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    box-sizing: border-box;
    text-indent: 0;
    font-variant: normal;
    text-rendering: auto;
}

/* Universal box-sizing — uses :where so it doesn't fight plugin styles */
:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) *,
:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) *::before,
:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) *::after {
    box-sizing: border-box;
}

/* ==========================================================================
   Headings (h1–h6)
   Themes love to style these. Reset to safe inherited values.
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) h1,
:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) h2,
:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) h3,
:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) h4,
:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) h5,
:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) h6 {
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-weight: bold;
    font-style: normal;
    line-height: 1.2;
    color: inherit;
    text-transform: none;
    letter-spacing: normal;
    word-spacing: normal;
    text-decoration: none;
    text-indent: 0;
    border: none;
    background: transparent;
    text-align: inherit;
    -webkit-font-smoothing: inherit;
    -moz-osx-font-smoothing: inherit;
}

/* ==========================================================================
   Paragraphs
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) p {
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    font-style: normal;
    line-height: inherit;
    color: inherit;
    text-transform: none;
    letter-spacing: normal;
    word-spacing: normal;
    text-align: inherit;
    text-decoration: none;
    text-indent: 0;
    border: none;
    background: transparent;
}

/* ==========================================================================
   Links
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) a {
    color: inherit;
    text-decoration: none;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    letter-spacing: normal;
    text-transform: none;
    background: transparent;
    border: none;
    outline: none;
    box-shadow: none;
    padding: 0;
    margin: 0;
}

/* ==========================================================================
   Lists (ul, ol, li)
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget) ul,
:where(.ai-assistant-overlay, .ai-search-widget) ol {
    margin: 0;
    padding: 0;
    list-style: none;
    border: none;
    background: transparent;
}

:where(.ai-assistant-overlay, .ai-search-widget) li {
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    text-transform: none;
    letter-spacing: normal;
    list-style: none;
    border: none;
    background: transparent;
}

/* ==========================================================================
   Form Elements (input, button, textarea, select)
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) input,
:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) button,
:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) textarea,
:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) select {
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
    color: inherit;
    text-transform: none;
    letter-spacing: normal;
    word-spacing: normal;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    outline: none;
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    box-sizing: border-box;
    min-height: 0;
    min-width: 0;
    text-indent: 0;
}

/* ==========================================================================
   Inline Text Elements (strong, b, em, i, code)
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget) strong,
:where(.ai-assistant-overlay, .ai-search-widget) b {
    font-weight: bold;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

:where(.ai-assistant-overlay, .ai-search-widget) em,
:where(.ai-assistant-overlay, .ai-search-widget) i {
    font-style: italic;
    color: inherit;
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

:where(.ai-assistant-overlay, .ai-search-widget) code {
    font-family: monospace;
    font-size: inherit;
    color: inherit;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    border-radius: 0;
    line-height: inherit;
    letter-spacing: normal;
}

/* ==========================================================================
   Images
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget) img {
    max-width: 100%;
    height: auto;
    border: none;
    box-shadow: none;
    border-radius: 0;
    padding: 0;
    margin: 0;
}

/* ==========================================================================
   SVG
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget, .assistant-cta-container) svg {
    overflow: visible;
    vertical-align: middle;
}

/* ==========================================================================
   Forms
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget) form {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
}

/* ==========================================================================
   Tables (AI responses may contain them)
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget) table {
    border-collapse: collapse;
    border-spacing: 0;
    width: auto;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    color: inherit;
}

:where(.ai-assistant-overlay, .ai-search-widget) th,
:where(.ai-assistant-overlay, .ai-search-widget) td {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    text-align: inherit;
    vertical-align: top;
}

/* ==========================================================================
   Blockquote / Pre
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget) blockquote {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    font-family: inherit;
    font-size: inherit;
    font-style: normal;
    color: inherit;
    quotes: none;
}

:where(.ai-assistant-overlay, .ai-search-widget) pre {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    font-family: monospace;
    font-size: inherit;
    color: inherit;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: inherit;
}

/* ==========================================================================
   Horizontal Rule
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget) hr {
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    height: auto;
}

/* ==========================================================================
   Label
   ========================================================================== */

:where(.ai-assistant-overlay, .ai-search-widget) label {
    margin: 0;
    padding: 0;
    font-family: inherit;
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    line-height: inherit;
    cursor: default;
}
