/* Create-test pop-up (on_page_test_create). */
/* Colours, radii and shadows come from the --abst-* tokens in admin/bt-bb-ab-admin.css */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    padding: 0 !important;
    margin: 0 !important;
    overflow-x: hidden;
    background: #ffffff;
    font-size: 14px;
    color: var(--abst-text);
    line-height: 1.5;
}

/* Form controls otherwise fall back to the browser font */
input, select, textarea, button {
    font-family: inherit;
}

/* WP core admin CSS normally hides these, but it is not loaded in this iframe */
.screen-reader-text {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0 !important;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    border: 0;
    white-space: nowrap;
}

form#post {
    padding: 0 24px 80px;
}

/* Header - stays visible while the form scrolls */
.abst-popup-header {
    position: sticky;
    top: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 -24px 20px;
    padding: 16px 24px;
    background: #ffffff;
    border-bottom: 1px solid var(--abst-border);
}

.abst-popup-header h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: var(--abst-text);
}

.abst-popup-close {
    width: 28px;
    height: 28px;
    padding: 0;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--abst-text-muted);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
}

.abst-popup-close:hover, .abst-popup-close:focus-visible {
    background: #fee2e2;
    color: #dc2626;
    outline: none;
}

/* Section boxes */
.experiment_box, .title_box {
    background: #ffffff;
    padding: 0;
    margin-bottom: 24px;
}

/* Section titles (h4) */
h4 {
    font-size: 14px;
    font-weight: 600;
    color: var(--abst-text) !important;
    margin: 16px 0 8px 0;
    text-decoration: none !important;
}

h4:first-child {
    margin-top: 0;
}

/* Labels */
label {
    font-size: 13px;
    font-weight: 500;
    color: var(--abst-text-secondary);
    display: block;
    margin-bottom: 4px;
}

.title_box label {
    color: var(--abst-text);
}

/* Accordion headers (h3) - collapsed state */
.collapsed > h3 {
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--abst-text);
    background: #ffffff !important;
    padding: 14px 16px;
    border: 1px solid var(--abst-border);
    border-radius: var(--abst-radius);
    box-shadow: var(--abst-shadow-sm);
    margin: 8px 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsed > h3:hover {
    border-color: var(--abst-primary);
    color: var(--abst-primary);
}

.collapsed > h3::after {
    content: "▸";
    color: var(--abst-text-muted);
    font-weight: 400;
    font-size: 14px;
}

/* Accordion headers (h3) - expanded state */
.expanded > h3 {
    font-size: 13px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--abst-text);
    background: #ffffff !important;
    padding: 14px 16px;
    border: 1px solid var(--abst-border);
    border-bottom: none;
    border-radius: var(--abst-radius) var(--abst-radius) 0 0;
    box-shadow: none;
    margin: 8px 0 0 0;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.expanded > h3:hover {
    color: var(--abst-primary);
}

.expanded > h3::after {
    content: "▾";
    color: var(--abst-text-muted);
    font-weight: 400;
    font-size: 14px;
}

/* Expanded section - wrap all content */
.expanded {
    background: #ffffff;
    border: 1px solid var(--abst-border);
    border-radius: var(--abst-radius);
    box-shadow: var(--abst-shadow-sm);
    margin: 8px 0;
    overflow: hidden;
}

.expanded > h3 {
    margin: 0 !important;
    border: none !important;
    border-bottom: 1px solid var(--abst-border) !important;
    border-radius: 0 !important;
}

.expanded > *:not(h3) {
    padding: 0 16px;
}

/* a select placed straight in an accordion (Device Size) lines up with the text */
.expanded > select {
    width: calc(100% - 32px);
    margin: 0 16px 16px;
    padding: 0 36px 0 14px;
}

.expanded > *:last-child {
    padding-bottom: 16px;
}

.expanded h4 {
    margin-top: 16px;
}

/* Generic h3 fallback */
h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--abst-text);
    margin: 16px 0 8px 0;
}

/* Description text */
p {
    font-size: 13px;
    color: var(--abst-text-secondary);
    margin: 0 0 12px 0;
    line-height: 1.5;
}

