/* ==========================================================================
   Display Rules Section — scoped to .ipb-display-rules
   ========================================================================== */

/* Top "Display" row */
.ipb-display-rules .rules {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 0;
    margin: 0;
}

.ipb-display-rules .rules h2 {
    font-size: 14px;
    font-weight: 600;
    color: #1e1f21;
    margin: 0;
    white-space: nowrap;
    min-width: 180px;
}

.ipb-display-rules .rules .selection {
    position: relative;
    width: auto;
    flex: 0 0 auto;
}

.ipb-display-rules .rules .selection select {
    width: 300px;
    max-width: 300px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 14px;
    color: #2c3338;
    background: #fff;
    cursor: pointer;
}

.ipb-display-rules .rules .selection select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* Hide info icon from top Display row */
.ipb-display-rules .rules .info {
    display: none;
}

/* Plus button */
.ipb-display-rules .rules .plus {
    flex: 0 0 auto;
}

.ipb-display-rules .rules .plus i {
    font-size: 22px;
    color: #2271b1;
    cursor: pointer;
    transition: color 0.15s ease;
}

.ipb-display-rules .rules .plus i:hover {
    color: #135e96;
}

/* Helper text below top row */
.ipb-display-rules .ipb-display-helper {
    margin: 8px 0 0 0;
    padding-left: 192px;
    font-size: 12px;
    color: #646970;
    line-height: 1.4;
}

/* Form fields container */
.ipb-display-rules .form_fields {
    margin: 16px 0 0 0;
    padding: 0;
}

/* Rule rows — thin divider, no card blocks */
.ipb-display-rules .input_fields_wrap {
    display: grid;
    grid-template-columns: 25% 15% 40% 1fr;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #e9ecef;
    position: relative;
    margin: 0;
}

.ipb-display-rules .input_fields_wrap:last-child {
    border-bottom: none;
}

/* Fields inside rule rows */
.ipb-display-rules .input_fields_wrap .fields {
    flex: none;
    width: 100%;
    min-width: 0;
}

/* Hide floating labels inside fields — use placeholders instead */
.ipb-display-rules .input_fields_wrap .fields > label {
    display: none;
}

/* Selects inside rule rows */
.ipb-display-rules .input_fields_wrap .fields select {
    width: 100%;
    height: 40px;
    padding: 0 10px;
    border: 1px solid #8c8f94;
    border-radius: 4px;
    font-size: 13px;
    color: #2c3338;
    background: #fff;
    cursor: pointer;
    box-sizing: border-box;
}

.ipb-display-rules .input_fields_wrap .fields select:focus {
    border-color: #2271b1;
    box-shadow: 0 0 0 1px #2271b1;
    outline: none;
}

/* Hide info icons inside rule rows */
.ipb-display-rules .input_fields_wrap .info {
    display: none;
}

/* Trash icon — subtle, vertically centered in last column */
.ipb-display-rules .input_fields_wrap > i.fa-solid.fa-trash {
    position: static;
    top: auto;
    justify-self: end;
    font-size: 14px;
    color: #a7aaad;
    cursor: pointer;
    transition: color 0.15s ease;
    padding: 6px;
}

.ipb-display-rules .input_fields_wrap > i.fa-solid.fa-trash:hover {
    color: #d63638;
}

/* initial_trigger "Everywhere" row — keep inline */
.ipb-display-rules .input_fields_wrap.initial_trigger {
    grid-template-columns: 25% 15% 40% 1fr;
}

/* display_wrapper / display_inner — reset spacing */
.ipb-display-rules .display_wrapper,
.ipb-display-rules .trigger_wrapper {
    padding: 0;
    margin: 0;
}

.ipb-display-rules .display_inner,
.ipb-display-rules .trigger_inner {
    padding: 0;
    margin: 0;
}

/* WooCommerce section */
.ipb-display-rules #display_woocommerce {
    margin-top: 8px;
}

/* ---- Responsive ---- */
@media (max-width: 782px) {
    .ipb-display-rules .rules {
        flex-wrap: wrap;
        gap: 10px;
    }

    .ipb-display-rules .rules h2 {
        min-width: auto;
        width: 100%;
    }

    .ipb-display-rules .rules .selection {
        flex: 1 1 auto;
    }

    .ipb-display-rules .rules .selection select {
        width: 100%;
        max-width: 100%;
    }

    .ipb-display-rules .ipb-display-helper {
        padding-left: 0;
    }

    .ipb-display-rules .input_fields_wrap {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 14px 0;
        position: relative;
    }

    .ipb-display-rules .input_fields_wrap > i.fa-solid.fa-trash {
        position: absolute;
        top: 14px;
        right: 0;
    }
}
