/* AI Settings page (page=chatbot_ai_setting) only: narrow screens, provider tick, Pro previews, motion. */

/* Long labels and help texts wrap instead of widening the page. */
.qcl-openai label,
.qcl-openai .form-check-label,
.qcl-openai .form-text,
.qcl-openai p {
    overflow-wrap: anywhere;
    white-space: normal;
}

/*
 * Checkbox labels: admin-style.css draws the box on the label itself (18px wide, text pushed
 * out with text-indent and nowrap), so long labels ran off the card and widened the page on
 * phones. Here the label takes the full width and wraps, and the box moves to ::before.
 * The id selectors match the more specific per-provider rules in admin-style.css.
 */
.qcl-openai input[type=checkbox] + label,
.qcl-openai div#wp-chatbot-openrouter-settings input[type=checkbox] + label,
.qcl-openai div#wp-chatbot-gemini-settings input[type=checkbox] + label {
    display: block;
    width: auto;
    max-width: 100%;
    height: auto;
    min-height: 22px;
    border: 0;
    border-radius: 0;
    padding-left: 32px;
    text-indent: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.5;
    padding-top: 1px;
}
.qcl-openai input[type=checkbox] + label::before,
.qcl-openai div#wp-chatbot-openrouter-settings input[type=checkbox] + label::before,
.qcl-openai div#wp-chatbot-gemini-settings input[type=checkbox] + label::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 18px;
    height: 18px;
    border: 2px solid #a1408d;
    border-radius: 4px;
    transition: border-color ease-out 200ms;
}
.qcl-openai input[type=checkbox]:checked + label,
.qcl-openai div#wp-chatbot-openrouter-settings input[type=checkbox]:checked + label,
.qcl-openai div#wp-chatbot-gemini-settings input[type=checkbox]:checked + label {
    border: 0;
}
.qcl-openai input[type=checkbox]:checked + label::before,
.qcl-openai div#wp-chatbot-openrouter-settings input[type=checkbox]:checked + label::before,
.qcl-openai div#wp-chatbot-gemini-settings input[type=checkbox]:checked + label::before {
    border-color: #22b573;
}
.qcl-openai input[type=checkbox] + label::after,
.qcl-openai div#wp-chatbot-openrouter-settings input[type=checkbox] + label::after,
.qcl-openai div#wp-chatbot-gemini-settings input[type=checkbox] + label::after {
    left: 11px;
    top: 6px;
}

.qcl-openai input.form-control,
.qcl-openai select.form-control,
.qcl-openai select.form-select,
.qcl-openai textarea.form-control {
    max-width: 100%;
    box-sizing: border-box;
}

/* The tick marks the provider that answers chat, whichever tab is open. */
.qcld-ai-provider-card .qcld-ai-provider-check {
    display: none;
}
.qcld-ai-provider-card.is-enabled .qcld-ai-provider-check {
    display: block;
}

/* Pro previews: disabled controls with a badge. */
.qcld-ai-pro-preview fieldset[disabled] {
    opacity: .6;
    border: 0;
    margin: 0;
    padding: 0;
}
.qcld-ai-pro-badge {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 8px;
    border-radius: 10px;
    background: #5b4e96;
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    line-height: 18px;
    vertical-align: middle;
}

/* Below ~960px the side tabs, the settings and the upgrade box stack in one column. */
@media (max-width: 960px) {
    .admin-maxwith.qcld-openai-main-box {
        margin-right: 0;
        width: auto;
        max-width: 100%;
    }
    .qcld-ai-provider-grid {
        padding-left: 0;
    }
    .admin-maxwith.qcld-openai-main-box .card-body.p-sm-0,
    .qcld-tab-content-main {
        flex-direction: column;
        flex-wrap: nowrap;
    }
    .admin-maxwith.qcld-openai-main-box ul.nav.nav-tabs {
        width: auto;
        min-height: 0;
    }
    .admin-maxwith.qcld-openai-main-box ul.nav.nav-tabs li {
        width: 100%;
    }
    .qcld-tab-content-main .qcld-tab-content-right-into,
    .qcld-tab-content-main .tab-content {
        width: auto;
        max-width: 100%;
    }
    .admin-maxwith.qcld-openai-main-box .col-auto.me-auto.ai-settings-title-container {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    .admin-maxwith.qcld-openai-main-box .col-auto.me-auto.ai-settings-title-container h4 {
        width: auto;
    }
    .qcld-ai-settings-actions {
        flex-wrap: wrap;
        gap: 12px;
    }
    .qcld-ai-settings-actions .qcld-btn-primary {
        min-width: 0;
    }
    .qcl-openai .input-group {
        flex-wrap: wrap;
    }
    .qcl-openai .nav-tab-wrapper {
        display: flex;
        flex-wrap: wrap;
    }
    .qcl-openai .qcld-row,
    .qcl-openai .row {
        margin-left: 0;
        margin-right: 0;
        max-width: 100%;
    }
    .qcl-openai [class*="col-md-"],
    .qcl-openai [class*="col-sm-"] {
        width: 100%;
        max-width: 100%;
        flex: 0 0 100%;
    }
    .qcl-openai table.wp-list-table {
        display: block;
        overflow-x: auto;
    }
}

/* The Knowledge Base button pulses only for people who allow motion. */
@media (prefers-reduced-motion: reduce) {
    button#ai-knowledge-base-tab {
        animation: none;
    }
    .wpbot-wizard-overlay,
    .wpbot-wizard-overlay * {
        transition: none !important;
        animation: none !important;
    }
}