/* Form inputs */
input[type="text"], input[type="number"], textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--abst-border);
    border-radius: var(--abst-radius-md);
    font-size: 14px;
    color: var(--abst-text);
    background: #ffffff;
    box-sizing: border-box;
    transition: border-color 0.15s ease;
}

input[type="text"]:focus, input[type="number"]:focus, textarea:focus, select:focus {
    border-color: var(--abst-primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(23, 168, 227, 0.12);
}

/* Selects - same height and chevron as the select2 fields */
select {
    width: 100%;
    height: 42px;
    padding: 0 36px 0 14px;
    border: 1px solid var(--abst-border);
    border-radius: var(--abst-radius-md);
    font-size: 14px;
    color: var(--abst-text);
    background: #ffffff url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 width=%2212%22 height=%2212%22 viewBox=%220 0 24 24%22 fill=%22none%22 stroke=%22%239CA3AF%22 stroke-width=%222.5%22%3E%3Cpolyline points=%226 9 12 15 18 9%22/%3E%3C/svg%3E") no-repeat right 14px center;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    box-sizing: border-box;
    margin-bottom: 16px;
}

/* Device Size select */
#bt_experiments_target_option_device_size {
    margin-top: 4px;
}

/* Goal card - flat card, as on the main test editor */
.conversion-goal {
    background: var(--abst-border-light);
    padding: 16px;
    border: 1px solid var(--abst-border);
    border-radius: var(--abst-radius-md);
    margin-bottom: 16px;
    position: relative;
}

.conversion-goal h4 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 0 0 8px 0;
}

.conversion-goal h4 {
    color: #15803d !important;
}

.conversion-goal p {
    margin-bottom: 12px;
    color: var(--abst-text);
}

/* the trigger select sits in a <p>, so its own margin only adds empty space */
.conversion-goal select {
    margin-bottom: 0;
}


/* Checkboxes - inline pills (toggles keep their own switch style) */
.ab-targeting-roles label,
label:has(input[type="checkbox"]:not(.ab-toggle)) {
    display: inline-flex;
    align-items: center;
    background: #f9fafb;
    border: 1px solid var(--abst-border);
    border-radius: 20px;
    padding: 6px 12px;
    margin: 4px 4px 4px 0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.15s ease;
}

.ab-targeting-roles label:hover,
label:has(input[type="checkbox"]:not(.ab-toggle)):hover {
    background: #eff6ff;
    border-color: #93c5fd;
}

.ab-targeting-roles label:has(input:checked),
label:has(input[type="checkbox"]:not(.ab-toggle):checked) {
    background: #dbeafe;
    border-color: #3b82f6;
    color: #1e40af;
}

input[type="checkbox"] {
    width: 14px;
    height: 14px;
    margin-right: 6px;
    border-radius: 3px;
}





/* Submit button */
.submit_box {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    padding: 14px 24px;
    border-top: 1px solid var(--abst-border);
}

button#submit_experiment {
    width: 100%;
    display: block;
    background: var(--abst-primary);
    border-radius: var(--abst-radius-md);
    color: #ffffff;
    padding: 13px 24px;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease;
}

button#submit_experiment:hover {
    background: var(--abst-primary-hover);
}

/* Links */
a {
    color: var(--abst-primary);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Select2 overrides */
.select2-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
}
.select2-container--default .select2-selection--single {
    border: 1px solid var(--abst-border) !important;
    border-radius: 6px !important;
    height: 42px !important;
    padding: 6px 12px !important;
}
.select2-container--default .select2-selection--single .select2-selection__rendered {
    line-height: 28px !important;
}

/* Select2 dropdown - contain within iframe */
.select2-dropdown {
    max-width: calc(100vw - 48px) !important;
    border: 1px solid var(--abst-border) !important;
    border-radius: 6px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15) !important;
}

.select2-results__options {
    max-height: 200px !important;
}

.select2-results__option {
    padding: 10px 14px !important;
    font-size: 13px !important;
}

.select2-results__option--highlighted {
    background: var(--abst-primary) !important;
}
