/**
 * AIEO Category Extras — admin term-edit panel.
 *
 * The panel is rendered inside a <tr>...<th colspan=2>...</th></tr> at the
 * bottom of the WP term edit form. We reset the th's default styling so the
 * panel reads as a self-contained card, then layer tabs + grids inside.
 */

.form-table tr.aieo-ce-panel-row > th {
    padding: 0 !important;
    background: transparent;
    font-weight: normal;
}

.aieo-ce-panel {
    border: 1px solid #c3c4c7;
    border-radius: 6px;
    background: #fff;
    margin: 18px 0 6px;
    overflow: hidden;
}

.aieo-ce-panel-head {
    padding: 14px 18px;
    background: #f6f7f7;
    border-bottom: 1px solid #dcdcde;
}
.aieo-ce-panel-head h2 {
    margin: 0 0 4px;
    font-size: 16px;
    font-weight: 600;
}
.aieo-ce-panel-head .description { margin: 0; color: #50575e; }

/* ── Tabs ───────────────────────────────────────────────────────────── */

.aieo-ce-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid #dcdcde;
    background: #fafafa;
    padding: 0 12px;
}
.aieo-ce-tab {
    appearance: none;
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    padding: 10px 16px;
    font: inherit;
    font-weight: 500;
    color: #50575e;
    cursor: pointer;
    transition: color 120ms ease, border-color 120ms ease;
}
.aieo-ce-tab:hover { color: #1d2327; }
.aieo-ce-tab.is-active {
    color: #2271b1;
    border-bottom-color: #2271b1;
}
.aieo-ce-tab:focus {
    outline: 2px solid #2271b1;
    outline-offset: -2px;
}

.aieo-ce-tabpanel {
    display: none;
    padding: 18px;
}
.aieo-ce-tabpanel.is-active { display: block; }

/* Rich-editor field — give wp_editor instances breathing room and make
   the toolbar wrap nicely when the panel is narrower than core admin. */
.aieo-ce-rich-field .wp-editor-wrap {
    margin-top: 6px;
}
.aieo-ce-rich-field .wp-editor-tabs {
    float: none;
    text-align: right;
}

/* ── Field layout ───────────────────────────────────────────────────── */

.aieo-ce-field {
    margin-bottom: 18px;
}
.aieo-ce-field:last-child { margin-bottom: 0; }
.aieo-ce-field > label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}
.aieo-ce-field .description {
    margin: 4px 0 0;
    color: #50575e;
    font-style: normal;
}

.aieo-ce-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}
.aieo-ce-grid-3 {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 18px;
    margin-bottom: 18px;
}
@media (max-width: 700px) {
    .aieo-ce-grid-2,
    .aieo-ce-grid-3 { grid-template-columns: 1fr; }
}

/* ── Image uploader ─────────────────────────────────────────────────── */

.aieo-ce-image-preview {
    width: 100%;
    max-width: 280px;
    margin: 6px 0 8px;
    border: 1px solid #dcdcde;
    border-radius: 4px;
    overflow: hidden;
    background: #f6f7f7;
}
.aieo-ce-image-preview img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 160px;
    object-fit: contain;
}
.aieo-ce-image-clear {
    margin-left: 8px !important;
    color: #b32d2e !important;
    text-decoration: none;
}

/* ── Chip picker (related posts / campaigns) ────────────────────────── */

.aieo-ce-search-field {
    position: relative;
}
.aieo-ce-search-input {
    margin-bottom: 6px;
}
.aieo-ce-search-results {
    position: absolute;
    z-index: 5;
    left: 0;
    right: 0;
    top: 56px;
    margin: 0;
    padding: 4px 0;
    list-style: none;
    background: #fff;
    border: 1px solid #c3c4c7;
    border-radius: 4px;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
    max-height: 220px;
    overflow-y: auto;
}
.aieo-ce-search-result {
    padding: 7px 12px;
    cursor: pointer;
    font-size: 13px;
}
.aieo-ce-search-result:hover { background: #f0f6fc; color: #2271b1; }
.aieo-ce-search-empty {
    padding: 10px 12px;
    color: #8c8f94;
    font-style: italic;
    font-size: 13px;
}

.aieo-ce-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
}
.aieo-ce-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 6px 4px 10px;
    background: #f0f6fc;
    border: 1px solid #c5d9ed;
    border-radius: 16px;
    font-size: 12px;
    line-height: 1.3;
    color: #1d2327;
}
.aieo-ce-chip-remove {
    appearance: none;
    background: transparent;
    border: 0;
    cursor: pointer;
    color: #50575e;
    font-size: 14px;
    line-height: 1;
    padding: 0 4px;
}
.aieo-ce-chip-remove:hover { color: #b32d2e; }
